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

# Troubleshooting

> Common embedded checkout issues and how to fix them.

When the checkout can't load, the modal shows a **Link Not Found** page with the
reason under it. Find that reason below.

> [accordion] onSuccess never fires after payment
>
> `Playto.checkout()` never calls an `onSuccess` you pass to it. Success is
> reported only by **`Playto.handleReturn()`**, so call it on the page the
> customer returns to — that's what reads the result from the URL.
>
> Also confirm your `returnUrl` points to a page that actually loads the SDK and
> calls `handleReturn()`, and that nothing on that page removes `playto_status`
> from the URL before `handleReturn()` runs.

> [accordion] The modal opens but the checkout area is blank
>
> Usually a **Content-Security-Policy on your site** blocking the iframe. Allow
> Playto as a frame source:
>
> ```
> Content-Security-Policy: frame-src https://app.playto.so;
> ```
>
> Also check the browser console for the real error and confirm the product id
> exists and is active.

> [accordion] “Could not load playto.js”
>
> The script URL is wrong or blocked. Use
> `https://app.playto.so/pay/playto.js`. If you have a `script-src` CSP, allow
> `https://app.playto.so`. For local development against a webapp dev server,
> point the script at `http://localhost:<port>/pay/playto.js`.

> [accordion] “Link Not Found” with a sandbox or live id
>
> Sandbox and production are isolated. A sandbox id only works with
> `env: "sandbox"`, and a live id only without it. Without `env: "sandbox"`, a
> sandbox id shows **Link Not Found**. Make sure the id and the `env` match, and
> that the product or invoice is still available.

> [accordion] “This domain is not approved to use Playto embedded checkout”
>
> This happens in **Live** only. The site that opened the checkout is not on an
> approved domain on your account.
>
> * Add the domain under **Playto Pay → API Key → Embedded checkout domains**
>   with **Live** switched on, and wait until it shows **Approved**.
> * An approved domain covers its subdomains, so approving `example.com` covers
>   `www.example.com` and `shop.example.com`. An approved subdomain doesn't
>   cover its parent: `shop.example.com` doesn't cover `example.com`.
> * Still testing? Pass `env: "sandbox"` with a sandbox id. Test mode needs no
>   approval.

> [accordion] “The embedding website could not be identified”
>
> This happens in **Live** only. The checkout could not read the origin of the
> page that opened it, so it cannot match it to an approved domain.
>
> * Open your page from a real `http(s)` address. A page opened from a file on
>   your computer (`file://`) or inside a sandboxed iframe has no usable origin.
> * Load playto.js from `https://app.playto.so/pay/playto.js`.
> * Still testing? Pass `env: "sandbox"` with a sandbox id. Test mode needs no
>   approval.

> [accordion] “This checkout opens from the merchant's website with playto.js”
>
> The embedded checkout runs only inside the modal that `Playto.checkout()`
> opens. You will see this message if:
>
> * The checkout address (`/pay/checkout?…&embed=1`) was opened directly in a
>   browser tab.
> * playto.js did not answer within about two seconds. Check that it loaded from
>   `https://app.playto.so/pay/playto.js` and is not blocked.
>
> To share a link a customer can open on its own, use the product's
> `checkout_url` instead.

> [accordion] “A valid merchant return URL is required for embedded checkout”
>
> This happens in **Live** only, when the customer starts to pay. The
> `returnUrl` is not an `http(s)` URL (for example `mailto:` or `javascript:`),
> or is longer than 1000 characters. Pass an `http(s)` URL, such as
> `https://example.com/thanks`. A relative URL such as `/thanks` is fine:
> playto.js turns it into a full one.
>
> Test mode doesn't show this error. It ignores such a `returnUrl`, and the
> customer may not be sent back to your page after paying. Fix it before going
> live.

> [accordion] The customer isn't sent back to my page after paying
>
> Embedded checkout returns the customer to your `returnUrl`. If you don't pass
> one, it uses the page that opened the checkout. It ignores any redirect URL set
> on the product or invoice.
>
> * Pass a full `returnUrl` to send customers somewhere other than the current
>   page.
> * The page at `returnUrl` must load playto.js and call `Playto.handleReturn()`
>   to read the result.
> * Closing the modal with the close button doesn't send the customer anywhere.
>   Only `onClose` fires, with the reason `"user"`.

> [accordion] Popup blocked
>
> The embedded checkout does **not** rely on popups — the card form is shown
> inside the checkout itself, so popup blockers don't affect card entry. If you
> built a custom flow that opens a window, trigger it directly from the user's
> click.

> [accordion] I want to preview it without a real product
>
> Pass `demo: true` to `Playto.checkout()`. It renders a sample product and a
> simulated gateway — the full flow, no backend, no charge.

## Still stuck?

Email [support@playto.so](mailto:support@playto.so) with the product id, the page
you're embedding from, and any console errors.
