Webhooks API
Documentation on how to use the webhooks API via OAuth2 in SePay.
Introduction
SePay’s Webhooks API lets you manage webhooks to receive real-time notifications about transactions. Webhooks are an efficient way to automate payment workflows, allowing your system to be notified immediately when a new transaction occurs.
To use this API, your Access Token must include the appropriate scopes:
webhook:readto view,webhook:writeto create/update, andwebhook:deleteto delete webhooks.
Endpoints
- The Webhooks API provides the following endpoints:
/api/v1/webhooks- Get a list of webhooks with filtering options
/api/v1/webhooks/{id}- Get detailed information about a specific webhook
/api/v1/webhooks- Create a new webhook
/api/v1/webhooks/{id}- Update a webhook
/api/v1/webhooks/{id}- Delete a webhook
Get webhook list
/api/v1/webhooksAuthorization: Bearer {YOUR_ACCESS_TOKEN}
This endpoint returns the list of webhooks for your company. You can filter results by various criteria.
Required permissions
- Scope:
webhook:read - User permission: Webhooks (View webhook list)
- Scope:
Query parameters
Name Type Required Description webhook_urlstring Not required Filter by webhook URL (partial match)api_keystring Not required Filter by API keyactiveinteger Not required Filter by active status (0: inactive, 1: active)pageinteger Not required Page number, starting from 1limitinteger Not required Number of results per page
Get webhook details
/api/v1/webhooks/{id}Authorization: Bearer {YOUR_ACCESS_TOKEN}
This endpoint returns detailed information of a webhook by its ID.
Required permissions
- Scope:
webhook:read - User permission: Webhooks (View webhook list)
- Scope:
Path parameters
Name Type Required Description idinteger Required Webhook ID
Create a new webhook
/api/v1/webhooksAuthorization: Bearer {YOUR_ACCESS_TOKEN}
This endpoint allows you to create a new webhook to receive transaction notifications.
Required permissions
- Scope:
webhook:write - User permission: Webhooks (Add webhooks)
- Scope:
Request parameters
Name Type Required Description bank_account_idinteger Required Bank account IDnamestring Required Webhook nameevent_typestring Required Event type (All, In_only, Out_only)authen_typestring Required Authentication type (No_Authen, OAuth2.0, Api_Key)webhook_urlstring Required Webhook receiving URLis_verify_paymentinteger Required Verify payment (0: no, 1: yes)skip_if_no_codeinteger Not required Skip if there is no payment code (0: no, 1: yes)activeinteger Not required Active status (0: inactive, 1: active)retry_conditionsarray Not required Retry conditions when errors occuronly_vainteger Not required Only receive transactions from virtual accounts (0: no, 1: yes)bank_sub_account_idsarray Not required List of virtual account IDs (required if only_va=1)Additional parameters for each authentication type:
🔐 OAuth2.0
Additional configuration parameters:
oauth2_access_token_url(required) – URL to obtain the access token.oauth2_client_id(required) – Client ID.oauth2_client_secret(required) – Client Secret.
🔑 Api_Key
Additional configuration parameters:
api_key(required) – API Key used for authentication.request_content_type(required) – Request content type (Json, multipart_form-data).
🚫 No_Authen
Additional configuration parameters:
request_content_type(required) – Request content type (Json, multipart_form-data).
Update a webhook
/api/v1/webhooks/{id}Authorization: Bearer {YOUR_ACCESS_TOKEN}
This endpoint allows you to update an existing webhook.
Required permissions
- Scope:
webhook:write - User permission: Webhooks (Edit webhooks)
- Scope:
Path parameters
Name Type Required Description idinteger Required Webhook IDRequest parameters
- The request parameters are the same as when creating a webhook, but all are optional. Provide only the parameters you want to change.
Delete a webhook
/api/v1/webhooks/{id}Authorization: Bearer {YOUR_ACCESS_TOKEN}
This endpoint allows you to delete a webhook.
Required permissions
- Scope:
webhook:delete - User permission: Webhooks (Delete webhooks)
- Scope:
Path parameters
Name Type Required Description idinteger Required Webhook ID
Error codes
- Below are possible error codes when using the webhooks API:
HTTP Code Error Code Description 400 validation_errorInput data validation error401 unauthorizedToken is invalid or expired403 forbiddenYou do not have permission to access this resource404 not_foundWebhook not found