#nerder-discounts
1 messages ยท Page 1 of 1 (latest)
Basically promo codes are codes you give to customers to apply a discount
Customers should only know those codes
Coupons are just for you to use on the backend
so, for instance, in my app, I'm thinking about presenting a place to to insert the promo code (customer facing)
i want a button to "apply" the code
the idea is that I use this: https://stripe.com/docs/api/promotion_codes/retrieve
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
to implement "apply", which I suspect will fail already if the coupon is not valid
in case of success will return the coupon associated with it
Yeah you can do that
If this is a custom integration, then you'll need to do the lifting to apply the code yourself
Checkout would already handle everything for you, for example, if you enabled promo codes
yes it's a custom integration
Is this a subscription one I assume?
both subscription and manual invoices
i've seen that the API is slightly different
for subscription, I can simply pass the coupon_id
instead for invoices, i to used discounts
Hi ๐
You would pass in the Coupons by ID but, as you noticed, the APIs have slightly different parameters.
For Invoices you can pass the discounts.coupon parameter with the Coupon ID https://stripe.com/docs/api/invoices/create#create_invoice-discounts-coupon
for Subscriptions, the coupon parameter is where you will pass the Coupon ID https://stripe.com/docs/api/subscriptions/create#create_subscription-coupon
Kind of. The coupon applied to the Invoice will apply the discout defined by that Coupon to a single Invoice. For Subscriptions, it depends on how often the Coupon can be redeemed but it will apply to one or more Invoices generated by that Subscription