Configure a Webhook in Chargify
To allow Chargify to notify Zephr when subscription payment methods are charged successfully, you must provide an URL that Chargify can use to issue webhooks.
To configure a webhook in Chargify, complete the following steps:
- In your Chargify account, select Config
- Select Settings
- Select Webhooks
- Select the Add new endpoint button
- Enter the URL to which you want Chargify to send webhooks
If you are using the Zephr CDN, the address to use is in the format
https://<your_domain>/plugins/advanced/public/chargify/subscriptionChargedCallback
.If you are not using the Zephr CDN, Zephr still provides a public endpoint that can be used by Chargify to send webhooks. To find this endpoint, complete the following steps in the Admin Console:
- Select Delivery
- Select Sites
- Select the site for which you want to use webhooks with Chargify
- Select Site Domains
The address is in the format
https://<your_zephr_cdn_domain>/plugins/advanced/public/chargify/subscriptionChargedCallback
- In your Chargify account, select the Payment Success event checkbox
- You can test whether Zephr can receive the webhook at the entered URL. To do this, select Actions, then select the option to run a test for the webhook
Chargify offers a number of useful tools for working with webhooks, including the ability to inspect the status of webhooks issued to Zephr.
Note: Chargify can resend webhooks. If you use this, duplicate product grants might be visible in the Zephr Admin Console. Although these duplicate grants do not affect the level of access for an end user, it can affect any reporting that uses Zephr data.
List Subscriptions Endpoint
The Chargify extension creates a new API endpoint at mydomain.com//plugins/public/chargify/subscriptions
, which lists the Chargify subscriptions for the signed-in user.
This endpoint can be called using the following cURL command:
curl --location --request GET 'https://MYDOMAIN.com/plugins/public/chargify/subscriptions' \ --header 'Cookie: blaize_session=df45a301-23a7-465a-b838-61d81d6e1bd5'
The response from this endpoint is similar to the following:
{ "subscriptions": [ { "token": null, "managed-by": "Chargify", "external-id": 1234567, "next-billing-time": "2021-08-14T17:02:30-04:00", "ends": null, "blaize-product": { id": "product-1", "label": "Product 1", "description": "" }, "transaction-history": [ { "human-readable-amount": "$3.74 CAD", "time": "2021-07-14T17:02:30-04:00", "currency": "CAD", "cents": 374, "cycle": null, "period_start": "2021-07-14", "period_end": "2021-08-14", "cycleCount": 1, "taxRate": {} } ], "subscription-state": "active", "paid_through_date": "2021-08-14T17:02:30-04:00", "plan_id": 234567, "plan_name": "Monthly magazine" } ] }