Skip to content
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

Call to createPaymentMethod still uses previous publishable key after new publishable key is set on Stripe instance with applySettings(). #1954

Open
moony-baby opened this issue Oct 9, 2024 · 0 comments
Labels
needs triage Needs triage

Comments

@moony-baby
Copy link

moony-baby commented Oct 9, 2024

This is similar to this issue, but for the publishable key.

The following will create a payment method in the account with publishable key pk_test_xxx:

Stripe.publishableKey = "pk_test_xxx";
await Stripe.instance.applySettings();

Stripe.publishableKey = "";
await Stripe.instance.applySettings();

final paymentMethod = await Stripe.instance.createPaymentMethod(
          params: PaymentMethodParams.card(
        paymentMethodData: PaymentMethodData(
          billingDetails: billingDetails,
        ),
      ));

To me this behaviour is unexpected, as I would expect the API call that creates the payment method to use the new publishable key (i.e. the empty string).

When you inspect Stripe and Stripe.instance after the second applySettings(), the publishableKey property is blank as expected, but clearly this does not apply to the API call, as the payment method is successfully created.

I would expect no payment method to be created, as the Stripe instance has an empty publishable key.

@moony-baby moony-baby added the needs triage Needs triage label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Needs triage
Projects
None yet
Development

No branches or pull requests

1 participant