Create a payment for an order and send the customer to the payment_url in the response.
Endpoint: POST {{base_url}}/payment/create, with the header Authorization: Bearer {{access_token}}
| Parameter | Type | Details |
|---|---|---|
amount | decimal | The amount to charge, with up to two decimal places |
currency | string | Three-letter currency code in capitals, for example NGN |
return_url | string | Where the customer goes after paying |
cancel_url | string | Where the customer goes if they stop or the payment cannot go ahead |
custom | string (optional) | Your own reference, such as an order number. It is returned when you check the payment. |
Request example (PHP, Guzzle)
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', '{{base_url}}/payment/create', [
'json' => [
'amount' => '15000.00',
'currency' => 'NGN',
'return_url' => 'https://yourstore.example/payment/success',
'cancel_url' => 'https://yourstore.example/payment/cancel',
'custom' => 'ORDER-10293',
],
'headers' => [
'Authorization' => 'Bearer {{access_token}}',
'accept' => 'application/json',
'content-type' => 'application/json',
],
]);
echo $response->getBody();Response: success (200)
{
"message": { "code": 200, "success": ["CREATED"] },
"data": {
"token": "PAYMENT_TOKEN",
"payment_url": "https://{{dpay_host}}/pay/v1/user/authentication/form/PAYMENT_TOKEN"
},
"type": "success"
}Response: error
{
"message": { "code": 401, "error": ["Request token is expired"] },
"data": [],
"type": "error"
}





