In Plug&Pay, you have the option to set up a webhook. Setting up a webhook ensures that a particular action is carried out in another system or tool after an order has been placed, after a subscription has expired or after an affiliate has been accepted.
In this article, you'll learn how to create and set up a webhook in Plug&Pay.
What are webhooks?
Webhooks can be seen as automatic messages that Plug&Pay sends to another system as soon as something happens. The other system can then do something, such as sign up a customer, send an email or create an invoice.
Webhooks make sure that Plug&Pay passes on events immediately to other systems, so everything keeps running automatically without you having to do anything yourself.
Example: Setting up a webhook means that after an order has been placed, your customer automatically receives login details for an environment.
Which triggers can I use?
With Plug&Pay, you can set up the following starting moments for a webhook:
Affiliate accepted
Affiliate denied
Affiliate quit
Invoice created
Order paid
Subscription ended
Which data is sent via webhooks?
βοΈ This information only applies to Webhooks V2.
Webhooks in Plug&Pay only send an event payload. This includes, among other things:
trigger_typee.g. order_created
triggerable_ide.g. order_ID
triggerable_typee.g. orders
sent_attenant_idrule_id
You have to retrieve the actual data yourself with the API. You do this through a URL. The structure of this URL differs depending on the data you retrieve. Here are a few examples π
If triggerable_type is order
π Documentation
If triggerable_type is subscription
π Documentation
The advantage of this is that you always have the most up-to-date data to hand. Because you only retrieve the data when you process the webhook, you can check whether the information is still correct (with sent_at, for example) or retrieve data later if your webhook arrives with a delay.
This also gives you more flexibility in retrieving different types of data.
Adding a webhook
Within Plug&Pay, you have the option to set up a webhook for a specific product/checkout, or a universal webhook for all products and all checkouts.
Setting up a universal webhook
A universal webhook is called every time the chosen trigger occurs. For example, on every order or every accepted affiliate.
Go to Settings > Rules to get started. Click Add rule, give your rule a name, choose a trigger and select the Webhook V2 option under 'Action'.
Enter the webhook URL of the system you'd like to connect with. Click 'Create rule' to save your new webhook.
Setting up a webhook per product
If you want to set up a webhook that isn't called for every order, but only for a specific product, follow the steps below.
Navigate to Products and open the product you want. Go to the Rules tab and add a new integration.
Give your rule a name, choose the trigger, select Webhook V2 and enter the webhook URL. Save your rule by clicking 'Create rule'.
Setting up a webhook per checkout
If you want to set up a webhook that isn't called for every order, but only for a specific checkout, follow the steps below.
Navigate to Pages > Checkouts and open the page you want. Go to the Integrations tab and add a new integration.
Give your rule a name, choose the trigger, select Webhook V2 and enter the webhook URL. Save your rule by clicking 'Create rule'.
Webhook key π
You can also verify your webhooks with a webhook key. This verification is optional, and you use it to verify that the data being sent comes from your Plug&Pay environment.
You can find more information at π https://docs.plugandpay.nl/docs/plug-pay/38jm8ez0c40hl-create-a-new-rule#webhook-security
You'll find the webhook key under Settings > Developers.β
Good to know
We use JSON format in all Webhooks V2 payloads.β
If you've created a universal integration with the trigger Invoice created, a webhook is also called after a successful transaction via the one-click upsell.β
Do you want to call a webhook for a specific upsell? You can do this via the upsell's settings under the Advanced tab by filling in the webhook field with the desired webhook URL.β
β
Connecting with Huddle? Then read this article πβ
Connecting with ActiveCampaign? Then read this article π









