Search code examples
node.jsstripe-paymentsstripe-connect

Stripe: Accessing a payout from a charge


I am trying to access a payout object (https://stripe.com/docs/api#payouts) from a charge object (https://stripe.com/docs/api#charges). The problem is that I do not know what ID to use for the payout. I tried using the transfer ID from payouts but I get the error:

No such payout: tr_1Bxxxxxxxxxx

I also know that the ID of the payout is in the format po_xxxxxxxxxxxxxxx but I can't find any from the charge, the transfer and the balanced_transaction. How is the payout related to the charge?


Solution

  • There's not a direct way to get the Payout from a Charge object ch_xxxyyyzzz, but if your account is setup to make automatic payouts, you can get a list of charges and any other balance transactions (refunds, adjustments, etc) that make up a specific payout object.

    https://stripe.com/docs/api#balance_history-payout

    stripe.balance.listTransactions({payout:"po_xxxyyyyyyzzz",limit: 100 }, 
    function(err, transactions) {
      // asynchronously called
    });
    

    Payouts and Transfers are two separate types of Objects. A Payout always refers to when moving funds from your balance to your bank account. A Transfer refers to funds moving between Stripe accounts, typically in the context of Stripe's Connect.

    https://stripe.com/docs/transfer-payout-split