Skip to main content

Strict H2H flow

With PagaSul, you can accept payments by redirecting customers to your own checkout page or redirect customer to given URL.

How to integrate

1. Create a pay-in

Send a POST request to /v2/pay-in. Include a signature in the header.

curl -X POST https://api.pagasul.com/v2/pay-in \
-H "Content-Type: application/json" \
-H "signature: <calculated>" \
-d '{
"client_id": 123,
"client_payment_id": "order_42",
"amount": 150.00,
"currency": "BRL",
"payer": {
"id": "user_1234"
},
"payment_options": {
"callback_url": "https://your-site.com/webhook",
"return_url": "https://your-site.com/thank-you"
}
}'

client_payment_id must be unique per payment in your system — it is used for idempotency.

To preselect a payment method, pass payment_method (e.g. "BR.PIX"). Without it, the customer chooses on the checkout page. See Payment Methods for available codes and any additional required fields per method.

Full parameter list

ParameterTypeRequiredDescription
client_idintegerYesYour account identifier, provided upon integration
client_payment_idstringYesYour payment ID, must be unique to the client_id used
payment_methodstringYesPreselected payment method code (see Supported payment methods section)
currencystringYesPayment currency (see Supported payment methods section)
amountdecimalYesRequested payment amount (for example: pass 12.34 for 12 dollars 34 cents amount)
payerobjectOptionalCustomer data section
payer.idstringYesA unique identifier for a customer or customer account on your side. It is used to accumulate customer data and for anti-fraud protection
payer.is_trustedbooleanOptionalIf passed and "true" customer marked as trusted (for use please consult Pagasul representative)
payer.namestringOptionalCustomer name
payer.emailstringOptionalCustomer email
payer.countrystringOptionalCustomer country (alpha-2 code)
payer.statestringOptionalCustomer state
payer.citystringOptionalCustomer city
payer.addressstringOptionalCustomer address
payer.phonestringOptionalCustomer phone
payer.languagestringOptionalPreferred language for customer
payer.cpfstringOptionalCustomer CPF (Cadastro de Pessoas Físicas) for Brazil payment methods. Can be passed in following formats: "231.002.999-00" or "23100299900"
payer.cuitstringOptionalCustomer CUIT (Unique Tax Identification Code) for Argentina payment methods. Can be passed in following formats: "30-69330706-2" or "30693307062"
payer.citizenship_cardstringOptionalNumber of the Citizenship Card (Cédula de Ciudadanía) for Colombian/Ecuadorian payment methods
payer.nitstringOptionalUnique Taxpayer Number (Número de Identificación Tributaria) for Colombian/Bolivian payment methods
payer.passtringOptionalPassport needed for Bolivian/Ecuadorian payment methods
payer.cestringOptionalCustomer Identity card of Foreigners (Cédula de Extranjería) for Colombian payment methods
payer.tistringOptionalCustomer identity document (Tarjeta de Identidad) for Colombian payment methods
payer.cistringOptionalCustomer identity document (Cédula de Identidad) for Bolivia/Venezuela payment methods. For Venezuela it must start with letter V or E
payer.rucstringOptionalEcuadorian taxpayer number (Registro Único de Contribuyente)
payer_accountobjectOptionalCustomer account data section
payer_account.bank_codestringOptionalPayer bank code (Mandatoriness see in section Supported payment methods). One of bank code from list (see Bank Codes section)
payment_optionsstringOptionalOptional section for extra parameters used for payment flow adjustment
payment_options.return_urlstringOptionalIf passed, the customer will be returned to the specified URL after the payment is completed
payment_options.callback_urlstringOptionalIf passed, the notification on payment status change will be sent to the specified URL
payment_options.reclaim_client_payment_idstringOptionalPlease, consult Pagasul representative about using this parameter
payment_extra_paramstringOptionalPlease, contact to your manager for possible parameter values and purpose

Also the full parameter list, see Create pay-in in the API Reference.

2. Show to customer loader

A successful request returns a 200 response with status: "processing":

Pay-in init response

'{
"client_id": 111,
"client_payment_id": "test_payment_00123",
"payment_type": "pay-in",
"payment_id": 301150550709,
"payment_method": "BR.PIX",
"currency": "USD",
"amount": 192.21,
"status": "processing",
"result_code": "0",
"result_message": "payment processing"
}'

3. Get the payment details

Send a POST request to /v2/status. Include a signature in the header.

curl -X POST https://api.pagasul.com//v2/status \
-H "Content-Type: application/json" \
-H "signature: <calculated>" \
-d '{
"client_id": 123,
"client_payment_id": "payment_35",
"payment_id": 246001234
}'

Payment status response (redirect)

'{
"client_id": 111,
"client_payment_id": "test_payment_00123",
"payment_type": "pay-in",
"payment_id": 301150550709,
"currency": "COP",
"amount": 192.21,
"status": "redirect",
"redirect_data": {
"method": "GET",
"url": "https://checkout.pagasul.com/checkout/a6e28417-5e29-11ef-a876-fa163e25c64d"
},
"result_code": "OK",
"result_message": "payment processing"
}'

Data contained in “payment_data” section must be used to display payment instruction to customer on your side. This section will become available upon receiving “pay pending” status. You can refer our checkout as implementation example.

Data contained in “redirect_data” section must be used to redirect customer to given URL. This section will become available upon receiving “redirect” status. You can refer our checkout as implementation example.

Also callback will be sent upon “pay pending” or “redirect” status. Callback is completely follows the structure and parameters of the status response.

Response full parameter list

ParameterTypeRequiredDescription
client_idintegerYesYour account identifier, provided upon integration
client_payment_idstringYesYour payment ID
payment_idUnsigned big integerYesPayment ID on our system
payment_typestringYesPayment direction ("pay-in")
payment_methodstringOptionalPayment method code (see Supported payment methods section).
currencystringYesPayment currency (see Supported payment methods section)
amountdecimalYesPayment amount (for example: pass 12.34 for 12 dollars 34 cents amount)
statusstringYesPayment status (see Payment status model)
result_codestringYesInternal result code
result_messagestringYesExtended description of result
payment_dataobjectOptionalSection is available for strict H2H only
payment_data.qr_datastringConditionalString with must be encoded to QR image
payment_data.bank_namestringConditionalReceiver bank name for payment instruction
payment_data.receiver_namestringConditionalReceiver name for payment instruction
payment_data.receiver_phonestringConditionalReceiver phone number for payment instruction
payment_data.receiver_docstringConditionalReceiver document for payment instruction
payment_data.receiver_accountstringConditionalReceiver account for payment instruction
payment_data.selected_amountstringConditionalAmount needs to be transferred by customer to complete payment
payment_data.amountsArray of decimalConditionalIn case of requested amount is currently unavailable we sends a set of available amounts. We suggest to allow customer to choose one of them and make a transfer of it. (No need to send us selected amount back for now. But for a best user experience please force customer to choose one of them before displaying payment receiver account)
redirect_dataobjectOptionalSection is available for strict H2H only
redirect_data.urlstringConditionalURL for customer redirect (CO.BT and CO.PSE)
redirect_data.methodstringConditionalHTTP method for customer redirect (CO.BT and CO.PSE)

4. Handle the callback

When the payment is completed, PagaSul sends a POST to your callback_url. Verify the signature in the header, then check the status field:

StatusMeaningAction
successPayment completedFulfil the order
declinePayment declinedNotify the customer
failedProcessing errorContact PagaSul support

For all statuses and result codes, see Statuses & Codes. For the full callback structure, see Callbacks.

5. Show payment resalt

After receiving the final status, display the page with the payment result for the user.