Documentation

keyboard_backspaceBack to numeropay.comhomeHomerepeatPayments FlowcodeSchemasapiAPIsupportSupport
Merchant Sign inarrow_right_alt

v1.0.0

Documentation
Home/Numeropay Api

NumeroPay API

The NumeroPay API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

info
Test Mode

You can use the NumeroPay API in test mode, which does not affect your live data or interact with the banking networks. The API KEY_ID you use to authenticate the request determines whether the request is live mode or test mode.

To enable test mode, prefix the KEY_ID with sandbox.KEY_ID and for KEY_SECRET use KEY_ID.

For example:

Assuming your Live Secrets are:

: du7UghNhhhMTnYwqrEYp

: 10LuRTaAefHwMCMdKgoF

Then your Test Secrets will be:

: sandbox.du7UghNhhhMTnYwqrEYp

: du7UghNhhhMTnYwqrEYp

You can acces the api from any applicatiuon to create Payment Transactions and get updates for created transaction.

API endpoint
1https://api.numeropay.com

Authentication

NumeroPay API uses Bearer authentication (also called token authentication) as HTTP authentication scheme.

Token passed for authentication is a JWT token. For Merchant integration, the JWT token is signed using Merchant’s secrets (not user’s secrets).

To obtain the merchant secrets, please look into Merhcant Panel > Settings > Your Mercahnt Account > API Secrets. These secrets are generated on a Merchant level.

1GET /transaction/<<Your transaction Id>>
2Host: api.numeropay.com
3Authorization: Bearer <<your token here>>

Generating Auth JWT Token

To generate the JWT token, you need to follow the following steps:

info
Assuming you have already obtained the KEY_ID and KEY_SECRET from Merchant panel.
  1. Create a token payload with following schema :
    JWT Token Body
    JSON
    1{
    2    "scopes": [
    3      "YOUR",
    4      "SCOPES"
    5    ],
    6    "iat": 1602501211,
    7    "exp": 1602502411,
    8    "iss": "merchant.numeropay",
    9    "sub": "MERCHANT ID"
    10  }
  2. Use following header and Update you KEY_ID
    JWT Token Header
    JSON
    1{
    2    "alg": "HS256",
    3    "type": "JWT",
    4    "keyid": "KEY_ID"
    5  }
  3. Generate signature
    Generating JWT Signature
    JAVASCRIPT
    1const SignaturePayload = base64UrlEncode(header) + "." + base64UrlEncode(payload);
    2HMACSHA256(SignaturePayload, KEY_SECRET);

See example JWT token.

JWT Token Fields

Below is a table for fileds used int JWT tokens explained in detail.

FieldDescription
scopesPermission SCOPES where this token can be used.
iatWhen the token is issues. This can be different to when it can be used (nbf).
expWhen the token is expired. after this time, the token will be invalidated.
iss

Issuer of the token.

In case of merchants, use merchant.numeropay.

sub

Subject of the token. To whome this token represents.

In case the JWT token represents a Merchant’s integration, this will have Merchant Id in this field.

For JWT Header

FieldDescription
algStatic. Always set to HS256
typeStatic. Always set to JWT
keyidYour KEY_ID from your merchant credentials

API Request

NumeroPay API request should always accompany the Authorization header. For POST requests, the data has to be passed as a JSON object with content type set to application/json.

CURL request to create a new transaction
BASH
1curl --location --request POST 'https://api.numeropay.com/transaction' \
2  --header 'accept: application/json, text/plain, */*' \
3  --header 'content-type: application/json;charset=UTF-8' \
4  --header 'Authorization: Bearer <<YOUR JWT TOKEN>>' \
5  --data-raw '{"amount":100,"busin ... nsaction"}'

The Response for the above request return a transaction object in reponse wrapper.

