Create a crypto payment and get a redirectUrl
How to create a crypto payment and get a redirectUrl in one API call: POST /api/v1/payment, the x-api-key header, an amount in your currency (USD by default) and a redirect to checkout.
Creating a payment and getting a redirectUrl is one request in Qvard Host-to-Host API v1. This guide covers the request fields, the response and how to send the customer to checkout safely.
The request fields
Send a POST to /api/v1/payment with the x-api-key header. id is your own transaction identifier, price is the amount in currency (USD by default), currency is an optional ISO-4217 code such as INR, RUB or EUR, and paymentSystemId is optional. Keep the id unique per order, so you can match the response to your record. An unsupported code is refused with 422 unsupported_currency, too many decimal places for that currency with 422 invalid_amount_precision, and a currency with no rate with 422 rate_unavailable.
Reading the response
The response contains the payment id and the redirectUrl, which points to the hosted page at https://my.qvard.com/pay/ followed by the payment id. Store both values with the order before you redirect the customer.
Redirecting the customer
Send the customer to the redirectUrl with a normal HTTP redirect or with a link on your site. On the hosted page the customer chooses an asset and network and sees the exact amount at a fixed rate.
x-api-key: sk_live_…
{
"id": "order_1024",
"price": 12499.00,
"currency": "INR",
"paymentSystemId": 12
}
// 201 Created
{
"data": {
"id": "8f3k2a1c",
"redirectUrl": "https://my.qvard.com/pay/8f3k2a1c"
},
"code": 201,
"message": "success",
"status": true
}Handling errors and retries
If a request fails, check your records before you send it again, so that one order does not get two payments. Log the response body for support, and retry only when you have confirmed that no payment exists for that order.
Common mistakes
Do not put x-api-key in front-end code, do not treat the redirect as confirmation of payment, and do not send the price in a currency other than the one in the currency field. The final status always arrives by webhook.
An online order, step by step
When a shopper clicks pay, your server creates the payment with the order id and the cart total, then redirects the shopper to the redirectUrl. When the webhook reports paid, you mark the order as paid.
FAQ
Do I have to send paymentSystemId?
No. It is optional. Send it when you want a specific payment method; otherwise the hosted page offers the available options.
Can I reuse a redirectUrl for another order?
No. Each payment has its own redirectUrl. Create a new payment for each order.
Can the customer pay from a link I send by email?
Yes. The redirectUrl is an ordinary HTTPS page, so it works in an email or a chat. A no-code payment link from the dashboard is on the roadmap.
What amount does the customer pay?
The hosted page shows the exact amount for the chosen asset at a fixed rate for the lifetime of the invoice.
