Nusagate Docs
Search
K
Comment on page

Create Invoice

Steps

  1. 1.
    Merchant's backend sends request to Get List Available Currency to be set on Invoice.
  2. 2.
    Merchant's backend sends request to Create Invoice API in order to retrieve payment URL.
  3. 3.
    Share the payment URL to Customer and then wait for them to proceed to payment.
  4. 4.
    Merchant gets callback of payment status changes and need to handle it accordingly.
Merchant can also use other API endpoints to manage Invoice. For example to Get List & Detail Invoice as needed.

Host URL

Environment
Url
Sandbox
Production

Get Available Currency API

Request :
Endpoint : /v1/invoices/available-currecny
HTTP Method : GET
Header :
Authorization: Basic ENCODED_KEY
ENCODED_KEY value is result of Base64Encode("apiKey"+":"+"secretKey")
Response :
Sample Success Response :
HTTP Status Code : 200
"data": [
{
"id": "a19a5c32-27f6-46f9-a236-87a808052565",
"priority": 1,
"currencyId": "69ee6a50-0242-41db-aa17-fc75fe33306c",
"status": 1,
"code": "TRX",
"name": "Tron",
"imageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/1958.png",
"description": null,
"decimal": 6,
"precision": 2,
"contractAddress": null,
"blockchainCode": "TRON",
"baseCurrency": "USD",
"minPrice": 5
},
{
"id": "79cb792a-8ae4-4d98-9681-b58b81467027",
"priority": 3,
"currencyId": "c8393ce1-75ed-4189-a352-b07dc8fd15d6",
"status": 1,
"code": "USDT_TRC20",
"name": "Tether USD TRC 20",
"imageUrl": "https://nusagate.s3.amazonaws.com/USDT/1642988151838%20-%20usdt.png",
"description": null,
"decimal": 6,
"precision": 3,
"contractAddress": "TXLAQ63Xg1NAzckPwKHvzw7CSEmLMEqcdj",
"blockchainCode": "TRON",
"baseCurrency": "USD",
"minPrice": 10
}
],
"meta": {
"message": "Get available currency success",
"statusCode": 200,
"totalData": 0,
"page": 1,
"perPage": 10,
"totalPage": 1
}
Response JSON Body Details :
Property
Descriptions
id
Merchant Currency ID
priority
Priority available currency
currencyId
Currency ID
status
Currency Status
code
Currency code
name
Currency name
imageUrl
Currency image url
contractAddress
Currency Smart Contract Address
blockchainCode
Blockchain Code
baseCurrency
Merchant Base Currency
minPrice
Minimum Price in Fiat

Create Invoice API

Request :

Endpoint : /v1/invoices
HTTP Method : POST
Header :
Accept : application/json
Content-Type:application/json
Authorization: Basic ENCODED_KEY
ENCODED_KEY value is result of Base64Encode("apiKey"+":"+"secretKey")
Request JSON Body :
{
"externalId": "ECOMM_123456",
"description": "invoice example description",
"price": "12000000",
"dueDate": "2022-02-07T19:26:07.255Z",
"email": "[email protected]",
"phoneNumber": "085875517882",
"payCurrency": "ETH"
}

Fee Calculation:

transaction fee = 0.8 * invoice_amount
Example :
Invoice Amount : 5 ETH
Merchant's balance : 0.2 * 5 ETH = 1 ETH
Note : Merchant is able to custom transaction fee by contact Our Support
Request JSON Body Details :
Parameter
Required
Type
Description
externalId
required
string
Unique Identifier for your invoice
description
optional
string
invoice example description
price
required
integer
Amount Invoice in Fiat (IDR, USD)
dueDate
required
string
Expired date of invoice
email
optional
string
Customer's email
phoneNumber
optional
string
Customer's phone number
payCurrency
optional
string
Payment Currency (Ex: ETH, TRX, zUSD, etc). This data is taken from property code on Get Available Currency API
Response :
Sample Success Response :
HTTP Status Code : 200
{
"data": {
"id": "854e7b3f-ba8f-4696-8766-734ec42e1cbf",
"slug": "INV-220207672-TJBXYY",
"type": "INVOICE_API",
"externalId": "ECOMM_123456",
"description": "...",
"dueDate": "2022-02-07T19:26:07.255Z",
"expiredAmountAt": "2022-02-07T19:31:07.255Z",
"email": "[email protected]",
"phoneNumber": "085875517882",
"payCurrency": "ETH",
"paymentLink": "https://checkout.dev.nusagate.com/?id=854e7b3f-ba8f-4696-8766-734ec42e1cbf",
"baseCurrency": "IDR",
"price": 12000000,
"amount": 0.269045,
"paymentType": "DIRECT",
"fee": "0.0000",
"paidAt": null,
"completedAt": null,
"details": null,
"createdAt": "2022-02-07T06:11:33.343Z",
"updatedAt": "2022-02-07T06:11:33.343Z",
"status": "UNPAID"
},
"meta": {
"message": "Create invoice success",
"statusCode": 201
}
}
Response JSON Body Details :
Property
Descriptions
id
Invoice Id
slug
Reference ID
type
Type indicates source of invoice created
dueDate
Expired date of invoice
expiredAmountAt
Next date of amount updated, it can be nullable if value of payCurrency is null
email
Customer's email
phoneNumber
Customer's phone number
payCurrency
Payment Currency (Ex: ETH, TRX, zUSD, etc)
paymentLink
Checkout Page URL
baseCurrency
Merchant's Base Currency (Ex: IDR, USD)
price
Amount Invoice in Fiat
amount
Amount Invoice in Crypto
paymentType
Merchant's Payment Method
fee
Fee of Invoice
paidAt
Date of invoice is paid by customer it can be nullable if invoice is not already paid
completedAt
Date of invoice already in merchant's balance it can be nullable if invoice is not already in balance
createdAt
Date of invoice created
updatedAt
Date of invoice last updated
status
Status of invoice