- Compago-hosted page —
https://app.compago.com/checkout/pl/{id}(the canonical URL you share with customers). - Embeddable iframe —
https://app.compago.com/checkout/pl/{id}/embed(renders only the checkout form so it fits inside your own site).
<iframe> at the /embed URL.
Restrictions
Embedded mode is only available for fixed-amount and subscription payment links. Product-based and flexible-amount links can’t be embedded; opening their/embed URL emits a PAYMENT_LINK_NOT_FOUND iframe event and shows a “Link de pago no disponible” message.
Embed snippet
Drop this snippet into your page, replacing the id with your payment link:Customizing the button
The submit button inside the iframe can be customized via two optional URL query parameters on the embed URL. They override the default styling for that specific embed instance — they are not stored on the payment link.+, # becomes %23.
Iframe events
The embedded checkout sendspostMessage events to the parent window so you can react without a redirect.
Events reference
Listening for events
Error codes
Theerror.code field on COMPAGO_PAYMENT_LINK_ERROR events lets you distinguish failure modes:
Sizing the iframe
The embedded checkout uses a single-column responsive layout. Recommended starting dimensions:- Width: 100% of a max ~600 px container.
- Height: 760 px (covers both fixed-amount and subscription links).
Best practices
Always verify the payment server-side
Always verify the payment server-side
The
COMPAGO_PAYMENT_LINK_SUCCESS event confirms the iframe checkout completed, but a malicious actor could spoof a postMessage. Send the paymentId to your backend and verify with the Compago API before fulfilling.Filter events by prefix
Filter events by prefix
Other scripts and browser extensions also emit
postMessage events. Always check event.data.type.startsWith('COMPAGO_PAYMENT_LINK_') before handling.Set an explicit allow attribute
Set an explicit allow attribute
Include
allow="payment" on the <iframe> so 3DS challenges and the Payment Request API work correctly inside the embed.Don't expose dev-only customizations to end customers
Don't expose dev-only customizations to end customers
The
buttonText and buttonColor query params are intended for developer-controlled embeds. Don’t accept them as user-supplied input — that would let third parties rewrite the button copy on your checkout.