Crypto Payment API: How to Integrate Crypto Payments into Your Platform
A developer-focused guide to integrating crypto payments with payment creation, callbacks/webhooks, order IDs, testing, and hosted checkout vs API trade-offs.
Short answer: a crypto payment API lets your platform create a payment request, show a hosted checkout or wallet address, receive blockchain confirmations, and update the order through callbacks or webhooks. For most SaaS platforms, marketplaces, and ecommerce products, the safest integration path is to create payments server-side, store your own order ID, verify every callback signature or token, and test the complete payment lifecycle before going live.
If you are evaluating a crypto payment API or cryptocurrency payment API, the goal is not only to display a wallet address. A production integration needs predictable order matching, callback handling, checkout UX, network/coin selection, payment status updates, and a clear fallback path for underpaid, overpaid, expired, or delayed transactions.
What is a crypto payment API?
A crypto payment API is a developer interface that allows a website, app, marketplace, or internal platform to accept cryptocurrency payments programmatically. Instead of manually generating wallet addresses and reconciling transactions, your backend calls the payment provider API, creates a payment tied to an order, and receives payment events when funds are detected or confirmed.
With BlockBee, developers can connect payment creation, hosted checkout, callbacks, and operational workflows from the BlockBee API documentation. Teams comparing providers can also review our guide to the best crypto payment processor options for businesses.
Crypto payment API integration flow
A typical crypto checkout API flow has six steps:
- Create the order in your platform. Generate an internal order ID, cart total, currency, customer reference, and success/cancel URLs.
- Create the crypto payment server-side. Your backend calls the payment API with the amount, coin/network, callback URL, and order metadata.
- Show checkout to the customer. Redirect to hosted checkout or display payment instructions returned by the API.
- Listen for callbacks or webhooks. Your backend receives payment events and matches them to the original order ID.
- Verify and update order status. Confirm the callback is authentic, check amount and confirmation state, then mark the order as pending, paid, confirmed, expired, or failed.
- Fulfill and reconcile. Deliver the product, unlock the subscription, update invoices, and record settlement or payout details.
Creating payments: what your backend should send
When you integrate crypto payments, create payment requests from your server rather than directly from the browser. This protects API credentials and keeps order totals under your control.
Your payment creation request should usually include:
- Amount and pricing currency: the fiat or crypto amount the customer must pay.
- Cryptocurrency/network: the coin or chain selected by the customer.
- Order ID: your internal identifier for reconciliation.
- Callback/webhook URL: the endpoint BlockBee should notify when payment status changes.
- Redirect URLs: success, pending, and cancel destinations for the customer experience.
- Metadata: customer ID, cart ID, invoice ID, or subscription reference where supported.
// Hosted checkout example using BlockBee's current Checkout API.
// Keep the API key server-side; never expose it in browser JavaScript.
const order = await createInternalOrder({ customerId, cartId, total });
const notifyUrl = new URL("https://example.com/webhooks/blockbee");
notifyUrl.searchParams.set("order_id", order.id);
const redirectUrl = new URL(`https://example.com/orders/${order.id}/success`);
const params = new URLSearchParams({
apikey: process.env.BLOCKBEE_API_KEY,
value: order.total.toFixed(2), // fiat order value as a decimal string
currency: "usd", // fiat currency for value
item_description: `Order #${order.id}`,
notify_url: notifyUrl.toString(), // BlockBee IPN/webhook target
redirect_url: redirectUrl.toString(), // customer return URL after payment
post: "1"
});
const response = await fetch(`https://api.blockbee.io/checkout/request/?${params}`);
const payment = await response.json();
if (payment.status !== "success") {
throw new Error(payment.error || "BlockBee checkout creation failed");
}
await saveBlockBeePayment({
orderId: order.id,
paymentId: payment.payment_id,
successToken: payment.success_token
});
return { checkoutUrl: payment.payment_url, orderId: order.id };This example uses BlockBee's hosted checkout endpoint GET https://api.blockbee.io/checkout/request/. For a fully custom address flow, use GET https://api.blockbee.io/{ticker}/create/ with a unique URL-encoded callback parameter and show the returned address_in to the customer.
Callbacks and webhooks: matching crypto payments to orders
Callbacks are the part of a cryptocurrency payment API that keeps your platform synchronized with the blockchain payment state. Your webhook endpoint should be idempotent, fast, and safe to retry.
Recommended webhook handling:
- Match by order ID: store the order ID when creating the payment and require it in callback processing.
- Verify authenticity: validate the callback using the provider’s documented verification method before trusting the event.
- Check amount and asset: do not fulfill unless the expected amount and cryptocurrency match your order rules.
- Handle multiple states: pending, detected, confirmed, underpaid, overpaid, expired, and failed should not all mean “paid”.
- Make updates idempotent: if the same webhook arrives twice, your system should not duplicate fulfillment.
For product updates related to payout notifications, see Payout Webhooks Now Available. If your platform also sends funds to users, review mass payout solutions and the BlockBee documentation.
Hosted checkout vs crypto checkout API
| Approach | Best for | Advantages | Trade-offs |
|---|---|---|---|
| Hosted checkout | Merchants that want a faster launch | Lower frontend work, familiar payment page, simpler UX | Less control over custom payment screens |
| Direct API checkout | SaaS platforms, marketplaces, wallets, and custom apps | More control over flow, order states, and embedded UX | Requires stronger backend, webhook, and QA implementation |
| Hybrid flow | Platforms that need speed now and customization later | Start with hosted checkout, move complex cases into API flows | Requires consistent order and status logic across both flows |
Testing a crypto payment API integration
Testing should cover more than a successful payment. Build a checklist that includes:
- Creating an order and payment from the backend.
- Redirecting to hosted checkout or rendering payment instructions.
- Receiving a callback and updating the correct order ID.
- Handling duplicate callbacks without duplicate fulfillment.
- Testing pending, confirmed, expired, underpaid, and overpaid states.
- Confirming customer emails, invoices, dashboards, and admin views show the same status.
- Verifying logs do not expose API keys, customer secrets, or private payment data.
For teams building a production integration, start in a controlled test environment, then run a small live transaction before opening the payment method to all customers.
Implementation checklist
- Create payments only from your backend.
- Use your own order ID on every payment request.
- Store payment provider IDs, addresses, amounts, coin/network, and current status.
- Use HTTPS callback URLs and verify callback authenticity.
- Design status pages for pending and delayed blockchain confirmations.
- Keep fulfillment separate from “payment detected” until your confirmation rules are met.
- Document refund, underpayment, and support workflows for your operations team.
FAQ
What is the difference between a crypto payment API and a crypto checkout API?
A crypto payment API is the backend interface for creating and tracking payments. A crypto checkout API usually refers to the customer-facing checkout flow, which may be hosted by the provider or embedded into your own product.
Do I need webhooks to accept cryptocurrency payments?
Yes, for a reliable production integration. Webhooks or callbacks notify your system when a payment is detected, confirmed, expired, underpaid, or otherwise updated.
Why should I use an order ID?
An order ID lets your backend match payment events to the correct cart, invoice, subscription, or account. Without it, reconciliation becomes fragile and manual.
Should I use hosted checkout or a direct API integration?
Use hosted checkout if you want the fastest implementation. Use a direct API integration if your platform needs a deeply customized payment experience, advanced order state handling, or embedded checkout UX.
Where can I start with BlockBee?
Developers can review the BlockBee docs. When you are ready to configure a live integration, create an account or sign in at dash.blockbee.io.
Next step: open the API documentation, map your order states, and test the callback flow before enabling crypto checkout for customers.
Build your crypto payment flow with BlockBee
Integrate crypto payments and payouts through a simple REST API with webhooks, libraries, and plugins — non-custodial by design.
0% fees for 7 days!