#morteza_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1257376118126940302
๐ Have more to share? Add details, code, screenshots, videos, etc. below.
this is one of the events for example
evt_3PXmhXLmjdnG8GX00goYs7MP
this is the payment intent created with stripe.net : pi_3PXmhXLmjdnG8GX00Og5r4IG
The API version in the Event object is listed as "api_version": "2022-11-15",
On which event object?
I'm looking at all 3 delivery attempts for this event and none of them have that api version
What URL received that event?
The version for the event is set by the version on the webhook endpoint
You have 4 Live and 2 test webhook endpoints on this account
I'm looking right at the Event object for that webhook endpoint and I am seeing
{
"id": "evt_3PXmhXLmjdnG8GX00goYs7MP",
"object": "event",
"api_version": "2020-03-02",
"created": 1719849883,
To be perfectly honest I have no idea. This is the exact payload our servers sent to that webhook endpoint
event: {
id: 'evt_3PXmhXLmjdnG8GX00goYs7MP',
object: 'event',
api_version: '2019-12-03',
created: 1719849883,
data: { object: [Object] },
livemode: true,
pending_webhooks: 0,
request: {
id: 'req_nWA8WlTdnMyYk2',
idempotency_key: '1719849881736028791b2-597d-4b93-969f-82fbddd7ee2dHJnyJbdU'
},
type: 'charge.succeeded'
}
can it be because of secret key ?
Oh.....
The API version that was made on this request: https://dashboard.stripe.com/logs/req_nWA8WlTdnMyYk2 is '2019-02-19'
yes
and because of that our endpoints seem to not process data correctly so can't register on the database
Which explains this response from your server
{"Code":-100,"Message":"Object reference not set to an instance of an object. 7"}
Yes, likely there is a parameter that does not exist in the older version that your code is trying to access
But i'm still having trouble understanding why we sent that older version.
Especially since the event payload we sent does not have the data you are showing
is it possible that react native stripe terminal changing something ?
this is the sdk we use for tap to pay
in the client app
That is where the API version of '2019-02-19' is being set
this ??
Yes, the RN TTP integration
but in the skd docs we don't find anywehre to change it
I'm not finding anything either
this is the package
Which is strange since you can set the API version in the iOS and Android
payment intents, connection token are crated on the backend, why would stripe terminal specify the version, im wondering
so you mean in native sdks, we can set stripe api versions ??
and they define what events api version to be
any news
I'm looking at this with another colleague. We are still trying to understand why none of our data shows that we sent an event with that API version
Did you retrieve the event yourself or just rely on the webhook payload?
I retrieved
const stripeClient = () => {
const stripeSecretKey = process.env.STRIPE_SECRET_KEY;
if (!stripeSecretKey) {
throw new Error(
"Cannot instantiate Stripe client. STRIPE_SECRET_KEY needs to be set in environment variables.",
);
}
return new Stripe(stripeSecretKey, {
apiVersion: API_VERSION,
typescript: true,
appInfo: { name: APP_INFO_NAME },
});
};
const stripe = stripeClient();
const events = await stripe.events
.list({
created: { gt: 1719831999 },
expand: ["data.object"],
})
.autoPagingEach((event) => {
if (event.data.object.id == "ch_3PXmhXLmjdnG8GX00NxYTvE9") {
console.log("====================================");
console.log({ event });
console.log("====================================");
}
});
this is how I get the event
You retrieved it with a curl command so that returned an object using your account default API version
I retrieved the payment intent with curl and get the charge id and then with the code above I get the event for that charge
Okay so this version is being specified in your request.
so you are saying that you sent the event with version 2020-03-02 ??
Yes we did
Also with version '2022-11-15' because you have some endpoints with that version
most of the endpoints work with 2020 version
but for this one we can't get data
it's weired
Yes
But, it turns out, that when you request a webhook event it will always use your account default API version
Which is 2019-02-19
So you should rely on the webhook event we send instead of attempting to retrieve it
ok if it is the case then why we can't get data I mean it's 2020-03-02
based on what you say it's 2020-03-02
yes that is the version we send
I recommend you use the Stripe CLI to resend webhook events and use it to debug your webhook listener code. https://docs.stripe.com/cli/events/resend
Sure thing! Happy to offer what help I can ๐
thanks
by this you mean api version in dashboard or the code I used to retrival ?
I mean this
Hi there ๐ taking over, as my colleague needs to step away
The default that's set in the Dashboard
ok