Webhook Endpoints API

The webhook endpoints API allows you to create and view your webhook endpoints. These are URLs that Pin Payments requests when events occur on your account.

POST /webhook_endpoints

Creates a new webhook endpoint and returns its details.

Parameters

url The destination URL of the webhook endpoint.

Example

curl https://test-api.pinpayments.com/1/webhook_endpoints -u your-secret-api-key: \
 -d "url=https://example.org/webhooks/"
201 Created
{
  "response": {
    "token": "whe_4I23afROQsdI5Csjo",
    "key": "vSeHhoa0amv38tF3pXDtPA",
    "url": "https://example.org/webhooks/",
    "created_at": "2023-09-22T15:08:54Z",
    "updated_at": "2023-09-22T15:08:54Z"
  }
}

Error Responses

422 invalid_resource {...}
{
  "error": "invalid_resource",
  "error_description": "One or more parameters were missing or invalid",
  "messages": [
    {
      "code": "url_invalid",
      "message": "url is not a valid URL",
      "param": "url"
    }
  ]
}
403 limit_reached {...}
{
  "error": "limit_reached",
  "error_description": "You have reached the maximum number of allowed webhook endpoints."
}

GET /webhook_endpoints

Returns a paginated list of all webhook endpoints.

Example

curl https://test-api.pinpayments.com/1/webhook_endpoints -u your-secret-api-key:
200 OK
{
  "response": [
    {
      "token": "whe_4I23afROQsdI5Csjo",
      "key": "vSeHhoa0amv38tF3pXDtPA",
      "url": "https://example.org/webhooks/",
      "created_at": "2023-09-22T15:08:54Z",
      "updated_at": "2023-09-22T15:08:54Z"
    }
  ],
  "pagination": {
    "count": 1,
    "per_page": 25,
    "current": 1
  }
}

GET /webhook_endpoints/webhook-endpoint-token

Returns the details of the specified webhook endpoint.

Example

curl https://test-api.pinpayments.com/1/webhook_endpoints/whe_4I23afROQsdI5Csjo -u your-secret-api-key:
200 OK
{
  "response": {
    "token": "whe_4I23afROQsdI5Csjo",
    "key": "vSeHhoa0amv38tF3pXDtPA",
    "url": "https://example.org/webhooks/",
    "created_at": "2023-09-22T15:08:54Z",
    "updated_at": "2023-09-22T15:08:54Z"
  }
}

Error Responses

404 resource_not_found {...}
{
  "error": "resource_not_found",
  "error_description": "No resource was found at this URL."
}

DELETE /webhook_endpoints/webhook-endpoint-token

Deletes a webhook endpoint and all of its webhook requests. You will not be able to recover them.

Example

curl https://test-api.pinpayments.com/1/webhook_endpoints/whe_4I23afROQsdI5Csjo -u your-secret-api-key: -X DELETE
204 No Content
No response body.

Error Responses

404 resource_not_found {...}
{
  "error": "resource_not_found",
  "error_description": "No resource was found at this URL."
}