Sample Response
JSON
1{
2  "data": {
3    "id": "5CD0RGCKJ",
4    "merchant": "17c69865-7edd-4d05-bc70-65a1b85b9322",
5    "businessName": "Infinity Group",
6    "channel": 1,
7    "amount": 100,
8    "currency": "aud",
9    "description": "sample transaction",
10    "structure": {},
11    "state": 0,
12    "createdOn": "2020-10-14T02:31:23.328Z",
13    "updatedOn": "2020-10-14T02:31:23.328Z",
14    "ipAddress": "120.19.86.103"
15  },
16  "success": true
17}

API Response

All the success API calls follow a standard response format. A success response consits of two properties explained below:

PropertyDescription
dataAny JSON compatibe data type.
successBoolean. Always true in case the request processed correctly.
info
If API call is not expected to return any data then only success: true is returned.

In case of errors, Error Response is returned with any of the error mentioned in API Response Errors and sucess always set to false.

info
These Error codes are not HTTP responses. Error response has HTTP 200 or 500 response codes in case of follwing scenarios.

Example error respnse
JSON
1{
2  "success": false,
3  "error": {
4    "code": 403,
5    "message": "Action not allowed",
6    "name": "FORBIDDEN"
7  }
8}

API Response Errors

In case of an error response, the flowing is the list of errors which will return as response.

Error NameCodeMessage and Description
SYSTEM_ERROR500Some error in our systems. nothing relating to your request.
USER_EXIST406Message: User with email <<EMAIL>> already exists
MERCHANT_EXIST406Message: Merchant with ABN/ACN <<ABN/ACN>> already exists
BAD_REQUEST400

Your request has some invalid or incomplete input.

Message: The request could not be understood by the server due to malformed syntax.

NOT_IMPLEMENTED501

Your are trying to make a request to an invalid.

Message: The server does not recognize the request method and is not capable of supporting it for any resource

UNKNOWN_USER404

Message: User does not exist

NOT_FOUND404

Message: Resource <<RESOURCE>> does not exist

FORBIDDEN403

You are trying to perform an action which you are not allowed to do.

E.g. Getting details of a transaction id which is owned by some other merchant.
Message: Action not allowed


Payments API

Payments API will allow you to access manage transactions in your merchant account in NumeroPay. You can create new transaction and get updated state of the transaction.

All Payment Api calls are made on /transaction resource. Below is the list of awailable api calls on transaction resource:

  1. Create new transaction - POST /transaction
  2. Get transaction update - GET /transaction/TRANSACTION ID

Create new Transaction

To create new transaction, you need to call POST /transaction with JSON body with your transaction details.

Properties of the JSON Request Body are explined below:

Property NameTypeDescription
amountNumber(Required) Amount of the Transaction. Always greater than 0 and upto precision of 2 decimal places.
currencyString(Required) Three-letter ISO currency code, in lowercase. One of Currency code from CURRENCIES
descriptionStringTransaction’s description. This is also displayed to the payer when making the payment.
merchantString(Required) Merchant Id of the Merchant requesting to create this transaction.
businessNameString(Required) Business Name of the merchant for this transaction. This Business name shoul be from the list of Business names of the Merchant. This is also displayed to the payer when making the payment.

Returns

When successful, this call returns the generated transaction object (See Payment Schema).

Get All Transactions

To get a paginated and filtered list of your transaction you need to call GET /transaction. The transactions in this api call is limmited top the mertchant mentioned in the JWT token.

For pagintation, below is the list of query paramerters:

ParameterType
limit

Number

Default to 25. Cannot be 0 or less than 0.

from

Number

Unix timestamp. Default to current time.

For filters, below is the list of query paramerters:

ParameterType
status

String

JSON stringified Array of statuses or Single Status as string

business_name

String

JSON stringified Array of valid business named or Single business name as string

Returns

When successful, this call returns an array of transaction object (See Payment Schema) paginated and filterd based on query parameters.

Get Transaction Update

To get an existing transaction object, you need to call GET /transaction/<<TRANSACTION ID>>.

Returns

When successful, this call returns the transaction object (See Payment Schema) for the passed Transaction ID.