> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cuprice.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Checkout Link

> Send buyers from your pricing page to the checkout you already run

Cuprice does not take payments. When a buyer picks a plan, Cuprice sends them to a checkout link you own, with the plan, price and currency attached. The page or API route behind that link creates the payment with the provider you already use, such as Stripe, Paddle, Lemon Squeezy or Payriff. The money and the customer record stay with you and your provider.

## Set the link

**1. Open the payment settings**

In the builder, open **Integration** and expand **Payment**.

**2. Paste your checkout URL**

Enter the address that starts checkout on your side, for example `https://yourapp.com/billing/checkout`. It has to be a full address starting with `https://` or `http://`.

**3. Choose the embed behavior and save**

Pick **Redirect** or **postMessage** (see below), then click **Save payment settings**.

The link applies to your published page as soon as you save it. Every plan on the page and the custom plan card use this one link, so your checkout tells plans apart by the `plan_id` and `cuprice_plan_id` query parameters. [Checkout Flow](https://docs.cuprice.io/payments/checkout-flow.md) lists everything Cuprice sends.

## Redirect or postMessage

| | Redirect | postMessage |
| - | - | - |
| What happens | The browser goes to your checkout link with the plan in the query string | The embed fires a `cuprice:checkout` event on your page with the full JSON payload |
| Works on | The share link and embeds | Embeds only |
| Pick it when | Your checkout is its own page or a hosted checkout | You want to start checkout inside your own page, for example in a modal |

With **Redirect** inside an embed, the whole browser tab moves to your checkout, not only the iframe.

With **postMessage**, the checkout link must still be set, because Cuprice does not build the payload without one. The standalone share link has no host page to receive the message, so its buttons do nothing in this mode. Choose Redirect if buyers also use the share link.

Listen for the event on the page that holds the embed:

```javascript theme={null}
document.addEventListener("cuprice:checkout", function (e) {
  const { payload, handoffUrl, shareId } = e.detail;
  // payload.plan.id, payload.plan.amount, payload.plan.interval, payload.features
  // handoffUrl is your checkout link with the query parameters already added
  startCheckout(payload);
});
```

`startCheckout` stands for your own code. The payload fields are described in [Checkout Flow](https://docs.cuprice.io/payments/checkout-flow.md#the-checkout-payload).

## Without a checkout link

Until you set a link, buyers cannot check out:

| Where the buyer clicks | What happens |
| - | - |
| A plan on the pricing page | An error: "Online checkout isn't set up for this page yet. Contact the company to sign up." |
| The custom plan card | The card asks for the buyer's name and email instead. The request, with the chosen features and price, appears under **Dream plan requests** in your dashboard. |
| A plan in the embedded billing widget | The widget fires `cuprice:plan-selected` on your page and does nothing else. |

## Test the handoff

Cuprice has no test mode of its own. To check the flow before buyers use it:

1. Ask Cuprice for the payload your checkout will get for a plan, without clicking through the page. The `handoffUrl` in the response is the exact link a buyer would be sent to.

   ```bash theme={null}
   curl "https://app.cuprice.io/api/share/YOUR_SHARE_ID/checkout-payload?planId=768&billingInterval=month"
   ```

   Plan IDs come from the [Share API](https://docs.cuprice.io/api-reference/share.md). See [Checkout Payload](https://docs.cuprice.io/api-reference/checkout-payload.md) for the full response.
2. Run your checkout route against your payment provider's test or sandbox mode.
3. To click through the real page, point the checkout link at your staging route, try it, then put the live URL back. Real buyers use the same link in the meantime, so do this before you share the page.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.