Changelog

Payment API

Payment API provides all the functionality required to manage beneficiaries and initiate payments on your user's behalf.

The Payment APIs are:

  • Dapi AutoFlow - The easiest and most efficient way to facilitate payments.
  • [Not required when using Autoflow] Get beneficiaries - Retrieve beneficiaries from the bank account.
  • [Not required when using Autoflow] Create Beneficiary - Create a beneficiary into the bank account.
  • [Not required when using Autoflow] Create Transfer - Initiate a transfer to an existing beneficiary only.

Transfer Autoflow [Recommended]

Transfer Autoflow

Transfer Auto Flow automatically takes care of all requirements for adding a beneficiary as well as initiating a transfer. We recommend using Transfer Auto Flow to initiate a payment.

Using Dapi AutoFlow you can easily create a transfer and listen to the success or failure results.

ParameterTypeDescription
transferObjectTransfer Object (see details below)
clientHeadersObject
Optional
More details
clientBodyObject
Optional
More details

Transfer Object Schema

ParameterTypeDescription
senderIDStringThis is the id of a particular sub account. You can get this from calling getAccounts function.
beneficiaryObjectIts params can be found
here
amountNumberThis is the amount you want to send.
remarksStringUnique ID generated by your application. Can be used to track the transfer during settlement.

NB! No special characters allowed

Example

var transfer = {
    senderID: "XXXAAABBBCCC",
    amount: 0,
    remarks: "",
    beneficiary: {
      name: "Mohammad Omar Amr",
      nickname: "Mohammad Omar LIV",
      iban: "DAPIBANKAELIV1619116273261987517393",
      accountNumber: "1619116273261987517393",
      swiftCode: "EBILAEAD",
      address: {
          line1: "Maryam Street",
          line2: "Abu Dhabi",
          line3: "United Arab Emirates"
      },
      country: "AE",
      branchAddress: "Dubai Mall",
      branchName: "Main Branch"  
    }
  }
  ba.payment.transferAutoflow(transfer)
    .then(transferResponse => {
          if(transferResponse.status === "done") {
            console.dir(transferResponse)
          } else {
            console.error("API Responded with an error")
            console.dir(transferResponse)
          }
        })
        .catch(error => {
            console.dir(error)
        })

❗️

How to set beneficiary details?

There are multiple ways to communicate the beneficiary details to Dapi. Please follow the best approach based on your exact use case and security requirements


  • Option 1: Set the beneficiary on the Dapi Dashboard.
    • ⚠️ Works only for static beneficiaries. (All of the transfers will be sent to beneficiaries that you know ahead of time.)
    • ✅ No configuration required on the SDK nor on the SDK Backend Server side.

  • Option 2: Set the beneficiary as the DAPIBeneficiary object in the SDK function call
    • ✅ Works for both dynamic and static beneficiaries.
    • ⚠️ You should be double-checking the beneficiary details integrity in the SDK Backend Server that you set up. This is to ensure no tampering with the data on the front-end layer.

  • Option 3: Set the beneficiary details only in the SDK Backend Server (in principle the same as Option 2)
    • ✅ Works for both dynamic and static beneficiaries.
    • ✅ You never have to expose the beneficiary details to the front-end layer.
    • ✅ You want your backend to be in full control of the beneficiary details.
    • ⚠️ Don't recommend for static beneficiary use cases, since it would be unnecessary additional development work on the Backend Server Side.


No Autoflow Approach

❗️

If you do not use AutoFlow you will be responsible for:

  • ⚠️ Handling beneficiary addition based on each bank's requirements
  • ⚠️ Handling beneficiary existence checks
  • ⚠️ Setting up a way to call the Accounts API to obtain the sender account information

Get Beneficiaries

Access the bank account's beneficiaries array.

ParameterTypeDescription
clientHeadersObject
Optional
More details
clientBodyObject
Optional
More details

Example

ba.payment.getBeneficiaries()
    .then(benefResponse => {
          if(benefResponse.status === "done") {
            console.dir(benefResponse)
          } else {
            console.error("API Responded with an error")
            console.dir(benefResponse)
          }
        })
        .catch(error => {
            console.dir(error)
        })

Get Beneficiaries Response

Create Beneficiary

Create a beneficiary into the bank account with this endpoint.

ParameterTypeDescription
beneficiaryObjectIts params can be found here
clientHeadersObject
Optional
More details
clientBodyObject
Optional
More details

Example

var beneficiary = {
      name: "Mohammad Omar Amr",
  		nickname: "Mohammad Omar Liv",
      iban: "DAPIBANKAELIV1619116273261987517393",
      accountNumber: "1619116273261987517393",
      type: "local",
      swiftCode: "EBILAEAD",
      address: {
          line1: "Maryam Street",
          line2: "Abu Dhabi",
          line3: "United Arab Emirates"
      },
      country: "United Arab Emirates",
      branchAddress: "Dubai Mall",
      branchName: "Main Branch"  
  }
  ba.payment.createBeneficiary(beneficiary)
    .then(benefResponse => {
          if(benefResponse.status === "done") {
            console.dir(benefResponse)
          } else {
            console.error("API Responded with an error")
            console.dir(benefResponse)
          }
        })
        .catch(error => {
            console.dir(error)
        })

Create Transfer

Send money to a particular existing beneficiary.

ParameterTypeDescription
TransferObjectSee details below
clientHeadersObject
Optional
More details
clientBodyObject
Optional
More details

Transfer Object Schema

ParameterTypeDescription
senderIDStringThis is the id of a particular sub account. You can get this by calling the getAccounts function.
receiverIDStringThis is the id of a particular beneficiary. You can get this by calling the getBeneficiaries function
accountNumberString
Optional
This is the accountNumber of a new beneficiary you want to send money to. Some banks require it
ibanString
Optional
This is the iban of a new beneficiary you want to send money to. Some banks require it
amountNumberThis is the amount you want to send
remarksString
Optional
This is the id you can use to track the transaction.

Example

var transfer = {
    senderID: "ntV7rbYoexYaGDRfLCAo8vw1xXgu2VaXXtqvNoMU0sfy6aNErfUEGMD+P6lAlkzu/GKxPeoef7d7eNoxlHKyRw==",
    receiverID: "kSSWuq7RXww1VZpvF05KBfeiQxr8nb/uHQ35ZqSmhnp2gVoqZ7+DCnI/zRLzcg32myS/e8BLPhMJaT7mJ3z9Uw==",
    accountNumber: "1619116273261987517393",
    name: "Mohammad Omar Amr",
    iban: "DAPIBANKAELIV1619116273261987517393",
    amount: 10,
    remarks: "",
  }
  
  ba.payment.createTransfer(transfer)
    .then(transferResponse => {
          if(transferResponse.status === "done") {
            console.dir(transferResponse)
          } else {
            console.error("API Responded with an error")
            console.dir(transferResponse)
          }
        })
        .catch(error => {
            console.dir(error)
        })