Happy path
- Your server creates the link with
POST /v2/checkout-links(see Create Checkout Links), with the cart total and your order id inreference. - Your page receives the returned
data.urland renders one of the two snippets below. - The buyer pays inside your page.
- Your server confirms the order on the
transaction.paidwebhook, wheredata.checkout_link.referenceis your order id.
Inline
The checkout takes the place of adiv in your page and grows with its content.
data-checkouttakes the link’surl(or just its slug).- The script follows the page: a
divrendered later, as in React or Next, mounts when it appears, and changing itsdata-checkoutloads the new link. - Optional:
data-locale="en"sets the checkout language.
#pagou-checkout, give it the same attributes and
call PagouCheckout.mount(element):
Modal
The checkout opens over your page when the buyer clicks a button.PagouCheckout.close() closes it from your code. Opening a second modal closes the first one.
Knowing the payment finished
status is the transaction status in lowercase. On a subscription sale it fires when the
subscription starts (active, trialing or cancel_scheduled), and transaction_id is the
subscription id. No buyer data comes with it.
After the payment
When the link has asuccess_url:
- Same domain as your page: your page navigates to it.
- Another domain: the checkout shows a Continue button, and the buyer clicks it to go on.
Requirements and limits
- Your page must be served over HTTPS. The checkout refuses to load inside an
http://page. - Payment methods: Pix and cards (with 3-D Secure) work. Apple Pay is not offered inside an embedded checkout.
- Custom domain: when the link URL carries your custom checkout domain,
data-checkoutandcheckoutaccept it as is. - Custom CSS: the checkout’s custom CSS applies here too. Inline, avoid
viewport heights such as
100vh, because the frame grows with its content.
Where the checkout was embedded
Every checkout session records the origin of the page that embedded it (for example,https://shop.com), and the sale carries it in attribution.embed_origin on the transaction and
its webhooks. It is unknown when the browser hides the embedding page, and null when the
checkout was opened on its own page. It is a record, not an access control: any HTTPS site can embed
a checkout link.
Sandbox
Usehttps://checkout.sandbox.pagou.ai/embed.js with links created on the sandbox API.

