stripe / stripe-node

Node.js library for the Stripe API.
https://stripe.com
MIT License
3.9k stars 755 forks source link

Missing type in Checkout.SessionCreateParams #2096

Closed mike-hand closed 5 months ago

mike-hand commented 6 months ago

Describe the bug

types/Checkout is missing the property payment_method_data.

https://docs.stripe.com/api/checkout/sessions/create

To Reproduce

Add a params const and set the type to Stripe.Checkout.SessionCreateParams

Expected behavior

Type should be available to use. Does work when using it, typescript flags it as not available and causes unit tests to fail (just an fyi).

Code snippets

const stripeParams: Stripe.Checkout.SessionCreateParams = {
  payment_method_data: { allow_redisplay: 'always' }
}

OS

Web

Node version

v20.13.0

Library version

15.8.0 (latest)

API version

2023-10-16

Additional context

No response

remi-stripe commented 6 months ago

@mike-hand Thanks for the report! We'll work on a fix

ramya-stripe commented 6 months ago

@mike-hand The Stripe.Checkout.SessionCreateParams type was recently updated to include the property payment_method_data you are looking for.

Does work when using it, typescript flags it as not available and causes unit tests to fail

Can you elaborate what you mean by "does work when using it"?

mike-hand commented 6 months ago

"Does work when using it"... even tough typescript complains about it, when I include the property through a work-around, it works when the form is built. It's just that typescript doesn't see the type is the only issue and causes the unit test to fail if it's included within. const stripeParams = { allow_promotion_codes: true, automatic_tax: { enabled: true }, ui_mode: 'embedded',

// payment_method_data: { allow_redisplay: 'always' }, //<-- typescript/unit test complains. }

//work-around adds the property so we can use it. This property still works. stripeParams['payment_method_data] = { allow_redisplay: 'always' }

ramya-stripe commented 5 months ago

Understood

I am not able to reproduce the issue though. When using the latest stripe package, I am getting all the relevant type hints in my editor Screenshot 2024-05-30 at 9 29 23 AM

Screenshot 2024-05-30 at 9 29 49 AM

My hunch is that you are getting an older version of the stripe package where payment_method_data was not yet added to SessionCreateParams.

Can you recheck the version of the stripe package that is being used in your project? Try looking at the node_modules/stripe/package.json file

mike-hand commented 5 months ago

It's marked as updated last month. I checked before I submitted the ticket, maybe is was recently pushed?

ramya-stripe commented 5 months ago

The changes were released on April 18th in version 15.3.0 of the stripe package

ramya-stripe commented 5 months ago

@mike-hand Hoping that updating to the latest version of the package has resolved the problem for you. Closing this issue out

mike-hand commented 5 months ago

Yes! Thanks! You can close this issue.

On Wed, Jun 5, 2024 at 10:33 AM Ramya Rao @.***> wrote:

@mike-hand https://github.com/mike-hand Hoping that updating to the latest version of the package has resolved the problem for you. Closing this issue out

— Reply to this email directly, view it on GitHub https://github.com/stripe/stripe-node/issues/2096#issuecomment-2150195242, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOYCMA35XMSAGR3DD6MAXSTZF4OSZAVCNFSM6AAAAABINOG3S6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJQGE4TKMRUGI . You are receiving this because you were mentioned.Message ID: @.***>

--

Mike Hand

Web Application Developer

Liberated Syndication

libsyn.com I blog.libsyn.com I support.libsyn.com I facebook https://www.facebook.com/libsyn I x https://twitter.com/libsyn

2403 Sidney Street, Suite 210, Pittsburgh, PA 15203 USA

Phone: 412-621-0902 I Fax: 412-621-2625

~~~*~

This e-mail is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. Dissemination, distribution or copying of this e-mail or the information herein by anyone other than the intended recipient(s), is prohibited. If you have received this e-mail by mistake, please delete it from your system immediately and notify the sender.