Create a billing statement
Creates a billing statement resource.
Endpoint
POST /billing_statements
Sample code
- curl
- Node
- PHP
- Python
- Ruby
curl --request POST --location 'https://api.payrexhq.com/billing_statements' \
-u replace_with_secret_api_key: \
--data-urlencode 'customer_id=<ID of a customer resource>' \
--data-urlencode 'payment_settings[payment_methods][]=gcash' \
--data-urlencode 'payment_settings[payment_methods][]=card'
const client = require('payrex-node')('insert your PayRex Secret API key.');
const billingStatement = await client.billingStatements.create({
customer_id: '<ID of a customer resource>',
payment_settings: {
payment_methods: ['gcash', 'card', 'maya']
}
});
$client = new \Payrex\PayrexClient('insert your PayRex Secret API key.');
$billingStatement = $client->billingStatements->create([
'customer_id' => '<ID of a customer resource>',
'payment_settings' => [
'payment_methods: ['gcash', 'card', 'maya']
]
]);
from payrex import Client as PayrexClient
client = PayrexClient('insert your PayRex Secret API key.')
billing_statement = client.billing_statements.create(
{
'customer_id': '<ID of a customer resource>',
'payment_settings': {
'payment_methods': ['gcash', 'card', 'maya']
}
}
)
client = Payrex::Client.new("insert your PayRex Secret API key.")
billing_statement = client.billing_statements.create(
customer_id: '<ID of a customer resource>',
payment_settings: {
payment_methods: ['gcash', 'card', 'maya']
}
)
Parameters
customer_id REQUIRED
The ID of a customer resource. To learn more about the customer resource, you can refer here.
description optional
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>"
payment_settings REQUIRED
Set of key-value pairs that can modify the behavior of the payment processing for the billing statement.
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
.
metadata optional
A set of key-value pairs you can attach to the resource. This can be useful for storing additional information about the billing statement in a hash format.
Once the billing statement is finalized, the latest value of its metadata will be copied to its payment intent.
Returns
Returns a Billing Statement resource.