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.
- cURL
- Python
- Ruby
- PHP
- C#
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
- cURL
- Python
- Ruby
- PHP
- C#
1 2 3 4curl "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_type | event | description |
|---|---|---|
| transaction | create | A new transaction has been created. |
| transaction | agree | All parties have agreed to the transaction. |
| transaction | party_verification_submitted | A party has submitted their verification for review. |
| transaction | party_verification_approved | A party has had their verification reviewed and approved. |
| transaction | party_verification_rejected | A party has had their verification reviewed and rejected. |
| transaction | payment_approved | PROJECT_NAME has approved the payment for the transaction and the goods may now be shipped by the seller. |
| transaction | payment_rejected | PROJECT_NAME has rejected the payment for the transaction. |
| transaction | payment_sent | The buyer has sent payment to PROJECT_NAME. |
| transaction | payment_received | PROJECT_NAME has received payment from the buyer. |
| transaction | payment_refunded | PROJECT_NAME has refunded a buyer's payment. |
| transaction | payment_disbursed | PROJECT_NAME has disbursed payment to the seller. |
| transaction | payment_rejected | PROJECT_NAME has rejected the payment for the transaction. |
| transaction | ship | The seller has indicated that the goods have been shipped. |
| transaction | receive | The buyer has indicated that the goods have been received. |
| transaction | accept | The buyer has indicated that the goods have been accepted. |
| transaction | reject | The buyer has indicated that the goods have been rejected. |
| transaction | ship_return | The buyer has indicated that the goods to be returned following rejection have been shipped. |
| transaction | receive_return | The seller has indicated that the goods to be returned following rejection have been received. |
| transaction | accept_return | The seller has indicated that the goods to be returned following rejection have been accepted. |
| transaction | reject_return | The seller has indicated that the goods to be returned following rejection have been rejected. |
| transaction | complete | All disbursements have been made to the seller, closing statements have been sent. PROJECT_NAME marked the transaction as complete. |
| transaction | cancel | PROJECT_NAME has marked the payment as cancelled. |
| transaction | offer_accepted | This is sent for Offers transactions, when an offer has been accepted. |
| transaction | refund_resolved | This is sent when PROJECT_NAME has approved to process a refund for a transaction. |
| transaction | refund_rejected | This is sent when PROJECT_NAME has rejected to process a refund for the transaction. |