The moment it happens
Save every Stripe invoice PDF to Drive
Each paid Stripe invoice is saved as a PDF in your Drive receipts folder, named by date and customer.
- Runs
- The moment it happens
- Apps
- Google Drive, Stripe
- AI
- Not needed
- Access
- Stripe read; Drive file
Send this to your assistant
Create a ClickRuntime automation: when a Stripe invoice is paid, download its PDF and save it to my Receipts folder in Drive, named with the date, customer and invoice number.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A consultancy bills clients through Stripe invoices. At year end, their accountant asks for a copy of every invoice, and someone spends a day downloading PDFs from the Stripe dashboard one at a time and renaming them so they can be found.
Saving each invoice PDF to Drive as soon as it is paid builds that archive as you go. The accountant gets a shared folder that is always complete, and anyone looking for a past invoice can search Drive by client name.
What you get out of it
An archive that is always complete
Every paid invoice lands in the folder without anyone remembering to download it. Nothing is missing when the accountant asks.
Files you can find by name
Each PDF is named with the date, the customer and the invoice number. Searching Drive for a client brings up all their invoices.
Easy to share with your accountant
Share the folder once and the accountant sees new invoices as they arrive. No more zip files at the end of the year.
A copy outside Stripe
Keeping your own copies means records survive a change of payment provider or a closed account. Many tax rules expect you to keep them for years.
How it works
What happens, step by step
When an invoice is paid in Stripe, Stripe notifies ClickRuntime straight away.
ClickRuntime checks the notification came from Stripe and reads the invoice details.
It downloads the invoice PDF that Stripe created.
The PDF is saved in your Drive receipts folder, named with the date, customer name and invoice number.
Before it runs live
- Connect Google Drive
- Connect Stripe
- Paste your automation's link into the other app's webhook settings
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Act only on the items that match your own rules, and skip the rest
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Google Drive and Stripe steps into one automation
Under the hood
The code that runs this automation
import io
from datetime import date
from googleapiclient.http import MediaIoBaseUpload
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_event, credentials, verify, http
FOLDER_ID = "your-receipts-folder-id"
@on_event
def handle(event):
if not verify.stripe(event.body, event.header("Stripe-Signature"), credentials.secret("STRIPE_WEBHOOK_SECRET")):
return {"ignored": "bad signature"}
if event.json["type"] != "invoice.paid":
return {"ignored": event.json["type"]}
inv = event.json["data"]["object"]
pdf = http.get(inv["invoice_pdf"])
pdf.raise_for_status()
paid = date.fromtimestamp(inv["status_transitions"]["paid_at"])
name = f"{paid} {inv.get('customer_name') or inv['customer_email']} {inv['number']}.pdf"
drive = build("drive", "v3", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
f = drive.files().create(body={"name": name, "parents": [FOLDER_ID]},
media_body=MediaIoBaseUpload(io.BytesIO(pdf.content), mimetype="application/pdf"),
fields="id").execute()
return {"saved": name, "file": f["id"]}FAQ
Common questions
Is this the same PDF the customer receives?
Does it save receipts for one-off checkout payments?
Can it sort files into a folder per month?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Deliver a Drive file when someone buys on Stripe
Each buyer gets access to the right Google Drive file seconds after paying, with an email from Drive containing the link.
See how it worksSave a monthly Stripe revenue report to Drive
On the first of each month, last month's Stripe transactions are saved to Drive as a spreadsheet file, with a short written summary emailed to you.
See how it worksPost new orders and sign-ups to Slack
When something happens in your shop, app or form, the details land in the right channel straight away.
See how it worksKeep exploring
Set up “Save every Stripe invoice PDF to Drive” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.