#deepstitch - Setup Intent
1 messages ยท Page 1 of 1 (latest)
Hi!
Yeah you want to use this method
https://stripe.com/docs/js/setup_intents/confirm_setup
This is what I tried
that documentation states that the "elements" object must be passed in JSON, but the format doesn't seem correct
Can you share a code snippet?
That is a functioning JS function signature. I've used it many many times
here's how I've tried
I mean, I use async, await but otherwise it's the same
Here's the card element being mounted
the SetupIntent comes from our server
this works fine
Here's where we attempt to confirm the setupIntent
The first block of code is fired when the user clicks "Change" to modify the payment method. The second block is triggered after clicking "Save" on the card info
how should that be - using ES3/5?
Your call to confirmSetup fails, yes?
Okay. So your syntax is incorrect, as I said.
how should I structure that? it's not clear as the syntax in the documentation is written for ES6
Looking into this
thanks
Can you try not using the key and just passing the Element object?
i tried that, but webpack won't compile with gulp
Unfortunately it appears that, in our Typescript support, you may need to ignoring/overriding type definitions. We call this out here:
https://github.com/stripe/stripe-js#typescript-support
we recommend updating to the latest version, or ignoring and overriding the type definitions as necessary.
๐ @rare pike stepping in here.
I think the issue actually is that you are attempting to pass your payment element to confirmSetup instead of your elements instance
Can you break out your elements instance creation and your payment element creation into two separate calls?
ah
I'll try that
So, send this element:
corpstripe.elements({clientSecret : resp.token})
Yep
Here's what I have now (please excuse the Angular-JS usage - this is an old application that works well and we've not migrated it to Angular 13)
Sure looks fine. Now pass $scope.billing_elements to confirmSetup
yes, and here's a little more from the debugger - element object info on the right
It should be elements not element
๐
And, may I say, again this Discord is the best I've ever been a part of.
If you don't mind taking a moment, can you try removing elements and just passing the $scope.billing_elements object?
I'm curious if that errors or not
So instead of confirmSetup({elements: $scope.billing_elements}) just do confirmSeetup({$scope.billing_elements})
you mean like this:
confirmSetup($scope.billing_elements)
same error as before, method doesn't read the object when called. "expected either elements or ..."
Was that with {} or without or both?
you're welcome. thanks for the help. have a great day.