Docs
Webhook > Pay

Pay

After you broadcast a transaction with our endpoint, kamiPay will keep you updated on the progress of this payment using our webhooks so you don't need to manually check status endpoints from your backend

Handling Webhook Responses

The first step in the payment process is to send a transaction over the blockchain

1. Blockchain Transfer

Mined: This status indicates the transaction is confirmed in the blockchain so bank instruction can kick in.

{
  "status": "mined",
  "transaction_hash": "0x0ce2792b5deff9440b6xxxxxxxxxxxxxxxf0c25b47739cbc3a35b16",
  "type": "pay",
  "timestamp": "2024-07-27 11:28:50.426788-03:00",
  "external_id": "aaa-11112",
  "kamipay_id": "txc_01j3t9fxqffrva9s8d1ekm4g3v"
}

Dropped or not_found: These are status that indicates that the operation won't continue for the broadcasted transaction and you will need to retry. Money won't be deducted from your wallet in this case

{
  type: 'pay',
  transaction_hash: '0x0ce2792b5deff9440b6xxxxxxxxxxxxxxxf0c25b47739cbc3a35b16',
  status: 'not_found',
  timestamp: '2024-02-04 17:13:51.419027-03:00',
  external_id: "aaa-11112",
  kamipay_id: "txc_01j3t9fxqffrva9s8d1ekm4g3v"
}

The second Step of the payment is initiated once transaction was confirmed and received by our bank, so our webhooks will continue to notify you through that flow

2. Bank Payment Process

processing: This status indicates that the money is received and the bank initiated the payment, which may end up successfully or be rejected. If success, receiver bank will see the notification only few seconds later

{
  "status": "processing",
  "transaction_hash": "0x0ce2792b5deff9440b6xxxxxxxxxxxxxxxf0c25b47739cbc3a35b16",
  "data": {
    "operation_id": "1722090526505",
    "address_in": "0xca4xxxxxxxxxxxxxxx1f2fc",
    "usdt_amount": "0.72626",
    "brl_amount": "4.0",
    "bank_txid": null,
    "pix_key": "nico@kamipay.io",
    "name": "Kamipay AR Servicos Digitais Ltda"
  },
  "type": "pay",
  "timestamp": "2024-07-27 11:29:11.160878-03:00",
  "external_id": "aaa-11112",
  "kamipay_id": "txc_01j3t9fxqffrva9s8d1ekm4g3v"
}

done: If payment was successful, you will receive the bank transaction information so you can share with the receiver as proof of payment. It's important to mention that this status is when we already have all the final settlement and the sender and receiver banks have confirmed the payment. In most cases the receiver already gets the confirmation in their machine if it's a merchant, before this status is received and when the processing status begins

{
  "status": "done",
  "transaction_hash": "0x0ce2792b5deff9440b6xxxxxxxxxxxxxxxf0c25b47739cbc3a35b16",
  "data": {
    "operation_id": "1722090526505",
    "address_in": "0xca4xxxxxxxxxxxxxxx1f2fc",
    "usdt_amount": "0.72626",
    "brl_amount": "4.0",
    "bank_txid": "E20018183202407271428zerNpVxiayI",
    "pix_key": "nico@kamipay.io",
    "name": "Kamipay AR Servicos Digitais Ltda"
  },
  "type": "pay",
  "timestamp": "2024-07-27 11:29:11.160878-03:00",
  "external_id": "aaa-11112",
  "kamipay_id": "txc_01j3t9fxqffrva9s8d1ekm4g3v"
}

failed: This status indicates that the payment attempt failed. This can happen for various reasons, some for instance can be that the QR code expired before you pay, or for any other technical reason

In all cases, the money is refunded to the wallet, so you will get a deposit in your wallet with the amount of USDt paid.

{
  "status": "failed",
  "transaction_hash": "0x0fbe56145a07e5fxxxxxxxxxxxxxxxxxa4a61ee904bf5b7644",
  "data": {},
  "refund_txid": "0x2c15a5b6fcd8277e5fxxxxxxxxxxxxxxxxxa30b84c28fd79142ad39128d15bc",
  "type": "pay",
  "timestamp": "2024-03-15 10:10:47.017652-03:00",
  "external_id": "aaa-11112",
  "kamipay_id": "txc_01j3t9fxqffrva9s8d1ekm4g3v"
}

Additional Notes: If external_id is not provided, all webhooks will come with null. We strongly recommend all users to pass an external_id to this endpoint but if not, that will be the response type.