Skip to main content

Webhook

Webhook notifications allow you to receive real-time updates about payment transaction status changes. When a payment's status changes (e.g., from pending to authorised, or from authorised to waiting), Hello Clever will send a POST request to your specified webhook endpoint.


Webhook Object

When a payment status changes, you'll receive a webhook notification with the following object structure:

FieldTypeDescription
uuidstringUnique identifier for the payment transaction
namestringCustomer's name
emailstringCustomer's email address
external_idstringYour reference ID for this payment
statusstringCurrent status of the payment
pay_codeobjectWhen 3DS is required, contains 3ds_url. When the payment failed, contains error_code and error_message.
└─ 3ds_urlstringURL for the customer to complete 3DS authentication (when required)
└─ error_codestringError or decline code (e.g. issuer_declined)
└─ error_messagestringError or decline message
currencystringTransaction currency code
amountstringOriginal payment amount
totalstringTotal amount including any fees
paid_amountstringAmount that has been paid
is_refundablebooleanWhether the payment can be refunded
payment_methodstringPayment method used (e.g. "card")
expired_atstringThe timestamp indicating when the payment url expires (UTC)
webhook_notificationobjectWebhook configuration details
└─ endpoint_urlstringURL where webhooks will be sent
└─ authorization_headerstringAuthorization header for webhook
refund_informationobjectDetails about any refunds
└─ total_amountstringTotal amount available for refund
└─ refund_amountstringAmount that was refunded
└─ descriptionstringReason for the refund
sender_detailsobjectPayment method details
└─ cardobjectCard payment details
└─── card_typestringType of card used
└─── card_brandstringCard brand (visa, mastercard etc)
└─── card_last_4stringLast 4 digits of card number
created_atstringTimestamp when payment was created
tokenobjectCard token details
└─ idstringToken for the card
└─ typestringToken type (e.g. "card")

Example:

{
"uuid": "QVABPPC7",
"name": "Hello Clever",
"email": "[email protected]",
"external_id": "123",
"status": "authorised",
"pay_code": {
"3ds_url": "https://3ds-example.com"
},
"currency": "USD",
"amount": "100.0",
"total": "100.0",
"paid_amount": "0.0",
"is_refundable": false,
"payment_method": "card",
"expired_at": "",
"webhook_notification": {
"endpoint_url": "https://webhook.site/12da7803-c4cf-4f32-812d-aaeaecf20d9d",
"authorization_header": "****"
},
"refund_information": {
"total_amount": "250.0",
"refund_amount": "10.0",
"description": "Testing refund"
},
"sender_details": {
"card": {
"card_type": "card",
"card_brand": "visa",
"card_last_4": "1111",
"card_country": "US"
}
},
"created_at": "2025-05-30T05:11:17.602+0000",
"token": {
"id": "tok_dfe1988a1ffc0d6562d3",
"type": "card"
}
}

Error codes and messages

When a payment failed, pay_code includes error_code and error_message. Reference table:

