I am a newbie and this feels to me like a newbie question.
I am using Checkouts and have an e-commerce model in which each checkout is for a single purchasable product. I markup the Session at creation with the "type of product" both using session.client_reference_id and session.lineItems[0].product_data as in the following fragment. (Both $regId and $productData are product-type-specific codes in my inventory.)
$checkout_session = \Stripe\Checkout\Session::create([
'payment_method_types' => ['card'],
'customer_email' => $reg['billEmail'],
'line_items' => [[
'price_data' => [
'currency' => 'cad',
'unit_amount' => 100*$reg['price'],
'product_data' => $productData,
],
'quantity' => 1,
]],
'client_reference_id' =>$regId,
'mode' => 'payment',
'success_url' => 'myserver/stripe_success.php?stripe_id={CHECKOUT_SESSION_ID}',
'cancel_url' => 'myserver/checkout.php',
]);
A bunch of customers buy a bunch of products creating a bunch of Payments which eventually get bulked together and dispersed to my bank account as a Payout. Now I would like to report in the reverse direction. I want to report on a date-span of Payouts, and see how many of which of my products I am actually earning money for.
I realize I compute this in the forward direction from my proprietary sales records, but I want to actually audit the post-fees Stripe Payout data to verify my sales records.
I can't figure out how to do this using any stock reports. Payout Reconciliation Detail sounds like the right report---"Detailed breakdown of the total payouts line from the above Balance Summary report. Includes all activity that makes up the payouts in this time range, as well as itemized downloads."--and it definitely breaks down payments into their separate discrete charges and payoutIntents. But none of the 42 possible custom fields I can request for that report seem to contain either of the Session data I'm using above to code that charge's actual product type. (I *can* see the type of product ordered if I open up an individual paymentIntent in dashboard; but I can't see how to report it.)
I'm equally lost how to build a custom report. From the API I can easily get all the payouts. But how do I then find all the paymentIntents bundled into a specific payout? Reading the docs, I can see how to reason from a paymentIntent to the CheckoutSession and from that to the lineItems that will describe my product, but I don't see how to determine which paymentIntents contribute to an actual Payout that I've fielded in my bank account? I must be missing something obvious.
Thanks for your help,
Nick