Responding to Billing Request events

Responding to Billing Request events

This doc shows the events that are produced as part of a Billing Request’s lifecycle, and how you can use them to understand how your customers are behaving across your requests.

Events and webhooks

When things happen in GoCardless's system, we create an event to record that it happened. You can browse your events in the dashboard or via the API.

Integrators who want to respond to events as they happen can follow the Staying up-to-date with webhooks guide, where you configure a webhook endpoint to receive events as they happen.

Billing Request events

Now you know about events and how to use them, we can explain what events are available for Billing Requests.

Billing Requests are the touchpoint between a merchant and their customer, and everyone can benefit from a high level of visibility into the process. For this reason, we aim to provide events for:

  • Whenever any state in the Billing Request changes

  • Payer interactions, such as opening a Billing Request Flow link

  • Any situations that might require contacting the payer, such as bank authorisation failure

Each event aims to reference every resource that might be relevant. Across the events, we have the following link fields:

billing_request

The billing request ID

billing_request_flow

The flow that triggered the event, if from a flow

customer

Associated customer ID

customer_bank_account

Whatever bank account is associated with the event

bank_authorisation

whatever bank authorisation is associated with the event

institution_id

whatever institution associated with the event

payment_request_payment

payment ID that was created as part of the request

mandate_request_mandate

mandate ID that was created as part of the request

We’ll split this section into a header per event, with a small explanation of what the event does. We’ll include an example event in the same format you’d see from the List Events endpoint, or what you’d receive in a webhook.

More detail on events

Triggered whenever a Billing Request is created. Use this event to register a Billing Request, so that any listening system can respond to subsequent events that follow.

The origin can be api if created through an integration, or payer if created as part of a payer’s action, like following a paylink or a Billing Request Template URL.

1{ 2 "id": "EV0039FK74X5Y4", 3 "created_at": "2021-05-03T18:23:08.141Z", 4 "resource_type": "billing_requests", 5 "action": "created", 6 "links": { 7 "customer": "CU00016Y7P8FPA", 8 "customer_bank_account": "BA0000QF3HBM4V", 9 "payment_request_payment": "PM000SY3392D1T", 10 "billing_request": "BRQ000012HQV2J4" 11 }, 12 "details": { 13 "origin": "payer", 14 "cause": "billing_request_created", 15 "description": "This billing request has been created." 16 }, 17 "metadata": {} 18}

Triggered when a new flow has been created against a Billing Request. This does not mean anyone has visited the flow, just that a flow has been created.

1{ 2 "id": "EV0039FK756APS", 3 "created_at": "2021-05-03T18:23:08.181Z", 4 "resource_type": "billing_requests", 5 "action": "flow_created", 6 "links": { 7 "customer": "CU00016Y7P8FPA", 8 "customer_bank_account": "BA0000QF3HBM4V", 9 "payment_request_payment": "PM000SY3392D1T", 10 "billing_request_flow": "BRF000011RGT7FDRW90FTGJ1BZ6944DP", 11 "billing_request": "BRQ000012HQV2J4" 12 }, 13 "details": { 14 "origin": "payer", 15 "cause": "billing_request_flow_created", 16 "description": "A billing request flow has been created against this billing request." 17 }, 18 "metadata": {} 19}

When the Billing Request Flow link is visited, the frontend app will initialise a new session in exchange for the Billing Request Flow ID.

This is the first thing that happens upon visiting the flow and will trigger the creation of this event. You can use this event to infer that a payer has visited the flow.

1{ 2 "id": "EV0039FK76YFFR", 3 "created_at": "2021-05-03T18:23:09.435Z", 4 "resource_type": "billing_requests", 5 "action": "flow_visited", 6 "links": { 7 "customer": "CU00016Y7P8FPA", 8 "customer_bank_account": "BA0000QF3HBM4V", 9 "payment_request_payment": "PM000SY3392D1T", 10 "billing_request_flow": "BRF000011RGT7FDRW90FTGJ1BZ6944DP", 11 "billing_request": "BRQ000012HQV2J4" 12 }, 13 "details": { 14 "origin": "payer", 15 "cause": "billing_request_flow_visited", 16 "description": "The billing request flow has been visited." 17 }, 18 "metadata": {} 19}

Triggered whenever a payer successfully completes the collect_customer_details action. Can be used to build funnels to measure how payers progress through the flow.

