Skip to main content

Create Webhook

Endpoint for creating a Webhook.

info

Please be aware that this endpoint requires a Manage Webhooks API Key.

POST /api/v1/groups/{group_id}/revere_pay/{linked_account_id}/webhooks

Request Parameters

NameDescriptionTypeRequired
urlThe webhook URL. It must be HTTPS.stringRequired
trigger_onThe list of the events which trigger the webhook.stringRequired
encoding_typeThe encoding type of the webhook. Possible value: jsonstringRequired
request_typeThe request type of the webhook. Possible value: basicstringRequired

Trigger On Types

ValueDescription
transaction.initiateTriggered by a successful transaction initialization.
transaction.pendingTriggered when the transaction status has changed to pending.
transaction.declineTriggered when the transaction has been declined.
transaction.settlementTriggered when the transaction status has changed to settled.
transaction.voidTriggered when the transaction has been voided.
transaction.refundTriggered when the transaction has been refunded.
subscription.createTriggered when the subscription has been created.
subscription.updateTriggered when the subscription has been updated.
subscription.deleteTriggered when the subscription has been deleted.
subscription.cancelTriggered when the subscription has been canceled.
subscription.cancel_by_userTriggered when the subscription has been canceled by user.

Response

CodeDescription
201Success
400Bad Request / Validation error
500Internal Error

Example Usage

webhook.js
var headers = new Headers();
headers.append('Authorization', 'API_KEY');

var requestOptions = {
method: 'POST',
headers: headers,
redirect: 'follow',
body: {
// request body data
}
};
const group_id = '';
const linked_account_id = '';
const url = `https://api.reverepayments.dev/api/v1/groups/${group_id}/revere_pay/${linked_account_id}/webhooks`;
fetch(url, requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log('error', error));

Example Request

{
"url": "https://webhook.site/ed874d91-5204-4a41-aa9b-224239adc7e9",
"trigger_on": ["transaction.initiate", "transaction.decline", "transaction.settlement"],
"encoding_type": "json",
"request_type": "basic"
}

Example Success Response

{
"id": "62589c1a-07c7-4410-a2dc-8ed2f23d6b49",
"group_id": "3322d0a9-5578-4072-a67b-eb48de1f52c7",
"url": "https://webhook.site/ed874d91-5204-4a41-aa9b-224239adc7e9",
"trigger_on": ["transaction.initiate", "transaction.decline", "transaction.settlement"],
"encoding_type": "json",
"request_type": "basic",
"public_key": "BEGIN RSA PUBLIC KEY...",
"created_at": "2024-07-28T15:11:16.975339432Z",
"updated_at": "2024-07-28T15:11:16.975339432Z"
}