#allan-egidio_api
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1402354908820144211
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
hello! just want to acknowledge your question, i'll be back to it ASAP
can you share an example customer you've been testing this with where it's not working as expected?
typically coupons are directly attached to a specific invoice and not to a customer, so i'm curious how you're trying to implement this currently
All right
Hello solanum
I'm doing the following steps:
- Added a coupon/promotional code for a specific customer with ID: cus_RwVLKB9vjyxAMo
The coupon id is EWEM2u3d and the promotional code is promo_1Rsoz9S5MCZY2pF9W45mAB5l
When I create the invoice, I can see in the docs:
The coupons and promotion codes to redeem into discounts for the invoice. If not specified, inherits the discount from the invoice’s customer. Pass an empty string to avoid inheriting any discounts.
But when I'm creating the invoice, it is not inheriting the coupons/promotion codes
I'm creating the invoice for this same customer id cus_RwVLKB9vjyxAMo
Hello
Thank you for sharing more details. Let me take a look
do you have the invoice ID?
sure I created it right now in_1RspytS5MCZY2pF9txVpvZBq
Associating a customer when you create a coupon/promotion code does not automatically apply the discount to that customer. It just limits it's use to that specific customer - https://docs.stripe.com/api/promotion_codes/create#create_promotion_code-customer
Hence, you'd need to apply that promo code separate when creating the invoice
But why we have this description? something is not making sense for me sorry:
The coupons and promotion codes to redeem into discounts for the invoice. If not specified, inherits the discount from the invoice’s customer. Pass an empty string to avoid inheriting any discounts.
Why I have the option to send empty string If I want to avoid inheriting discount? How I can make it inheriting the discount from customer?
** If not specified, inherits the discount from the invoice’s customer.** How I can do it?
inherit discount from invoice customer?
I think there's a way you can "apply discounts" directly on the Customer obejct via the dashboard
Like this
There's "Apply Coupon" in the dashboard that let's you set a discount on the Customer
I will try using dashboard, but I really would need to do it by API 🙁
I don't think there's a way to apply coupon on a Customer via the API unfortunately.
It worked on this way, it applied automatically the coupon to the invoice now using apply coupon to the customer via Dashboard
omg I can't believe it 😮
There used to be a way in the Older API version - https://docs.stripe.com/changelog/basil/2025-03-31/deprecate-singular-coupon-promotion-code#changes
but in the latest version (Basil), we've removed coupon from the customer
We expect folks to use discounts parameter for the objects that support it like Subscriptions, Invoices etc
I'm taking a look here and when I apply the coupon to the customer, the coupon enter as discount to the customer
The dashboard is using https://dashboard.stripe.com/v1/customers/cus_RwVLKB9vjyxAMo
to update using dashboard
I will try to update the customer via API passing the discount object, one moment
What API version are you currently on? If you're not on Basil, you can still use coupon parameter to apply it directly to the Customer.
The dashboard is likely using an older API version under the hood.
I'm using the v1 "/v1/customers/"
All right it worked Hanzo!!!
https://docs.stripe.com/api/customers/update I have used this endpoint to update the customer with the discount: {coupon: coupon_id}
Unfortunately, in the doc, we don't have this parameter to be updated, showing there. My luck was you!
Thank you so much!
NP! 🙂 pure luck but glad you're unblocked