#pradeep-gururani_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1222854188040458301
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Can you share a screenshot of where it shows 'inactive'?
It's expired
I'm sorry, I need to rephrase the question, although its showing expired on stripe dashboard, but when we fetch the coupon details from stripe API, it returns valid:true
That's the parent Coupon object, not the Promotion Code
They're separate entities โ a Coupon have multiple Promotion Codes and it's validity is separate to whether or not the promo has expired or not
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
That's the field you're looking at in that JSON. The screenshot for the Dashboard is for a Promotion Code object: https://docs.stripe.com/api/promotion_codes/object
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
we're using this code to fetch the coupon details, hitting endpoint https://api.stripe.com/v1/promotion_codes
const promoCode = await axios({
url: 'https://api.stripe.com/v1/promotion_codes',
method: 'get',
headers: {authorization: `Bearer ${process.env.STRIPE_SECRET_KEY}`},
params: {
limit: 100
}
}).then(response => response).catch(error => error);
const promotionCodes = _.get(promoCode, 'data.data', []);
so we need to check validity separately for each coupon code ?
OK, but the JSON in your screenshot is clearly a Coupon object. It clearly states so: object: 'coupon'
I don't understand what you're doing enough to answer this
ok, I apologise about the confusion, so I just need to only verify the validity of the promotion code which is part of some stripe coupon ?
Well, what are you trying to show in your application with the data from the API?
we're looking for api endpoints that can return the information about coupon and promotion separately or in the same place together
like here promo29feb1 is a promo code that any user can use to get 10 percent discount, so we're taking the code promo29feb1 and we want to check its validity
OK, so if it's a Promotion Code then you'd need to check the expires_at and active fields
this endpoint will return the above info right? https://api.stripe.com/v1/promotion_codes
Yes
The 'inactive' badge in the Dashboard is likely computed from a number of API fields โ there's no one field in the API for that