Stripe React Native Subscriptions

Viewed 1261

I'm stuck on this issue: When I try to submit this subscription, I got an error of "subscription_payment_intent_requires_action", should I handle it on client-side or there is another way to do it?

For information: I already created setupIntent (verify 3D Secure) and return payment_method

Steps: 1 - create setupIntent 2 - generate payment_method ( verify 3D Secure) 3 - create Customer and attach payment_method to it 4 - create Subscription (on back_end) => error: "subscription_payment_intent_requires_action" shows up!

Thank you all!

// Create Subscription With Payment Method + Customer ID
router.post('/createSubscription', function (req, res){
  const {payment_method, customerId} = req.body;
  var stripe = require("stripe")(stripe_sk);
  try{
  stripe.subscriptions
  .create({
    customer: customerId,
    items: [{
      plan: 'plan_HTGCI8ljPYFTHQ'
    }],
    default_payment_method: payment_method,
    expand: ["latest_invoice.payment_intent"],
    // enable_incomplete_payments: true
  }).then(subscription => {
    res.send({
      subscription : subscription
    })
  }).catch(err => {
    res.send({
      err
    })
  })
} catch (error) {
  res.send("Error : ", error);
}
});```
0 Answers
Related