#morteza_api

1 messages ยท Page 1 of 1 (latest)

leaden muralBOT
#

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

vivid salmon
#

this is one of the events for example

#

evt_3PXmhXLmjdnG8GX00goYs7MP

#

this is the payment intent created with stripe.net : pi_3PXmhXLmjdnG8GX00Og5r4IG

next grail
#

The API version in the Event object is listed as "api_version": "2022-11-15",

vivid salmon
#

yes

#

for me it's

api_version: '2019-12-03',

next grail
#

On which event object?

vivid salmon
#

it must be 2020-03-02

#

evt_3PXmhXLmjdnG8GX00goYs7MP

#

rhis one

next grail
#

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

vivid salmon
next grail
#

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,
vivid salmon
#

really

#

why I see 2019

next grail
#

To be perfectly honest I have no idea. This is the exact payload our servers sent to that webhook endpoint

vivid salmon
#

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 ?

next grail
#

Oh.....

vivid salmon
#

yes

#

and because of that our endpoints seem to not process data correctly so can't register on the database

next grail
#

Which explains this response from your server
{"Code":-100,"Message":"Object reference not set to an instance of an object. 7"}

vivid salmon
#

so

#

what's the problem

#

is this because of version mismatch ?

next grail
#

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

vivid salmon
#

is it possible that react native stripe terminal changing something ?

#

this is the sdk we use for tap to pay

#

in the client app

next grail
#

That is where the API version of '2019-02-19' is being set

vivid salmon
next grail
#

Yes, the RN TTP integration

vivid salmon
#

but in the skd docs we don't find anywehre to change it

next grail
#

I'm not finding anything either

vivid salmon
next grail
#

Which is strange since you can set the API version in the iOS and Android

vivid salmon
#

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

leaden muralBOT
vivid salmon
#

any news

next grail
#

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

vivid salmon
#

ok

#

thanks

next grail
#

Did you retrieve the event yourself or just rely on the webhook payload?

vivid salmon
#

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

next grail
#

You retrieved it with a curl command so that returned an object using your account default API version

vivid salmon
#

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

next grail
#

Okay so this version is being specified in your request.

vivid salmon
#

so you are saying that you sent the event with version 2020-03-02 ??

next grail
#

Yes we did

#

Also with version '2022-11-15' because you have some endpoints with that version

vivid salmon
#

most of the endpoints work with 2020 version

#

but for this one we can't get data

#

it's weired

next grail
#

You have 4 Live mode webhook endpoints

#

3 of them have an API version of 2022-11-15

vivid salmon
#

and the other one has 2020-03-02

#

?

next grail
#

Yes

vivid salmon
next grail
#

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

vivid salmon
#

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

next grail
#

yes that is the version we send

vivid salmon
#

that's a good idea

#

thanks

next grail
#

Sure thing! Happy to offer what help I can ๐Ÿ™‚

vivid salmon
#

thanks

vivid salmon
south geyser
#

Hi there ๐Ÿ‘‹ taking over, as my colleague needs to step away

The default that's set in the Dashboard

vivid salmon
#

ok