#pradeep-gururani_api

1 messages ยท Page 1 of 1 (latest)

trim mothBOT
#

๐Ÿ‘‹ 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.

ripe groveBOT
solar patrol
#

Can you share a screenshot of where it shows 'inactive'?

simple moth
#

sure

#

on stripe dashboard

solar patrol
#

It's expired

simple moth
#

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

solar patrol
#

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

simple moth
#

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 ?

solar patrol
#

OK, but the JSON in your screenshot is clearly a Coupon object. It clearly states so: object: 'coupon'

solar patrol
simple moth
#

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 ?

solar patrol
#

Well, what are you trying to show in your application with the data from the API?

simple moth
#

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

solar patrol
#

OK, so if it's a Promotion Code then you'd need to check the expires_at and active fields

simple moth
solar patrol
#

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

ripe groveBOT