Skip to main content

Creating a pay-in request

This section provides the instructions on how to build a pay-in request.

URLhttps://api.pagasul.com
API endpoint/v2/pay-in
HTTP request methodPOST
Request body formatJSON
HeaderValueDescription
SignaturecalculatedSignature string. For the information on how to generate the signature, see Signature generation.
Content-TypejsonHTTP header indicating the media type of the resource sent in the request body.

Parameters of a pay-in request:

In PagaSul, there are the following types of parameters depending on whether they are required in the pay-in request:

  • Strictly required—the parameter is always required in the pay-in request
  • Optional—the parameter is optional
  • Required conditionally—the parameter may be sometimes required depending on the payment method you initiate the payment with. See the Payment methods section to check whether it is required in the request
Object/ParameterTypeRequiredDescription
client_idintegerStrictly requiredAccount ID you obtained from PagaSul when integrating.
client_payment_idstringStrictly requiredPayment ID unique within your system.
currencystringStrictly requiredCode of the pay-in currency in the ISO-4217 alpha-3 format.
amountnumberStrictly requiredPay-in amount in major currency units, e.g., pass 12.34 for the 12 dollars 34 cents amount.
payment_methodstringOptionalPayment method's code. Passing it in the request allows you to enforce a payment method for your customer on the checkout. If not passed, the customer will have to choose a payment method on the checkout themselves. For the values that can be passed in this parameter, see the Payment methods section.
payerobject
payer.idstringStrictly requiredUnique ID of the customer within your system.
payer.namestringRequired conditionallyCustomer's full name.
payer.emailstringRequired conditionallyCustomer's email.
payer.countrystringOptionalCustomer's country in the ISO 3166-1 alpha-2 format.
payer.statestringOptionalCustomer's state.
payer.citystringOptionalCustomer's city.
payer.addressstringOptionalCustomer's address.
payer.phonestringOptionalCustomer's phone number.
payer.languagestringOptionalCustomer's preferred language.
payer.cpfstringRequired conditionallyCustomer's CPF (Cadastro de Pessoas Físicas) for Brazilian payment methods. Can be passed in the following formats: 231.002.999-00, 23100299900
payer.cuitstringRequired conditionallyCustomer's CUIT (Clave Única de Identificación Tributaria) for Argentinian payment methods. Can be passed in the following formats: 30-69330706-2, 30693307062
payer.citizenship_cardstringRequired conditionallyCustomer's citizenship card (Cédula de Ciudadanía) for Colombian payment methods.
payer.nitstringRequired conditionallyCustomer's NIT (Número de Identificación Tributaria) for Colombian payment methods.
payment_optionsobject
payment_options.return_urlstringOptionalThe URL to redirect the customer to after the payment is completed.
payment_options.callback_urlstringOptionalThe URL to send callbacks to. If not passed, callbacks will be sent to the URL you provided PagaSul with when integrating.

Here is an example of a pay-in request to the PagaSul payment platform.

curl --request POST
--url https://api.pagasul.com/v2/pay-in
--header 'Content-Type: application/json'
--header 'Signature: NTU1YjUwY2M1MTU3ZjE2ZmY5MjMDI1lZNDQ2NDQ='

--data '{
"client_id": 123,
"client_payment_id": "payment_35",
"payment_method": "BR.PIX",
"currency": "BRL",
"amount": 192.21,
"payer": {
"id": "customer_1234",
"name": "John Doe",
"email": "johndoe@example.com"
},
"payment_options": {
"return_url": "https://example.com/return/",
"callback_url": "https://example.com/callback/"
}
}'

After receiving your request, the PagaSul payment platform will send a response to your system. To see what a response may look like, check out the Response section.

PagaSul returns you the final payment status in a separate callback. For the information about callbacks, see the Callback section.