Abhishek
Abhishek

Reputation: 3967

Stripe: Get all the transactions involved in a payout paid event webhook

I am subscribing to the payout.paid event of stripe.

The payout object has the following object:

{
  "id": "po_1H50scIkcSPJwVI7bFSQmBnV",
  "object": "payout",
  "amount": 1100,
  "arrival_date": 1594782118,
  "automatic": true,
  "balance_transaction": "txn_1H2z37IkcSPJwVI7rVwkvfCT",
  "created": 1594782118,
  "currency": "usd",
  "description": "STRIPE PAYOUT",
  "destination": "ba_1H50scIkcSPJwVI7MshqFr6u",
  "failure_balance_transaction": null,
  "failure_code": null,
  "failure_message": null,
  "livemode": false,
  "metadata": {},
  "method": "standard",
  "source_type": "card",
  "statement_descriptor": null,
  "status": "in_transit",
  "type": "bank_account"
}

Ref: https://stripe.com/docs/api/payouts/object

I am able to get this event in my webhook but I am interested in getting the transactions "involved" in this Payout.

Let's say if the payout is of $100 and I have two products of $2 and $5 each, I need to determine how many of those transactions are there from each price.

Not able to find it in docs but from the UI we can do this by going to the individual payout from the payouts screen from the "export" button beside the transactions section header:

enter image description here

Upvotes: 2

Views: 295

Answers (1)

Paul Asjes
Paul Asjes

Reputation: 5847

You'd use the "List all Balance Transactions" endpoint and specify the Payout ID there: https://stripe.com/docs/api/balance_transactions/list#balance_transaction_list-payout

That way you receive a list of all balance transactions that were a part of that specific Payout.

Upvotes: 2

Related Questions