Webhooks

How to set up webhooks

PayGate Subscriptions also provides webhooks functionality.

Upon request to info@rainbowriders.dk we can setup for you webhooks that will be triggered on:

  • Agreement created

  • Agreement updated

  • Payment created

  • Payment updated

If you would like to use these, just send us the URLs that will receive each of these webhooks.

Or alternatively, you can set them yourself by logging into PayGate and going to Settings > Webhooks – https://mps.paygate.dk/settings/webhooks

You can then specify multiple webhook URLs for each trigger, by separating the URLs with commas. See the example below.

In order to setup webhook processing, you will need to know the data payload and headers of these webhooks.

Headers

User-Agent: PayGate – Webhooks

Content-Length: {length of request in bytes}

Content-Type: application/x-www-form-urlencoded

Payloads

Agreement payload (created/updated)

{

“id”: 11111,

“cpr”: null,

“action”: “created”,

“agreement_id”: “dbed001f-20eb-4895-a5f7-f548789b1e02”,

“amount”: “100.00”,

“sms_at”: “2020-04-02 12:52:55”,

“status”: “Accepted”,

“company”: {

“id”: 11,

“name”: “Company name”

},

“request”: {

“plan”: “Plan name”,

“links”: [{

“rel”: “user-redirect”,

“href”: “https://mobilepay.rainbowriders.dk/agreement/id/11111”

},

{

“rel”: “success-callback”,

“href”: “https://mobilepay.rainbowriders.dk/api/callback/11111/success” },

{

“rel”: “cancel-callback”,

“href”: “https://mobilepay.rainbowriders.dk/api/callback/11111/cancel” }

],

“amount”: “100”,

“currency”: “DKK”,

“frequency”: “12”,

“description”: null,

“external_id”: “AGGR11111”,

“country_code”: “DK”,

“next_payment_date”: “2020-04-04”,

“mobile_phone_number”: “4512345678”,

“retention_period_hours”: 24,

“expiration_timeout_minutes”: 20160,

“disable_notification_management”: true

},

“user_id”: 135,

“campaign”: {

“company_id”: 11,

“created_at”: “2019-11-09 23:59:17”,

“deleted_at”: null,

“id”: 98,

“name”: “Campaign name”,

“updated_at”: “2019-11-09 23:59:17”

},

“comments”: null,

“custom_1”: null,

“from_api”: 1,

“frequency”: “12”,

“oo_amount”: null,

“plan_name”: “Plan name”,

“company_id”: 11,

“created_at”: “2020-04-02 12:52:55”,

“deleted_at”: null,

“subscriber”: {

“id”: 7528,

“zip”: “4600”,

“city”: “Køge”,

“email”: “mail@example.com”,

“phone”: “12345678”,

“lastname”: “Smith”,

“address_1”: “Falkevej 22A”,

“address_2”: null,

“firstname”: “John”,

“full_name”: “John Smith”,

“created_at”: “2020-04-02 12:52:55”,

“deleted_at”: null,

“updated_at”: “2020-04-02 12:52:55”

},

“updated_at”: “2020-04-02 12:55:04”,

“campaign_id”: null,

“canceled_at”: null,

“custom_data”: {

“key”: “value”,

“key2”: “value2”

},

“description”: “”,

“from_iframe”: null,

“rejected_at”: null,

“subscriber_id”: 7528,

“oo_description”: null,

“confirmation_link”: “https://go.paygate.dk/xxxxx”, “is_admin_canceled”: 0,

“membership_number”: null,

“payment_method”:{

“id”:1,

“type”:”recurring”,

“description”:”MobilePay Subscriptions (recurring)” },

“next_payment_date”: “2020-05-04 00:00:00”,

“tags”: {}

}

Payment payload (created/updated)

{

“id”: 61288,

“action”: “created”,

“payment_id”: “dbed001f-20eb-4895-a5f7-f548789b1e02” “amount”: 50,

“status”: “Executed”,

“request”: {

“amount”: “50.00”,

“due_date”: “2020-03-13”,

“description”: “Subscribe Payment”,

“external_id”: “SP11111”,

“agreement_id”: “ea09b81b-33f2-4b36-ac7b-7azx629b5b11”, “grace_period_days”: 3,

“next_payment_date”: “2020-04-13”

},

“due_date”: “2020-03-13”,

“response”: {

“amount”: “50.00”,

“status”: “Executed”,

“currency”: “DKK”,

“payment_id”: “98f52c4d-3dad-4674-8d01-as9d2350bfe6”, “external_id”: “SP11111”,

“status_code”: 0,

“status_text”: null,

“agreement_id”: “ea09b81b-33f2-4b36-ac7b-7azx629b5b11”, “payment_date”: “2020-03-13”,

“payment_type”: “Regular”

},

“created_at”: “2020-03-11 00:00:04”,

“updated_at”: “2020-04-01 13:08:32”,

“agreement_id”: 1111,

“payment_type”: “subscription_payment”,

“next_payment_date”: “2020-04-13”

}