There are two ways to take money. A checkout session (this guide) is single-use — one customer, one order — and is what you create from your server at the moment of purchase. A payment link is reusable and shareable — one URL you hand out or embed. The direct
POST /payments endpoint has been removed; every payment now starts from a session or a link.Prerequisites
- A Blockra account (app.blockra.io) with a wallet set up — this is where crypto lands. See Set Up Your Wallet; it is created in your browser under Settings → Payment Methods, and takes about a minute. To take cards as well, connect your Stripe account on the same page.
- An API key with the
payments:writeandpayments:readscopes — see Authentication.
Step-by-step
1
Create a checkout session
Call
POST /checkout/sessions with the amount, currency, and where to send the buyer afterwards. Blockra returns a hosted checkout url.Response
2
Send the customer to checkout
Redirect the buyer to
data.url, or open it in an embedded checkout so they pay without leaving your site. On the page they pick a coin, see the exact amount and a QR code, and pay. The quote is valid for 30 minutes.3
Confirm via webhook
Register an endpoint under Developers → Webhooks and listen for By the time this fires, the funds are already in your wallet. See Webhooks for signature verification.
payment.completed. Match the event to your order with the reference you passed:payment.completed event
4
Poll the payment status (alternative)
If you can’t receive webhooks, poll
GET /payments/{id} until status is terminal. The payment id arrives on the payment.* webhooks, or you can list payments filtered by your reference.Node.js
Handling edge cases
What happens if a payment expires?
What happens if a payment expires?
If the buyer doesn’t send funds within the 30-minute quote window, the payment status changes to
expired and you receive a payment.expired webhook. Create a new session if the buyer still wants to complete the purchase — the exchange rate is re-locked.What if the buyer sends too little or too much?
What if the buyer sends too little or too much?
Blockra marks the payment
underpaid or overpaid. Because the deposit address is yours, any coins the buyer sent are already in your wallet — resolve the order with them (refund or top-up) directly. The webhook payload and dashboard show the exact amounts.How do I associate a payment with a customer?
How do I associate a payment with a customer?
Pass
customer_email when creating the session. Blockra creates a customer record (or matches an existing one) and links the payment to it. Retrieve it from GET /payments/{id} in the customers field.
