Webhooks

Receive notifications in other systems for different customer lifecycle events.

If you want to track the different events of your customer lifecycle, being able to make productive decisions for your business, we have great news for you: you don’t need to quit Rebill to set-up your own webhooks and receive notifications in other systems.

Events

You can configure webhooks based on the following events:

  • New payment. Every time a payment is made.

  • New subscription. Every time a new customer signs up to a subscription product.

  • 24 hours forewarning payment. 24 hours before an automatic debit is made (on subscriptions or cyclic payments).

  • Payment status change. When it goes, for example, from pending to approved / rejected.

  • Subscription status change. When it is canceled or a subscriber changes his plan.

Use case

Next question is: when do we use webhooks? Let’s see a real case…

Example:

Suppose your business sells fruit, so you want to offer your customers a subscription plan to receive a personalized fruit crate every month.

To send the orders the exact day the payment is made, you can configure the webhook "24 hours forewarning payment" to be notified when you should prepare the crates for your customers.

In this way, you can prepare your orders in advance, to send them at the right time and give your customers the best experience.

How to set-up your webhooks?

You can configure your webhooks in 2 simple steps, in a simple and intuitive way:

  1. Go to the “webhooks” section (left menu) and, to create a webhook, click on this option in the upper right corner.

  2. Choose the event you want to be notified about and, in the same pop-up, fill in the destination URL for that webhook.

Examples

Examples of the data structures that respond to each event detailed below.

New payment event / succeeded payment

{
   "payment":{
      "id":"e23d4a48-7aa6-45a0-94f4-cd254062f0dc",
      "amount":"1.23",
      "card":{
         "id":"b704b0d6-3714-46d0-8c5c-1a63ee5941c1"
      },
      "createdAt":"2022-10-27T22:09:48.845Z",
      "currency":"EUR",
      "customer":{
         "email":"[email protected]"
      },
      "gateway":{
         "country":"UK",
         "type":"stripe"
      },
      "organization":{
         "id":"41c4be3f-6366-4984-b9e1-21d5050131a8"
      },
      "status":"SUCCEEDED"
   }
}

New payment event / failed payment

{
   "payment":{
      "id":"f61def1c-d33b-4530-925a-89248529148a",
      "amount":"1.23",
      "card":{
         "id":"b1ccaac6-e216-4f26-acb4-41627037b167"
      },
      "createdAt":"2022-10-27T22:10:07.482Z",
      "currency":"EUR",
      "customer":{
         "email":"[email protected]"
      },
      "gateway":{
         "country":"UK",
         "type":"stripe"
      },
      "organization":{
         "id":"11f421ed-7421-4643-b769-fdb181c2d5c8"
      },
      "status":"FAILED"
   }
}

New subscription event

{
   "card":{
      "id":"768a36df-4d8f-45e4-a585-83e506c76da5",
      "last_four_digits":"4242"
   },
   "customer":{
      "email":"[email protected]"
   },
   "gateway":{
      "country":"UK",
      "type":"stripe"
   },
   "organization":{
      "id":"28fae0e5-4a5f-4086-bb47-7aa41ed18367"
   },
   "payment":{
      "id":"346f7281-de01-48ba-bd8c-4648e4139d7c",
      "gatewayPaymentId":"ch_5NqoGmLdmyGpZQ0W2OFgzWQz"
   },
   "subscription":{
      "id":"ec81b44f-d5bd-4368-b48c-eeeab106c454",
      "createdAt":"2022-10-27T22:09:48.884Z",
      "price":{
         "id":"2e05f975-2cc6-4e17-babb-c556ebd8e4b9",
         "currency":"EUR",
         "debitDay":null,
         "debitType":null,
         "decimalPlaces":2,
         "description":"this the price's description",
         "enabled":true,
         "frequency":{
            "quantity":1,
            "type":"months"
         },
         "item":{
            "id":"5fdb78c1-0b50-4e74-bf0b-00d0f746fabc",
            "createdAt":"2022-10-27T21:58:49.551Z",
            "description":"The product's name",
            "itemFamilyId":null,
            "metadata":[
               
            ],
            "name":"Example product"
         },
         "priceSetting":{
            "id":"57ccd341-0261-4599-9baf-072dfbe6c1e4",
            "billingAddressRequired":true,
            "documentRequired":true,
            "phoneRequired":true,
            "redirectUrl":"rebill.to",
            "showImage":true
         },
         "repetitions":null,
         "type":"fixed",
         "value":"123"
      },
      "quantity":1,
      "title":"Example product"
   }
}

Payment change status event

{
  "payment": {
   "id": "024160d0-7ba4-48c0-828e-b2c6fab86e53",
   "createdAt": "2022-09-06T14:38:00.082Z",
   "newStatus": "REFUNDED",
   "orderId": "637285ca-85f5-476e-bade-40b6ec61da2c",
   "previousStatus": "SUCCEEDED"
  }
 }

Subscription status change event

{
   "billingScheduleId":"ac0a2bcf-3240-446f-abcf-501ee3742b7e",
   "newStatus":"ACTIVE",
   "oldStatus":"PAUSED"
}

Subscription charge in 24 hours event

Valid until 2022-11-07 23:59

