Backend crypto payment integration, step by step
Backend crypto payment integration step by step: create payments from your server, redirect customers, verify webhooks and reconcile orders.
Integrating crypto payments into a backend takes three pieces: a server call that creates the payment, a redirect for the customer and a webhook that closes the order. This guide walks through each step with the Qvard v1 API.
Step 1: store the order first
Save the order in your database with a status such as pending before you call the API. Use your order id as the id field, so the payment and the order are linked from the start.
Step 2: create the payment
From your backend, send POST /api/v1/payment with the x-api-key header, the order id in id and the total in price. Keep the API key in server configuration and never in front-end code.
Step 3: redirect the customer
Store the returned redirectUrl with the order and send the customer there. On the hosted page the customer picks an asset and network and pays the exact amount.
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
}Step 4: close the order from the webhook
Your webhook endpoint checks x-api-key, finds the order by id and sets it to paid when the status is paid. This is the only place where a payment is confirmed.
Step 5: reconcile and monitor
Run a daily check for orders that stayed pending too long and compare them with your payment records. Log every API response and every webhook for support.
x-api-key: sk_live_…
{ "id": "order_1024", "status": "paid" }Architecture tips
Keep the payment code in a small service, separate from the checkout views. You can then change the webhook handler or add a second channel without touching the rest of the shop.
FAQ
Which backend languages can I use?
Any language that can send an HTTPS POST with a JSON body and receive a webhook. The API is plain HTTP, so no SDK is required.
Where should I put the webhook URL?
Use a public HTTPS endpoint on your backend. Make sure it accepts POST and checks the x-api-key header before it updates an order.
Do I need a separate integration for each cryptocurrency?
No. The customer chooses the asset and network on the hosted checkout page, so your backend creates one payment in USD and reads one status.
Can I test the whole integration first?
Yes. Use the demo invoice flow to pay a test invoice and confirm that your webhook handler runs before you accept real payments.
