Buy Order

This POST endpoint is responsible for making a buy order and returns the checkout url and access token.

The buy order POST api takes your publicKey as a required parameter in the header and a body containing properties like the customer's email, phone number, customer deposit, receipt methods, etc. Unlike the standard buy endpoint, this will return additional properties like checkoutUrl, and accessToken which can be used to redirect your users and continue the order flow.

A boolean property called deferPaymentMethod is added to the request body which can be set to true to delay providing your users' payment methods to initiate any of the order endpoints. It can also be set to false if you intend to provide the details and require a confirmation of the request immediately.

When deferPaymentMethod is set to true, a call to Initiate Order Created With Deferred Payment Method should be made to complete the order initiation.

See the example below

Initiates a buy order

POST https://checkout-api-sandbox.xendbridge.com/api/ThirdPartyUI/Buy/Initiate

Headers

Name
Type
Description

publicKey*

{publicKey}

Request Body

Name
Type
Description

emailAddress*

annadoe@gmail.com

phoneNumber*

07064366723

userName*

annadoe

payInCurrencyCode*

NGN

payInCurrencyNetwork*

LOCAL

receiveInCurrencyCode*

BUSD

receiveInCurrencyNetwork*

BEP20

orderAmount*

50

consumerDepositMethod*

Object

paymentMethod*

Bank

paymentData*

Object

accountName*

John Doe

accountNumber*

0000187849

bankName*

Access Bank

consumerReceiptMethod*

Object

paymentMethod*

Crypto

paymentData*

Object

walletAddress*

0x52434Ac4BE04393e020c9b16C327d04d4367Cbcd

network*

BEP-20

deferPaymentMethod*

bool

false

{
    "Status": 2,
    "Message": "You Have A Pending Buy Order",
    "Data": null
}
JSON Request Format
{
  "emailAddress": "annadoe@gmail.com",
  "phoneNumber": "07064366723",
  "userName": "annadoe",
  "payInCurrencyCode": "NGN",
  "payInCurrencyNetwork": "LOCAL",
  "receiveInCurrencyCode": "BUSD",
  "receiveInCurrencyNetwork": "BEP20",
  "orderAmount": 50,
  "deferPaymentMethod": false,
  "consumerDepositMethod": {
    "paymentMethod": "Bank",
    "paymentData": {
      "accountName": "Emmanuel Diala",
      "accountNumber": "0000187849",
      "bankName": "Access Bank"
    }
  },
  "consumerReceiptMethod": {
    "paymentMethod": "Crypto",
    "paymentData": {
      "walletAddress": "0x52434Ac4BE04393e020c9b16C327d04d4367Cbcd",
      "network": "BEP20"
    }
  }
}

If deferPaymentMethod is set to true, you can provide the minimum payload below which starts the order initiation process and returns the checkoutUrl .

JSON Request Format
{
  "emailAddress": "johndoe@gmail.com",
  "phoneNumber": null,
  "userName": "johndoe",
  "payInCurrencyCode": "NGN",
  "payInCurrencyNetwork": "LOCAL",
  "receiveInCurrencyCode": "BUSD",
  "receiveInCurrencyNetwork": "BEP20",
  "orderAmount": 1,
  "deferPaymentMethod": true
}
Parameters
Type
Definitions

emailAddress

string

Required This is the consumer's email address.

phoneNumber

string

Required This is the consumer's phone number.

userName

string

Required This is the consumer's username

payInCurrencyCode

enum

Required This is the currency code to pay with. Must be NGN for buy order.

receiveInCurrencyCode

enum

Required This is the currency code to receive the currency in. Must be BUSD for buy order.

orderAmount

decimal

Required The order amount by the consumer.

consumerDepositMethod

object

Required This holds the properties of the deposit method of the consumer which is are the bank details.

paymentMethod

enum

Required The payment method by which transactions are made. It should be BANKfor buy order.

paymentData

object

Required This holds the properties of the bank details of the consumer.

accountName

string

Required This is the account name of the consumer.

accountNumber

string

Required The local account number of the consumer

bankName

string

Required This is the bank name of the consumer.

consumerReceiptMethod

object

Required This holds the properties of the consumer receiving method. The paymentMethod prop must be Crypto .

paymentData

object

Required This holds the properties of the consumer receiving account details.

walletAddress

string

Required The crypto wallet address of the consumer.

network

string

Required This is the network on which the address is on.

Last updated