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
Parameter | Type | Required | Description |
---|---|---|---|
merchantId | string | Yes | Your Merchant ID. You can find it on the Merchant Details page in your account. See this guide for creating one |
reference | string | Yes | A reference you and your customer will see relating to the payment. This can be anything you like. |
amount | long | Yes | The amount required to complete the payment. |
currency | string | Yes | The currency code that you want to display the price to the end-user in. |
returnUrl | string | No | A URL that will be used to redirect the user if they click "back to merchant" in the payment flow. |
type | string | Yes | Dictates whether you are creating a Pay IN or a Pay OUT - in this case, we are using IN to create a Pay IN. |
expiryMinutes | integer | No | The 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.currency | string | No | Use 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.protocol | string | No | Protocol 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.
Updated 4 months ago
What’s Next