Webhooks
Payment Received Event

Webhook Event: Payment Received

Event Name: payment_received
HTTP Method: POST
Webhook URL: Your specified endpoint URL
Test Key: is_test (boolean): Indicates whether the webhook event is a test (true) or a real event (false).

Description

This event is triggered when a payment is successfully received by the store. The webhook payload provides detailed information about the payment, allowing the store to update its records accordingly.

Payload Structure

The webhook payload for the payment_received event includes the following fields:

  • event_name (string): The name of the webhook event, in this case, payment_received.
  • is_test (boolean): Indicates if the webhook event is a test.
  • chain_id (number | null): The blockchain chain ID of the transaction.
  • created_at (string): The creation date and time of the payment record in TIMESTAMPTZ format.
  • currency_address (string | null): The address of the currency used for the payment.
  • exchange_rate_to_usd (string | null): The exchange rate to USD at the time of the transaction.
  • fee_amount (string | null): The transaction fee amount.
  • from_address (string): The blockchain address of the sender.
  • id (string): The unique identifier for the payment.
  • metadata (Json | null): Additional metadata associated with the payment.
  • product_id (string | null): The identifier of the product associated with the payment.
  • sent_amount (string | null): The amount sent by the payer.
  • store_id (string | null): The identifier of the store receiving the payment.
  • to_address (string): The blockchain address of the recipient.
  • total_amount (string): The total amount of the payment.
  • tx_hash (string): The transaction hash of the payment.

Example Payload

{
  "event_name": "payment_received",
  "is_test": false,
  "chain_id": 1,
  "created_at": "2023-01-01T16:48:32.007852+00",
  "currency_address": "0x...",
  "exchange_rate_to_usd": "100",
  "fee_amount": "1",
  "from_address": "0xFromAddress",
  "id": "payment123",
  "metadata": null,
  "product_id": "prod456",
  "sent_amount": "100",
  "store_id": "store789",
  "to_address": "0xToAddress",
  "total_amount": "99",
  "tx_hash": "0xTransactionHash"
}

Handling the Event

Upon receiving a payment_received webhook, verify the transaction details and update your store's records accordingly. The is_test key can be used to differentiate between real transactions and test events during development.