gshow8 shac
gshow8 shac

Reputation: 421

Stripe retrieve payment history of a customer

On my web app, I have Stripe customers making payments through cards to Stripe connected accounts. I am trying to retrieve the payment histories the customer made to display it back to the customer to build a transaction histories dashboard. So far, I tried:

  const balanceTransactions = await stripe.customers.listBalanceTransactions(
    'cus_xxxxyyy',
    {limit: 3}
  );
  console.log(balanceTransactions);

But the balance transactions are empty, the customer do have payment histories if I look into my Stripe console (although it is in test mode):

{
  object: 'list',
  data: [],
  has_more: false,
  url: '/v1/customers/cus_xxxxyyy/balance_transactions'
}

Does payment not count as a balance transaction? Any other way that I can retrieve all the payment histories a customer made in the past, preferably a hosted tool by Stripe?

Upvotes: 2

Views: 1613

Answers (1)

karbi
karbi

Reputation: 2163

Listing a customer's balance transactions includes transactions that affect their Stripe balance (such as credit notes), not a customer's full payment/charging history. You can read more about the customer credit balance here: https://stripe.com/docs/billing/customer/balance

You can use the Payment Intent API to retrieve a list of payments made for a specific customer (https://stripe.com/docs/api/payment_intents/list#list_payment_intents-customer).

Upvotes: 1

Related Questions