Setup a webhook
Speed sends a webhooks message to notify your application when an event happens in your account. Webhooks are particularly useful for asynchronous events like when a customer makes a payment, you receive recurring payments, or when collecting subscription payments. It is imperative for Speed to know where to send event notifications. So you need to register webhook endpoints. Provide a publicly accessible HTTPS URL to deliver these notifications when registering your webhook endpoint so we can send unauthenticated POST requests. Therefore, ensure it is a secure (HTTPS) endpoint capable of handling webhook JSON payloads. You can register any amount of webhook endpoints with Speed. The URL must be in the standard format of https://(www.)domain.com/.
Set up a webhook endpoint using these steps
- Add endpoint URL.
- Select API versioning
- Add description
- Select events to receive their notification
- Complete your webhooks integration by testing it in test mode.
- After testing your webhook endpoint, register the endpoint in live mode, and you are all set.
Speed users will be able to enable the same events on multiple endpoints. Furthermore, you can add the same URL multiple times. While adding the endpoint, you can choose the version you want. You can select your version or the latest Speed version. Speed enables you to create Webhooks for both test and live modes.
Register an endpoint via Web application
You can configure webhooks in your Speed web app’s dashboard or using the APIs. Most users configure webhooks from the Speed web application, which provides a user interface for registering and testing your webhook endpoints.
To set up a webhook endpoint through the Speed web application, follow these steps:
- Log into your Speed web application with your login credentials.
- Navigate to Dashboard → Developers → Webhooks.
- On the left sidebar, click
Add endpoint
. - Add your webhook endpoint’s HTTPS URL in the
Endpoint URL
. - Enter a description.
- Select the version of your choice.
- Click
next
. You will see a list of all events. Select your desired events. After selecting events, you can see the selected ones in the sample endpoint code on the Speed web application. - Click
Add endpoint
. This will take you to the webhook detail page, where you can find the webhook endpoint status, secret, id, and many other details.
Set up a webhook endpoint via API
You can also programmatically create webhook endpoints. Let’s see the request and its parameters for the same.
Request
{
"url": “string”,
"description": “string”,
"api_version": “string”,
"enabled_events":[ “payment.created”, “payment.paid”]
}
Request parameters
Provide the basic information outlined in the table below:
Parameter | Required | Type | Description |
---|---|---|---|
url | ✅ | string | The webhooks-endpoint URL you want to use to receive notifications. |
api_version | string | You can send your version or the latest version in this parameter. The default api_version is 2022-04-15 . | |
description | string | This parameter allows you to describe this webhooks endpoint. The description is an optional field, and you can use this parameter as you choose to do. The best practice is to use this to describe the usage of this particular endpoint. | |
enabled_events | ✅ | Array of strings | Enable events by entering the event names in this parameter and receive real-time notifications for those desired events. See the events list page to know for which events we provide webhooks. |
More information can be found in our API reference.
Response
{
"id": "we_xxxxxxxxxxxxxxxxxx",
"object": "webhook.endpoint",
"api_version": "2022-10-15",
"enabled_events": [
"payment.created"
],
"livemode": false,
"status": "active",
"url": "https://speed.abc.com/xxxxxxxxxxxx",
"secret": "wsec_xxxxxxxxxxxxxxxxxxxxxx",
"description": null,
"created": 1670478066054,
"modified": 1670478066054
}
Attributes
id string
Unique identifier for the object.
object string
The type of the object indicates to which entity this response belongs.
livemode boolean
If the object is in live mode, it has the value true; otherwise, it has the value false.
status enum
A webhook endpoint object can have 2 statuses as mentioned below.
- active
- Upon generation, by default, it will be active until deactivated.
- deactivated You can manually deactivate a webhook endpoint when you don't intend to receive notifications via it.
api_version string
Specifies the API version for which all the events of the webhook endpoint are rendered. The default api_version is 2022-04-15
.
enabled_events string
The list of all your enabled events.
url string
The URL of the webhook endpoint.
secret string
The endpoint’s secret is to ensure that the real-time notifications sent are indeed from Speed. Store this value for future use.
description string
A description of the webhooks endpoint.
created timestamp
Time at which the webhook endpoint object was created.
modified timestamp
Time at which the last modification was made.
Updated 4 months ago