Skip to content

Add support for ui_mode: custom in Stripe Checkout Sessions#1815

Merged
taylorotwell merged 2 commits intolaravel:16.xfrom
emaadali:custom-checkout
Dec 30, 2025
Merged

Add support for ui_mode: custom in Stripe Checkout Sessions#1815
taylorotwell merged 2 commits intolaravel:16.xfrom
emaadali:custom-checkout

Conversation

@emaadali
Copy link
Contributor

Currently, Cashier treats ui_mode: custom the same as hosted mode, causing it to incorrectly require success_url/cancel_url, and generate errors such as:

This PR ensures custom sessions are handled the same way as embedded sessions and return the Stripe session object as expected:

- if (isset($data['ui_mode']) && $data['ui_mode'] === 'embedded') {
+ if (isset($data['ui_mode']) && in_array($data['ui_mode'], ['embedded', 'custom'])) {
    $data['return_url'] = $sessionOptions['return_url'] ?? route('home');

    // Remove return URL for embedded UI mode when no redirection is desired on completion...
    if (isset($data['redirect_on_completion']) && $data['redirect_on_completion'] === 'never') {
        unset($data['return_url']);
    }
} else {
    $data['success_url'] = $sessionOptions['success_url'] ?? route('home').'?checkout=success';
    $data['cancel_url'] = $sessionOptions['cancel_url'] ?? route('home').'?checkout=cancelled';
}

@taylorotwell taylorotwell merged commit 3a8f7c7 into laravel:16.x Dec 30, 2025
7 checks passed
@emaadali
Copy link
Contributor Author

emaadali commented Jan 3, 2026

@taylorotwell This merge closes #1780

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants