6. Searching subscriptions by status

6.1. Sending the request

Your POST must be sent to https://sandbox.pagbrasil.com/api/pagstream/subscription/get setting the content-type of the request header and body as "x-www-form-urlencoded".

Please note that this URL shall only be used for integration and testing procedures. 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

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

 

status

0 = Waiting for first payment
1 = Active
2 = Pending payment
3 = Inactive/Cancelled
4 = Expired
5 = Paused

 

No

 

1

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

6.2. Reading the response

PagBrasil's response will be an XML or JSON with multiple item nodes having the following structure:

Field

Description

Length

Field

Description

Length

subscription

Subscription identification

9

 

status

0 = Waiting for first payment
1 = Active
2 = Pending payment
3 = Inactive/Cancelled
4 = Expired
5 = Paused

 

1

amount_brl

Amount in Brazilian Real of the recurring charge.

7.2

next_billing_date

Next billing date.
Format: YYYY-MM-DD

10

Sample:

<?xml version="1.0" encoding="UTF-8"?> <pagstream> <subscriptions> <item id="0"> <subscription>32736721764588</subscription> <status>1</status> <amount_brl>52.65</amount_brl> <next_billing_date>2022-04-23</next_billing_date> </item> <item id="1"> <subscription>32736678576364</subscription> <status>1</status> <amount_brl>145.00</amount_brl> <next_billing_date>2022-04-22</next_billing_date> </item> <item id="2"> <subscription>32736613171436</subscription> <status>1</status> <amount_brl>145.00</amount_brl> <next_billing_date>2022-04-22</next_billing_date> </item> <item id="3"> <subscription>32736590889196</subscription> <status>1</status> <amount_brl>145.00</amount_brl> <next_billing_date>2022-04-22</next_billing_date> </item> <item id="4"> <subscription>32736572866796</subscription> <status>1</status> <amount_brl>145.00</amount_brl> <next_billing_date>2022-05-20</next_billing_date> </item> </subscriptions> </pagstream>

 

CONFIDENTIAL