Billing Statement Issued
Webhook
Type: billing_statement.created.v1
Occurs when a billing statement is issued.
Payload
The data object in the payload contains details of all invoices and credit notes related to the statement.
These credit notes and invoices will all have the same billing_period_id in the credit note issued and invoice
issued webhooks, respectively.
Example
{
"specversion": "1.0",
"id": "01FBJ0PYJ7931K0CJ6GMP8N3WG",
"type": "billing_statement.created.v1",
"time": "2023-06-21T12:34:56.123456Z",
"source": "https://api.two.inc",
"subject": "billing_account/c8b27c7c-3362-4c10-b4e5-7d68c8b554be",
"twomerchantid":"b6b9d5d1-f6b7-4e15-9703-9c32c6e5c1c2",
"data": {
"invoices": [
{
"root_order_id": "a9f5d2d3-5d6d-4e2a-a4b4-6c7f8a9d0f1e",
"order_id": "a9f5d2d3-5d6d-4e2a-a4b4-6c7f8a9d0f1e",
"invoice_id": "7a5a7b9b-7d9e-4e9e-b9b1-2d7c658e1a4d",
"amount": "190.65",
},
]
"credit_notes": [
{
"refund_id": "433401fe-76ae-4e10-b091-59788c90a5df",
"credited_amount": "-40.00"
},
]
"merchant_id": "b6b9d5d1-f6b7-4e15-9703-9c32c6e5c1c2",
"billing_period_id": "175bda61-c6f2-4b9d-a429-5f31c83ecc10",
"statement_number": "1004",
"payment_reference": "234234234",
"gross_amount": "150.65",
"outstanding_amount": "120.65",
"currency": "GBP"
"due_date": "2023-06-21T12:34:56.123456Z",
"issue_date": "2023-06-05T12:34:56.123456Z",
"billing_account_id": "c8b27c7c-3362-4c10-b4e5-7d68c8b554be",
}
}
Triggering in sandbox
- Create a billing account using the billing account API. This is also available in the Two webhooks Postman collection. Note the ID of the billing account returned in the response to use in the next step.
- Create an order and use the billing account ID returned in the response from step 1 in the
"billing_account_id": "<id>"field in the body of the request. - Fulfil the order (see the
order.reconciliation.invoiced.v1for details). - (Optional) If you want to include multiple orders in the statement, repeat steps 2 and 3 to create multiple fulfilled orders for the same billing account.
- Create a statement by using the "Simulate close billing statement" endpoint from the Two webhooks Postman collection.
- One the billing statement has been issued, the
billing_statement.created.v1webhook will be sent to any endpoints subscribed to this event.
Request
Responses
- 200
- 422
Successful Response
Validation Error