Error codeMessage
account_closedThe customer's bank account has been closed.
amount_invalidThe payment amount is invalid, or exceeds the amount that's allowed.
amount_too_largeThe specified amount is greater than the maximum amount allowed. Use a lower amount and try again.
amount_too_smallThe specified amount is less than the minimum amount allowed. Use a higher amount and try again.
authentication_expiredThe card authorisation has expired.
authentication_failedThe payment can't be authorised.
authentication_requiredThe card was declined because the transaction requires authentication such as 3D Secure.
capture_not_authorisedTransaction must be in 'authorised' status before it can be captured.
card_decline_rate_limit_exceededThis card has been declined too many times. You can try to charge this card again after 24 hours. We suggest reaching out to your customer to make sure they've entered all of their information correctly and that there are no issues with their card.
card_expiredThe card has expired.
card_lostThe payment was declined because the card is reported lost.
card_not_supportedThe card does not support this type of purchase.
card_number_incorrectThe card number is incorrect.
card_restrictedThe customer can't use this card to make this payment (it's possible it was reported lost or stolen).
card_stolenThe payment was declined because the card is reported stolen.
card_velocity_exceededThe customer has exceeded the balance, credit limit, or transaction amount limit available on their card.
currency_not_supportedThe card does not support the specified currency.
customer_canceledThe customer has stopped the payment with their bank. Contact them for details and to arrange payment.
cvc_incorrectThe CVC number is incorrect.
debit_not_authorisedThe customer has notified their bank that this payment was unauthorised.
expiry_month_invalidThe expiration month is invalid.
expiry_year_invalidThe expiration year is invalid.
fraudulentThe payment was declined because we suspects that it's fraudulent.
generic_declinedThe card was declined for an unknown reason or blocked the payment.
insufficient_fundsThe card has insufficient funds to complete the purchase.
issuer_declinedThe card was declined for an unknown reason.
issuer_not_availableThe card issuer couldn't be reached, so the payment couldn't be authorised.
pin_requiredThe card was declined because it requires a PIN.
pin_try_exceededThe allowable number of PIN tries was exceeded.
processing_errorAn error occurred while processing the card. Try again later or with a different payment method.
return_url_invalidReturn URL is invalid.
transaction_is_blockedTransaction is blocked. If you paid, we will refund you soon.
transaction_duplicatedA recent transaction with identical details was submitted recently.
withdrawal_count_limit_exceededThe customer has exceeded the balance or credit limit available on their card.

Token for Authorised Cards

When a payment reaches the authorised or waiting status for card payment, we will additonal a token object in the webhook notification. You should be save this token and can be used it to create subsequent payments for the same customer without requiring re-authorisation of their card.

Note: For security reasons, the token object is only included in the webhook notification when the payment status changes to authorised or waiting. It will not be included in webhook notifications for other status changes.

The token object has this structure:

{
...,
"token": {
"id": "tok_773085396b86562040f4",
"type": "card"
}
}

Setting Up Webhooks

For security reasons, when using our SDK Integration, you need to contact us to provide your default webhook information to receive notifications. However, when using API Create Payment via Tokenisation, if you specify a different webhook URL, we will send notifications to that URL instead of the default webhook. You can do this by including the webhook_notification object in your payment creation request:

{
"webhook_notification": {
"endpoint_url": "https://your-domain.com/webhook",
"authorization_header": "Bearer your-secret-token" // Optional
}
}

Webhook Security

For enhanced security, you can include an authorization_header in your webhook configuration. This header will be sent with each webhook request, allowing you to verify the authenticity of the notifications.


Status Changes

Webhook notifications are sent when a payment's status changes to any of the following:

  • pending: Customer started a new payment but hasn't proceeded yet.
  • authorised: Payment has been authorised, ready to be captured.
  • waiting: Payment has been approved, awaiting funds to settle.
  • received: Funds have been received.
  • expired: Payment session expired before completion.
  • return_pending: Refund request initiated, awaiting processing.
  • return_expired: The refund request has expired. Expiration time is set to be 10 days.
  • partially_refunded: Partial refund has been issued to the customer.
  • return_received: Full amount has been refunded to the customer.
  • return_rejected: Refund request was denied. The system will not retry again.
  • failed: Payment failed due to an error or decline.
  • in_dispute: Customer has raised a dispute, under review.
  • dispute_lost: Dispute has been resolved in customer's favour The disputed amount is not returned to the merchant.

Note: When a payment status is in_dispute, you can contact our support team to provide evidence for the dispute resolution process.


Best Practices

  1. Always verify the webhook signature or authorization header to ensure the request is legitimate
  2. Implement idempotency in your webhook handler to prevent duplicate processing
  3. Respond with a 200 OK status code as soon as you receive the webhook
  4. Process the webhook data asynchronously to avoid timeout issues
  5. Keep your webhook endpoint URL secure and private

Testing Webhooks

You can test webhook notifications using tools like webhook.site or by setting up a local endpoint using tools like ngrok.


Error Handling

If the target endpoint does not return HTTP 200, Hello Clever will retry the webhook call 3 times with 15 minutes delay per call.