#louisplessis-coupons
1 messages ยท Page 1 of 1 (latest)
Yes : pi_3LnhBKLUeUeNVIey1BWoIbKx
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.
All right
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.
ok, do you have an example of this higher-order object in Node.js ?
Yup, since you're applying the Coupon to a Customer record, that Coupon will be applied to payments generated by Subscription objects.
https://stripe.com/docs/api/customers/update#update_customer-coupon
https://stripe.com/docs/billing/subscriptions/coupons#discount-customers
Are the recurring payments that are generated from Subscriptions what you're trying to discount, or are you trying to accomplish something else?
louisplessis-coupons
i'd like to intend a discount on a one time paiement but not with checkout method like this : https://stripe.com/docs/payments/checkout/discounts, but with Stripe element : https://stripe.com/docs/payments/accept-card-payments?platform=web&ui=elements
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,
});`
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