#vikiram_api

1 messages ¡ Page 1 of 1 (latest)

gilded whaleBOT
#

👋 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/1277507286088024124

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

fringe lagoon
#

Hello, can you share the request id [0] where you included the metadata? it'd look like req_xxx and also the object id where you're expecting metadata to show but is not showing

[0] https://stripe.com/docs/api/request_ids

upbeat heath
#

req_X2NJtOuxqpRMhu

fringe lagoon
#

req_X2NJtOuxqpRMhu - this is the request where you're retrieving the Payouts. What is the request id for where you created a Payout with metadata?

upbeat heath
#

req_1lDcIX2g50bnJ8 please check this id which i have created metadata as orderid_1031715

fringe lagoon
#

req_1lDcIX2g50bnJ8 -> is where you created a Checkout Session. metadata created on a Checkout Session does not get populated or copied to a Payout object. These are two entirely separate and different objects.

If you really want to be able to trace the payment, what I suggest you do instead is include the metadata on https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata also. When you view the itemized breakdown of the payout, such as in this report for example : https://docs.stripe.com/reports/payout-reconciliation, you should be able to view the corresponding metadata for the payment

upbeat heath
#

then how an where i can create metadata, so that i can get that metadata in payout. i am doing session create like below. can you please guide me, the solution is already live.

#

LineItems = new List<Stripe.Checkout.SessionLineItemOptions>
{
new SessionLineItemOptions
{
PriceData = new SessionLineItemPriceDataOptions
{
UnitAmount = Convert.ToInt32(shopamount),
Currency = "dkk",
ProductData = new SessionLineItemPriceDataProductDataOptions
{
Name = xxxx,
},
},
Quantity = 1,
},
},
Metadata = new Dictionary<string, string> { { "order_id", yyyy} },
Mode = "payment"

fringe lagoon
#

maybe lets take a couple of steps back, why do you want that metadata in payout?

#

do you have one payout for every payment?

upbeat heath
#

i need to check each transaction created in stripe is paid to my bank or not, so based on that only i can pay that transaction amount to my client

fringe lagoon
#

well yes, if that's the case, then you should be adding the metadata to https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata and then checking the itemized breakdown of the payout, such as in this report for example : https://docs.stripe.com/reports/payout-reconciliation

Reconcile each payout with the batch of transactions it settles.

upbeat heath
#

so, when creationg seassion i have created metadata as orderid_xxxx, but when i check the payout for that transaction then i dont find that metadata ?

#

example please check this

#

{
"cancel_url": "https://www.billetsalg.dk/Payment/Decline.aspx?HF=1",
"customer_email": "leneguttekoch@gmail.com",
"line_items": {
"0": {
"price_data": {
"currency": "dkk",
"product_data": {
"name": "1030721"
},
"unit_amount": "207089"
},
"quantity": "1"
}
},
"metadata": {
"order_id": "1030721"
},
"mode": "payment",
"payment_method_types": {
"0": "mobilepay"
},
"success_url": "https://www.billetsalg.dk/Stripe/Confirm?HF=1&passpget=0&newpassgd=&newpassge=&refno=1030721&session_id={CHECKOUT_SESSION_ID}"
}

fringe lagoon
#

each Payout can have one or more payments associated with it. This is why you should check the report instead

upbeat heath
#

here i have created meta data, but in payout i dont find anything ?

#

"<Stripe.Payout@13244319 id=po_1Pr8PdGr08F4adJkigbj4yqB> JSON: {
""id"": ""po_1Pr8PdGr08F4adJkigbj4yqB"",
""object"": ""payout"",
""amount"": 69747,
""application_fee"": null,
""application_fee_amount"": null,
""arrival_date"": 1724889600,
""automatic"": true,
""balance_transaction"": ""txn_1Pr8PdGr08F4adJkH778YMvp"",
""created"": 1724461505,
""currency"": ""dkk"",
""description"": ""STRIPE PAYOUT"",
""destination"": ""ba_1PTLTHGr08F4adJkiKi8003P"",
""failure_balance_transaction"": null,
""failure_code"": null,
""failure_message"": null,
""livemode"": true,
""metadata"": {},
""method"": ""standard"",
""original_payout"": null,
""reconciliation_status"": ""completed"",
""reversed_by"": null,
""source_type"": ""card"",
""statement_descriptor"": null,
""status"": ""in_transit"",
""type"": ""bank_account""
}"

#

please check about payout why this metadata showing empty data ?

#

please check *above payout why this metadata showing empty data ?

fringe lagoon
#

to reiterate, metadata in the Checkout Session object will not show in a Payout object

