Skip to main content

Create a Webhook

Creates a Webhook resource.

Creating webhooks

As of this writing, you can create webhooks via API. In future releases, we will allow you to create a webhook via Dashboard.


Endpoint

POST /webhooks

Sample code

const client = require('payrex-node')('insert your PayRex Secret API key.');

const webhook = await client.webhooks.create({
url: 'https://my-ecommerce.com/send-shipments',
description: 'test description',
events: ['payment_intent.succeeded'],
});

Parameters

url REQUIRED

The URL where PayRex will send the event that happened from your account. For security purposes, the URL must be using HTTPS protocol.


description optional

An arbitrary string attached to the Webhook. You can use this to give more information about the Webhook resource.


events REQUIRED

An array of strings that defines the list of events the webhook will listen to. To learn about the possible values, please refer to this list.

Returns

Returns a Webhook resource.