Skip to content

Embedded Checkouts: Button Stuck Loading After Successful Purchase #6735

@zaini

Description

@zaini

From another ticket (apart from the user reporting this)

Embedded Checkout Button Stuck Loading After Successful Purchase - No Redirect Handling

Description

When 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

  1. User clicks purchase button and embedded checkout opens
  2. User completes purchase process
  3. Email confirmation is received confirming successful purchase and subscription
  4. Checkout remains stuck on "Waiting confirmation from Kenzi" loading state
  5. No redirect occurs automatically
  6. User is left in limbo state despite successful transaction

Expected Behavior

After successful purchase completion:

  1. Checkout should automatically detect the successful payment
  2. User should be redirected to success page or checkout should close
  3. Clear indication that purchase was successful within the embed
  4. No manual redirect handling should be required for basic functionality

Screenshots

See attached screenshot showing the checkout stuck on "Waiting confirmation from Kenzi" state while developer console shows the successful transaction.

Image Image

Environment:

  • Operating System: Windows 10
  • Browser (if applicable): Chrome
  • Framework: Next.js (React)
  • Polar Checkout Package: @polar-sh/checkout

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 PurchaseButton

Questions

  1. Is manual redirect handling required for embedded checkout success flows?
  2. Should event listeners be implemented to detect successful purchases?
  3. Is there a callback or promise resolution that should be handled?
  4. Are there additional configuration options needed for proper redirect behavior?

Additional Context

  • Purchase processing works correctly (email confirmations received)
  • Issue appears to be with the embedded checkout UI state management
  • No clear documentation on handling post-purchase flow in embedded mode

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions