OPay Payment Initialization

Use this endpoint to initialize an OPay payment transaction. On success, you receive a payment_url that you redirect your customer to in order to complete payment.

Endpoint

POST https://backendapi.sayswitchgroup.com/api/s2s/v1/transaction/opay/initialize

Headers

Authorization: Bearer YOUR_SECRET_KEY
Content-Type: application/json

Request Body Parameters

ParameterTypeRequiredValidation Rules
emailstringRequiredValid email address, minimum 6 characters
amountnumericRequiredMinimum value: 1
referencestringOptionalMin 16 characters, max 33 characters
first_namestringOptionalMaximum 100 characters
last_namestringOptionalMaximum 100 characters
callbackUrlstringOptionalMust be a valid URL

Sample Request Body

{
    "email": "lekan126@gmail.com",
    "amount": 13,
    "callbackUrl": "https://www.geegpay.africa"
}

Sample cURL

curl -X POST "https://backendapi.sayswitchgroup.com/api/s2s/v1/transaction/opay/initialize" \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "lekan126@gmail.com",
    "amount": 13,
    "callbackUrl": "https://www.geegpay.africa"
  }'

Validation Error Response

If validation fails, the API returns a 400 status with the following structure:

{
    "status": false,
    "message": "The email field is required.",
    "error": {
        "email": ["The email field is required."],
        "amount": ["The amount field is required."]
    }
}

Success Response

On success, redirect your customer to the payment_url returned in the response to complete payment on the OPay checkout page.

{
    "status": true,
    "message": "Proceed payment",
    "data": {
        "payment_url": "https://express.opaycheckout.com/apiCashier/redirect/payment/checkoutHome?orderToken=TOKEN.fd20af62...",
        "reference": "SSW_17793454451101895",
        "status": null
    }
}

Response Fields

FieldTypeDescription
statusbooleanIndicates whether initialization succeeded.
messagestringResponse message.
data.payment_urlstringOPay checkout URL where the customer completes payment.
data.referencestringUnique transaction reference.
data.statusstring/nullCurrent transaction status returned during initialization.