#waqas ahmad
1 messages · Page 1 of 1 (latest)
You can fetch the promotions_code by code.
https://stripe.com/docs/api/promotion_codes/list#list_promotion_code-code
For each returning object, you'll have the coupon object:
https://stripe.com/docs/api/promotion_codes/object#promotion_code_object-coupon
Then you can do your check if the related coupon is valid or not:
https://stripe.com/docs/api/coupons/object#coupon_object-valid
Can I fetch coupon by code not promotions_code?
Sorry, I'm not understanding you. >hat code are you mentioning ? I though you were talking about promotions_code. The coupon object doesn't have code attribute:
https://stripe.com/docs/api/coupons/object
This is coupon I create using stripe dashboard. I want to valid coupon using name as highlight in image not auto-generated Id.
if you're only using the Coupon API and not PromotionCodes, then no, you need to save the 'name' in your database along with the id, and then when a customer enters the name in your webform, check with your database if it matches with the coupon.
if you use Promotion codes then you can use https://stripe.com/docs/api/promotion_codes/list#list_promotion_code-code as my colleague mentioned to validate the 'name'/'code' the customer enters on the webform.