Creating a payment

To create a payment, you will need to use the Create payment endpoint.

curl -X "POST" "https://api.sandbox.bvnk.com/api/v1/pay/summary" \
     -H 'Authorization: Hawk id="gwfA3cAerOLoQstDlR2bhMtiDmgxddjolPIx8IPlMKdcsKEUFLA8cGTfnqr78dOR", ts="1704807606", nonce="cjmSmi", mac="CugWKQMl1wg0FPHrroOIe1tLUroWiuZzb3R1B/naSLU="' \
     -H 'Content-Type: application/json' \
     -d $'{
  "amount": "100",
  "reference": "6a4013c2-5fa9-4e2f-bef7-88c5570b6501",
  "merchantId": "00a4af9d-ad4b-42d5-bec4-b7a8c90161fe",
  "returnUrl": "https://yourwebsitename.com",
  "type": "IN",
  "currency": "USD",
  "payInDetails": {
    "currency": "USDT",
    "protocol": "TRC20"
  },
  "expiryMinutes": "60"
}'

Let's go through the details you'll need to supply in the create payment request

ParameterTypeRequiredDescription
merchantIdstringYesYour Merchant ID. You can find it on the Merchant Details page in your account.

See this guide for creating one
referencestringYesA reference you and your customer will see relating to the payment. This can be anything you like.
amountlongYesThe amount required to complete the payment.
currencystringYesThe currency code that you want to display the price to the end-user in.
returnUrlstringNoA URL that will be used to redirect the user if they click "back to merchant" in the payment flow.
typestringYesDictates whether you are creating a Pay IN or a Pay OUT - in this case, we are using IN to create a Pay IN.
expiryMinutesintegerNoThe amount of time you are giving the end-user to pay in. If no expiry minutes specified in your request, BVNK will default it to 20 minutes.
payInDetails.currencystringNoUse this to skip the cryptocurrency selection screen if you already know which currency your end-user is paying in. Don't send this variable if you want to give your customer the choice.
payInDetails.protocolstringNoProtocol is strictly required when supplying payInDetails.currency. The list of supported protocols per currency is available here.

After submitting this successfully, you'll receive the following response

{
  "uuid": "fef4e99d-b41d-4efe-89fd-4fdf41f3f33f",
  "merchantDisplayName": "Metallica Inc",
  "merchantId": "00a4af9d-ad4b-42d5-bec4-b7a8c90161fe",
  "dateCreated": 1704807605678,
  "expiryDate": 1704808805678,
  "quoteExpiryDate": 1704808806000,
  "acceptanceExpiryDate": 1704807636000,
  "quoteStatus": "ACCEPTED",
  "reference": "a003cec4-abf5-42aa-baf0-43a1cc815536",
  "type": "IN",
  "subType": "merchantPayIn",
  "status": "PENDING",
  "displayCurrency": {
    "currency": "EUR",
    "amount": 100,
    "actual": 0
  },
  "walletCurrency": {
    "currency": "EUR",
    "amount": 100,
    "actual": 0
  },
  "paidCurrency": {
    "currency": "USDT",
    "amount": 109.277675,
    "actual": 0
  },
  "feeCurrency": {
    "currency": "EUR",
    "amount": 1,
    "actual": 0
  },
  "displayRate": {
    "base": "USDT",
    "counter": "EUR",
    "rate": 0.915099996408
  },
  "exchangeRate": {
    "base": "USDT",
    "counter": "EUR",
    "rate": 0.9151
  },
  "address": {
    "address": "TTwyxkKzenGBhVX2TsjYLVFfApEQ3hPXGc",
    "tag": null,
    "protocol": "TRC20",
    "uri": "TTwyxkKzenGBhVX2TsjYLVFfApEQ3hPXGc",
    "alternatives": []
  },
  "returnUrl": "https://yourwebsitename.com",
  "redirectUrl": "https://pay.sandbox.bvnk.com/payin?uuid=fef4e99d-b41d-4efe-89fd-4fdf41f3f33f",
  "transactions": [],
  "refund": null,
  "refunds": []
}

Take note at this step of the redirectURL variable as we will be using this in the next step to redirect the end-user to the payment page.