Environments
Payment Acceptance has separate Sandbox (testing) and Production (live) environments. Use the host and URLs for your target environment consistently — the REST API, the returned hosted checkout URL, and the embedded component are all environment-specific.| Environment | REST API host | Embedded component script |
|---|---|---|
| Sandbox | https://sandbox.cdp.coinbase.com/platform | https://payments.coinbase.com/sandbox/payments/components/v1/payment-link.mjs |
| Production | https://api.cdp.coinbase.com/platform | https://payments.coinbase.com/payments/components/v1/payment-link.mjs |
Keep the environment consistent across all three. For example, a Sandbox payment session will not render in the Production component.
Overview
Redirect flow
Redirect customers to a hosted checkout page.Create a payment session
Call
POST /v2/payment-sessions on the host for your environment (see Environments) with your payment details. Include a redirect object in the request body with successUrl and failureUrl to control where customers land after payment.Extract the payment URL
From the response, get the top-level
url field. This is the hosted payment page where customers complete the payment.Embedded UI
The payment UI can be embedded natively into your website using Coinbase’s<coinbase-payment> web component. This allows customers to complete payments without leaving your checkout page.
Setup
Load the web component from the URL for your target environment. Use the Sandbox URL for testing and switch to the Production URL when you go live.Rendering
Callrender() with the paymentSessionId from the POST /v2/payment-sessions response:
render() again. To navigate back to the wallet selection view, call back():
Attributes
| Attribute | Description |
|---|---|
layout | Set to "single-column" to force the small desktop view regardless of screen size. Set to "default" for the standard 2-column layout when appropriate. |
Events
The component emits Custom Events for handling payment outcomes:| Event | Description |
|---|---|
rendered | Fired when the component is ready. Includes installedWallets in detail. |
completed | Payment completed. Detail includes status: 'success' | 'failure'. |
cancelled | User cancelled the payment. |
walletAction | Wallet interaction events (selected, connected, rejected). |
pageNavigated | Navigation between views. Detail includes page name. |
paymentError | Error occurred. Detail includes error message. |
deeplink | Deeplink URL for mobile wallet redirects. Detail includes url. |
Deeplink handling (iframes)
When the component is rendered inside an iframe, it cannot redirect the browser directly. You must handle thedeeplink event to perform the redirect from the parent page:
iFrame permissions
If embedding the component inside an iframe, configure the following permissions to enable passkey and clipboard access:Theming
Customize the component appearance using CSS custom properties:All CSS custom properties
All CSS custom properties
| Property | Default |
|---|---|
--cb-color-background-primary | white |
--cb-color-background-secondary | white |
--cb-color-qr-background | white |
--cb-color-text-primary | black |
--cb-color-link-hover | - |
--cb-color-button-primary | #005bd3 (blue) |
--cb-color-button-primary-hover | #005bd3 (blue) |
--cb-color-button-primary-text | - |
--cb-color-button-border-primary | - |
--cb-color-accent-primary | - |
--cb-border-radius-button-primary | - |
--cb-color-navigation-hover | - |
--cb-color-border-primary | - |
--cb-color-icon | grey |
--cb-color-icon-background-hover | light gray |
--cb-typography-header-font-family | System |
--cb-typography-body-font-family | System |