#crenon-Payout
1 messages · Page 1 of 1 (latest)
Hi!
I know I've seen it somewhere in the docs but I can't seem to find it
I know it can't be done for a manual payout, so we've transitioned to weekly automatic payouts and now I just need to code the part that pulls the list of transactions to allow our users to reconcile the transactions to the payout
thanks for your help!
We have a Doc right exactly for your need: https://stripe.com/docs/expand/use-cases#charges-in-payout
good luck!
Hi there, as I'm getting deeper into this I have another question
Sure
The method in that documentation gets you a list of the balance transactions that make up the payout, but what I'm trying to display to the end user is a human-readable list of the transactions that went into the payout, so at the least I'd like the cusomer's name
Is it possible to query the customer from the balance transaction?
if so, I could loop through the list of balance transactions and pull the customer object for each of them.
Or is there a better way?
Here's an example of an object that's returned from the method in that documentation:
(
[id] => txn_1LZLni2E2W3rVrT8h00Q5CE9
[object] => balance_transaction
[amount] => 50000
[available_on] => 1661299200
[created] => 1661117721
[currency] => usd
[description] =>
[exchange_rate] =>
[fee] => 1771
[fee_details] => Array
(
[0] => Stripe\\StripeObject Object
(
[amount] => 1771
[application] => ca_HmoufWTwMChqYd2STKfz16wikoW6K7dJ
[currency] => usd
[description] => DonationPay application fee
[type] => application_fee
)
)
[net] => 48229
[reporting_category] => charge
[source] => Stripe\\Charge Object```
note that it doesn't have a transaction id nor a customer id
Thanks for any help you can give!
The object returned is documented here https://stripe.com/docs/api/balance_transactions/object
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Look at its source property: https://stripe.com/docs/api/balance_transactions/object#balance_transaction_object-source
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
In your case I see a Charge object
if you expand it, it's the Charge object again: https://stripe.com/docs/api/charges/object
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
And inside it you can expand Customer
https://stripe.com/docs/expand to expand resource
No worry!
In my current code, i'm doing this
'expand' => ['data.source.source_transfer.source_transaction'],
that's what came from the docs
but that doesn't seem to do the trick
Oh no, i see
nevermind
thanks!
I'm able to pull the charge object, within the source, but the billing details appear to be empty
here's an example:
[application] =>
[application_fee] => fee_1LZLlK2E2W3rVrT82rfsnsr4
[application_fee_amount] => 231
[balance_transaction] => txn_3LZLl8FpNhphKMNx1ccIj78Q
[billing_details] => Stripe\\StripeObject Object
(
[address] => Stripe\\StripeObject Object
(
[city] =>
[country] => US
[line1] =>
[line2] =>
[postal_code] => 94114
[state] =>
)
[email] =>
[name] =>
[phone] =>
)
[calculated_statement_descriptor] => DONATIONPAY.ORG
[captured] => 1
[created] => 1661117572
[currency] => usd
[customer] => cus_LAwE2oXPvwvqeQ
[description] =>
[destination] => acct_1LZLdr2E...', referer: https://dev.donationpay.org/portal/payouts/
I checked the payment in the stripe portal and i do see the customer attached and all the billing info listed within the customer
maybe i need to further expand the customer object there?
I tried and it says "You cannot expand more than 4 levels of a property"
so maybe at this point i need to loop through again to pull the customer objects?
Yeah further expand Customer. And yes probably need to nest API.