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

Not possible to specify payment_method_types #246

Open
marcingolenia opened this issue Nov 18, 2021 · 6 comments
Open

Not possible to specify payment_method_types #246

marcingolenia opened this issue Nov 18, 2021 · 6 comments

Comments

@marcingolenia
Copy link

marcingolenia commented Nov 18, 2021

Hi there!
I wanted to specify other payment methods like stated in docs;
https://stripe.com/docs/payments/p24/accept-a-payment?platform=checkout

const session = await stripe.checkout.sessions.create({
  payment_method_types: ['card', 'p24'],
  line_items: [{
...

but it seems not possible. I tried to look into the source code. It seems that in stripe.js

export function getCheckoutData(cart) {

we would need to add extra parameter (getCheckoutData function)

const options = {
    mode: cart.mode,
    paymentMethodTypes: cart.paymentMethodTypes, // THIS IS MISSING ?
    lineItems,
    successUrl: cart.successUrl,
    cancelUrl: cart.cancelUrl,
    billingAddressCollection: cart.billingAddressCollection
      ? 'required'
      : 'auto',
    submitType: 'auto'
  }

and extend the CartState thing here;

export interface CartState {

Seems like a quick win, but probably I am missing something.

@dayhaysoos
Copy link
Owner

Hey! Thanks for bringing my attention to this, I'm gonna take a deeper look at this later tonight, just wanted to let you know that I saw this!

@dayhaysoos
Copy link
Owner

@marcingolenia Which checkout mode are you using? I'm assuming you're not using any serverless functions or anything, yeah?

@marcingolenia
Copy link
Author

marcingolenia commented Nov 18, 2021

client-only, so In my gatsby site I am using this like this;

      <CartProvider
        mode="client-only"
        stripe={getStripe()}
        successUrl={`${isBrowser() && window.location.origin}/thanks/`}
        cancelUrl={`${isBrowser() && window.location}`}
        currency="PLN"
        allowedCountries={['PL']}
        billingAddressCollection={true}
      >

I use "2.4.3" version of the library.

@dayhaysoos
Copy link
Owner

@marcingolenia Yeah I should def add a way support what you're doing in client-only mode, but why are you using version 2.43?

If we were to update this, it would have to happen on version 3 >

@marcingolenia
Copy link
Author

marcingolenia commented Nov 24, 2021

The app I've built is not that new, I am going to update it soon. For now it just works :) It is absolutely clear that I will have to update.

@marcingolenia
Copy link
Author

:(

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

No branches or pull requests

2 participants