Creating a payment
To initiate a payment process, utilize the Create Payment endpoint.
Important: Executing API Calls on Behalf of Your Merchant
Ensure the
x-account-reference
of your EPM is included in the API call headers. Failing to do so will result in transactions being processed under the EP account instead.
Below are the details required for the create payment request:
Parameter | Type | Required | Description |
---|---|---|---|
merchantId | string | Yes | Identifies the Merchant ID, indicating which wallet the payment should settle in. Found on the Merchant Details page. |
amount | long | Yes | The total amount needed to complete the payment. |
expiryMinutes | integer | No | Defines the time frame for the end-user to complete the payment. Defaults to 1440 minutes if not specified. |
currency | string | Yes | The currency code to present the price in to the end-user. |
returnUrl | string | No | The URL for redirecting the user back to the merchant's site from the payment flow. |
reference | string | Yes | A unique reference for the payment, visible to both you and your customer. |
type | string | Yes | Specifies the transaction type, using IN for incoming payments. |
Example Request
Here is how an example request might look:
{
"merchantId": "00a4af9d-ad4b-42d5-bec4-b7a8c90161fe",
"amount": "100",
"expiryMinutes": "60",
"currency": "USD",
"returnUrl": "https://yourwebsitename.com",
"reference": "6a4013c2-5fa9-4e2f-bef7-88c5570b6501",
"type": "IN"
}
Example Response
Upon successfully submitting the request, you'll receive a response like the following:
{
"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": "USD",
"amount": 100,
"actual": 0
},
"walletCurrency": {
"currency": "EUR",
"amount": 100,
"actual": 0
},
"paidCurrency": {
"currency": null,
"amount": 0,
"actual": 0
},
"feeCurrency": {
"currency": "EUR",
"amount": 1,
"actual": 0
},
"displayRate": null,
"exchangeRate": null,
"address": null,
"returnUrl": "https://yourwebsitename.com",
"redirectUrl": "https://pay.sandbox.bvnk.com/payin?uuid=fef4e99d-b41d-4efe-89fd-4fdf41f3f33f",
"transactions": [],
"refund": null,
"refunds": []
}
At this juncture, it's crucial to note the uuid
and redirectUrl
.
The uuid is used for querying the payment status, and the redirectUrl directs the end-user to BVNK's Hosted Payments Page for cryptocurrency selection. Since the payment currency is yet to be determined at this stage, exchange rates and paid currency values will be null.
Note that as the payment currency is not known at this stage, exchange rates and paid currency values are null
If you already know the cryptocurrency the end-user will pay with, or if you wish to limit the currencies available to a few options BVNK supports, refer to the next guide for creating a tailored payment request.
Updated 8 months ago