1{ 2 "id": "EV0039FK77ARRT", 3 "created_at": "2021-05-03T18:23:20.386Z", 4 "resource_type": "billing_requests", 5 "action": "collect_customer_details", 6 "links": { 7 "customer": "CU00016Y7P8FPA", 8 "customer_bank_account": "BA0000QF3HBM4V", 9 "payment_request_payment": "PM000SY3392D1T", 10 "billing_request_flow": "BRF000011RGT7FDRW90FTGJ1BZ6944DP", 11 "billing_request": "BRQ000012HQV2J4" 12 }, 13 "details": { 14 "origin": "api", 15 "cause": "billing_request_collect_customer_details", 16 "description": "Customer details have been collected for this billing request." 17 }, 18 "metadata": {} 19}

Triggered whenever a payer successfully completes the collect_bank_account action. Can be used to build funnels to measure how payers progress through the flow.

The customer_bank_account ID is the bank account that was created as a result of completing this action.

1{ 2 "id": "EV0039FK7845W0", 3 "created_at": "2021-05-03T18:23:32.065Z", 4 "resource_type": "billing_requests", 5 "action": "collect_bank_account", 6 "links": { 7 "customer": "CU00016Y7P8FPA", 8 "customer_bank_account": "BA0000QF3HBM4V", 9 "payment_request_payment": "PM000SY3392D1T", 10 "billing_request_flow": "BRF000011RGT7FDRW90FTGJ1BZ6944DP", 11 "billing_request": "BRQ000012HQV2J4" 12 }, 13 "details": { 14 "origin": "api", 15 "cause": "billing_request_collect_bank_account", 16 "description": "Bank account details have been collected for this billing request." 17 }, 18 "metadata": {} 19}

Triggered if a payer was redirected to their bank and rejected the authorisation. Payers can always return to the flow and create a new bank authorisation, but the linked authorisation is now permanently denied.

1{ 2 "id": "EV0039FK79TA5M", 3 "created_at": "2021-05-03T18:24:00.063Z", 4 "resource_type": "billing_requests", 5 "action": "bank_authorisation_denied", 6 "links": { 7 "customer": "CU00016Y7P8FPA", 8 "customer_bank_account": "BA0000QF3HBM4V", 9 "bank_authorisation": "BAU000012N3A4GG", 10 "institution_id": "monzo", 11 "payment_request_payment": "PM000SY3392D1T", 12 "billing_request": "BRQ000012HQV2J4" 13 }, 14 "details": { 15 "origin": "payer", 16 "cause": "billing_request_bank_authorisation_denied", 17 "bank_account_id": "BA0000QF3HBM4V", 18 "description": "A bank authorisation for this billing request has been denied by the payer." 19 }, 20 "metadata": {} 21}

Triggered if a payer was redirected to their bank and authorised the request. Authorisation of payments can trigger Billing Request fulfilment, depending on the scheme.

1{ 2 "id": "EV0039FK7ATXFE", 3 "created_at": "2021-05-03T18:24:26.509Z", 4 "resource_type": "billing_requests", 5 "action": "bank_authorisation_authorised", 6 "links": { 7 "customer": "CU00016Y7P8FPA", 8 "customer_bank_account": "BA0000QF3HBM4V", 9 "bank_authorisation": "BAU000012N4B63N", 10 "institution_id": "monzo", 11 "payment_request_payment": "PM000SY3392D1T", 12 "billing_request": "BRQ000012HQV2J4" 13 }, 14 "details": { 15 "origin": "payer", 16 "cause": "billing_request_bank_authorisation_authorised", 17 "bank_account_id": "BA0000QF3HBM4V", 18 "description": "A bank authorisation for this billing request has been authorised by the payer." 19 }, 20 "metadata": {} 21}

Triggered when the Billing Request has been fulfilled, and the sub-resources have been created. This means any Instant Bank Payments have been created, along with any DD mandates from the Billing Request.

1{ 2 "id": "EV0039FK7F2AAD", 3 "created_at": "2021-05-03T18:24:26.988Z", 4 "resource_type": "billing_requests", 5 "action": "fulfilled", 6 "links": { 7 "customer": "CU00016Y7P8FPA", 8 "customer_bank_account": "BA0000QF3HBM4V", 9 "payment_request_payment": "PM000SY3392D1T", 10 "billing_request": "BRQ000012HQV2J4" 11 }, 12 "details": { 13 "origin": "gocardless", 14 "cause": "billing_request_fulfilled", 15 "description": "This billing request has been fulfilled, and the resources have been created." 16 }, 17 "metadata": {} 18}

What’s next?

Reconciling payouts

Get started

Billing Request overview

First instant payment with mandate Direct Debit set up

Collect Verified Mandates

Collect Direct Debit Mandates

For partners

Go to Partner PortalTo learn more about technical and UX requirements

Need help?