Payment: getting started

📘

Prerequisites

  1. Go register your Merchant Portal account and follow the steps to get access to your Neonomics Checkout API credentials and Webhook API.
  2. Have an active bank account in the country you are choosing to integrate in to test your connection.

Initiate your first payment

Follow the steps below to initiate your first payment:

  1. Complete the setup of your Merchant Portal account
  2. Add Neonomics to your website as a payment option
  3. Handle the user click of the pay button
  4. Create your first Checkout Request

1. Complete the setup of your Merchant Portal account

Follow our step-by-step onboarding guide to get started with the Checkout.

2. Add Neonomics to your website as a payment option

Place a "Directly from your bank" button or link on a page you wish your customers to complete payment using Neonomics.

Payment button

Adding a button to initiate the payment process is one way you can enable payments for your end users. Below you can see some examples of what the payment button should look like.

<form action="pay-with-neonomics.php" method="POST">
  <button type="submit" id="checkout-button">Directly from your bank</button>
</form>

The Pay Button has to follow the Neonomics Design Toolkit

Download Neonomics brand assets here 👉🏻 Neonomics Brand Assets

3. Handle the user click of the pay button

Server-side plugin

This plugin that triggers the call towards the Neonomics Checkout endpoint.

Clicking the already added "Pay Now" button trigger the execution of the code below. This is an example of how the server-side can initiate the process for creating a checkout request.

<?php
$curl = curl_init();  

$YOUR_DOMAIN = "http://localhost";  

$postData = [
  "referenceId" => "46cc77a44f0f40f8b7877c78d8bbd8e0", //Your Reference
  "amount" => 20.00,
  "currency" => "NOK",
  "successUrl" => "$YOUR_DOMAIN/success",
  "failUrl" => "$YOUR_DOMAIN/fail",
  "cancelUrl" => "$YOUR_DOMAIN/cancel",
  "remittanceInfo" => "Sweatshirt Order #85" // Remittance Information
  "language" => "EN"
  "country" => "NO"
];  

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://checkout.sandbox.neonomics.io/api/v1/checkout-requests',   CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => json_encode($postData),
  CURLOPT_HTTPHEADER => array(
    'api-key: 09e4201c-9ddb-4b65-bc95-975b7373qwer', // Your Api Key
    'Content-Type: application/json',
    'Accept: application/json'
  ),
));
$response = curl_exec($curl);
curl_close($curl);

$redirectUrl = json_decode($response, true)['redirectUrl']
; header("Location: $redirectUrl");
?>
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
import org.json.JSONObject;  

import static spark.Spark.*;  

public class PayWithNeonomics {
       public static void main(String[] args) {
        PayWithNeonomicsSevice payWithNeonomicsSevice = new PayWithNeonomicsSevice();
        port(80);
        post("/pay-with-neonomics", (request, response) -> {
            String redirectUrl = payWithNeonomicsSevice.createCheckoutRequest();
            response.redirect(redirectUrl);
            return "";
          });
    }
    static class PayWithNeonomicsSevice {
        public String createCheckoutRequest() throws UnirestException {
            JSONObject requestBody = new JSONObject();
            requestBody.put("referenceId", "a6128c9f-8155-4e2e"); // Your Reference
            requestBody.put("amount", 12.24);
            requestBody.put("currency", "NOK");
            requestBody.put("remittanceInfo","Sweatshirt Order #85");
            requestBody.put("country", "NO");
            requestBody.put("successUrl", "https://-yourDomain-.com/order/a6128c9f-81554e2e-b24f-7a65555b93c6/success");
            requestBody.put("failUrl", "https://-yourDomain-.com/order/a6128c9f-8155-4e2eb24f-7a65555b93c6/fail");
            requestBody.put("cancelUrl", "https://-yourDomain-.com/order/a6128c9f-8155-4e2eb24f-7a65555b93c6/cancel");
            requestBody.put("language", "EN");
               String redirectUrl = Unirest.post("https://checkout.sandbox.neonomics.io/api/v1/checkout-requests")
              .header("api-key", "4d3aacdb-54c1-4348-b09f-ed439590ae0f") // Your API Key
              .header("Content-Type", "application/json")
              .header("Accept", "application/json")
              .body(requestBody)
              .asJson().getBody().getObject()
              .getString("redirectUrl").toString();
              return redirectUrl;
        }
    }
  }

4. Create your first Checkout Request

Client’s system calls Neonomics Checkout via REST API in order to create CheckoutRequest.

Rest API Specification

The specification is intended to provide information about integration endpoint and fields.

Endpoint: Create CheckoutRequest
Method: POST
HTTP Path: /api/v1/checkout-requests

Sandbox Environment: https://checkout.sandbox.neonomics.io/

Live Environment: https://checkout.neonomics.io/

Checkout Request

JSON Object with the next fields:

📘

Only one of the two RemittanceInfo parameters can be populated, not both.

