#akii
1 messages · Page 1 of 1 (latest)
https://stripe.com/docs/api/promotion_codes/list#list_promotion_code-code is how you find the PromoCode objects with a given string like that
Great now how will i get the Applicable products here??
given a PromotionCode, go and look at the coupon it's for https://stripe.com/docs/api/promotion_codes/object#promotion_code_object-coupon and check the applies_to https://stripe.com/docs/api/coupons/object#coupon_object-applies_to
so for example it's probably helpful to use expand:["data.coupon.applies_to"] when listing the PromotionCode API so you can get that information back immediately
Okay trying that
In the promotion code object, i also have the coupon object but the coupon object does not have the applies_to information Its showing me null
then it applies to all products
also make sure you are using expand to get applies_to
it is not included by default.
In the PromotionCode object I already have the coupon object, how do i use the expand param now???
what exact code did you use to get the PromotionCode object?
what exact code did you use to get the PromotionCode object?
AT50
if you list PromoCodes and use expand:["data.coupon.applies_to"] as I mention, that should work to get the applies_to information.
? that means nothing to me.
Well i passed this case sensitive code only AT50
Then this will give me list of all promo code..
Oh okay
not if you pass the code paramater as I also mentioned
Map<String, Object> params = new HashMap<>();
params.put("code", "AT50");
PromotionCodeCollection promotionCodes = PromotionCode.list(params);
cool so why don't you add expand like I told you?
Ohkay trying that
you already do
you are not passing expand, which you should
params.addExpand("data.coupon.applies_to")
if you do that and then look at your list of PromotionCodes you should see the coupon and the AppliesTo information returned.