# Webhooks

# Billing Webhook Registration

Billing Webhooks can be registered with the following Event Types. Remember that the businessId value in the web hook registration request corresponds to the OrgId value from your Developer Portal account online.

APPLICATION_SUBSCRIPTION_START              - Subscription Start
APPLICATION_SUBSCRIPTION_END                - Subscription End
APPLICATION_SUBSCRIPTION_PAYMENT_SUCCESS    - Payment made successfully on the account
APPLICATION_SUBSCRIPTION_PAYMENT_FAIL       - Payment on the account failed
APPLICATION_SUBSCRIPTION_PHASE_CHANGE       - Subscription moved from a Trial to a Paid phase
APPLICATION_SUBSCRIPTION_REFUND_SUCCESS     - Refund from the Gateway succeeded

TIP

Please refer to the Webhooks Registration section for more information on registering webhooks for the event types.

# Webhook

When a Subscription event occurs, a webhook notification is triggered and sent to the deliveryUrl from step (1). This event gets triggered regardless of whether the subscription has a free trial.

Sample Webhook for Subscription Start:

{
  "createdAt": "2018-06-11T19:27:46Z",
  "updatedAt": "2018-06-11T19:27:46Z",
  "links": [
    {
      "href": "https://billing.poynt.net/apps/urn:aid:24c6e3d4-19e4-45c8-8231-6af2089dc694/subscriptions/5edfded9-49fb-464c-922e-cf662734055f",
      "rel": "resource",
      "method": "GET"
    }
  ],
  "id": "ff32460f-a0b6-4c17-b945-6649b8df2095", // id of this event
  "hookId": "21f4a4da-6c10-43f0-bd23-3875067d2031", // id of the web hook that generated this event
  "applicationId": "urn:aid:24c6e3d4-19e4-45c8-8231-6af2089dc694", // appId of your application
  "resource": "/apps/subscriptions",
  "resourceId": "5edfded9-49fb-464c-922e-cf662734055f", // subscription id for this merchant
  "eventType": "APPLICATION_SUBSCRIPTION_START",
  "merchantType": "TEST_MERCHANT", // TEST_MERCHANT for test merchants and MERCHANT for merchants in Production environment
  "businessId": "2bd73f40-60ff-4ced-aafd-66f270a2972c" // merchant's business id
}

To get the details of the merchant (i.e. business name, email, phone, etc.) who purchased/installed the app you can make a HTTP GET request to https://services.poynt.net/businesses/{businessId}. Please refer to Api Reference (opens new window) to see the type of information contained in the response.

Sample Webhook for Payment Success:

{
  "createdAt": "2017-05-24T02:15:43Z",
  "updatedAt": "2017-05-24T02:15:43Z",
  "links": [
    {
      "href": "https://billing.poynt.net/apps/urn:aid:b326335b-ce7c-4482-80d4-109e0fe6f9d9/subscriptions/65f713f3-55eb-40ed-bb4a-e4f392ccc2fb",
      "rel": "resource",
      "method": "GET"
    },
    {
      "href": "https://billing.poynt.net/businesses/db4a4f0d-d467-472d-a85b-2d08a61b57fa/invoices/d47e96f3-ef63-4190-8e52-b1acd2d625df",
      "rel": "resource",
      "method": "GET"
    }
  ],
  "id": "a0b9acd8-5332-438f-9765-5d94c31487ca",
  "hookId": "f6c07532-2401-40ea-a569-5058a9b8d468",
  "applicationId": "urn:aid:b326335b-ce7c-4482-80d4-109e0fe6f9d9",
  "resource": "/apps/subscriptions",
  "resourceId": "65f713f3-55eb-40ed-bb4a-e4f392ccc2fb",
  "eventType": "APPLICATION_SUBSCRIPTION_PAYMENT_SUCCESS",
  "merchantType": "TEST_MERCHANT",
  "businessId": "db4a4f0d-d467-472d-a85b-2d08a61b57fa"
}

Sample Webhook for Subscription Phase Change (from Trial to Paid subscription):

{
  "createdAt": "2018-06-12T19:27:46Z",
  "updatedAt": "2018-06-12T19:27:46Z",
  "links": [
    {
      "href": "https://billing.poynt.net/apps/urn:aid:24c6e3d4-19e4-45c8-8231-6af2089dc694/subscriptions/5edfded9-49fb-464c-922e-cf662734055f",
      "rel": "resource",
      "method": "GET"
    }
  ],
  "id": "d223114f-2f18-401c-a8a0-04d9f8d356e8",
  "hookId": "21f4a4da-6c10-43f0-bd23-3875067d2031",
  "applicationId": "urn:aid:24c6e3d4-19e4-45c8-8231-6af2089dc694",
  "resource": "/apps/subscriptions",
  "resourceId": "5edfded9-49fb-464c-922e-cf662734055f",
  "eventType": "APPLICATION_SUBSCRIPTION_PHASE_CHANGE",
  "merchantType": "TEST_MERCHANT",
  "businessId": "2bd73f40-60ff-4ced-aafd-66f270a2972c"
}

Sample Webhook for Successful Refund:

{
  "createdAt": "2018-06-12T21:47:53Z",
  "updatedAt": "2018-06-12T21:47:53Z",
  "links": [
    {
      "href": "https://billing.poynt.net/apps/urn:aid:24c6e3d4-19e4-45c8-8231-6af2089dc694/subscriptions/569b915f-2631-4cfb-ba36-fd23f9871e13",
      "rel": "resource",
      "method": "GET"
    },
    {
      "href": "https://billing.poynt.net/businesses/2bd73f40-60ff-4ced-aafd-66f270a2972c/invoices/9101b739-f9eb-4400-8aa3-f10aca1bc7bb",
      "rel": "resource",
      "method": "GET"
    }
  ],
  "id": "8b262b17-ba1f-4f6d-979a-52e75213a5cb",
  "hookId": "21f4a4da-6c10-43f0-bd23-3875067d2031",
  "applicationId": "urn:aid:24c6e3d4-19e4-45c8-8231-6af2089dc694",
  "resource": "/apps/subscriptions",
  "resourceId": "569b915f-2631-4cfb-ba36-fd23f9871e13",
  "eventType": "APPLICATION_SUBSCRIPTION_REFUND_SUCCESS",
  "merchantType": "TEST_MERCHANT",
  "businessId": "2bd73f40-60ff-4ced-aafd-66f270a2972c"
}

The subscription resource URL returned in href can be used to retrieve the complete Subscription Information as described in Step (3).

TIP

If you need to receive webhooks on multiple applications, you must register one webhook per application.

Last Updated: 9/4/2023, 1:28:22 PM