{
  "id": "e41862c6-636d-460e-9bd9-eb2682dada44",
  "buyer": {
   "card": {
    "id": "0bc0d935-920c-4de5-8a58-80aa31552ff0",
    "cardholder": "JOHN DOE",
    "cardNumber": "424242bx_0a30839da0c7451387d0793e9ed362c4_bx4242",
    "expirationMonth": "03",
    "expirationYear": "2039",
    "personalIdNumber": "11312412",
    "personalIdType": "DNI",
    "securityCode": null
   },
   "customer": {
    "profile": {
     "id": "d905b703-846c-480a-bc1d-ea3bfcd4ba17",
     "birthday": null,
     "cellPhone": null,
     "createdAt": "2022-09-19T18:40:41.644Z",
     "firstName": "John",
     "lastName": "Doe",
     "personalIdNumber": "11312412",
     "personalIdType": "DNI",
     "taxIdNumber": null,
     "taxIdType": null
    },
    "user": {
     "id": "6750e15d-4730-4467-85f1-dface272eff6",
     "cards": [
     ],
     "createdAt": "2022-09-19T18:40:41.632Z",
     "email": "[email protected]",
     "enabled": true,
     "password": "dummy.password",
     "profile": {
      "id": "fc8d778f-8c28-45cb-9756-654106d9030e",
      "birthday": null,
      "cellPhone": null,
      "createdAt": "2022-09-19T18:40:41.644Z",
      "firstName": "John",
      "lastName": "Doe",
      "personalIdNumber": "11312412",
      "personalIdType": "DNI",
      "taxIdNumber": null,
      "taxIdType": null
     },
     "roles": [
      {
       "id": "0588e5f5-0fa9-47d0-856e-17b6a029cc7c",
       "createdAt": "2022-05-05T13:23:12.904Z",
       "description": "Customer of organization",
       "organization": {
        "id": "a2b82057-f15d-4d4a-88ad-b66197207f9f",
        "alias": "example",
        "compliance": false,
        "customCheckoutUrl": null,
        "logoUrl": "https://dashboard.rebill.to/images/e00ac2e0c4b31eb638b9a7706dde.png",
        "name": "example SAS",
        "ownerId": "5eb51cb4-f1ab-4e65-a325-e60f99c61d66"
       },
       "permissions": [
       ],
       "_name": "customer"
      }
     ]
    }
   }
  },
  "createdAt": "2022-09-19T18:40:43.148Z",
  "currency": "ARS",
  "debitDay": null,
  "debitType": null,
  "decimalPlaces": 0,
  "description": null,
  "externalReference": "",
  "frequency": {
   "quantity": 1,
   "type": "months"
  },
  "item": {
   "id": "3f96299d-ad98-4a56-b26f-61871a348ffd",
   "createdAt": "2022-05-05T13:46:57.909Z",
   "description": "An item description",
   "itemFamilyId": "36d5f3a8-d0e6-489e-b4e0-d5fcd02ec8f7",
   "metadata": null,
   "name": "Item dummy"
  },
  "metadataObject": null,
  "paymentsIds": [
  ],
  "price": {
   "id": "0b6cdcb0-b5a4-4bce-bcab-380e4912f2af",
   "country": "AR",
   "description": "a gateway sandbox",
   "organization": {
    "id": "3179350a-811f-4221-994b-7a815952c5f9",
    "alias": "example",
    "customCheckoutUrl": null,
    "name": "example SAS",
    "ownerId": "e939411b-b193-423c-a72e-497346142a4f"
   },
   "type": "dlocal"
  },
  "quantity": 1,
  "repetitions": 2,
  "type": "fixed",
  "updateSubscribers": [
  ],
  "user": {
   "email": "[email protected]",
  },
  "value": "412",
  "_balance": {
   "decimalPlaces": 0,
   "value": 0
  },
  "_lastChargeDate": "2022-09-19T18:40:43.000Z",
  "_nextChargeDate": "2022-10-19T18:40:43.000Z",
  "_recoveryToken": null,
  "_remainingIterations": 1,
  "_status": {
   "id": "ACTIVE"
  }
 }

Valid since 2022-11-08 00:00

{
   "billingSchedule":{
      "billingScheduleId":"b8fdfacb-1098-4606-acec-b53dbef1c614",
         "metadataObject": {
            "color": "blue"
          },
      "externalReference":"My custom external reference",
      "lastChargeDate":"2022-11-05T13:00:02.000Z",
      "nextChargeDate":"2023-11-05T13:00:02.000Z",
      "quantity":1,
      "remainingIterations":null,
      "status":"ACTIVE",
      "createdAt":"2022-11-05T13:00:02.398Z",
      "cardId":"18af0c4b-c281-4287-9e67-2f1b3de0c1be",
      "balance":"5.43",
      "invoices":[
         "4d42f894-196d-4a44-873d-f7c7a7ffd67d", "d0ea93ec-569e-4169-93d4-a833053f4429"
      ],
      "price":{
         "priceId":"2cfa05e2-b5c0-454b-86f3-dd5d46ea9569",
         "priceDescription":"Valid until 2023",
         "value":"1.99",
         "currency":"EUR",
         "debitDay":null,
         "frequency":{
            "type":"years",
            "quantity":1
         },
         "repetitions":null,
         "type":"fixed"
      },
      "item":{
         "itemId":"3a05ae67-8aa0-461e-944c-3c6d61099e05",
         "itemName":"un producto TECH-2024 !",
         "itemDescription":"My premium plan",
         "itemMetadata":[]
      },
      "user":{
         "userId":"ec772e13-03da-470f-a8e8-b07fae2efdc6",
         "email":"[email protected]"
      },
      "gateway":{
         "gatewayId":"b4dea99d-127c-45c5-b4fe-3ae547817228",
         "gatewayDescription":"My Stripe gateway",
         "gatewayType":"stripe",
         "country":"UK",
         "status":"ACCEPTED"
      }
   },
   "webhook":{
      "event":"subscription-charge-in-24-hours"
   },
   "organization":"ce11c748-3d33-4726-b919-0aa494d89228"
}