Build a vendor integration
A complete COPE integration is three pieces: a small amount of dashboard configuration, a buyer-facing checkout page, and a backend webhook receiver that confirms each payment.1. Configure the business
In the COPE dashboard, gather three values before writing any code:| Setting | Where | Purpose |
|---|---|---|
Publishable key (cope_pk_live_...) | Settings → Developers → API keys | Safe to ship in the browser. Used by the Checkout SDK. |
Product UUID (prod_...) | Catalog | The product the buyer will purchase. |
| Embed origin (iframe checkout only) | Settings → Checkout → Embed domains | The exact parent origin that will host the iframe, for example https://shop.example.com. |
https://shop.example.com and https://www.shop.example.com are different origins.
Embed origins and success_url / cancel_url are independent allowlists. Registering an origin authorizes a parent page to iframe the checkout (and registers the domain with Stripe Payment Method Domains so browser wallets work). The success and cancel URLs are validated separately when the checkout is created and must be HTTPS. Failures look different too — an unregistered embed origin produces a browser CSP block (frame-ancestors 'none'), while an invalid success_url produces an API error on cart creation.
2. Add checkout to your page
Install the Checkout SDK. Iframe checkout requires^0.2.0 or later for mountCheckout; hosted (redirect) checkout works on any 0.x.
success_url once payment completes. Treat that landing page as cosmetic — the authoritative payment signal arrives on your backend as a webhook (next step).
See Embedded hosted checkout for the full mount contract, every callback, and the security model. The Checkout SDK overview covers the cart-building APIs.
3. Receive signed webhooks
The thank-you page is decorative. A buyer can land there directly and theorder_uuid in the URL can be forged. Treat the signed webhook delivery to your backend as the only authoritative payment signal — that is where you grant access, write to your database, and notify other systems.
Stand up an HTTPS endpoint and register it once with COPE using a server-side cope_sk_... key — that is the secret counterpart of the publishable cope_pk_... you put in the browser. Only the publishable key is safe to ship to a client; the secret key stays on your server and is rotated periodically. Once the endpoint is registered, COPE will POST every relevant event to your URL. The receiver should:
- Verify the
X-Cope-SignatureHMAC against the raw request body. - Ack
2xximmediately. Push real work to a queue. - Dedupe by
X-Cope-Event-Id—2xxdoes not guarantee at-most-once delivery.
Before going live
A handful of things easy to miss until the first real buyer trips on them:- The webhook handler grants access — not the thank-you page.
- Rotate the secret API key (
cope_sk_...) and the webhook signing secret on a schedule. Store both server-side only. - For iframe checkout, every parent origin you deploy from — preview, staging, production, custom domains — must be registered separately under Settings → Checkout. They are different origins to the browser.