XendBridge
  • Get Started
  • 🛠️API Method Calls
    • Third Party Order Operations
      • Rate
      • Buy Order
      • Sell Order
      • Swap Order
      • Pending Order
      • Pay For Order
      • Cancel Order
    • LP Simulation
      • Pay For Order (Buy Order)
      • Pay For Order (Sell Order)
    • Dispute
      • Raise Third Party Dispute
      • Get All Disputes
      • XendBridge Chat SDK
    • Payment Inquiry
    • WebHooks
      • Order Payment Confirmation
      • Order Matched Notification
      • Order Canceled Notification
      • Checksum Verification
  • 📄XENDBRIDGE PORTAL
    • Checkout URL
      • Buy Order
      • Sell Order
      • Swap Order
      • Rate
      • Rate Bounds
      • Initiate Order Created With Deferred Payment Method
      • Supported Currencies
      • Payment Methods
    • Inline Html Snippet
    • DeFi Checkout
  • 📦XENDBRIDGE SDKS
    • XendBridge NodeJs SDK
    • XendBridge .NET SDK
      • Rate
      • Buy Order
      • Sell Order
      • Swap Order
      • Pending Order
      • Pay For Order Confirmation
      • Cancel Order
      • Raise A Dispute
  • Errors
  • 🔖REFERENCE
    • API Reference
Powered by GitBook
On this page

Was this helpful?

  1. XENDBRIDGE PORTAL
  2. Checkout URL

Swap Order

This endpoint is called when a customer wants to make either a fiat-fiat or crypto-crypto swap for currencies.

It is an POST endpoint that takes your publicKey as a required parameter in the header and the body should contain properties like the customer's email, phone number, customer deposit, and receipt methods, etc.

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 swap order

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

Headers

Name
Type
Description

publicKey*

string

{publicKey}

Request Body

Name
Type
Description

emailAddress*

string

annadoe@gmail.com

phoneNumber*

string

07064366723

userName*

string

annadoe

payInCurrencyCode*

string

BUSD

payInCurrencyNetwork*

string

BEP-20

receiveInCurrencyCode*

string

NGN

receiveInCurrencyNetwork*

string

LOCAL

orderAmount*

double

50

consumerDepositMethod*

Object

paymentMethod*

string

Crypto

paymentData*

Object

walletAddress*

string

0x52434Ac4BE04393e020c9b16C327d04d4367Cbcd

network*

string

BEP-20

consumerReceiptMethod*

Object

paymentMethod*

string

Crypto

paymentData*

Object

walletAddress*

string

0x52434Ac4BE04393e020c9b16C327d04d4367Cbcd

network*

string

POLYGON

deferPaymentMethod*

bool

false

