File tree Expand file tree Collapse file tree 4 files changed +9
-4
lines changed
components/settings/Account Expand file tree Collapse file tree 4 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ export type Account = {
33
33
unconfirmedEmail ?: string ;
34
34
stripePaymentActionUrl ?: string ;
35
35
onboardSkipped ?: boolean ;
36
+ paymentAttemptCount ?: number ;
36
37
notificationPreferences ?: {
37
38
billing : "email" | "none" ;
38
39
updates : "email" | "none" ;
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ export const BillingAlert = () => {
128
128
return null ;
129
129
}
130
130
131
- const { status, stripePaymentActionUrl } = meQuery . data ;
131
+ const { status, stripePaymentActionUrl, paymentAttemptCount } = meQuery . data ;
132
132
133
133
if ( status === "paymentVerification" ) {
134
134
const message = ! stripePaymentActionUrl ?. startsWith (
@@ -147,7 +147,10 @@ export const BillingAlert = () => {
147
147
) ;
148
148
}
149
149
150
- if ( status === "invalidPayment" ) {
150
+ if (
151
+ status === "invalidPayment" ||
152
+ ( paymentAttemptCount && paymentAttemptCount !== 0 )
153
+ ) {
151
154
return (
152
155
< BillingTypeAlert
153
156
title = "Your payment method was declined"
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ export const ManageBillingButton: React.FC<ManageBillingButtonProps> = ({
64
64
size = "sm"
65
65
fontWeight = "normal"
66
66
>
67
- { account . status === "validPayment"
67
+ { account . status === "validPayment" && ! account . paymentAttemptCount
68
68
? "Manage billing"
69
69
: paymentVerification
70
70
? "Verify payment method →"
Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ const SettingsBillingPage: ThirdwebNextPage = () => {
20
20
const meQuery = useAccount ( ) ;
21
21
const router = useRouter ( ) ;
22
22
const { data : account } = meQuery ;
23
- const validPayment = account ?. status === "validPayment" ;
23
+ const validPayment =
24
+ account ?. status === "validPayment" && ! account . paymentAttemptCount ;
24
25
const paymentVerification = account ?. status === "paymentVerification" ;
25
26
26
27
const [ stepsCompleted , setStepsCompleted ] = useState <
You can’t perform that action at this time.
0 commit comments