API Reference
Webhooks API
The webhooks API allows you to view and replay webhooks—requests that have been sent to your webhook endpoints. When an event occurs, Pin Payments creates a webhook record and sends a web request to each of your endpoints.
Replaying a webhook causes Pin Payments to request the URL again. It will not repeat other webhook requests for the same event. Replaying a webhook will reset the error information recorded during the original request and record any new errors that occur during the replay.
Webhooks are only guaranteed to be stored for 30 days after they are created.
GET /webhooks
Returns a paginated list of all webhooks.
Example
curl https://test-api.pinpayments.com/1/webhooks -u your-secret-api-key:
200
OK
{
"response": [
{
"token": "whr_87H4fafROQsdI5PrtyI",
"status": "completed",
"url": "http://www.google.com/?signature=ee4f5023a182b408fee81f9131d04dcb865b2a6dbeeb343b0cc0213b94ffa05f",
"event_token": "evt_12K4fafROQsdI5PdwLkX",
"webhook_endpoint_token": "whe_4I23afROQsdI5Csjo",
"created_at": "2024-12-21T11:50:55Z",
"accepted_at": "2024-12-21T11:50:55Z",
"next_run": null,
"retries": 0,
"errors": {
}
}
],
"pagination": {
"count": 1,
"per_page": 25,
"current": 1
}
}
GET /webhooks/webhook-token
Returns the details of a webhook.
Example
curl https://test-api.pinpayments.com/1/webhooks/whr_87H4fafROQsdI5PrtyI -u your-secret-api-key:
200
OK
{
"response": {
"token": "whr_87H4fafROQsdI5PrtyI",
"status": "retrying",
"url": "http://www.google.com/?signature=ee4f5023a182b408fee81f9131d04dcb865b2a6dbeeb343b0cc0213b94ffa05f",
"event_token": "evt_12K4fafROQsdI5PdwLkX",
"webhook_endpoint_token": "whe_4I23afROQsdI5Csjo",
"created_at": "2024-12-21T11:50:55Z",
"accepted_at": null,
"next_run": "2024-12-21T11:51:55Z",
"retries": 1,
"errors": {
"2024-12-21 11:50:55 UTC": {
"error": "unexpected_http_code",
"error_description": "Unexpected http code 405"
}
}
}
}
Error Responses
404 | resource_not_found |
{...}
|
---|
PUT /webhooks/webhook-token/replay
Replays a webhook.
Example
curl https://test-api.pinpayments.com/1/webhooks/whr_87H4fafROQsdI5PrtyI/replay -u your-secret-api-key: -X PUT
200
OK
{
"response": {
"token": "whr_87H4fafROQsdI5PrtyI",
"status": "pending",
"url": "http://www.google.com/?signature=ee4f5023a182b408fee81f9131d04dcb865b2a6dbeeb343b0cc0213b94ffa05f",
"event_token": "evt_12K4fafROQsdI5PdwLkX",
"webhook_endpoint_token": "whe_4I23afROQsdI5Csjo",
"created_at": "2024-12-21T11:50:55Z",
"accepted_at": null,
"next_run": null,
"retries": 0,
"errors": {
}
}
}
Error Responses
404 | resource_not_found |
{...}
|
---|---|---|
400 | cannot_replay_webhook |
{...}
|