Search code examples
apipaystack

How to fetch all transactions of a customer using Paystack api


I integrated the Paystack API into my mobile app, and it works fine instead of fetching the customer's transactions from Paystack. I want to check the customer's history of transactions on launch and unlock locked features if the last transaction is active.

https://api.paystack.co/customer/[email protected]

The URL above was to fetch the customer's data along with transactions and subscriptions, but no transactions were fetched along with the data returned. It is in test mode. Please what do you suggest obtaining the customer's transactions?


Solution

  • You can fetch transactions for a specific customer by calling the GET /transaction endpoint and passing the customer ID as a query parameter. For example,

    GET https://api.paystack.co/transaction?customer=113957392

    will fetch all transactions for the customer with ID=113957392. You can get the customer ID by fetching the customer object from GET /customer.