#0_jennifer_0

1 messages ยท Page 1 of 1 (latest)

iron bisonBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

narrow otter
#

What's the issue

sterile lodge
#

I am trying to add information related to EasyPost to my pay intents metadata, I can successfully do this for the client but the updated metadata doesnt display on the server

narrow otter
sterile lodge
#

would it be an id like this one? id": "pi_3OB1rqGqqYFSl2qM1KKIAAyk" this is my most recent event

#

"id": "pi_3OB1qPGqqYFSl2qM0w9G9A8Z" this one shows the metadata in the stripe dashboard

narrow otter
#

Sorry I thought you said metadata doesn't show?

#

Where are you not seeing metadata where you expect it to show? Because it is indeed set properly there

sterile lodge
#

it isnt showing anywhere in my nextjs server

narrow otter
#

Ok but I need specifics. What do you mean it isn't showing in your server? It isn't showing the response object you get back upon updating metadata on the payment intent?

sterile lodge
#

when I trigger a pay intent success using the CLI it successfully runs the code in my webhook but when I log out the event I do not see any metadata in the event object

narrow otter
#

Can you share the event id you're referring to?

sterile lodge
#

"id": "evt_3OB2DnGqqYFSl2qM1nAKgOnr",

narrow otter
#

Ah that's because that's the payment intent.created event. You didn't set metadata on creation. You set it in a separate api call to update the payment intent, so you won't get metadata in that event

sterile lodge
#

ah, so how do I resolve this?

narrow otter
#

What's your goal

#

If you want it in the payment_intent.created event just set metadata on creation of the payment intent instead

sterile lodge
#

I would like to send the updated pay intent info to the webhook and then upon a successful pay intent, use the webhook to buy a shipment from EasyPost, unfortunately the shipping id and rate id arent known until a user fills out the address form and then selects a shipping rate.

#

I tried doing this manually using state variables but it looks like the webhook makes a separate http request so the variables I was sending to the API were not persisting or available for the webhook so I am hoping that sending them through the pay intents meta data will resolve the issue

narrow otter
#

So you don't need the metadata until successful payment?

#

You'll have the metadata in the payment_intent.succeeded event

#

It just isn't in the created event because that event occurred before you even set the metadata

iron bisonBOT
sterile lodge
#

ah, but when I log out the pay intent succeeded event the metadata isnt showing up there either

narrow otter
#

Can you share the event id

#

Because the payment intent from the above event never succeeded

#

It's still in requires_payment_method state

sterile lodge
#

okay so if I fill out the form in test mode and hit submit on the pay button, the metadata appears as it should but running the cli isnt showing the updated metadata.

#

"id": "evt_3OB2fHGqqYFSl2qM0nEb9bMe" this event is from when I hit the submit button and this event was triggered from the cli "id": "evt_3OB2foGqqYFSl2qM0nN2q9ga",

junior sluice
#

That's because you add metadata after the payment is successful, so the state of the object hasn't been updated with metadata when you get it from the event.

sterile lodge
#

can I still access the metadata in the pay intent success webhook?

junior sluice
sterile lodge
#

Im using a custom payment flow in my nextjs app is the checkout session created when I initially create my payment intent?

junior sluice
#

Ah, apologies. I thought you said you were using Checkout. What are you using on the front-end? Payment Element?

#

Also, can you just add the metadata to the Payment Intent when it's created?

sterile lodge
#

I cannot because we dont know what the shipping rate or id will be until the user fills out their address and selects a rate option. I am using the Pay Element and Address Element and sending the information from the Address Element to the EasyPost api to get the shipping information.

junior sluice
#

That would ensure that metadata is present in your payment_intent.succeeded event

sterile lodge
#

that could work

junior sluice
#

Right on!

sterile lodge
#

my api works! I didnt need to use the on.change() event, if I fill out all of the form info and press submit, the process works and buys a shipment from EasyPost. It just doesnt work with the CLI but when we're in production that wont be an issue

junior sluice
#

Ah! Good to hear it's working where it counts

sterile lodge
#

thanks for your help! now to set EasyPosts webhook so I can fetch the tracking info ๐Ÿ˜… the life of a developer