Creating a payout

When creating a payout, there are two possible flows:

  1. You already know the crypto address of the destination of the payout and can enter it on the API call.
  2. You don't know the crypto address of the destination of the payout, and will redirect the user to the hosted page to collect it.

In the same way as the payments workflow, you will be provided with a redirect URL to collect the details if necessary. For this guide, we will presume you have the address already.

Validating the crypto address

If integrated directly with our API, before making a payout, it is recommended to validate the crypto address with the Validate address endpoint. This checks that all required data is present in order achieve a successful payout. This improves end user experience by providing this feedback ahead of creating the payout. If you're using the hosted page the address will be validated when inputted by the end user.

For example, tag is required for XRP payouts to exchanges, ensuring the funds are allocated to the correct customer.

❗️

If the address is invalid the payout request will fail and you'll see an error like the following:

{
  "errorList": [
    {
      "parameter": "payOutInstruction",
      "code": "invalidPayout",
      "message": "Invalid Instruction for Payout"
    }
  ]
}

Setting a unique reference

Make sure you are setting a unique reference for the payout, otherwise you'll see an error like the following:

{
  "errorList": [
    {
      "parameter": "reference",
      "code": "unique",
      "message": "Duplicate Reference"
    }
  ]
}

Requester IP Address validated in the request

If needed, you can include the IP of the payout requester to conform to regulatory requirments as an optional field within the payout request:

"complianceDetails": {
    "requesterIpAddress": "172.101.0"
  }

Making the request

Here's an example payout request using the Create payment endpoint.

curl -X "POST" "https://api.sandbox.bvnk.com/api/v1/pay/summary" \
     -H 'Authorization: Hawk id="cs32OwgPsxZIB642vqiclSFGBClYJ9LjVpq7n8xFKoytc8Fn9xRZBAuUQ4uRvOMe", ts="1635330255", nonce="0T7Ynn", mac="WpvsRJmKIgS/2xaM5Sfj7U7Tr3cuRFHaxIcT/A4ugP8="' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "amount": 40,
  "currency": "EUR",
  "reference": "df58eff9-76bc-4fd7-b7a5-3bdfbb003c95",
  "type": "OUT",
  "merchantId": "9a57c17a-1eef-48ff-83d0-b5892c99f767",
  "payOutDetails": {
    "address": "0xc70a3deb2971346544c87e77c1736757e889619f",
    "currency": "ETH",
    "code": "crypto"
  },
  "complianceDetails": {
    "requesterIpAddress": "172.101.0"
  }
}'

Let's go through the details you'll supply in the payout request.

ParameterTypeDescription
merchantIdstringYour Merchant ID. You can find it on the Merchant Details page in your account.

See this guide for creating one
referencestringYour unique reference for the payout.
amountbig decimalThe amount to payout in the display currency.
currencystringThe currency code for the currency you'd like to display the payout value in - which will be debited from your merchant account.
typestringSet to OUT to define this as a payout.
payoutDetails.addressstringAn optional field to collect the crypto address and prevent the user from needing to enter it into a hosted page.
payoutDetails.currencystringAn optional field to collect the currency the user wants to be paid out. If you'd like to let them select, then leave this field out and send them to the hosted page to select.
payoutDetails.codestringSet to crypto.
complianceDetails.requesterIpAddressstringThe IP of the payout requester (optional)