feat(stash-pay): WebKit same-tab redirect (2.3.0) — no extra tabs - #8
Closed
anton-stash wants to merge 3 commits into
Closed
feat(stash-pay): WebKit same-tab redirect (2.3.0) — no extra tabs#8anton-stash wants to merge 3 commits into
anton-stash wants to merge 3 commits into
Conversation
On Safari/iOS, skip the cross-origin iframe drawer and open checkout in a new tab so Google Pay / Apple Pay can complete first-party. Chromium keeps the existing iframe path. Popup-blocked falls back to location.assign. Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Partner requirement is no extra tabs. On WebKit, skip the iframe drawer and location.assign to checkout so wallets run first-party in the same tab. Document that in-page onSuccess/onFailure/onClose will not run after unload. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@stashgg/stash-payskips the iframe drawer and same-tab redirects vialocation.assign(checkoutUrl)so Apple Pay / Google Pay run first-party with no extra tab (explicitly notwindow.open).preferRedirectOnWebKit(defaulttrue),onTopLevelNavigation({ url, mode: 'redirect' }).onSuccess/onFailure/onCloseon WebKit; fulfillment via webhooks + checkout return URLs.onOpen/onReadystill fire immediately before assign.Why redirect (not new tab / not iframe)
dpm=gpayhandoffwindow.openlocation.assign(this PR)Huuuge rollout
@stashgg/stash-pay@2.3.0Test plan
window.open; callback order before assign; URL validation still throwsdpm=gpayhandoff tabNote
Medium Risk
Safari/iOS checkout UX and callback semantics change (no in-page success/failure after redirect); integrators must confirm webhooks and return URLs; Chromium path is unchanged.
Overview
@stashgg/stash-pay 2.3.0 changes how checkout opens on WebKit (Safari + iOS): instead of the iframe drawer, the SDK same-tab redirects with
location.assign(checkoutUrl)so Apple Pay / Google Pay run first-party without an extra tab. Chromium still uses the iframe drawer.New API:
preferRedirectOnWebKit(defaulttrue),onTopLevelNavigation({ url, mode: 'redirect' }), and exportedisWebKitEngine(). After redirect the host page unloads —onSuccess/onFailure/onClosewon’t run on WebKit; partners should rely on webhooks and checkout return URLs.onOpen/onReadystill fire in order before assign.Adds Vitest + happy-dom and unit tests for WebKit detection and redirect vs iframe branches. README and MIGRATION document the Safari behavior change.
Reviewed by Cursor Bugbot for commit 076bb33. Bugbot is set up for automated code reviews on this repo. Configure here.