Skip to main content

Callback handler example and information

You should send the invoice as the response to the callback requests

If a payment address is created by a callback, we will send a POSR request to your callback on any of these events:

  • New payment
  • Confirmations count changed

For instance, if a payment address is created with 2 confirmations, it will receive the following events: unconfirmed, pending [1/2], confirmed.

The logic for processing callback requests should be as follows. Each payment address corresponds to a confirmed and unconfirmed balance. N is the number of required confirmations.

  • confirmations = 0 check if there is a payment in the database (unique payment identifier = invoice + transaction hash), if not exist, then you need to insert it to the database and add an unconfirmed balance to the user.

  • 0 < confirmations < N check if there is a payment in the database, if not, then insert it in the database and add an unconfirmed balance to the user.

  • confirmations >= N check if there is a payment in the database, if there is one and it is not processed, reduce the unconfirmed balance, increase the confirmed one and mark the payment as processed. If there is no payment, then add it as processed, add the confirmed balance to the user.

In case no correct answer, notifications will be repeated with each new block within 24 hours. To stop sending notifications, callback should reply with correct response to the request (with confirmations greater than or equal to the specified value when generating a payment address).

Request Body — REQUIRED
event string — REQUIRED

Possible values: [unconfirmed, pending, confirmed, payout_sent, payout_confirmed]

Current state event [unconfirmed, pending [N/M], confirmed, payout sent, payout confirmed]

address string — REQUIRED

Address that received the payment

amount uint — REQUIRED

Payment amount

currency string — REQUIRED
confirmations string — REQUIRED

Transaction confirmations

tx_hash string — REQUIRED

Payment transaction hash

invoice string — REQUIRED

Invoice code

code string — REQUIRED

Security payment code

payout_tx_hash string

Payout transaction hash

payout_tx_outs string

List of outputs with payout (btc, bch, ltc)

payout_service_fee uint

Service fee

tx_count string

Total transactions count received by address

received_amount uint

Total amount received by address

pending_tx_count string

Unconfrimed transaction count

pending_amount uint

Total unconfirmed amount

Responses
default

Invoice

Schema
string