Creating an invoice and making a payment

Documentation: Working with API to create an invoice and make a payment


1. General information

The API provides the ability to manage invoices: create new invoices and make payments on them.

Base URL: https://api.client.nbcgate.tech


2. Steps of work

Step 1: Creating an invoice

The method is used to create a new invoice specifying the amount, currency, product and other data.

Request URL: POST /invoice/create

Example request (cURL):

curl -X 'POST' \
  'https://api.client.nbcgate.tech/invoice/create' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "amount": 100,
  "coin_id": 1,
  "id": 12345,
  "product_id": 67890
}'

Description of the request body parameters:

Fiels
Type
Description
Example of a value

amount

number

Invoice amount

100

coin_id

number

Currency identifier (e.g. 1 - USD)

1

id

number

Unique identifier pay_link

12345

product_id

number

Product Identifier

67890

Response answer (JSON):

{
  "success": true,
  "invoice_id": 12345,
  "message": "Invoice created successfully"
}

Response Description:

  • success (boolean): Transaction Status.

  • invoice_id (number): The unique identifier of the created invoice.

  • message (string): Result Description.


Step 2: Making a payment on an invoice

The method is used to pay a previously created invoice.

Request URL: POST /invoice/pay

Let's update the documentation for the /invoice/pay method to reflect the new response format.


Method: Making payment on invoice

The method is used to pay a previously created invoice. The response returns information about the payment, including the address for funds transfer, amount, commission and additional data.


Request URL:

POST /invoice/pay


Example request (cURL):

curl -X 'POST' \
  'https://api.client.nbcgate.tech/invoice/pay' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "idInvoice": 12345
}'

Request body:

Field
Type
Required
Description
Example of a value

idInvoice

number

Yes

Unique invoice identifier

12345


An example of a successful response:

{
  "address": "TRDkc3pmPnvYZ2UiDsmModEitJp7akTVyy",
  "amount": "444.274652",
  "rate": 0.116482,
  "name": "Tron Shasta Testnet",
  "code": "TRX"
}

Response Fields Description:

Field
Type
Description

address

string

The address of the wallet to which you want to transfer funds.

amount

string

Transfer amount in the specified cryptocurrency.

rate

float64

The exchange rate of a currency relative to the base currency of the invoice.

name

string

The name of the cryptocurrency network (e.g., Tron Shasta Testnet).

code

string

The code of the cryptocurrency in which the transfer is made (e.g. TRX).

transferCommissionWeis*

float64

(If available) Amount of transfer fee in units of cryptocurrency.

*The transferCommissionWeis field may be enabled depending on API settings or request context.


Example of how to use a response:

After receiving the answer, you can:

  1. Send the amount to the address via the selected cryptocurrency wallet.

  2. Ensure that the correct currency code (code) and network (name) are used.


Error Handling:

Response code
Description
Possible causes

400

Invalid request

Absence of a mandatory parameter.

404

Invoice not found

Non-Existent idInvoice is specified .

500

Internal server error

Server-side problems.


3. A complete example of executing two queries

  1. Create an invoice:

    curl -X 'POST' \
      'https://api.client.nbcgate.tech/invoice/create' \
      -H 'accept: application/json' \
      -H 'Content-Type: application/json' \
      -d '{
      "amount": 100,
      "coin_id": 1,
      "id": 12345,
      "product_id": 67890
    }'

    Result:

    {
      "success": true,
      "invoice_id": 12345,
      "message": "Invoice created successfully"
    }
  2. Make the payment:

    curl -X 'POST' \
      'https://api.client.nbcgate.tech/invoice/pay' \
      -H 'accept: application/json' \
      -H 'Content-Type: application/json' \
      -d '{
      "idInvoice": 12345
    }'

    Result:

    {
      "success": true,
      "message": "Payment processed successfully"
    }

4. Errors and their handling

The following errors may occur when working with the API:

Response code
Description
Possible causes

400

Invalid request

Lack of mandatory parameters.

404

Invoice not found

Non-Existent idInvoice is specified .

500

Internal server error

Server-side problems.

Last updated