Skip to content

Conversation

@xlisachan
Copy link
Contributor

@xlisachan xlisachan commented Jan 22, 2026

Because

  • Sentry events frequently stating the "Server Components render" error occur for the CheckoutForm component

    • CheckoutForm is a client component, but it is importing the Node server SDK for Stripe causing Next to try to bundle Stripe Node SDK into the client build and surfacing the Server Components render error
    • Validation for paymentProvider was expecting an enum
  • This occurred as some of the options for payment methods (e.g. Apple Pay, Google Pay) during checkout were not considered valid payment provider types.

  • We should distinguish payment providers and payment methods.

This pull request

  • Updates definition/usage of payment providers vs methods

Issue that this pull request solves

Closes: PAY-3439

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.

@xlisachan xlisachan requested a review from a team as a code owner January 22, 2026 16:19
@xlisachan xlisachan force-pushed the PAY-3439 branch 5 times, most recently from 6b5861a to 01d5ee3 Compare January 22, 2026 23:54
Because

Sentry events frequently stating the "Server Components render" error occur for the CheckoutForm component
        CheckoutForm is a client component, but it is importing the Node server SDK for Stripe causing Next to try to bundle Stripe Node SDK into the client build and surfacing the Server Components render error
        Validation for paymentProvider was expecting an enum

This occurred as some of the options for payment methods (e.g. Apple Pay, Google Pay) during checkout were not considered valid payment provider types.

We should distinguish payment providers and payment methods.

This pull request

Updates definition/usage of payment providers vs methods

Issue that this pull request solves

Closes: PAY-3439
Copy link
Contributor

@StaberindeZA StaberindeZA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like splitting out payment method and payment provider. I left a few comments with issues and a few questions.

Additionally, I noticed that the payment_provider differed on the Glean submit event vs success event.

{ ...params },
Object.fromEntries(searchParams),
'external_paypal'
'external_paypal' as SubPlatPaymentMethodType
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: do not use type assertion

{ ...params },
Object.fromEntries(searchParams),
selectedPaymentMethod as PaymentProvidersType
selectedPaymentMethod as SubPlatPaymentMethodType
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: do not use type assertion

@IsOptional()
@IsEnum(PaymentProvidersTypePartial)
paymentProvider?: PaymentProvidersType;
paymentMethod?: SubPlatPaymentMethodType;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: this should have a validation check that the provided values match an enum

| 'external_paypal';
| 'paypal';

export type SubPlatPaymentMethodType =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Is this type still necessary?

Is this type just a subset of values from Stripe.PaymentMethod.Type? What would the value be for an IAP payment method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this type just a subset of values from Stripe.PaymentMethod.Type?
Yes

What would the value be for an IAP payment method?
No, SubPlatPaymentMethodType only includes the current accepted payment methods during Checkout.

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.

3 participants