-
Embedded Checkout Button Stuck Loading After Successful Purchase - No Redirect HandlingDescriptionWhen using Polar's embedded checkout, after completing a purchase successfully (email confirmation received), the checkout button remains stuck on "Waiting confirmation from Kenzi" and never redirects the user. The issue occurs despite the purchase and subscription being processed successfully. Related documentation: https://docs.polar.sh/features/checkout/embed Current Behavior
Expected BehaviorAfter successful purchase completion:
ScreenshotsSee attached screenshot showing the checkout stuck on "Waiting confirmation from Kenzi" state while developer console shows the successful transaction.
Environment:
Code Sample"use client"
import { useEffect, useState } from 'react'
import { PolarEmbedCheckout } from "@polar-sh/checkout/embed";
import { Button } from '../ui/button'
import { createCheckoutSession } from '@/app/actions/polar/polar-actions';
const PurchaseButton = ({ children }: { children: React.ReactNode }) => {
const [checkoutEmbedInstance, setCheckoutEmbedInstance] = useState<PolarEmbedCheckout | null>(null)
useEffect(() => {
return () => {
if (checkoutEmbedInstance) {
checkoutEmbedInstance.close()
}
}
}, [checkoutEmbedInstance])
const openCheckout = async () => {
const session = await createCheckoutSession()
const checkout = await PolarEmbedCheckout.create(session.url);
setCheckoutEmbedInstance(checkout);
}
return (
<Button onClick={openCheckout}>
{children}
</Button>
)
}
export default PurchaseButtonQuestions
Additional Context
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
I've tried adding the following but have the same issue with no redirect occuring: Following docs here: https://docs.polar.sh/features/checkout/embed |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
From some brief debugging, it seems like UPDATED: I currently suspect that the issues stem from the You can see this request returns null:
And I believe that request is being made here: The https://github.com/polarsource/polar-js/blob/main/src/funcs/checkoutsClientGet.ts I'm not sure where the actual logic for this is though... I want to see how the |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.





Fixed by following this instruction:
I was not properly setting the
embedOriginwhen using my custom checkout session.This should probably be better handled or throw some error otherwise the UI and states are quite broken. Or a default embed origin of
window.location.originshould be used.