API Reference

Create a Payment

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}}

ParameterTypeDetails
amountdecimalThe amount to charge, with up to two decimal places
currencystringThree-letter currency code in capitals, for example NGN
return_urlstringWhere the customer goes after paying
cancel_urlstringWhere the customer goes if they stop or the payment cannot go ahead
customstring (optional)Your own reference, such as an order number. It is returned when you check the payment.

Request example (PHP, Guzzle)

PHP
<?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)

JSON
{
  "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

JSON
{
  "message": { "code": 401, "error": ["Request token is expired"] },
  "data": [],
  "type": "error"
}

Get the App

Coming soon on Google Play
Coming soon on the App Store

DPay is coming to Android and iPhone. Leave your e-mail in the footer and we will tell you when it is ready.

Prefer your browser? Open an account on the web