#_lordtejas
1 messages ยท Page 1 of 1 (latest)
Sure
lib/stripe.js
import Stripe from "stripe"
export const stripe = new Stripe(process.env.STRIPE_API_KEY, {
// https://github.com/stripe/stripe-node
apiVersion: '2023-08-16',
typescript: false
})
The 2nd file web hook one is raising the error
According to the error message you are passing a null value instead of a valid String Subscirption Id
did you tired to debug your itnegration ?
I tried, the subscriptionId are there along with other ones, also show on the payments dashboard
This should be automatically generated by stripe right? rest all calls are 200
I can't find this variable: subscription_exposed_id in the object
Can you share the objectId ?
which one?
WHich you are getting 500 error
[500] POST http://localhost:3000/api/webhook [evt_1NibeaSIlVreXqjGAqYIUN5Q]
evt_1NibeaSIlVreXqjGAqYIUN5Q
In your code you have
const subscription = await stripe.subscriptions.retrieve(
session.stripeSubscriptionId
)
you need to replace it with session.subscription
https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-subscription
sub_1NibeVSIlVreXqjG8OUyc10I
instead of session.stripeSubId i need to pass just session.subscription
I was going from github and other code sources on youtube, wasn't able to find a proper next js integration, Then I went to some youtube who build similar AI sass we are building
Let me test
Thanks it helped me, You are a saviour
Here, 2nd last one is 400 I should ignore
Can you copy past that eventId here ?
evt_1Nic6ISIlVreXqjG3H7x0UyE
I haven't activated the account yet and in developer test mode
Did you try to debug your integration and understand why your endpoint responded with 400 status code ?
The eventId youa re sharing was delivered successfully to your stripe cli
However your endpoint replied with 400, check your endpoint logs and try to debug it to understand why it responded with 400 and not 200
Cool, happy to help!
I'm not sure, my whole code executed fine, if i can live with this error then I'm fine, I had my mongo db user updated. Thanks for the help @little lance You were a saviour