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 — REQUIREDPossible values: [ Current state event [unconfirmed, pending [N/M], confirmed, payout sent, payout confirmed] |
address string — REQUIREDAddress that received the payment |
amount uint — REQUIREDPayment amount |
currency string — REQUIRED |
confirmations string — REQUIREDTransaction confirmations |
tx_hash string — REQUIREDPayment transaction hash |
invoice string — REQUIREDInvoice code |
code string — REQUIREDSecurity payment code |
payout_tx_hash stringPayout transaction hash |
payout_tx_outs stringList of outputs with payout (btc, bch, ltc) |
payout_service_fee uintService fee |
tx_count stringTotal transactions count received by address |
received_amount uintTotal amount received by address |
pending_tx_count stringUnconfrimed transaction count |
pending_amount uintTotal unconfirmed amount |
Responses | ||
---|---|---|
default Invoice
|