-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(checkout-flow): handle credit card functionality #8005
Conversation
@@ -40,7 +40,7 @@ | |||
"Comment": "../../database/types/Comment#default as CommentDB", | |||
"Company": "./types/Company#CompanySource", | |||
"CreateImposterTokenPayload": "./types/CreateImposterTokenPayload#CreateImposterTokenPayloadSource", | |||
"CreatePaymentIntentSuccess": "./types/CreatePaymentIntentSuccess#CreatePaymentIntentSuccessSource", | |||
"CreateSetupIntentSuccess": "./types/CreateSetupIntentSuccess#CreateSetupIntentSuccessSource", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SetupIntent is used for subscriptions whereas createPaymentIntent is used for one-off payments
await upgradeToTeamTier(orgId, stripeToken, email, dataLoader) | ||
// TODO: remove upgradeToTeamTierOld once we rollout the new checkout flow: https://github.com/ParabolInc/parabol/milestone/150 | ||
if (paymentMethodId) { | ||
await upgradeToTeamTier(orgId, paymentMethodId, email, dataLoader) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upgradeToTeamTier
changed quite a bit now that we're using Stripe Elements and use the paymentMethodId rather than creating a stripe token using the credit card details the user gives us.
I felt that the simplest move was to rename upgradeToTeamTier
to upgradeToTeamTierOld
and create a new upgradeToTeamTier
helper function. We can remove the old one when we rollout the new checkout flow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm trying to upgrade another org after one successful upgrade, I'm getting this error:
16:11:06 1|GraphQL Executor | SEND TO SENTRY Error: payment_method
16:11:06 1|GraphQL Executor | at Object.resolve [as MutationupgradeToTeamTierResolver] (/Users/igor/www/parabol/dev/gqlExecutor.js:21603:29)
16:11:06 1|GraphQL Executor | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {}
Works after some time.
Can you reproduce?
packages/client/modules/userDashboard/components/OrgBilling/PaymentDetails.tsx
Outdated
Show resolved
Hide resolved
packages/client/modules/userDashboard/components/OrgBilling/BillingForm.tsx
Outdated
Show resolved
Hide resolved
Thanks @igorlesnenko - I could reproduce the |
const UpgradeButton = styled(PrimaryButton)<{isDisabled: boolean}>(({isDisabled}) => ({ | ||
background: isDisabled ? PALETTE.SLATE_200 : PALETTE.SKY_500, | ||
color: isDisabled ? PALETTE.SLATE_600 : PALETTE.WHITE, | ||
boxShadow: 'none', | ||
marginTop: 16, | ||
width: '100%', | ||
elevation: 0, | ||
'&:hover': { | ||
'&:hover, &:focus': { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a side note, the "Plans" panel does not have any focus behaviour which makes it impossible to use with just the keyboard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that would be nice! I've created an issue to work on that: #8085
packages/client/modules/userDashboard/components/OrgBilling/BillingForm.tsx
Outdated
Show resolved
Hide resolved
setIsLoading(false) | ||
if (error) return | ||
const {payment_method: paymentMethodId, status} = setupIntent | ||
if (status === 'succeeded' && typeof paymentMethodId === 'string') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1 What about if not? If I test with a declining card 4000000000000002 or with a 3D Secure card 4000002760003184 and decline, then there is no message at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, updated!
By the way, 3D Secure cards won't create subscriptions in this PR. It'll be handled in #7864
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before we forget, can you please also add new testing scenarios to the release test?
Could also be done a bit later, but should be logged in an issue so we don't forget.
Sure thing! I've added an issue here: #8089 |
Fix #7693
Demo: https://www.loom.com/share/66aedcba66f14d6ea1ce1dcd82217c0e
I had a look on the Stripe Dashboard to see if Igor & Georg have access, but I couldn't see any other users. I think that's because I have restricted permissions where I can't see or invite other users. So if you don't have Stripe access, please tag someone in Slack that can invite you.
I'll improve the UI after the user has upgraded in the following issue: #8006
A subscription will not be created for 3D Secure payment methods. This will be handled here: #7864
To test