API Guide :: Webhooks

Using webhooks

By providing a HTTP endpoint that accepts POST requests, PROJECT_NAME will send you updates via webhook at key points during a transaction.

Please note that PROJECT_NAME strongly recommends verifying any data received via webhook by fetching related data such as by using the fetch transaction endpoint before taking actions based on webhook updates to ensure that the update was sent from PROJECT_NAME.

Adding a webhook

You can add a webhook by making a POST request with your own URL you would like to be called, as such.

The response body will include a unique ID for the created webhook. You can use this ID to delete the webhook in future.

Example Response

Getting current webhooks

To see all of the webhooks you have created, can make a GET request to the same resource at https://PROJECT_NAME/2017-09-01/customer/me/webhook

Example Response

Deleting a webhook

To delete a webhook, make a DELETE request to the webhook resource, using the unique webhook ID found by using the above GET endpoints. https://PROJECT_NAME/2017-09-01/customer/me/webhook

1
2
3
4
curl "https://PROJECT_NAME/2017-09-01/customer/me/webhook/1234" \
    -X DELETE \
    -u "email-address:your-api-key" \
    -H "Content-Type: application/json" \

This will return a 204 status code on successful deletion. Deleted webhooks will no longer be called.

Webhook behaviour

When transactions change state, PROJECT_NAME will make POST requests to all of your active webhooks. The body of the POST request that we will send is as shown:

Example Webhook Call

1
2
3
4
5
{
    "event": "payment_approved",
    "event_type": "transaction",
    "transaction_id": 12345
}

Note

PROJECT_NAME has a 10 second timeout on your webhook requests. Webhooks will be retried if the request fails.

Webhook events

This table shows the possible events that trigger webhooks.

event_typeeventdescription
transactioncreateA new transaction has been created.
transactionagreeAll parties have agreed to the transaction.
transactionparty_verification_submittedA party has submitted their verification for review.
transactionparty_verification_approvedA party has had their verification reviewed and approved.
transactionparty_verification_rejectedA party has had their verification reviewed and rejected.
transactionpayment_approvedPROJECT_NAME has approved the payment for the transaction and the goods may now be shipped by the seller.
transactionpayment_rejectedPROJECT_NAME has rejected the payment for the transaction.
transactionpayment_sentThe buyer has sent payment to PROJECT_NAME.
transactionpayment_receivedPROJECT_NAME has received payment from the buyer.
transactionpayment_refundedPROJECT_NAME has refunded a buyer's payment.
transactionpayment_disbursedPROJECT_NAME has disbursed payment to the seller.
transactionpayment_rejectedPROJECT_NAME has rejected the payment for the transaction.
transactionshipThe seller has indicated that the goods have been shipped.
transactionreceiveThe buyer has indicated that the goods have been received.
transactionacceptThe buyer has indicated that the goods have been accepted.
transactionrejectThe buyer has indicated that the goods have been rejected.
transactionship_returnThe buyer has indicated that the goods to be returned following rejection have been shipped.
transactionreceive_returnThe seller has indicated that the goods to be returned following rejection have been received.
transactionaccept_returnThe seller has indicated that the goods to be returned following rejection have been accepted.
transactionreject_returnThe seller has indicated that the goods to be returned following rejection have been rejected.
transactioncompleteAll disbursements have been made to the seller, closing statements have been sent. PROJECT_NAME marked the transaction as complete.
transactioncancelPROJECT_NAME has marked the payment as cancelled.
transactionoffer_acceptedThis is sent for Offers transactions, when an offer has been accepted.
transactionrefund_resolvedThis is sent when PROJECT_NAME has approved to process a refund for a transaction.
transactionrefund_rejectedThis is sent when PROJECT_NAME has rejected to process a refund for the transaction.