Paystack with Google Sheets for Simple Reporting
Two approaches: 1) No-code via Zapier: connect Paystack + Google Sheets in Zapier, trigger on charge.success, map fields to columns. 2) Direct via Google Apps Script: deploy a web app script that accepts POST requests, parse the Paystack webhook payload, and append a row to your sheet. Configure Paystack to send webhooks to the Apps Script URL.
Zapier Setup (No-Code)
- Create a new Zap in Zapier.
- Trigger: search for "Paystack" and select the charge.success event.
- Action: select Google Sheets → Create Spreadsheet Row.
- Map Paystack fields to sheet columns: Reference → Column A, Amount → Column B (divide by 100 for major unit), Customer Email → Column C, Channel → Column D, Date → Column E.
- Test and turn on the Zap. Every successful Paystack payment will now add a row to your sheet.
Google Apps Script Webhook Receiver
For a free, code-based option, deploy a Google Apps Script web app that receives Paystack webhooks:
// In Google Apps Script (Tools > Script Editor in your Google Sheet)
function doPost(e) {
var payload = JSON.parse(e.postData.contents);
// Basic event filter — in production, validate HMAC here
if (payload.event !== 'charge.success') {
return ContentService.createTextOutput('ignored');
}
var txn = payload.data;
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
sheet.appendRow([
txn.reference,
txn.amount / 100, // convert from minor unit
txn.currency,
txn.customer.email,
txn.channel,
txn.paid_at,
txn.gateway_response,
]);
return ContentService.createTextOutput('ok');
}
Deploy as Web App (Execute as: Me, Who has access: Anyone). Copy the deployment URL and add it to Paystack webhook settings. Paystack will POST to your Apps Script on every event.
Get weekly developer tips
Join 25,000+ developers. Practical guides, job tips, and new content — straight to your inbox.
No spam. Unsubscribe anytime.
Learn More
For full reconciliation, see Paystack with Xero or QuickBooks.
Key Takeaways
- ✓Zapier connects Paystack charge.success events to Google Sheets in under 5 minutes — no code.
- ✓Google Apps Script (free) can receive Paystack webhooks directly and log to Sheets.
- ✓Apps Script does not validate HMAC signatures natively — add manual crypto validation for security.
- ✓Log: reference, amount, currency, customer email, payment channel, transaction date.
- ✓Use IMPORTDATA or Google Sheets API for pulling Paystack CSV exports into a sheet on a schedule.
Frequently Asked Questions
- Is Google Apps Script secure for receiving Paystack webhooks?
- Apps Script web apps are publicly accessible URLs. Without HMAC validation, anyone could post fake data. Add signature validation: compute HMAC-SHA512 of the raw body using your Paystack webhook secret and compare to the x-paystack-signature header. Apps Script does not have a built-in crypto library — use Utilities.computeHmacSha256Signature() as an approximation, or use a Cloudflare Worker or server-side function for full SHA-512 validation.
- Can I pull historical Paystack transactions into Google Sheets?
- Yes. Export a CSV from Paystack dashboard (Transactions → Export) and import it into Google Sheets. For automated daily exports, you could set up a time-triggered Apps Script that calls the Paystack transactions list API (GET /transaction) with a date filter and appends new rows to the sheet.
- Will the Apps Script approach capture refunds and failed payments?
- Only if you handle those webhook events. Add cases for charge.failed and refund.processed in your doPost function. Each webhook event type has different data fields — log the raw event.event type as a column so you can filter by type in the sheet.
Learn Paystack Integration
KES 2,999
The definitive guide to building payment systems with Paystack — from your first transaction to production-grade payment infrastructure across Africa. 9 modules, 47 lessons. Free preview available.
Start Paystack Course