Checkout SDK
The COPE Checkout SDK is a browser SDK for buyer checkout flows. It lets you fetch product data, build a cart, calculate final prices, create a hosted checkout session, and either redirect the buyer to COPE checkout or mount that checkout inside your page. Use the SDK when your site owns the product page or shopping experience and COPE owns payment collection, tax calculation, order creation, and payment lifecycle events.Install
Configuration
The SDK requires HTTPS except for
http://localhost during development.
Basic redirect flow
success_url with order_id appended:
Redirect URLs
success_url and cancel_url must be registered for the business before you can pass them to checkout(). Register them in the COPE dashboard under Settings → SDK, on the API Settings page, in the Redirect URLs section — up to 10 of each.
Passing a URL that is not registered fails the checkout call with 422 and a field error per offending value. The message points at the same screen:
Matching is exact
A registered entry is compared to the value you send as a complete URL string. It is not an origin match and not a path prefix, so every one of these is rejected when onlyhttps://shop.example.com/thank-you is registered:
If your landing page needs its own query parameters, register the full URL including them. You do not need to register the
?order_id= variant: COPE appends order_id after the value has been matched.
What you can register
- HTTPS only.
http://is rejected, includinghttp://localhost, so redirect URLs cannot point at a local development server even though the SDK itself acceptshttp://localhostas a page origin. - A public host. Loopback and private addresses such as
localhost,127.0.0.1,10.x.x.x,172.16-31.x.x,192.168.x.x, and IPv6::1or unique-local addresses are rejected. - No credentials in the URL (
https://user:pass@…) and no backslashes.
Omitting them
success_url and cancel_url are optional on checkout(). When you omit one, COPE uses the first URL registered for that field. When you send one, it must be registered.
Embedded checkout signals completion through postMessage events rather than a redirect, so iframe integrations can omit both. Keep at least one of each registered anyway: when mountCheckout() falls back with fallback: "redirect", the buyer continues on COPE hosted checkout, and that page still needs a success and cancel destination to return them to afterwards.
Embedded checkout
To keep the buyer on your page, create checkout withembed_origin and mount it with mountCheckout().