#julio - promo code

1 messages ยท Page 1 of 1 (latest)

steel stag
#

Can you explain more about what you're trying to do exactly?

sage wasp
#

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 ?

steel stag
#

Sorry, looking again now ๐Ÿ™‚

sage wasp
#

no sweat ๐Ÿ˜‰

steel stag
#

there will not be any issue with the product i add to my subscription

#

What kind of issues?

sage wasp
#

technically, i can create a coupon which only works for some products , right ?

steel stag
#

If the coupon/promo is no longer valid the request that tries to use it will error, that's how you'll know

#

Yes

sage wasp
#

ok so basically here is what can happen

steel stag
sage wasp
#
  1. User select the pricing he wants
  2. He types a promo code
  3. I validate the promo code using {{baseUrl}}/v1/promotion_codes?active=active&code=XXX
  4. I display the discount on the view ( knowning the percentOff of the coupon that is linked to the promotion_code )
  5. He click on CTA "purchased/confirm" or whatever
  6. 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
steel stag
#

Well the promo should still work/apply, but wont provide any discount if the products don't match

#

(if i remember correctly)

sage wasp
#

ahhh right

steel stag
#

Using the upcoming invoice api is likely to get you what you want, a real preview of the first invoice that would be generated

sage wasp
#

ok , there is no other endpoint allowing me to check the promo code on a specific subscription with specific product

sage wasp
steel stag
#

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.

sage wasp
#

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

steel stag
#

Quite welcome!