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="RucpDbCK06k9YxwyLzxJ7x0XgrYpdk6D3tIKDRtEKPwjvdmxCJYbffAD5T9E3M", ts="1636616294", nonce="LZ7rJs", mac="wTVRho+Ayh6rIB3OAjAGJNuF7PuDaiTA5HhlR0tx7O4="' \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"amount": "10000",
"reference": "4a393f21-1164-4b70-b82f-9611eab23b74",
"merchantId": "0a12a214-1619-43fa-9be1-0029f6a440a0",
"returnUrl": "https://yourwebsitename.com",
"type": "IN",
"currency": "JPY",
"payInDetails": {
"currency": "BTC"
},
"expiryMinutes": "60"
}'
Let's go through the details you'll need to supply in the create payment request
Parameter | Type | Description |
---|---|---|
merchantId | string | Your Merchant ID. You can find it on the Merchant Details page in your account. See this guide for creating one |
reference | string | A reference you and your customer will see relating to the payment. This can be anything you like. |
amount | long | The amount required to complete the payment. |
currency | string | The currency code that you want to display the price to the end-user in. |
returnUrl | string | A URL that will be used to redirect the user if they click "back to merchant" in the payment flow. |
type | string | 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 | The amount of time you are giving the end-user to pay in. |
payInDetails.currency | string | 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. |
After submitting this successfully, you'll receive the following response
{
{
"uuid": "9a34142a-9760-4add-84be-811589f3a784",
"merchantId": "0a12a214-1619-43fa-9be1-0029f6a440a0",
"dateCreated": 1636616283493,
"expiryDate": 1636619880451,
"reference": "9ccfe7b3-6b51-4fb8-98c9-eafdf37bb6c6",
"type": "IN",
"status": "PENDING",
"displayCurrency": {
"currency": "JPY",
"amount": 1E+4,
"actual": 0
},
"walletCurrency": {
"currency": "EUR",
"amount": 76.45,
"actual": 0
},
"paidCurrency": {
"currency": "BTC",
"amount": 0.00137295,
"actual": 0
},
"feeCurrency": {
"currency": "EUR",
"amount": 0.76,
"actual": 0
},
"displayRate": {
"base": "BTC",
"counter": "JPY",
"rate": 7283586.437962052514658218
},
"exchangeRate": {
"base": "BTC",
"counter": "EUR",
"rate": 55683.007773347885159365
},
"address": {
"protocol": null,
"address": "mnJoHg45whcRjiu42kZcF3xCUyx9kHg6Nz",
"tag": null,
"uri": "bitcoin:mnJoHg45whcRjiu42kZcF3xCUyx9kHg6Nz",
"alternatives": []
},
"redirectUrl": "https://pay.sandbox.bvnk.com/payin?uuid=9a34142a-9760-4add-84be-811589f3a784&flow=direct",
"returnUrl": "https://yourwebsitename.com",
"transactions": []
}
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 about 1 year ago