Skip to main content

Billing Statements

Learn more about the Billing Statement resource

Billing statements are one-time payment links that contain customer information, the due date, and an itemized list of your business's products or services.

To learn more about billing statements, refer to this guide.

Endpoints

EndpointName
POST /billing_statementsCreate billing statement endpoint
GET /billing_statements/:idList billing statement endpoint
GET /billing_statementsRetrieve billing statement endpoint
UPDATE /billing_statements/:idUpdate billing statement endpoint
DELETE /billing_statements/:idDelete billing statement endpoint
POST /billing_statements/:id/finalizeFinalize billing statement endpoint
POST /billing_statements/:id/voidVoid billing statement endpoint
POST /billing_statements/:id/mark_uncollectibleMark uncollectible billing statement endpoint

The BillingStatement Resource

{
"id": "bstm_AbvnRnF9r577BBFFuNsLFvXvLes1CeeS",
"resource": "billing_statement",
"amount": 100000,
"currency": "PHP",
"customer_id": "cus_ZBBnR6Fsr5zvX7HFuFsLFZcvAes9JC22",
"description": null,
"status": "open",
"line_items": [
{
"id": "bstm_li_27xaTabzf7pBvpGjFAjHynVHVGbauwFz",
"resource": "billing_statement_line_item",
"description": "Product X",
"unit_price": 10000,
"quantity": 5
},
{
"id": "bstm_li_A7xBTa2zfvpavpGjFA1Hy4V7V3JaHwAZ",
"resource": "billing_statement_line_item",
"description": "Product X",
"unit_price": 10000,
"quantity": 5
}
],
"livemode": false,
"url": "https://checkout.payrexhq.com/c/cs_AbvnRnF9r577BBFFuNsLFvXvLes1CeeS_secret_tttefYgf9BgAnuiq9bN8EuwrpUShZU4E",
"customer": {
"id": "cus_ZBBnR6Fsr5zvX7HFuFsLFZcvAes9JC22",
"name": "Juan Dela Cruz",
"email": "juan@gmail.com"
},
"payment_intent": {
"id": "pi_UDQ5s2yLAeE4h1CJsP9Mm6RYYk7MMnsb",
"amount": 100000,
"capture_type": null,
"client_secret": "pi_UDQ5s2yLAeE4h1CJsP9Mm6RYYk7MMnsb_secret_azBhHvfc17JJUDs8yi94KpMbtv56eQ5D",
"currency": "PHP",
"description": "Payment for Billing Statement <billing statement number>",
"livemode": false,
"metadata": null,
"next_action": null,
"payment_method_id": null,
"payment_methods": [
"card",
"gcash"
],
"payment_method_options": {
"card": {
"capture_type": "automatic"
}
},
"status": "awaiting_payment_method",
"return_url": null,
"capture_before_at": null,
"created_at": 1721726975,
"updated_at": 1721726975
},
"metadata": null,
"url": "https://bill.payrexhq.com/b/test_bstm_AbvnRnF9r577BBFFuNsLFvXvLes1CeeS_secret_SKhaVPaqozBV97oeU4h1kw7MbqZKFKSL4ZTqZaYNMAHaqsvtcB",
"payment_settings": {
"payment_methods": [
"card",
"gcash"
]
}
"due_at": 1721813375,
"created_at": 1721726975,
"updated_at": 1721726975
}

Attributes


id string

Unique identifier for the resource. The prefix is bstm_.


resource string

Represents the resource's type. The value is billing_statement.


amount string

The final amount collected by the BillingStatement is a positive integer representing the amount your customer will pay in the smallest currency unit, cents. If the customer pays ₱ 120.50, the amount of the BillingStatement should be 12050.

The BillingStatement amount is derived from the sum of all line_items.quantity * line_items.unit_price.

The minimum amount is ₱ 20 (2000 in cents), and the maximum amount is ₱ 59,999,999.99 (5999999999 in cents).


currency string

A three-letter ISO currency code, in uppercase. As of the moment, we only support PHP.

This value is derived from the currency of the associated customer.


customer_id string

The ID of the customer associated with the billing statement.

To learn more about the customer resource, check this reference.


description string

An arbitrary string attached to the billing statement and copied over to its payment intent. This is a useful reference when viewing the payment resources associated with the billing statement from the PayRex Dashboard.

If the description is not modified, the default value is "Payment for Billing Statement <billing statement number>"


status string

The latest status of the BillingStatement. Possible values are open, draft, paid, void or uncollectible.


line_items Array of hash

This attribute holds the billing statement's list of line items.

Show child attributes

id string

Unique identifier for the resource. The prefix is bstm_li.


resource string

Represents the resource's type. The value is billing_statement_line_item.


description string

The description of the line item. It could be a product name or the service that you offer.


unit_price integer

The amount of the line item in a single unit.

This is a positive integer in the smallest currency unit, cents. If the line item should be ₱ 120.50, the amount should be 12050.


quantity integer

The quantity of the line item. The quantity will be multiplied by the line_item.amount to compute the final amount of the billing statement.


livemode boolean

The value is true if the resource's mode is live, and the value is false if the resource is in test mode.


url string

The URL that your customer will access to pay the billing statement.

This is only visible if the billing statement's status is open.


customer hash

The details of the Customer resource associated with the billing statement.


payment_intent PaymentIntent

The PaymentIntent resource created for the BillingStatement.


metadata hash

Set of key-value pairs attached to the billing statement. This is useful for storing additional information about the billing statement.

The latest value of the billing statement's metadata will be copied to its payment intent once the billing statement is finalized.


payment_settings array of hash

Show child attributes

payment_methods array

The list of payment methods allowed to be processed by the payment intent of the billing statement. Possible values are card and gcash.


due_at timestamp

The time when the billing statement is expected to be paid. If the due_at is already past, your customer can still pay the billing statement if the status is open.

Measured in seconds since the Unix epoch.


created_at timestamp

The time the resource was created and measured in seconds since the Unix epoch.


updated_at timestamp

The time the resource was updated and measured in seconds since the Unix epoch.