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

Can't specify client_secret on SetupIntent confirm #735

Closed
tbartley opened this issue Dec 4, 2019 · 2 comments
Closed

Can't specify client_secret on SetupIntent confirm #735

tbartley opened this issue Dec 4, 2019 · 2 comments

Comments

@tbartley
Copy link

tbartley commented Dec 4, 2019

I'm trying to write automated tests around my usage of SetupIntents.

To simulate client activity I want to call Stripe.setupIntents.confirm as a client but I cannot specify the client_secret to do this. Without specifying client_secret the confirm call fails reporting client_secret as a missing parameter.

For example, the call to confirm in the code below fails with Error: Missing required param: client_secret:

import Stripe = require('stripe')

const stripeServer = new Stripe('sk_test_....')
const stripeClient = new Stripe('pk_test_....')

const setup = await stripeServer.setupIntents.create({usage: 'off_session'})
const confirmed = await stripeClient.setupIntents.confirm(setup.id, {payment_method: 'pm_card_visa'})

I would expect to be able to write:

const confirmed = stripeClient.setupIntents.confirm(setup.id, {payment_method: 'pm_card_visa', client_secret: setup.client_secret})

but client_secret is not a defined property of ISetupIntentConfirmOptions

Is this just an inadvertent omission in ISetupIntentConfirmOptions or am I trying to do things the wrong way?

Hacking ISetupIntentConfirmOptions to allow a client_secret option allows the confirm call to succeed. I wonder if this is specify to the typescript types definition file which was all I needed to hack in order to get this to work.

@remi-stripe
Copy link
Contributor

@tbartley Thanks for reporting! We don't have Typescript definitions for stripe-node today so you must be using a third-party library like DefinitelyTyped. You would need to work with them on a fix instead.

We're actively working on Typescript definitions this quarter though and are planning a beta soon! If you're interested, I'd recommend following the related issue here: #296

@tbartley
Copy link
Author

tbartley commented Dec 4, 2019

Yes. Will open a PR in DefinitelyTyped. Thanks.

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