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/initializeHeaders
Authorization: Bearer YOUR_SECRET_KEY
Content-Type: application/jsonRequest Body Parameters
| Parameter | Type | Required | Validation Rules |
|---|---|---|---|
email | string | Required | Valid email address, minimum 6 characters |
amount | numeric | Required | Minimum value: 1 |
reference | string | Optional | Min 16 characters, max 33 characters |
first_name | string | Optional | Maximum 100 characters |
last_name | string | Optional | Maximum 100 characters |
callbackUrl | string | Optional | Must 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
| Field | Type | Description |
|---|---|---|
status | boolean | Indicates whether initialization succeeded. |
message | string | Response message. |
data.payment_url | string | OPay checkout URL where the customer completes payment. |
data.reference | string | Unique transaction reference. |
data.status | string/null | Current transaction status returned during initialization. |