#louisplessis-coupons

1 messages ยท Page 1 of 1 (latest)

zenith steepleBOT
formal jewel
#

๐Ÿ‘‹ happy to help

#

would you mind sending the request id?

queen pulsar
#

Yes : pi_3LnhBKLUeUeNVIey1BWoIbKx

slim wind
#

Hi there ๐Ÿ‘‹ I'm jumping in as my teammate needed to step away. Please bear with me a moment while I pull up that record and take a look at it.

queen pulsar
#

All right

slim wind
#

It looks like that Payment Intent was created directly (rather than being generated by a higher-order object) so it's expected that a discount wouldn't be included as that functionality does not affect Payment Intents created directly.

queen pulsar
#

ok, do you have an example of this higher-order object in Node.js ?

slim wind
#

louisplessis-coupons

queen pulsar
#

So i do this :

#

`const customer = await stripe.customers.create({
name: req.body.name,
email: req.body.email,
coupon: coupon10,
});

  const paymentIntent = await stripe.paymentIntents.create({
    payment_method_types: ["card"],
    amount: forfait[0].prix + optionPrice,
    currency: "eur",
    customer: customer.id,
  });

  return res.json({
    paymentIntent,
  });`
hot fulcrum
#

Gotcha, unfortunately like toby said payment intents don't work with our discounts API like that. You would need to write the code yourself to subtract the discount amount from the payment intent's total

#

To be clear that is how it works with our Checkout and Invoice APIs too, the discount isn't affecting the Checkout Session or Invoice, stripe is taking the discount code, looking how much it is, and reducing the amount on the payment intent accordingly