#jvheaney
1 messages · Page 1 of 1 (latest)
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.
- jvheaney, 3 days ago, 10 messages
That event doesn't get called right away. It can take multiple days for it to fir, because it's used for payment methods like ACH, which take 3 to 5 business days.
If you want immediate confirmation for cards, then use checkout.session.completed
I see, and would that change why I can't see anything in the dashboard logs?
No. If that's not firing, it's either because you're taking an asynchronous payment method (which means you'd have to wait a couple of days to receive it), or something is going wrong in your payment flow
It has nothing to do with using Connect?
I am following the documentation to the best of my abilities, but I must be missing something
Are you using Direct, Destination, or SC&T?
Do you have an example Payment Intent ID I can look at to verify?
Interesting, I haven't seen anything like that. Here's my js code for creating a session:
const session = await stripeClient.checkout.sessions.create(
{
mode: 'payment',
line_items: [
{
price: stripeDetailsQuery.rows[0]['stripe_price_id'],
quantity: 1,
},
],
payment_intent_data: {
application_fee_amount: stripeDetailsQuery.rows[0]['fee_amount'],
},
customer: customerId,
success_url: 'http://localhost:3000/success',
cancel_url: 'http://localhost:3000/viewGpt/' + gptId,
},
{
stripeAccount: stripeDetailsQuery.rows[0]['stripe_account_id'],
}
);
This successfully creates a payment intent and returns the URL to the frontend.
If you give me a minute I can get you a payment intent ID
How can I get the payment intent ID from a session creation? I am having a hard time figuring that out, is it possible?
You have to go through the Checkout Session and attempt to pay with a test card
It will show up in the Dashboard from there, or you can retrieve it from the Checkout Session object
Where can I find it in the checkout session object? Payment intent is null when I console log it on the frontend.
Also I am still not seeing it in the dashboard
Do you have the Checkout Session ID I can look at instead?
Yup. Looking now
Thank you!
That checkout session hasn't had a payment attempt yet. You have to navigate to its URL and attempt to pay using a test card
So we've done that, this was just a test
do you want to see one with a completed flow?
Try this one:
cs_test_a16iixBrUt3lmtny94Ae1O4HaXLKwyIxDCDR6TKnsirB2DgCcgFWz8hE6U
Taking a look now
I see a Payment Intent on that object
I'm not sure where the disconnect is happening here, but that definitely has a PI attached to it
Okay, I don't see one when the link originally gets created, maybe it appears afterwards
however I still can't see it in the dashboard and it's not calling the webhook
Like I said before, a Payment Intent isn't created until you actually visit the Checkout URL and go through the Checkout payment flow
I understand, but after you complete the checkout it should call the webhook, right?
You can see the PI in the checkout session confirm API call from developer logs: https://dashboard.stripe.com/test/logs/iar_6S73yzyfAfPeyS
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Is there a place I am supposed to see it calling the webhook? I am checking the logs and cannot see anything from today
I understand, but after you complete the checkout it should call the webhook, right?
If you have a webhook setup to listen for that event on your connect accounts, yes.
I don't see any webhook endpoints setup in the platform's dashboard that are listening for Connect events. Just one for Account level events. You need to create a new webhook endpoint that listens for Connect events
I've done both in the last few days and received nothing
I will setup a new one and try again, does it take time to propagate or something?
Don't set up a new one. Set up an additional one. You have to have at least 2 webhook endpoints: 1 for events on your platform account, and 1 for events on all your connect accounts.
When you go in to create a new webhook endpoint in the dashboard, you'll see the option to toggle it on for Connect account events, so just click that and try again
That has worked, I don't know what is different now vs before but maybe I just needed a sanity check
I appreciate that help
I am not seeing line items appear in the webhook completion now though, am I supposed to use the payment intent to get the purchased item id?
Can you elaborate on what you mean? What specifically are you looking for? Where are you looking for it?
I have the webhook body, I am looking for the price id (or product id) of the item purchased. I read in the documentation (I think) that I could access this via the data object returned in the call to the webhook for event checkout.session.completed. The property line_items (which I believe has the ID) is not present on it
Do you have an Event ID for the checkout.session.completed webhook? It looks like evt_abc123
Is it in event.data.object? I have payment intent id, session id, but not event id
Checkout Session ID is fine
cs_test_a1tJ7U1guXcGAhZuaavatct4U1GgzlLbblzF3MO1CMB5c25d734eNKh7F8
The individual line_items are not included in the checkout.session.completed because they're only included via expansion when requested
You need to retrieve the Checkout Session via the API and use expansion to include line_items using expand[]=line_items
https://stripe.com/docs/expand
Am I able to do that all within the webhook function? or does that delay the 200 response too much?
You should respond to the webhook delivery first, then do any processing necessary
The success response is only intended to communicate delivery
Got it, i'll give that a try now
Okay, so now I get an error:
StripeInvalidRequestError: No such checkout.session: cs_test_a1hlqSORuQUjERwYSY7YZYucBy8CBXzrhIera5zpNryxFCW23tP84Z0Y4B
I assume it's because the checkout session is valid for a specific connect account? I have to call it with that connect account id in the header of the expand req?
If you're doing direct charge patterns and the session was created with a stripe-account header, yes, you need to retrieve it the same way
Which I wouldn't be able to get without knowledge of what the user purchased to match it up with the merchant account id, I think? Is there something I am missing?
You get it from the event we started from. If this is a Checkout session on a connected account, you're getting it to a Connect endpoint at the event has account at the top-level:
https://stripe.com/docs/api/events/object#event_object-account
Alright, that's worked now! I appreciate your help, thank you for helping us out