Appearance
Pay by Card (NGN)
Collect NGN card payments through the Direct API: you own the checkout UI, Rexel talks to card schemes and issuers.
- Initiate with transaction, customer and card details.
- Verify the final status.
Before you begin
Get your secret key from Developers > Configuration > API Keys. See API Keys.
Initiate the payment
bash
curl --request POST \
--url https://laas.rexel.ng/api/payment/pay/initiate \
--header 'X-Api: sk_test_xxx' \
--header 'content-type: application/json' \
--data '{
"amount": 100,
"channel": "Card",
"currency": "NGN",
"narration": "Order 123",
"userInformation": {
"firstName": "Dave", "lastName": "MC",
"emailAddress": "mcdave@test.com", "phone": "070 0000 0000"
},
"paymentRequestProps": {
"card": { "number": "4242424242424242", "cvv": "123", "expMonth": 6, "expYear": 2027 }
},
"metaData": { "orderId": "123" }
}'Add "link": { "alias": "..." } only when paying a payment link.
json
{
"value": {
"paymentStatus": "INITIATED",
"message": "Payment Initiated Successfully",
"bankAuthURL": null,
"paymentItem": {
"channel": "Card",
"amount": 100,
"fees": 0,
"reference": "THGUJYNHACLVSPG",
"paymentReference": "THGUJYNHACLVSPG",
"metaData": {}
}
},
"isSuccess": true
}Managing the auth window
If you load the auth URL in an iframe or modal and want it to close itself, change redirect=true to redirect=false in the URL first.
Verify status
Call Get Transaction Status with paymentReference, or wait for the webhook.
| Status | Meaning | Do |
|---|---|---|
| SUCCESSFUL | Funds secured | Give value |
| PENDING | Authorized, awaiting bank settlement | Show "Processing" |
| FAILED | Charge rejected | Offer another method |
Webhook events
payment.success: trigger fulfilment.payment.failed: notify the customer and log the reason.