ParametersDescription
referenceId
type: STRING
required: TRUE
May be order id in client's system
endToEndId
type: STRING
required: FALSE
If not provided it will be generated. Max length is 35 characters.
amount
type: Number
required: TRUE
Amount to be paid by debtor
currency
type: STRING
required: TRUE
Currency enum - currency of transferring money.
Currency codes (ISO 4217).
creditorAccount
type: Object
required: FALSE
Should be used when the creditor (payee) should be a different account than the one registered in the Merchant Portal.
Should contain creditorName (see the example below) and information about the creditor account (see Market specific variables for further details).
country
type: STRING
required: FALSE
Country enum - displays available banks in set country for end users to pay with.
Country codes (ISO 3166-1 alpha-2).
If it is not provided the default country is Norway.
language
type: STRING
required: FALSE
Language code for the language in which the UI should be rendered.
Language codes (ISO 639-1 alpha-2)
creditorAccount
type: JSON Object
required: TRUE
Information about the creditor. It needs to include the name of the creditor and the account number of the creditor. See examples further down and more information here.
paymentScheduledDate
‍type: STRING
required: FALSE
Date for scheduled Payment in YYYY-MM-DD format. Should not contain dates older than current date.
maxScheduledDate
‍type: STRING
required: FALSE
Can be provided when the scheduledDateEditable is TO_SET_DATE. The date provided will be the max selectable date in the date-picker. If not provided then it defaults to the paymentScheduledDate. (YYYY-MM-DD format)
scheduledDateEditable
‍type: STRING
required: FALSE
Value "TO_SET_DATE" to enable date-picker (if user should be able to edit the payment scheduled date) and "FIXED" to disable it. If it is not provided, feature is enabled by default.
successUrl
type: STRING
required: TRUE
URL for user redirection in case of success.
failUrl
type: STRING
required: FALSE
URL for user redirection in case of failed payment.
cancelUrl
type: STRING
required: TRUE
URL redirection for user checkout cancellation.
remittanceInfo
type: STRING
required: TRUE
Message that is put to remittance information of the payment (max size: 140 characters). This is unstructured information.
remittanceInfoStructured
type: JSON Object
required: TRUE
Containing data to execute structured payment. It is an unique identification for the payment, issued by the creditor in accordance with a national standard (e.g. "KID" in Norway, "INVOICE" in Finland, "OCR" in Sweden.
clientName
type: STRING
required: FALSE
clientName is the name that will be displayed to the end user, showing them what company they will be redirected to.
For embedded login users it will also be used stating who Neonomics is a payment provider for.
creditorAddress
type: JSONObject
required: FALSE
This field is mandatory for cross-border payments. Containing Creditor address fields.

Building your JSON objects

Lets build your Checkout Request

Request header:

api-key: 31mkl-hfy23-312kj-f8qw…

Request Body for non structured remittance info:

{
  referenceId: "41212",
  remittanceInfo: "Ord #41212",
  amount: 20,
  currency: "EUR",
  creditorAccount: {
    creditorName: "Bob Huws",
    iban: "NO9386011117947"
  },
  successUrl: "https://merchant.neonomics.io/order/41212/success",
  failUrl: "https://merchant.neonomics.io/order/41212/fail",
  cancelUrl: "https://merchant.neonomics.io/order/41212/cancel",
  language: "EN",
  country: "NO"
}

Response body:

{
  redirectUrl: "https://checkout.neonomics.io/api/v1/checkoutrequests/JkuOIJHLSjhasodLJGHD.../app",
  id: "0a15025d-824a-19c6-8182-7d5ab472002f"
}

Request Body for structured remittance info:

{
  referenceId: "41212",
  remittanceInfoStructured: {
    reference: "1234",
    referenceIssuer: "John Doe",
    referenceType: "KID" 
  },
  amount: 20,
  currency: "EUR",
  creditorAccount: {
    creditorName: "Bob Huws",
    iban: "NO9386011117947"
  },
  successUrl: "https://merchant.neonomics.io/order/41212/success",
  failUrl: "https://merchant.neonomics.io/order/41212/fail",
  cancelUrl: "https://merchant.neonomics.io/order/41212/cancel",
  language: "EN",
  country: "NO"
}

Request Body for cross-border payments

{
  referenceId: "41212",
  remittanceInfoStructured: {
    reference: "123456",
    referenceIssuer: "John Doe",
    referenceType: "OCR" 
  },
  amount: 20,
  currency: "EUR",
  creditorAccount: {
    creditorName: "Bob Huws",
    iban: "NO9386011117947"
  },
  successUrl: "https://merchant.neonomics.io/order/41212/success",
  failUrl: "https://merchant.neonomics.io/order/41212/fail",
  cancelUrl: "https://merchant.neonomics.io/order/41212/cancel",
  language: "EN",
  country: "SE",
  creditorAddress: {
    creditorStreetName: "Bogstadveien",
    creditorBuildingNumber: "23",
    creditorPostalCode: "0404",
    creditorCity: "Begen",
    creditorCountry: "Norway"
  }
}