{
    "data": {
        "checkoutReference": "XCHKC_b73aa1ab3e9b40ba97acce190ae6295c7b2b5e18f8c444b28f8ad9c39d8a26a1",
        "orderReference": "XC_acdcadd7c35d48afba8d203d5481ea85",
        "checkoutUrl": "https://checkout-sandbox.xendbridge.com/order?ref=XCHKC_b73aa1ab3e9b40ba97acce190ae6295c7b2b5e18f8c444b28f8ad9c39d8a26a1",
        "accessToken": "362479",
        "receiveInCurrencyCode": "WNT",
        "payInCurrencyCode": "BUSD",
        "customerPayInCurrencyNetwork": "BEP20",
        "customerReceieveInCurrencyNetwork": "POLYGON",
        "receivableAmount": 4.5208000,
        "payableAmount": 50.0,
        "receivableAmountWithoutMarkup": 0,
        "providerName": "John Doe",
        "providerFirstName": "John",
        "providerLastName": "Doe",
        "providerEmail": "owolabidamilola98@gmail.com",
        "initiatedAt": "2023-02-13T11:50:14.7794655Z",
        "orderExpiryDate": "2023-02-13T11:57:14.7015987Z",
        "initiatedAtTimestamp": 1676289014701,
        "orderExpiryTimestamp": 1676289434701,
        "estimatedOrderCompletionTimestamp": null,
        "fundedProviderAtTimeStamp": null,
        "fundedCustomerAtTimeStamp": null,
        "orderCompletedAtTimeStamp": null,
        "p2POrderStatus": "Acknowledged",
        "disputeStatus": "NoDispute",
        "disputeReference": null,
        "orderType": "Swap",
        "providerContact": {
            "phoneNumber": "2348181186644",
            "whatsappNumber": ""
        },
        "customerContact": {
            "email": null,
            "name": null,
            "phoneNumber": null
        },
        "providerPaymentMethods": {
            "paymentMethod": "Crypto",
            "paymentType": "Crypto",
            "paymentData": [
                {
                    "walletAddress": "0xB13A251A67E7f7e7466758EF55A3aDD69A7C15A3",
                    "network": "BEP20",
                    "currency": "BUSD"
                }
            ],
            "orderPaymentMethod": {
                "walletAddress": "0xB13A251A67E7f7e7466758EF55A3aDD69A7C15A3",
                "network": "BEP20",
                "currency": "BUSD"
            }
        },
        "consumerDepositMethod": {
            "paymentMethod": "Crypto",
            "paymentType": 0,
            "paymentData": {
                "walletAddress": "0x30b7D85f7CF498D556a9448243a7994bc4660790",
                "network": "BEP20",
                "currency": "BUSD"
            }
        },
        "consumerReceiptMethod": {
            "paymentMethod": "Crypto",
            "paymentType": 0,
            "paymentData": {
                "walletAddress": "0x30b7D85f7CF498D556a9448243a7994bc4660790",
                "network": "POLYGON",
                "currency": "WNT"
            }
        },
        "providerTransactionMetadata": null,
        "customerTransactionMetadata": null
    },
    "status": "OK",
    "message": ""
}
{
    "Status": 2,
    "Message": "You Have A Pending Swap Order",
    "Data": null
}
Crypto-Crypto JSON Request Format
{
  "emailAddress": "annadoe@gmail.com",
  "phoneNumber": "07064366723",
  "userName": "annadoe",
  "payInCurrencyCode": "BUSD",
  "payInCurrencyNetwork": "BEP20",
  "receiveInCurrencyCode": "WNT",
  "receiveInCurrencyNetwork": "POLYGON",
  "orderAmount": 50,
  "deferePaymentMethod": false,
  "consumerDepositMethod": {
    "paymentMethod": "Crypto",
    "paymentData": {
      "walletAddress": "0x30b7D85f7CF498D556a9448243a7994bc4660790",
      "network": "BEP20"
    }
  },
  "consumerReceiptMethod": {
    "paymentMethod": "Crypto",
    "paymentData": {
      "walletAddress": "0x30b7D85f7CF498D556a9448243a7994bc4660790",
      "network": "POLYGON"
    }
  }
}
Fiat-Fiat JSON Request Format
{
  "emailAddress": "annadoe@gmail.com",
  "phoneNumber": "07064366723",
  "userName": "annadoe",
  "payInCurrencyCode": "BUSD",
  "payInCurrencyNetwork": "BEP20",
  "receiveInCurrencyCode": "WNT",
  "receiveInCurrencyNetwork": "POLYGON",
  "orderAmount": 50,
  "deferPaymentMethod": false,
  "consumerDepositMethod": {
    "paymentMethod": "Bank",
    "paymentData": {
      "accountName": "Anna Doe",
      "accountNumber": "0000187849",
      "bankName": "Access Bank"
    }
  },
  "consumerReceiptMethod": {
    "paymentMethod": "Bank",
    "paymentData": {
      "accountName": "Anna Doe",
      "accountNumber": "0000187849",
      "bankName": "Access Bank"
    }
  }
}

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": null,
  "payInCurrencyCode": "XEND",
  "payInCurrencyNetwork": "BEP20",
  "receiveInCurrencyCode": "BUSD",
  "receiveInCurrencyNetwork": "BEP20",
  "orderAmount": 1,
  "deferPaymentMethod": true
}
Parameter
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 BUSD for sell order.

