#qmathe-paymentintents-timestamps
1 messages ยท Page 1 of 1 (latest)
Hi ๐
There isn't a 1:1 parity between the API and the dashboard for features like that. We don't know what the Dashboard is doing to get that second timestamp here (we're not Dashboard experts) but I would guess they are looking up the related Balance Transaction to identify when the payment completed.
Another approach would be to listen to payment_intent.payment_succeeded webhook events and store the timestamp of that event.
ok, I'll investigate whether using BalanceTransaction could be a good approach.
For your second suggestion, do you mean storing the timestamp corresponding when I received the event? I thought this was not reliable, because events could be delivered out of order.
I'm asking about this because I'm synchronizing suceeded payment intents between Stripe and my backend. On my side, the ordering is based on PaymentIntent.created. However my synchronization code gets in trouble, because PaymentIntent.list returns payments with a timestamp ordering that doesn't seem to be based on PaymentIntent.created.
The API returns PaymentIntents in reverse chronological order (most recent first)
As for the webhook timing, you are correct that is not guaranteed to be accurate. I would use the Balance Transaction created timestamp for the succeeded property
PaymentIntent->Charge->BalanceTransaction
How are you accessing the Payment Intent in the API to check the succeeded timestamp?
ok, thanks for the additional info! I'll also double-check my code, since I might be doing something wrong.
Not sure to understand your last question. For now, I don't check the succeeded timestamps.
With my synchronization code, I list recent payment intents by passing the last synchronized payment intent id to ending_before argument, then I filter out all intents whose status is not succeeded. After that, I expand each payment intent with latest_charge.transfer.destination_payment.balance_transaction, because I want to record the net amount from this balance transaction.
Okay, all I was wondering was whether you were getting the Payment Intent from a webhook event or if you were using the List API. So in that case you could use that expand parameter you mentioned to also get the BalanceTransaction's created timestamp
ok nice, I'll do this then. Thanks a lot!
Happy to help ๐