The Payment Voucher resource represents a voucher that has been created for a customer to initiate voucher-based payment. This resource contains relevant details such as the voucher URL, the amount of the voucher, the status of the voucher, and more. Currently, the only supported voucher-based payment source is Boleto. Boleto is a payment method in Brazil that is regulated by the Central Bank of Brazil and is considered an official form of payment. This is also a popular voucher-based payment method in Brazil.
Note: This resource can be extended in the future to support other types of payment sources for vouchers.
Sample payment voucher [ JSON ]
{
"id": "pv_1mG11S1TcNM88A9Zm",
"id_at_gateway": "pi_3N0VBuK7ilSfRo7v0D66epcC",
"payment_voucher_type": "boleto",
"expires_at": 1682365190,
"status": "active",
"amount": 17800,
"gateway_account_id": "gw_161my9TXG5oNYwgv",
"payment_source_id": "pm_1mG11S1TcNM3LP9ZX",
"gateway": "stripe",
"payload": "{\"url\":\"https://payments.stripe.com/boleto/voucher/test_YWNjdF8xTHZnMFRLN2lsU2ZSbzd2LF9ObTNJN2NoejBsYldJeDI0VTVxemkwbnJaZUVTN0FH0100PvfYwtjd\",\"voucher_number\":\"01010101010101010101010101010101010101010101010\",\"expiry\":\"1682365190\"}",
"url": "http://john.chargebee.com/pages/v3/__dev__w5aPBsoEK5z6kIEt2mrEIH9GWLliHXrN/view_voucher",
"date": 1682365010,
"updated_at": 1682365010,
"resource_version": 1682365010580,
"object": "payment_voucher",
"currency_code": "BRL",
"customer_id": "test_d23ed22ew",
"linked_invoices": [
{
"invoice_id": "61",
"date": 1682364955,
"total": 17800,
"status": "payment_due"
}
]
}
API Index URL GET
https://{site}.chargebee.com/api/v2/payment_vouchers
string, max chars=40 Uniquely identifies the payment voucher.
optional, string, max chars=100 The id with which this voucher is referred in gateway.
enumerated string Type of the payment source.
optional, timestamp(UTC) in seconds Timestamp indicating when the Voucher will expire if left unconsumed.
optional, enumerated string Current status of the payment voucher. Possible values are
activeActive and ready to be consumedconsumedConsumed for a transaction and cannot be used againexpiredExpired before consumed and cannot be used againfailureFailed to create the voucher due to gateway rejection
Show all values[+]
optional, string, max chars=50 Identifier of the subscription for which this payment voucher is made.
string, max chars=3 The currency code (ISO 4217 format) for the voucher.
optional, in cents, min=1 Amount for this payment voucher.
optional, string, max chars=50 The gateway account used for this voucher
optional, string, max chars=40 Identifier of the payment source for which this payment voucher is created
enumerated string The gateway through which this payment voucher was created.
Note: Note: Currently, stripe
is the only supported gateway through which you can create the payment voucher. Possible values are
chargebeeChargebee test gateway.chargebee_paymentsChargebee Payments gatewayadyenAdyen is a payment gateway.stripeStripe is a payment gateway.
Show all values[+]
optional, string, max chars=65k Payload from the gateway response with voucher details
optional, string, max chars=100 Error code received from the payment gateway on failure.
optional, string, max chars=65k Error message received from the payment gateway on failure.
optional, string, max chars=65k Chargebee Hosted Page url for payment voucher
optional, timestamp(UTC) in seconds Indicates when this payment voucher occurred date.
optional, long Version number of this resource. The resource_version
is updated with a new timestamp in milliseconds for every change made to the resource. This attribute will be present only if the resource has been updated after 2016-09-28.
optional, timestamp(UTC) in seconds Timestamp indicating when this voucher was last updated.
string, max chars=50 The unique identifier of the customer. optional, list of invoice_payment_voucher
Invoices related to the generated voucher
Linked invoice attributes
string, max chars=50 Identifier for the invoice.
string, max chars=40 Uniquely identifies the payment voucher.
timestamp(UTC) in seconds Timestamp at which the transaction is applied.
string, max chars=40 Uniquely identifies the payment voucher.
optional, string, max chars=100 The id with which this voucher is referred in gateway.
enumerated string Type of the payment source.
optional, timestamp(UTC) in seconds Timestamp indicating when the Voucher will expire if left unconsumed.
optional, enumerated string Current status of the payment voucher. Possible values are
activeActive and ready to be consumedconsumedConsumed for a transaction and cannot be used againexpiredExpired before consumed and cannot be used againfailureFailed to create the voucher due to gateway rejection
Show all values[+]
optional, string, max chars=50 Identifier of the subscription for which this payment voucher is made.
string, max chars=3 The currency code (ISO 4217 format) for the voucher.
optional, in cents, min=1 Amount for this payment voucher.
optional, string, max chars=50 The gateway account used for this voucher
optional, string, max chars=40 Identifier of the payment source for which this payment voucher is created
enumerated string The gateway through which this payment voucher was created.
Note: Note: Currently, stripe
is the only supported gateway through which you can create the payment voucher. Possible values are
chargebeeChargebee test gateway.chargebee_paymentsChargebee Payments gatewayadyenAdyen is a payment gateway.stripeStripe is a payment gateway.
Show all values[+]
optional, string, max chars=65k Payload from the gateway response with voucher details
optional, string, max chars=100 Error code received from the payment gateway on failure.
optional, string, max chars=65k Error message received from the payment gateway on failure.
optional, string, max chars=65k Chargebee Hosted Page url for payment voucher
optional, timestamp(UTC) in seconds Indicates when this payment voucher occurred date.
optional, long Version number of this resource. The resource_version
is updated with a new timestamp in milliseconds for every change made to the resource. This attribute will be present only if the resource has been updated after 2016-09-28.
optional, timestamp(UTC) in seconds Timestamp indicating when this voucher was last updated.
string, max chars=50 The unique identifier of the customer.
optional, list of invoice_payment_voucher Invoices related to the generated voucher Creates a voucher type payment source. If you create this voucher type payment source using customer details, like tax ID, you can then generate a voucher with that payment source.
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Creates a voucher for unpaid invoice
Creates a voucher for unpaid invoice
Sample Response [ JSON ]
Show more...
{
"payment_voucher": {
"id": "pv_1mG11S1TcNM88A9Zm",
"id_at_gateway": "pi_3N0VBuK7ilSfRo7v0D66epcC",
"payment_voucher_type": "boleto",
"expires_at": 1682365190,
"status": "active",
"amount": 17800,
"gateway_account_id": "gw_161my9TXG5oNYwgv",
"payment_source_id": "pm_1mG11S1TcNM3LP9ZX",
"gateway": "stripe",
"payload": "{\"url\":\"https://payments.stripe.com/boleto/voucher/test_YWNjdF8xTHZnMFRLN2lsU2ZSbzd2LF9ObTNJN2NoejBsYldJeDI0VTVxemkwbnJaZUVTN0FH0100PvfYwtjd\",\"voucher_number\":\"01010101010101010101010101010101010101010101010\",\"expiry\":\"1682365190\"}",
"url": "http://john.chargebee.com/pages/v3/__dev__w5aPBsoEK5z6kIEt2mrEIH9GWLliHXrN/view_voucher",
"date": 1682365010,
"updated_at": 1682365010,
"resource_version": 1682365010580,
"object": "payment_voucher",
"currency_code": "BRL",
"customer_id": "test_d23ed22ew",
"linked_invoices": [
{
"invoice_id": "61",
"date": 1682364955,
"total": 17800,
"status": "payment_due"
},
{..}
]
}
}
URL Format
POST
https://{site}.chargebee.com/api/v2/payment_vouchers
required, string, max chars=50 The unique identifier of the customer for whom you want to create the voucher.
optional, string, max chars=40 The identifier of the payment source used for generating the voucher. voucher_payment_source[[0..n]][0..n]
optional, enumerated string Parameters for voucher_payment_source invoice_allocations[[0..n]][0..n]
optional, array Parameters for invoice_allocations. Multiple invoice_allocations can be passed by specifying unique indices.
Parameters for voucher_payment_source
pass parameters as voucher_payment_source[<param name>]
voucher_payment_source[voucher_type] required, enumerated string
Parameters for invoice_allocations. Multiple invoice_allocations can be passed by specifying unique indices.
pass parameters as invoice_allocations[<param name>][<idx:0..n>]
invoice_allocations[invoice_id][0..n] required, string, max chars=50
always returned required
Resource object representing payment_voucher
Sample admin console URL
https://{site}.chargebee.com/admin-console/payment_vouchers/123x
Retrieves a voucher using the unique payment_voucher_id
.
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Response [ JSON ]
Show more...
{
"payment_voucher": {
"id": "pv_1mG11S1TcNL0SP9Vd",
"id_at_gateway": "pi_3N0V7aK7ilSfRo7v1pfbc2NI",
"payment_voucher_type": "boleto",
"expires_at": 1682364922,
"status": "active",
"amount": 18900,
"gateway_account_id": "gw_161my9TXG5oNYwgv",
"payment_source_id": "pm_1mG11S1TcNKrvR9Up",
"gateway": "stripe",
"payload": "{\"url\":\"https://payments.stripe.com/boleto/voucher/test_YWNjdF8xTHZnMFRLN2lsU2ZSbzd2LF9ObTNFc3MzMDlsbU1qamg1Q2ROdDNzOWNYUk81bkhp0100p0cMVCz3\",\"voucher_number\":\"01010101010101010101010101010101010101010101010\",\"expiry\":\"1682364922\"}",
"url": "http://john.chargebee.com/pages/v3/__dev__w5aPBsoEK5z6kIEt2mrEIH9GWLliHXrN/view_voucher",
"date": 1682364742,
"updated_at": 1682364742,
"resource_version": 1682364742832,
"object": "payment_voucher",
"currency_code": "BRL",
"customer_id": "test_d23ed22ew",
"linked_invoices": [
{
"invoice_id": "60",
"date": 1682364741,
"total": 18900,
"status": "payment_due"
},
{..}
]
}
}
URL Format
GET
https://{site}.chargebee.com/api/v2/payment_vouchers/{payment-voucher-id}
always returned required
Resource object representing payment_voucher
Sample admin console URL
https://{site}.chargebee.com/admin-console/payment_vouchers/123x
Retrieves vouchers for an invoice in reverse chronological order.
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Response [ JSON ]
Show more...
{
"list": [
{
"payment_voucher": {
"id": "pv_1mG11S1TcNL0SP9Vd",
"id_at_gateway": "pi_3N0V7aK7ilSfRo7v1pfbc2NI",
"payment_voucher_type": "boleto",
"expires_at": 1682364922,
"status": "active",
"amount": 18900,
"gateway_account_id": "gw_161my9TXG5oNYwgv",
"payment_source_id": "pm_1mG11S1TcNKrvR9Up",
"gateway": "stripe",
"payload": "{\"url\":\"https://payments.stripe.com/boleto/voucher/test_YWNjdF8xTHZnMFRLN2lsU2ZSbzd2LF9ObTNFc3MzMDlsbU1qamg1Q2ROdDNzOWNYUk81bkhp0100p0cMVCz3\",\"voucher_number\":\"01010101010101010101010101010101010101010101010\",\"expiry\":\"1682364922\"}",
"url": "http://john.chargebee.com/pages/v3/__dev__w5aPBsoEK5z6kIEt2mrEIH9GWLliHXrN/view_voucher",
"date": 1682364742,
"updated_at": 1682364742,
"resource_version": 1682364742832,
"object": "payment_voucher",
"linked_invoices": [
{
"invoice_id": "60",
"date": 1682364741,
"total": 18900,
"status": "payment_due"
},
{..}
],
"currency_code": "BRL",
"customer_id": "test_d23ed22ew"
}
},
{..}
]
}
URL Format
GET
https://{site}.chargebee.com/api/v2/invoices/{invoice-id}/payment_vouchers
optional, integer, default=10, min=1, max=100 The number of resources to be returned.
optional, string, max chars=1000 Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set offset
to the value of next_offset
obtained in the previous iteration of the API call.
optional, string filter
Sorts based on the specified attribute.
Supported attributes : date, updated_at
Supported sort-orders : asc, desc
Example → sort_by[asc] = "date"
This will sort the result based on the 'date'
attribute in ascending(earliest first) order.
optional, enumerated string filter
Current status of Payment Voucher. Possible values are : active, consumed, expired, failure
Supported operators : is, is_not, in, not_in
Example → status[is] = "active, consumed, expired"
Current status of Payment Voucher.
pass parameters as status[<param name>][<operator>]
optional, enumerated string filter
Possible values are : active, consumed, expired, failure
Supported operators :
Example →
optional, enumerated string filter
Possible values are : active, consumed, expired, failure
Supported operators :
Example →
optional, string filter
Possible values are :
Supported operators :
Example →
optional, string filter
Possible values are :
Supported operators :
Example →
always returned required
Resource object representing payment_voucher
always returned optional, string, max chars=1000
This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`.
Sample admin console URL
https://{site}.chargebee.com/admin-console/payment_vouchers/123x
Retrieves vouchers for a customer in reverse chronological order.
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Response [ JSON ]
Show more...
{
"list": [
{
"payment_voucher": {
"id": "pv_1mG11S1TcNL0SP9Vd",
"id_at_gateway": "pi_3N0V7aK7ilSfRo7v1pfbc2NI",
"payment_voucher_type": "boleto",
"expires_at": 1682364922,
"status": "active",
"amount": 18900,
"gateway_account_id": "gw_161my9TXG5oNYwgv",
"payment_source_id": "pm_1mG11S1TcNKrvR9Up",
"gateway": "stripe",
"payload": "{\"url\":\"https://payments.stripe.com/boleto/voucher/test_YWNjdF8xTHZnMFRLN2lsU2ZSbzd2LF9ObTNFc3MzMDlsbU1qamg1Q2ROdDNzOWNYUk81bkhp0100p0cMVCz3\",\"voucher_number\":\"01010101010101010101010101010101010101010101010\",\"expiry\":\"1682364922\"}",
"url": "http://john.chargebee.com/pages/v3/__dev__w5aPBsoEK5z6kIEt2mrEIH9GWLliHXrN/view_voucher",
"date": 1682364742,
"updated_at": 1682364742,
"resource_version": 1682364742832,
"object": "payment_voucher",
"linked_invoices": [
{
"invoice_id": "60",
"date": 1682364741,
"total": 18900,
"status": "payment_due"
},
{..}
],
"currency_code": "BRL",
"customer_id": "test_d23ed22ew"
}
},
{..}
]
}
URL Format
GET
https://{site}.chargebee.com/api/v2/customers/{customer-id}/payment_vouchers
optional, integer, default=10, min=1, max=100 The number of resources to be returned.
optional, string, max chars=1000 Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set offset
to the value of next_offset
obtained in the previous iteration of the API call.
optional, string filter
Sorts based on the specified attribute.
Supported attributes : date, updated_at
Supported sort-orders : asc, desc
Example → sort_by[asc] = "date"
This will sort the result based on the 'date'
attribute in ascending(earliest first) order.
optional, enumerated string filter
Current status of Payment Voucher. Possible values are : active, consumed, expired, failure
Supported operators : is, is_not, in, not_in
Example → status[is] = "active, consumed, expired"
Current status of Payment Voucher.
pass parameters as status[<param name>][<operator>]
optional, enumerated string filter
Possible values are : active, consumed, expired, failure
Supported operators :
Example →
optional, enumerated string filter
Possible values are : active, consumed, expired, failure
Supported operators :
Example →
optional, string filter
Possible values are :
Supported operators :
Example →
optional, string filter
Possible values are :
Supported operators :
Example →
always returned required
Resource object representing payment_voucher
always returned optional, string, max chars=1000
This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`.
Sample admin console URL
https://{site}.chargebee.com/admin-console/payment_vouchers/123x