#maria_35254
1 messages ยท Page 1 of 1 (latest)
Hello
You can use a duration coupon here
As long as the next Invoice is created within the duration of the coupon then it will be applied
Would it also work if I only want the coupon to be able to be redeemed once?
Yeah that would work if it is just a one-to-one relationship for Coupon to Customer
Ok yes it would be, so that's good. Would you mind sending a link to the documentation about what "using a duration coupon" means exactly?
You can set a duration_in_months (see: https://docs.stripe.com/api/coupons/create#create_coupon-duration_in_months)
That would mean the coupon applies over a certain period of time.
Ok great, thanks! So I'd need to:
- Create a coupon where duration = repeating and duration_in_months = X (probably 1 in my case) and max_redemptions = 1
- Update the customer to add the coupon
And then until the coupon expires/is redeemed once, it'll be successfully applied to the customer's next invoice for any of their subscriptions?
You don't really need to do both
If you are going to use max_redemptions = 1 then you don't need duration_in_months
But yes, if you do want it to be constrained to a duration then you could set that as well
Ah ok, I thought you originally said the duration piece was the key to allowing the coupon to be applied when billed through the API
Could I set duration to "once" and it would still work?
Ah actually I could be wrong here.
duration is meant to be used for Subscriptions specifically
So it wouldn't have any affect if you are creating one-off Invoices
In this case, I'm looking to apply them to the first invoice of a subscription
Ah okay perfect
Then you really should just set the coupon when you create the Subscription itself.
Why do you want to do this ahead of time?
Ah good question hahah -- we're using the coupon to basically apply "credits" from our app. so we don't want to apply the credits and therefore deduct them until we know the charge will go through successfully
(but before the first invoice is paid)
But since that seems to be impossible, the next best thing is to give the coupon to the customer (and deduct their credits). Even if their first try doesn't go through, at least the coupon would be applied on a subsequent attempt to pay.
Hmm sounds like really what you want here is to use the Customer Credit Balance, and not a coupon at all: https://docs.stripe.com/billing/customer/balance
Yeah, I'd love to be able to use that, but my company is choosing to use coupons instead of the credit balance for sales tax purposes ๐ฆ
If we use credit balance, the company owes sales tax on the full amount, even though the user is paying us less $
Hmm okay, well then I do think the duration_in_months is the only way to achieve this then.
Since you are applying the Coupon to the Customer and not the Subscription
Overall, I'd recommend just tracking this yourself, or using metadata or something, and then adding the Coupon on Subscription creation
That is much cleaner
Gotcha yeah I think that's the right long-term solution. Okay I'll give that a try. thanks so much!
๐