#julio - promo code
1 messages ยท Page 1 of 1 (latest)
ok
i have use this endpoint
{{baseUrl}}/v1/promotion_codes?active=active&code=XXX
to check if my promotion code is valid.
But how can i be sure that when i'll go for {{baseUrl}}/v1/subscriptions (using in body promotion_code=valid_code
, there will not be any issue with the product i add to my subscription ? or the expired_at of my coupon/promoCode
because i'm using react native ( so not stripe.js or checkout ) . I want my users to be able to enter a promo_code and if valid, display the discount they might got. before creating any subscriptions
am i understandable ?
do you want me to provide some screenshot ?
Sorry, looking again now ๐
no sweat ๐
there will not be any issue with the product i add to my subscription
What kind of issues?
technically, i can create a coupon which only works for some products , right ?
If the coupon/promo is no longer valid the request that tries to use it will error, that's how you'll know
Yes
ok so basically here is what can happen
before creating any subscriptions
You likely want to look at using the Upcoming Invoice API then:
https://stripe.com/docs/api/invoices/upcoming
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
- User select the pricing he wants
- He types a promo code
- I validate the promo code using
{{baseUrl}}/v1/promotion_codes?active=active&code=XXX - I display the discount on the view ( knowning the percentOff of the coupon that is linked to the promotion_code )
- He click on CTA "purchased/confirm" or whatever
- I call subscription.create({promotionCode}) and i can get a error because the promotion code could be valid in time, but not available for all product
Well the promo should still work/apply, but wont provide any discount if the products don't match
(if i remember correctly)
ahhh right
Using the upcoming invoice api is likely to get you what you want, a real preview of the first invoice that would be generated
ok , there is no other endpoint allowing me to check the promo code on a specific subscription with specific product
But using this endpoint, i should already have a subcription created right ? I'm in the case where nothing is yet created
Nope, you can use it to preview a new subscription by provide only subscription_items and no subscription id
subscription
optional
The identifier of the subscription for which youโd like to retrieve the upcoming invoice. If not provided, but a subscription_items is provided, you will preview creating a subscription with those items.
ahh yes ahah i just checked this out in Postman it worked
thank , like always, i always close a discussion with you guyz with the right answer and happy ๐ Cya
Quite welcome!