#avinash_payment-refund-metadata
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always 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/1346859129351962686
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- avinash_api, 1 hour ago, 28 messages
Hi there ๐
Can you elaborate? What object did you put the metadata on originally? It's important to note that typically metadata isn't copied from one object to another unless you do so yourself:
https://docs.stripe.com/metadata#copy-metadata
i guess, its being stored in payment intent for initial payment
and when we initiate refund against that payment we store another payment ref
Basically we are trying to get payout data send to ERP system for account reconciliation ...so for all refunds we need to identify original payment reference number
Can you elaborate on what "payment reference number" means to you? I need to be sure I understand what data you're looking for, and if it's something you provided I also need to know where you put it, in order to give advice on where to look for that data later.
So we are using Zuora to get payment and zuora payment reference number gets stored in stripe during payment intent process
I'm not familiar with how Zuora built their Stripe integration, so I'm not sure what that means.
I'm removing that screenshot as it wasn't clear whether it was showing real customer data (this is a public forum so that shouldn't be done here) or test customer data.
What object were you looking at in the dashboard; what is the object ID that is in the URL of that dashboard page?
payment intent
pi_3QoTx6JLAdhVHE0c1nOpER40
Ok I see metadata on both the Payment Intent and Refund object
So what's the issue exactly?
The payment intent and refund have different metadata
If you want to see payment intent metadata on the refund object, you'll need to either set it there as well
Or expand the payment intent on the refund to see its metadata
how do I expand the payment intent on the refund to see its metadata ?
when I download itemised payout report then i can see
but from balance transaction api ..i need these two details
What balance transaction object are you looking at
Again, you're going to need to either retrieve the payment intent and refund or use expansion
curl -G https://api.stripe.com/v1/balance_transactions .....
-d payout=po_xxx
-d "expand[]"="data.source"
We are using this...but this does not give the meta data ref for refund
Yeah that makes sense
You're listing balance transactions not refunds
The metadata is on the refund
And balance transaction objects aren't expandable actually
So you'd have to retrieve the actual refund object
Never mind
data.source should be expandable
Can you paste the response body you're seeing where metadata isn't being piped through?
"id": "txn_3QhUa1JLAdhVHE0c08v71M7a",
"object": "balance_transaction",
"amount": -17000,
"available_on": 1738061461,
"created": 1738061461,
"currency": "eur",
"description": "REFUND FOR CHARGE",
"exchange_rate": null,
"fee": 0,
"fee_details": [],
"net": -17000,
"reporting_category": "refund",
"source": {
"id": "re_3QhUa1JLAdhVHE0c02DbcyCb",
"object": "refund",
"amount": 17000,
"balance_transaction": "txn_3QhUa1JLAdhVHE0c08v71M7a",
"charge": "ch_3QhUa1JLAdhVHE0c0W7jtqX6",
"created": 1738061461,
"currency": "eur",
"destination_details": {
"card": {
"reference": "2388971017207950",
"reference_status": "available",
"reference_type": "acquirer_reference_number",
"type": "refund"
},
"type": "card"
},
"metadata": {
"zrefund_number": "R-00000189"
},
"payment_intent": "pi_3QhUa1JLAdhVHE0c0rJiaRvy",
"reason": null,
"receipt_number": null,
"source_transfer_reversal": null,
"status": "succeeded",
"transfer_reversal": null
},
"status": "available",
"type": "refund"
This has refund metadata but orginal payment ref data is missing
What do you mean
I see the payment intent id attached
Like I said earlier, you'd have to retrieve or expand that to see the payment intent metadata
As you only included the payment ref data on the payment intent and not the refund
how do i established link between Orginalt payment and refund ?
right but in balance transaction payload...i dont get that data
You didn't expand it
Like I said earlier, you'd have to retrieve or expand that to see the payment intent metadata
that's where my question is .... so i want two meta data reference in charge = refund
I did it ... -d "expand[]"="data.source"
If you want the payment intent's metadata, you need to expand the payment intent as well
data.source.payment_intent
To see the metadata on the paymentintent
Otherwise, I recommend just setting the payment intent's ref metadata on the refund as well when you create the refund
If you don't want to deal with expansion
The issue here is the payment intent and refund are 2 fundamentally different objects
They can each have their own independent metadata
Your payment intent's metadata is different from your refund's. So, you need to retrieve the payment intent: https://docs.stripe.com/api/payment_intents/retrieve or expand it on the refund: https://docs.stripe.com/expand to see it
Otherwise, just set the payment intent's same metadata on the refund object when creating it: https://docs.stripe.com/api/refunds/create#create_refund-metadata