#Nadiya-fetch-payment
1 messages · Page 1 of 1 (latest)
Hey there, a py_xxx is still a "charge" it is just a non-card payment. You can still fetch it via https://stripe.com/docs/api/charges/retrieve
it doesn't matter even if its not start with ch_xxx ?
Correct
i see.. thank you
But another question!
i'm trying to store the order details to db for future reference, so which id from the stripe payment event/s do you recommend to store?
there is also a payment_intent id returned along with the url after the payment
You likely want to listen for payment_intent.succeeded
That will contain all the information you want
it'll return paymentInent object right?
so, i should save paymentIntent's id on the database?
sorry, i'm kinda new to this
No problem. It really depends on what you want... the PaymentIntent object will contain the associated Charge: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-charges-data. So you can grab the Charge ID from that and then retrieve the charge later for more info. Or, you can listen for charge.succeeded and payment.succeeded and ingest the charge ID and its associated details immediately.
Really up to you.
okay, that means we can fetch all other details using the payment intent id?
Yep
how's pi_xxx and py_xxx connected?
i mean how to get the py_xxx from the payment intent id?
Th param I linked above
paymntintent.charges.data
That will have either the charge ID (ch_xxx) or the payment ID (py_xxx)... whichever is relevant based on the type of payment method used for the charge/payment
For instance, a card payment method will result in a charge object (ch_xxx) but a debit payment method (like ACH Debit) will result in a payment object (py_xxxx)
Both will show up in the same param on the PaymentIntent
understood , thanks
i just checked the paymentIntent retrieve api from stripe cli, and found the ch_xxx in charges.data
but here, it shows py_xxx ?
The page you are looking at in the Dashboard is the result of the transfer to your Connected Account
That is not the same charge that you retrieved
Looks like you are using Destination Charges or Separate Charges and Transfers?
destination charge
Yeah so you are currently retrieving the charge on your Platform, which also creates a transfer (tr_xxxx) on your platform, and a payment (py_xxxx) on your Connected Account.
The page you are looking at above is actually the payment on your Connected Account. That represents the funds coming into your Conneected Account from your Platform.
So it won't be associated with the PaymentIntent.
I'd recommend taking a glance at the flowchart in our docs here: https://stripe.com/docs/connect/destination-charges#flow-of-funds-app-fee
It may help to visualize the above
thanks, let me check