Skip to content

Commit f74c6e4

Browse files
fix: stripe checkout latency (#37453)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> Currently after user check out stripe using card and redirected back to extension but stripe webhook hasn’t sent and finished processing on subscription server yet and user still see transaction not subscribed. This PR show shield settings screen loading to wait for subscription available with a timeout. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/37453?quickstart=1) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: fix intermittent stripe checkout succeed subscription not shown ## **Related issues** Fixes: ## **Manual testing steps** 1. shield plan 2. subscribe using card 3. complete stripe check out 4. extension shield settings page should always show created subscription ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Opens `settings/transaction-shield` with `?waitForSubscriptionCreation=true` after successful card checkout (when no current tab) to allow background subscription creation before redirect. > > - **Subscription flow (card)**: > - After checkout, when opened from popup (no `currentTabId`), open `'/settings/transaction-shield/?waitForSubscriptionCreation=true'` instead of `'/settings/transaction-shield'` to wait for backend subscription creation before redirecting. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 1772547. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Chaitanya Potti <[email protected]>
1 parent 4eeaf57 commit f74c6e4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/scripts/services/subscription/subscription-service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ export class SubscriptionService {
117117

118118
if (!currentTabId) {
119119
// open extension browser shield settings if open from pop up (no current tab)
120-
this.#platform.openExtensionInBrowser('/settings/transaction-shield');
120+
this.#platform.openExtensionInBrowser(
121+
// need `waitForSubscriptionCreation` param to wait for subscription creation happen in the background and not redirect to the shield plan page immediately
122+
'/settings/transaction-shield/?waitForSubscriptionCreation=true',
123+
);
121124
}
122125

123126
const subscriptions = await this.#messenger.call(

0 commit comments

Comments
 (0)