Skip to content

Initiate Transaction

POST

Creates a transaction and returns a redirectUrl where your customer completes payment. This is the first call in the redirect flow.

EnvironmentURL
Productionhttps://api.pesepay.com/api/payments-engine/v1/payments/initiate
Sandboxhttps://api.test.sandbox.pesepay.com/payments-engine/v1/payments/initiate
  1. Build your request body with the payment details, then encrypt it with your application’s encryption key.
  2. POST the encrypted payload to the URL above, with your integration key in the authorization header.
  3. Decrypt the response to get referenceNumber, redirectUrl and pollUrl.
  4. Store referenceNumber for tracking, then redirect the customer to redirectUrl to complete payment.
ParameterTypeRequiredDescription
authorizationstringYesYour application’s integration key
content-typestringYesMust be application/json

The fields below are the plaintext shape — encrypt the entire object before sending (see Encryption Guide).

FieldTypeRequiredDescription
amountDetailsobjectYes{ amount: number, currencyCode: string }
reasonForPaymentstringYesA short summary of the transaction
resultUrlstringYesWhere Pesepay posts the final transaction result — see The Result Callback
returnUrlstringYesWhere the customer’s browser is sent after completing or cancelling
merchantReferencestringNoYour own order/invoice reference, echoed back on the transaction
paymentMethodCodestringNoPre-selects a method so the hosted page opens straight into it — see Payment Method Codes
paymentMetadataobjectNoString key/value pairs carried on the transaction and returned as transactionMetadata on the result. Required on an application with split payments, which must carry beneficiaryMerchantEmail
Plaintext request body (before encryption)
{
"amountDetails": {
"amount": 10.00,
"currencyCode": "USD"
},
"reasonForPayment": "Order #1042 — running shoes",
"resultUrl": "https://example.com/payments/result",
"returnUrl": "https://example.com/payments/return"
}

Each sample builds the request, encrypts it, sends it, and decrypts the response — see the Encryption Guide for the encrypt/decrypt helpers used here.

Terminal window
# Encrypt your JSON body first (see the Encryption Guide), then:
curl -X POST https://api.test.sandbox.pesepay.com/payments-engine/v1/payments/initiate \
-H "authorization: YOUR_INTEGRATION_KEY" \
-H "content-type: application/json" \
-d '{"payload": "ENCRYPTED_BASE64_STRING"}'

The response is an encrypted payload. Decrypt it to get these three fields — and only these three. There is no status or amount detail here; call Check Payment Status for that.

FieldTypeDescription
referenceNumberstringStore this — used to track status and match result callbacks
redirectUrlstringRedirect your customer here to complete payment
pollUrlstringA ready-made Check Payment Status URL for this transaction