upbeat heath
#

then where i have to add the metadata ? in seesion create and how can i know the payout is paid for list of metadata ?

gilded whaleBOT
fringe lagoon
#

As what I mentioned :

If you really want to be able to trace the payment, what I suggest you do instead is include the metadata on https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata also. When you view the itemized breakdown of the payout, such as in this report for example : https://docs.stripe.com/reports/payout-reconciliation, you should be able to view the corresponding metadata for the payment

upbeat heath
#

please check my sesion create, i have already adding metadata.

#

{
"cancel_url": "https://www.billetsalg.dk/Payment/Decline.aspx?HF=1",
"customer_email": "leneguttekoch@gmail.com",
"line_items": {
"0": {
"price_data": {
"currency": "dkk",
"product_data": {
"name": "1030721"
},
"unit_amount": "207089"
},
"quantity": "1"
}
},
"metadata": {
"order_id": "1030721"
},
"mode": "payment",
"payment_method_types": {
"0": "mobilepay"
},
"success_url": "https://www.billetsalg.dk/Stripe/Confirm?HF=1&passpget=0&newpassgd=&newpassge=&refno=1030721&session_id={CHECKOUT_SESSION_ID}"
}

#

still what wrong this, where i have to add metadata to populate it in each payout ?

tawdry pulsar
#

Hi @upbeat heath I'm taking over this thread

#

Are you using auto payouts or manual payouts?

upbeat heath
#

auto payout only

tawdry pulsar
#

OK, thanks for the sharing the code. But you are attaching the metdata to a checkout session object, not payout.

#

You should listen to payout.created events, and attach the metadata to payouts in the event handling.

upbeat heath
#

can you please send example of how and where to add ?

tawdry pulsar
upbeat heath
#

so each session i have created, i need to create payout right manually right ?

tawdry pulsar
#

Why do you want to do that? I thought you are on auto payouts?

upbeat heath
#

yes on auto payout, but how i can add meta data to that auto payout ?

tawdry pulsar
#

I thoguht I just answered this question? (i.e., listen to payout.created events and add metadata in event handling)

upbeat heath
#

i still dont understand what i have to do. I think you have understand my question

#

i have created session create and in sesssion create i am adding metadata.

#

And payout is auto. So each payout why the metadata is not adding it. what changes i have to do ?

tawdry pulsar
#

Or let me rephrase the question, why do you need to attach a metadata to a payout? is it for reconciliation?

upbeat heath
#

when i check each payout, that each payout is paid to my bank or not. So if paid to bank account that i get metadata orderi_xxx, and updated in our system that this transaction is paid, so that i will pay to my client

#

In simple. Each transaction we create in stripe, how i know each is paid to my bank account ?

tawdry pulsar
#

But payout and checkout doesn't have 1-to-1 relationship.

#

one payout can include payouts from many checkout sessions

gilded whaleBOT
upbeat heath
#

last time when i discuss here, they have given solution as adding metadata in checkout, so when creating payout that metadata is included.

tawdry pulsar
#

You can still go down this route but it's a complicated solution to build. In high-level, you should

  • Attach a metdata to the checkout session's payment_intent.data
  • Listen to payout.paid events. In the event handling, call the balance transactions API to list all payments, and look for the metadata that you attach earlier on that payment_intent
  • Update your DB
upbeat heath
#

{
"cancel_url": "https://www.billetsalg.dk/Payment/Decline.aspx?HF=1",
"customer_email": "leneguttekoch@gmail.com",
"line_items": {
"0": {
"price_data": {
"currency": "dkk",
"product_data": {
"name": "1030721"
},
"unit_amount": "207089"
},
"quantity": "1"
}
},
"metadata": {
"order_id": "1030721"
},
"mode": "payment",
"payment_method_types": {
"0": "mobilepay"
},
"success_url": "https://www.billetsalg.dk/Stripe/Confirm?HF=1&passpget=0&newpassgd=&newpassge=&refno=1030721&session_id={CHECKOUT_SESSION_ID}"
}

#

above code is correct ? for adding metadata ?

tawdry pulsar
#

This will add the metdata to the checkout session object only

upbeat heath
#

can you please send sample code to add metadata, so that it add automatically in payout when it create automatically

tawdry pulsar
#

No, as I explained before, there's no direct mapping between a payout and a checkout session, and adding a metadata on a checkout won't resulting in the same metadata in a payout.

#

I've told you that it's a complicated route and I'd suggest you to use payout reconciliation report instead

upbeat heath
#

send sample api or code to use payout reconcilation

tawdry pulsar
gilded whaleBOT