...
Once the Payment Service Agreement is signed, you will receive the production environment's URL when you request your account to go live.
Request parameters:
Field | Description | Required | Length |
secret | Secret phrase as defined in the PagBrasil Dashboard | Yes | 128 |
pbtoken | Token assigned to your merchant account. Your token is displayed at the PagBrasil Dashboard, menu Account > Settings. | Yes | 32 |
subscription | Subscription identification | Yes | 9 |
page | Selected page. When page is not provided, the page with the last 50 results is returned. | No | Unlimited |
response_type | XML (default) or JSON. | No | 4 |
5.2. Reading the response
PagBrasil's response will be an XML or JSON with information about the subscription and the recurrences, with the following structure:
Field | Description | Length |
---|---|---|
subscription | Subscription identification | 9 |
status | 0 = Waiting for first payment | 1 |
frequency | Interval between the subscription renewals. | 1 |
amount_brl | Amount in Brazilian Real of the recurring charge | 5.2 |
number_recurrences | Number of recurrences existing in the subscription. | Unlimited |
limit | Maximum subscription renewals (0 is unlimited). | 3 |
view_future_charges | Number of the visible future charges | 4 |
next_billing_date | Next billing date. Format: YYYY-MM-DD | 10 |
cancellation_date | Date the subscription will be cancelled if not paid. | 10 |
order_token | Tokenized order number | 80 |
customer_email | Customer's e-mail address | Unlimited |
Recurrences are included in multiple item notes with the following structure:
Field | Description | Length |
---|---|---|
order | Order number | 64 |
payment_method | C = Credit card | 1 |
order_status | WP = Payment requested but not processed yet | 2 |
product_name | Product name | 254 |
amount_brl | Amount in Brazillian Real | 5.2 |
amount_original | Original amount in Brazilian Real before any discount. | 5.2 |
payment_date | Date the payment was completed. | 10 |
customer_email | Customer's e-mail address | 128 |
products | JSON (When subscription contains products with SKU registered on product catalog) | Unlimited |
Sample:
Code Block | ||
---|---|---|
| ||
<?xml version="1.0" encoding="UTF-8"?> <pagstream> <subscription>32736721764588</subscription> <status>1</status> <frequency>M</frequency> <amount_brl>52.65</amount_brl> <number_recurrences>2</number_recurrences> <limit>0</limit> <next_billing_date>2022-04-10</next_billing_date> <cancellation_date>2022-04-15</cancellation_date> <order_token>REC_9324_2</order_token> <customer_email>josedasilva@myemail.com.br</customer_email> <recurrences> <item id="0"> <order>REC_9324_2</order> <payment_method>C</payment_method> <order_status>PC</order_status> <product_name>Product Test (1 license)</product_name> <amount_brl>52.65</amount_brl> <amount_original></amount_original> <payment_date>2022-02-19 15:58:58</payment_date> <customer_email>josedasilva@myemail.com.br</customer_email> </item> <item id="1"> <order>REC_9324_1</order> <payment_method>B</payment_method> <order_status>PC</order_status> <product_name>Product Test (1 license)</product_name> <amount_brl>52.65</amount_brl> <amount_original></amount_original> <payment_date>2022-01-19 08:30:10</payment_date> <customer_email>josedasilva@myemail.com.br</customer_email> </item> </recurrences> </pagstream> |
When subscrition is created by Rule by SKU, Products field is included in multiple item notes with the following structure:
Field | Description | Length |
---|---|---|
sku | Product’s SKU | 245 |
unit_price | Product’s unit price | 1 |
quantity | Product’s quantity | Unlimited |
discount | Product’s percentage discount | 10 |
amount_total | Product’s Total amount with quantity and unit discounts. | 128 |
Sample:
Code Block | ||
---|---|---|
| ||
<?xml version="1.0" encoding="UTF-8"?> <pagstream> <subscription>32736721764588</subscription> <product_name>Product Test (1 license)</product_name <status>1</status> <frequency>M</frequency> <amount_brl>52.65</amount_brl> <number_recurrences>3</number_recurrences> <limit>0</limit> <next_billing_date>2022-05-19</next_billing_date> <cancellation_date>2022-05-24</cancellation_date> <effective_cancellation_date></effective_cancellation_date> <order_token>REC_9324_2</order_token> <customer_email>samuel.cruz@pagbrasil.com</customer_email> <recurrences></recurrences> <products> <item id="0"> <sku>testproduct</sku> <unit_price>52.65</unit_price> <quantity>1</quantity> <discount>0.00</discount> <amount_total>52.65</amount_total> <category>Geral</category> </item> </products> </pagstream> |
...