Closed Ehtz closed 2 months ago
Is this normal that with the triggering: stripe trigger checkout.session.completed
from CLI it creates products?
I have found the code where the issue is likely coming from:
const stripe = new Stripe(`${process.env.STRIPE_SECRET_KEY}`, {
apiVersion: '2023-08-16',
});
const userIp = await fetchIpAddress();
const userCountry = await fetchIPData(userIp as string);
const prices = await stripe.prices.list();
console.log('Prices:', prices);
const sortedPrices = prices.data
.sort((a, b) => a.unit_amount! - b.unit_amount!)
.filter(({ active, currency }) => {
if (!active) return false;
switch (userCountry) {
case 'EU':
return currency === 'eur';
case 'US':
return currency === 'usd';
case 'UK':
return currency === 'gbp';
default:
return false;
}
});
console.log('Country:', userCountry);
console.log('Sorted Prices:', sortedPrices);
return sortedPrices;
}
Now Stripe is returning archived products and this despite if (!active) return false;
Tested Live products and works... Live API is pulling the proper products which are Active, the Test is not only the inactive, maybe the API is stuck for Test?
Investigating further as to why it is returning only archived products...
Is this normal that with the triggering:
stripe trigger checkout.session.completed
from CLI it creates products?
![]()
Says it's active when called but it's not true it was archived and is archived when calling
Fixed by archiving all products and creating new ones in test dashboard
Note that you can also specify active=true
in your Prices List API request: https://docs.stripe.com/api/prices/list#list_prices-active
Note that you can also specify
active=true
in your Prices List API request: https://docs.stripe.com/api/prices/list#list_prices-active
Yes thanks for the observation, will implement this
What happened?
The issue still persists with NextJS14. It was rendering fine and now it just disappeared so wired...
Stripe API version:
apiVersion: '2023-08-16',
Stripe test dashboard is fine nothing to report... .env keys are the same as before and working. I can access Stripe Payment Page.
I haven't touched or refactored the card component just have been working with Stripe Webhooks.
I believe this occurred after i used:
stripe trigger checkout.session.completed
to test webhooksEnvironment
"stripe": "^13.2.0",
Reproduction
No response