Downloads
The Video Guide
Setting the Stripe Webhook Up
To start receiving data from Stripe, you’ll need to subscribe to the webhook event which Stripe triggers when certain things happen.
To set up a webhook in your Stripe dashboard:
- Log in to your Stripe Dashboard.
- Navigate to Developers → Webhooks.
- Click Add Endpoint.
- Enter your webhook URL (e.g., a Make.com webhook, your own API, or another automation tool).
- Select the events you want to capture. You’ll need the below event (you can subscribe to others also):
- payment_intent.succeeded – Tracks successful payments.
- Click Save.
- Run a test payment to ensure you are receiving the correct data.
Accessing the fees after a Stripe transaction
Once the Stripe webhook is set up and capturing transactions, the next step is to extract the exact fees charged by Stripe for each payment. To do this, we need to access the Charges API endpoint and expand the balance transaction details.
🔗 Step 1: Retrieve the Charge ID
When Stripe sends a webhook event for a successful charge (e.g., charge.succeeded), it includes a charge ID in the response. This ID is crucial for retrieving detailed transaction data.
The charge ID will look something like this:
{
"id": "ch_1Nc1Xv2eZvKYlo2C1DfO9N8F",
"amount": 10000,
"currency": "gbp",
"balance_transaction": "txn_1Nc1Xv2eZvKYlo2Cxyz",
...
}
🔄 Step 2: Call the Charges API
To get the full details of the charge, including Stripe fees, make a GET request to:
GET https://api.stripe.com/v1/charges/ch_1Nc1Xv2eZvKYlo2C1DfO9N8FHowever, to include fee information, we need to expand the balance_transaction field. This allows us to access the detailed breakdown of processing fees and net payout.
🛠 Step 3: Expanding the Balance Transaction Fee
To retrieve fee details, modify the request to include ?expand[]=balance_transaction:
GET https://api.stripe.com/v1/charges/ch_1Nc1Xv2eZvKYlo2C1DfO9N8F?expand[]=balance_transaction
The API response will now include:
{
"id": "ch_1Nc1Xv2eZvKYlo2C1DfO9N8F",
"amount": 10000,
"currency": "gbp",
"balance_transaction": {
"id": "txn_1Nc1Xv2eZvKYlo2Cxyz",
"amount": 10000,
"fee": 290, // Stripe fee in pence
"net": 9710 // Amount after fee deduction
}
}
📊 Step 4: Extracting Stripe Fees
From the response, we can now extract:
- Total Amount Charged:
amount(e.g., £100.00) - Stripe Fee:
balance_transaction.fee(e.g., £2.90) - Net Amount Received:
balance_transaction.net(e.g., £97.10)
➗ Step 5: Dividing by 100
Now that we’ve successfully retrieved the Stripe fee details, you may notice that Stripe returns all monetary values in the smallest currency unit (e.g., cents for USD, pence for GBP). This means that a fee of 290 actually represents $2.90 or £2.90.
To ensure accurate calculations and proper financial reporting, you will need to divide all amounts by 100 before displaying or storing them.
🎯 Conclusion: Accurately Tracking Stripe Fees for Perfect Profitability
Understanding exactly how much you’re paying in Stripe fees per transaction is crucial for accurate financial reporting and profit calculation. By following this guide, you’ve learned how to:
- 🔗 Set up a Stripe webhook to capture transaction data in real time.
- 💳 Access the Charges API to retrieve transaction details.
- 📊 Expand the balance transaction to extract Stripe fees.
- ➗ Convert values from cents to dollars (or other currency units).
- ✅ Prepare the data for use in Google Sheets, Xero, or QuickBooks.
By automating this process, you eliminate guesswork and gain clear insights into your true profit margins. Whether you’re using Make.com, Zapier, or a custom API, integrating Stripe fee tracking into your workflow ensures better financial transparency.
🚀 What’s next? Now that you can extract Stripe fees accurately, consider automating further! Set up scheduled reports, track trends over time, or integrate AI-powered analysis for smarter financial decisions.
Happy automating! ⭐️