receiveInCurrencyCode

enum

Required This is the currency code to receive the currency in. Must be NGN 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.

paymentMethod

enum

Required The payment method by which transactions are made. It should be CRYPTOfor sell order.

paymentData

object

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

walletAddress

string

Required The crypto wallet address of the consumer.

network

enum

Required This is the network on which the address is on. It could be BEP20, ERC20 or POLYGON.

consumerReceiptMethod

object

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

paymentData

object

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

accountName

string

Required This is the account name of the consumer.

accountNumber

string

Required The local bank account number of the consumer

bankName

string

Required This is the bank name of the consumer.

Parameter
Type
Definitions

checkoutReference

string

This is the refernce to the checkout order.

orderReference

string

This the reference to a particular order.

receiveInCurrencyCode

enum

This is the currency code to receive the currency in.

payInCurrencyCode

enum

This is the currency code to pay with.

receivableAmount

decimal

This the receivable amount of the currency.

payableAmount

decimal

This is the payable amount of the currency.

providerName

string

This the provider's name.

providerFirstName

string

This is the provider's first name.

providerLastName

string

This is the provider's last name.

providerEmail

string

This is the provider's email address.

initiatedAt

DateTime

The date time the order was made.

orderExpiryDate

DateTime

The expiry date time of the order.

initiatedAtTimestamp

long

The time in milliseconds an order was made

orderExpiryTimestamp

long

The time in milliseconds of when thee order will expire.

fundedProviderAtTimeStamp

long

The time of when a customer indicates payment for an order in milliseconds.

fundedCustomerAtTimeStamp

long

The time of when a provider indicates payment of order to the customer in milliseconds

orderCompletedAtTimeStamp

long

The time in milliseconds an order was completed.

p2POrderStatus

enum

The status of the order at the curent time. It could be Submitted, Cancelled, Acknowledged, FundedProvider, FundReceivedFromUser, FundedUser, Completed, OrderTimedOut

disputeStatus

enum

The status of the dispute on an order. It could either be NoDispute, DisputeRaisedByCustomer, DisputeRaisedByProvider, DisputeRaisedByBothParties, DisputeResolvedor CouldNotBeResolved.

orderType

enum

This is the status of the order, whether it's a Buy or Sell.

providerContact

object

This is holds props of a provider's contact information.

phoneNumber

string

The phone number of either the provider or customer.

whatsappNumber

string

The whatsapp number of either the provider or customer.

customerContact

object

This holds the props of the contact information.

email

string

This is an email address of the customer.

name

string

This is the name of the customer.

phoneNumber

string

The phone number of the customer

providerPaymentMethods

object

This holds the props of the payment methods of the provider.

paymentMethod

enum

This is the method of payment. It could be Bank or Crypto

paymentType

enum

This is the type of payment. It could be Bank, Crypto, UserNameor MobileMoney.

paymentData

object

This holds the props of the payment method.

bankName

string

The bank name of the the provider or customer.

accountNumber

string

The bank account number of the provider or customer.

accountName

string

The bank account name of the provider or customer.

currency

enum

The currency in which the order was made. It could be BUSD or NGN.

orderPaymentMethod

object

This holds props of the payment method in which the order is to be made to.

consumerDepositMethod

object

This holds the props of the consumer deposit details.

consumerrReceiptMethod

object

This holds the props of the consumer receiving method details.

walletAddress

string

This is the crypto wallet address of the consumer.

network

enum

This is the network currently supported in the system which the wallet address is based on.

providerTransactionMetadata

object

This holds the props of the transaction metadata of an order.

PreviousSell OrderNextRate

Last updated 1 year ago

Was this helpful?

📄