Skip to content
Developer guides

How to integrate a crypto payment API without trusting the browser

Build a crypto payment API flow with trusted server prices, saved invoice mappings and verified settlement before fulfillment.

THE SHORT ANSWER

A crypto payment API connects your order system to invoice creation and verified settlement. With Coinvay, your server creates the invoice, the customer pays through hosted checkout, and your backend confirms payment before delivering the order.

Put your order system in charge

Start with a server-side order containing the product, trusted USD price, customer reference and fulfillment status. Your browser should send a product identifier rather than an editable payment total. The backend retrieves the catalog price and calls POST /api/invoices with its merchant bearer key. Save the returned invoice ID against the order before showing the checkout link. This mapping is how later payment evidence reaches the correct purchase.

Handle the whole lifecycle

Resolve checkoutPath against https://coinvay.com and redirect the customer there. Treat the return to your website as navigation, not a payment notification. A customer can close checkout, return early or edit browser parameters. Confirm Paid through authenticated GET /api/invoices/{id}, or process a signed payment.completed webhook on an eligible plan. Match the invoice, order reference, expected amount and currency before scheduling fulfillment.

Design a recoverable integration

For example, a digital shop can store order BOOK-204 with its invoice ID and a pending entitlement. When payment is verified, one database transaction records the settlement and creates an entitlement job. A worker can retry delivery without charging again. Use the same order-specific Idempotency-Key after ambiguous invoice-creation timeouts, and make fulfillment independently idempotent. During an outage, leave the order awaiting confirmation instead of guessing that a transaction succeeded.

Practical checklist

  • Keep the merchant key in backend secret storage, outside browser and mobile bundles.
  • Persist the order-to-invoice mapping and trusted amount before redirecting.
  • Test unpaid, duplicate, delayed and already-fulfilled orders before accepting customers.

Common questions

Do customers need a Coinvay account?+

Hosted invoice checkout does not require a merchant account from the payer. The merchant backend still needs authenticated access to private invoice status.

Can I use only a redirect URL to deliver the product?+

No. Verify payment on the server and check the saved order mapping. A success-looking page or return URL is not settlement evidence.

Sources and further reading

Primary references and Coinvay product documentation. Check the linked pages for current details.

  1. Coinvay merchant API documentation

AI-assisted drafting, published by Coinvay. Examples are illustrative. Read our editorial approach.

Back to all articles