Skip to main content

Authentication, Callbacks & Payment Status Reference

URLhttps://checkout.pagasul.com/pay
HTTP request methodGET

Request headers

HeaderValueDescription
SignaturecalculatedFor the information on how to generate the signature, see Signature.

Parameters to be sent:

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

Strictly required — the parameter is always required in the 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.

Query parameters:

ParameterTypeRequiredDescription
client_idintegerYesYour account identifier, provided upon integration
client_payment_idstringYesYour payment ID, must be unique to the client_id used
payment_methodstringOptionalPreselected payment method code (see Supported payment methods section). If not passed, the customer will be presented with a form to select a method from those connected on your client_id
currencystringYesPayment currency (see Supported payment methods section)
amountdecimalYesRequested payment amount (for example: pass 12.34 for 12 dollars 34 cents amount)
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 possible values: V, 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_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

Signature​

In PagaSul, payment safety is one of our top priorities that's why we require that all API requests to the payment platform include a digital signature. For this reason, you should always generate a digital signature and include it in your requests before sending them.

When PagaSul receives your request, it verifies the received data by comparing your signature to the one generated in the payment platform. If the signatures don't match, the PagaSul payment platform won't process the payment.

The responses and callbacks that you get from the payment platform contain signatures as well. When you get responses or callbacks from PagaSul, you should verify the received data by comparing the signatures to the ones generated in your system.

To generate a signature for your request:

  1. Create a string of all the parameters from the request body including spaces, hyphens, and other symbols without using any conversions.
  2. Calculate the HMAC (hash-based message authentication code) of the string by using the SHA-512 hash function and the secret key you obtained from PagaSul when integrating.
  3. Convert the HMAC to the hexadecimal string.
  4. Encode the hexadecimal string by using base64.

Here's an example of signature generation by using the Go programming language.

func CalcHmacSha512(requestBody string, clientSecretKey string) string {
h := hmac.New(sha512.New, []byte(clientSecretKey))
h.Write([]byte(requestBody))
// Get result and encode as hexadecimal string
return base64.StdEncoding.EncodeToString([]byte(hex.EncodeToString(h.Sum(nil))))
}

Response​

After sending a request to the PagaSul payment platform, your system should be ready to accept a response which PagaSul returns synchronously, i.e. within the same HTTP session.

The response may contain:

  • the data you passed in the initial request
  • the payment ID the PagaSul payment platform assigned to your payment
  • the status the payment is currently in — see Payment statuses and result codes
  • the data you should use to redirect the customer so that they can complete the payment

Response headers:

HeaderValueDescription
SignaturecalculatedSignature string. Verify it before trusting the body — see Signature generation.
Content-Typeapplication/jsonMedia type of the response body.

For the full list of response fields, their types, and live request/response examples, see PaymentStatusResponse (pay-in, payment status) and PayOutResponse (pay-out) in the API Reference.

Payment statuses and result codes​

When the payment is being performed, it changes its statuses depending on different events occuring during its processing. It is necessary to consider the status of your payment as it may require some actions from you for the payment to be completed.

You can learn the status of your payment:

  • by using the PagaSul Dashboard which is available at https://merchant.pagasul.com. Contact your key account manager at PagaSul to get access there
  • by checking responses and callbacks the payment platform sends to your system
  • by sending a request for the payment status to the PagaSul payment platform. To learn how to create such a request, see Payment status in the API Reference

Payment statuses​

The following table contains the information about the payment statuses occuring when performing payments in the Pagasul payment platform and the actions that you may need to perform upon these statuses.

StatusDescriptionIs finalAction needed
newThis is first status upon registration payment in our system. Payment is enqueued for processingNoNo
redirectTo continue payment process customer redirection requiredNoRedirect customer to CheckoutUrl Redirect customer to redirect_data.url (strict H2H flow)
processingPayment is processingNoNo
pay pendingPayment data for instruction provided. (strict H2H only)NoDisplay instruction to customer with params provided in payment_data section
pay confirmPayment is awaiting confirmationNoNo
successFinal positive payment status. Payment was completed and balance is fulfilledYesNo
declineFinal negative payment statusYesNo
failedPayment processing encountered an error, manual intervention requiredNoContact with PagaSul customer support to resolve payment status

To query payment status via the API, see Payment status in the API Reference.

Result codes​

The following table contains the information about the request processing result codes you receive in responses and callbacks from PagaSul, as well as their messages, description, and the actions that you may need to perform upon these result codes.

Result CodeMessageDescriptionRequired action
OK—The request is processed successfully. This result code does not mean that the payment is completed successfuly. It signifies that the payment platform accepted your request and started processing the payment The required action depends on the status of the payment, e.g., if the payment is assigned the success status, no action is required. If it is in the redirect status, redirect the customer to the URL you've been provided with
BAD REQUESTinvalid request formatThe request is malformedContact the technical support
invalid signatureInvalid signature was sent in the requestCorrect the signature and resend the request
validation failedReceived data cannot be validatedContact the technical support
unauthorizedAuthorization failed, e.g. due to an incorrect account ID passed in the requestCorrect and resend the request or just resend the request
NOT FOUNDpayment not foundPayment is not found in the systemResend the request or contact the technical support
NOT CREATEDinternal errorAn internal error has occurred in the systemContact the technical support

Decline reasons​

The list of possible codes is expanding. We are working to reduce the number of non-detailed declines.

decline_reason valueDescription
100:general declineDecline without detailed reason
200:Not paidCustomer not paid in desired time
200:Invalid customer dataCustomer’s data not passed internal validation
200:Customer reject to payCustomer press “reject” on checkout page
300:Channel is temporally unavailablePayment channel disabled or issuing downtime
300:Channel is temporally overloadedThe payment channel is receiving more requests than it can handle in-moment
300:Channel general declinePayment channel declines payment without detailed reason
300:Channel reports invalid dataCustomer’s data not passed in-channel validation
300:Channel depletedChannel was overloaded and issuing downtime
900:No channel availableNo active payment channel connected to you account
900:Blocked by FRAUD-prevention system: countFRAUD-prevention system blocks payment attempt because some customer`s count is high (for example: to much declined payments of the customer in short time)
900:Blocked by FRAUD-prevention system: blacklistFRAUD-prevention system blocks payment attempt because some customer is blacklisted
900:Insufficient balanceInsufficient merchant balance
900:Temporally system malfunctionOur system got internal fail with unexpected reason

Network error 500 it isn't the reason for final status. Such an operation needs recheck status or contact technical support.

Callback​

A callback is a system message that the PagaSul payment platform sends to your system to pass information such as the final payment result.

PagaSul sends callbacks to one of the following URLs:

  • the URL you provide PagaSul with when integrating
  • the URL you pass in the payment_options.callback_url parameter of your payment request — if passed, it overrides the integration URL for that specific payment
HTTP request methodPOST
Request body formatJSON

Callback headers:

HeaderValueDescription
SignaturecalculatedSignature string. Verify it before trusting the body — see Signature generation.
Content-Typeapplication/jsonMedia type of the callback body.

The callback body has the same structure as the synchronous payment response. For the full field list and examples, see PaymentStatusResponse in the API Reference; for possible status and result_code values, see Payment statuses and result codes.