Webhook Events for Membership in details
Getting Started
This article will briefly cover the events and payloads called during a webhook event.
Event Name | When will it be triggered? |
---|---|
add-member | When any new user subscribes to the free plan or when a new team member is added. |
update-member | When an existing member updates their email or name. |
remove-member | When a user is removed from the member list |
add-subscription | When a user purchases any paid plan |
update-subscription | When any paid member downgrades to a free plan or changes from annually to monthly or vice versa |
cancel-subscription | When a user cancels their subscription |
Member Added
An add-member event is fired when new users subscribe to the free plan.
Information sent in the payload for an add-member webhook is summarised in the table below.
Payload
Property | Type | Description | Example |
---|---|---|---|
name | String | The name of the added member | “John” |
String | The email address of the added member | abc@abc.com | |
userId | String | The added member’s User ID | 644094d7f939e67758 |
eventName | String | Name of the event | add-member |
eventId | String | The unique ID of the event | add-member-fj30fer |
membership | Object | This object will contain the value of the membership information (E.g customerId, subscriptionId) |
membership object properties:
Property | Type | Description | Example |
---|---|---|---|
customerId | String | The customer ID of the member added | cus_43fdf43nkkdf |
subscriptionId | String | The Subscription ID of the member | subs_4e**** or null(if free member) |
planId | String | The Plan ID of a member added will be Free | or null(if free member) |
status | String | Status of the subscription | |
renewAt | Date | Date when the subscription is to be renewed | |
cancellationEffectiveDate | Date | Date when the cancellation will be effective |
Member Updated
An update-member event is fired when an existing member updates their email or name.
Information sent in the payload for an update-member webhook is summarised in the table below.
Payload
Property | Type | Description |
---|---|---|
name | String | The updated name of the existing member |
String | The updated email address of the existing member | |
userId | String | The member’s User ID |
eventName | String | Name of the event |
eventId | String | The ID of the event |
membership | Object | This object will go to a payload containing the value of the membership |
membership object properties:
Property | Type | Description |
---|---|---|
customerId | String | Customer ID of the member |
subscriptionId | String | Subscription ID of the member |
planId | String | The ID of the plan the user has subscribed to |
status | String | Status of the subscription |
renewAt | Date | Date when the subscription is to be renewed |
cancellationEffectiveDate | Date | Date when cancellation will be effective |
Member Removed
A member-removed event is fired when a user is removed from the member list.
Information sent in the payload for a member-removed webhook is summarised in the table below.
Payload
Property | Type | Description |
---|---|---|
name | String | The name of the removed member |
String | The email address of the removed member | |
userId | String | The removed member’s User ID |
eventName | String | Name of the event |
eventId | String | The ID of the event |
membership | Object | This object will go into a payload containing the value of the membership |
membership object properties:
Property | Type | Description |
---|---|---|
customerId | String | Customer ID of the member |
subscriptionId | String | Subscription ID of the member |
planId | String | The ID of the plan the user had subscribed to |
status | String | Status of the subscription |
renewAt | Date | Date when the subscription is to be renewed |
cancellationEffectiveDate | Date | Date when the cancellation will be effective |
Subscriber Added
An add-subscription event is fired when a user purchases any paid plan
Information sent in the payload for an add-subscription webhook is summarised in the table below.
Payload
Property | Type | Description |
---|---|---|
name | String | The name of the new subscriber |
String | The email address of the subscribed member | |
userId | String | The new subscriber’s User ID |
eventName | String | Name of the event |
eventId | String | The ID of the event |
membership | Object | This object will go into a payload containing the value of the membership |
membership object properties:
Property | Type | Description |
---|---|---|
customerId | String | Customer ID of the new subscriber |
subscriptionId | String | Subscription ID of the new subscriber |
planId | String | The ID of the plan the user had subscribed to |
status | String | Status of the subscription |
renewAt | Date | Date when the subscription is to be renewed |
cancellationEffectiveDate | Date | Date when the cancellation will be effective |
Subscriber Updated
An update-subscription event is fired when any paid member updates to a free plan or changes from an annual to a monthly subscription or vice versa.
Information sent in the payload for an update-subscription webhook is summarised in the table below.
Payload
Property | Type | Description |
---|---|---|
name | String | The name of the subscriber who updated their plan |
String | The email address of the subscriber | |
userId | String | The new subscriber’s User ID |
eventName | String | Name of the event |
eventId | String | The ID of the event |
membership | Object | This object will go into a payload containing the value of the membership |
membership object properties:
Property | Type | Description |
---|---|---|
customerId | String | Customer ID of the subscriber |
subscriptionId | String | Subscription ID of the subscriber |
planId | String | The ID of the plan the user had updated to |
status | String | Status of the subscription |
renewAt | Date | Date when the subscription is to be renewed |
cancellationEffectiveDate | Date | Date when the cancellation will be effective |
Subscription Cancelled
An add-subscribtion event is fired when a user cancels their subscription.
Information sent in the payload for an add-subscribtion webhook is summarised in the table below.
Payload
Property | Type | Description |
---|---|---|
name | String | The name of the subscriber who canceled their plan |
String | The email address of the subscriber | |
userId | String | The subscriber’s User ID |
eventName | String | Name of the event |
eventId | String | The ID of the event |
membership | Object | This object will go into a payload containing the value of the membership |
membership object properties:
Property | Type | Description |
---|---|---|
customerId | String | Customer ID of the subscriber |
subscriptionId | String | |
planId | String | It will be updated to Free |
status | String | Status of the subscription |
renewAt | Date | |
cancellationEffectiveDate | Date |
Code Sample when a Member is Added
{
"name": "Abcd Efgh",
"email": "ilaxvdzrflpbhsrqoi@tmmwj.net",
"user_id": "6391774374eb6d00132cd44e",
"role": "subscriber",
"membership": {
"planId": "FREE",
"status": "INACTIVE",
"customerId": null
},
"eventName": "add-member",
"eventId": "635e21996b8dfb00d3d231d7-PLFKEHEFZ-DCISC"
}
Code Sample when a Member is Updated
{
"name": "Abcd Efgh",
"email": "abcd@abcd.net",
"user_id": "6391774374eb6d00132cd44e",
"role": "subscriber",
"membership": {
"planId": "FREE",
"status": "ACTIVE",
"customerId": null
},
"eventName": "update-member",
"eventId": "635e21996b8dfb00d3d231d7-PLFKEHEFZ-DCISC"
}
Code Sample when a Member is Removed
{
"email": "sami97abrar@gmail.com",
"user_id": "63956e801a11150011a0057f",
"role": "subscriber",
"membership": {
"planId": "FREE",
"status": "INACTIVE",
"customerId": "cus_Mxdd6rr03JN9JC",
"subscriptionId": null,
"renewAt": null,
"cancellationEffectiveDate": null
},
"eventName": "remove-member",
"eventId": "62c69bb8215fc200b029d395-YKOQ-IAZYYZKMUE"
}
Code Sample when a Subscriber is Added
{
"name": "Abcd Efgh",
"email": "abcd@abcd.net",
"user_id": "6391774374eb6d00132cd44e",
"role": "subscriber",
"membership": {
"planId": "MONTHLY",
"status": "ACTIVE",
"customerId": null
},
"eventName": "add-subscription",
"eventId": "635e21996b8dfb00d3d231d7-PLFKEHEFZ-DCISC"
}
Code Sample when a Subscription is Updated
{
"name": "Abrar",
"email": "sami97abrar@gmail.com",
"role": "subscriber",
"membership": {
"customerId": "cus_MxeQ8wVzEJJbVY",
"subscriptionId": "sub_1MDj8ERFal0kIVZ7DuIXcACG",
"planId": "price_1Lm9FGRFal0kIVZ7Q9RzMP8E",
"status": "ACTIVE",
"renewAt": 1702276526000,
"cancellationEffectiveDate": null,
},
"user_id": "63956f7c1a11150011a00584",
"eventName": "update-subscription",
"eventId": "62c69bb8215fc200b029d395-EUNLSJKW-LWWJQE"
}
Code Sample when a Subscription is Cancelled
{
"name": "Abrar",
"email": "sami97abrar@gmail.com",
"role": "subscriber",
"membership": {
"customerId": "cus_MxeQ8wVzEJJbVY",
"subscriptionId": "sub_1MDj8ERFal0kIVZ7DuIXcACG",
"planId": "price_1Lm9FGRFal0kIVZ7Q9RzMP8E",
"status": "CANCELLED",
"renewAt": "2023-12-11T06:35:26.000Z",
"cancellationEffectiveDate": 1702276526000,
},
"user_id": "63956f7c1a11150011a00584",
"eventName": "cancel-subscription",
"eventId": "62c69bb8215fc200b029d395-QBLNYSZF-KTXYAY"
}
Related articles
Adding Webhook for Membership Events
Updated on: 01/02/2023
Thank you!