Repo cannot run anymore : updated stripe payment-intent#4
Conversation
| async function getProductsAndPlans() { | ||
| return Promise.all([ | ||
| stripe.products.list({}), // Default returns 10 products, sorted by most recent creation date | ||
| stripe.products.list({ type:'service' }), // Default returns 10 products, sorted by most recent creation date |
There was a problem hiding this comment.
Before without this change the array of product was empty,
We need to add type:service in order to get our products.
discussion here
| }], | ||
| // trial_from_plan: true, | ||
| expand: ["latest_invoice.payment_intent"], | ||
| payment_behavior:'allow_incomplete' |
There was a problem hiding this comment.
We now need to add a payment_behavior, otherwise the default behavior is an error returned by stripe.
Then we cannot get any response object with payment_intent.
Hence we have to add that key : payment_behavior that we can set to allow_incomplete
| req.body.paymentMethodId, | ||
| customerInfo, | ||
| ); | ||
| } catch (err) { |
There was a problem hiding this comment.
Added a try/catch, i was not getting any error before,,
| /* Do NOT share or embed your client_secret anywhere */ | ||
| const { client_secret, status } = payment_intent; | ||
| if (status === "requires_action" || status === "requires_payment_method") { | ||
| if (status === "requires_action" || status === "requires_payment_method" || status === "requires_source_action" ) { |
There was a problem hiding this comment.
the status we get when setting payment_behavior: allow_incomplete is now requires_source_action
| <script> | ||
| /* Replace with Publishable Stripe Key */ | ||
| var stripe = Stripe('pk_test_***********************'); | ||
| var stripe = Stripe('pk_test_sN8QMwBCcsybtkQMue7JrgLT00yNdFd4d4'); |
There was a problem hiding this comment.
😓 I removed that one in the next commit
|
@code-nebula Hey, i made a pull request for you repo, |
Description
The purpose of this PR is to update the repo with the recent changes that were made to stripe API (Payment Intent)
Without theses changes the repo cannot be run !