The moment it happens
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.
- Runs
- The moment it happens
- Apps
- Google Drive, Stripe
- AI
- Not needed
- Access
- Stripe read; Drive file share
Send this to your assistant
Create a ClickRuntime automation: when a Stripe checkout completes, share the Drive file for the product they bought with the buyer's email and send them the link.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
An illustrator sells printable templates and a short ebook through Stripe payment links. Every evening they check new orders and share the right file with each buyer by hand. Buyers who pay in the morning wait all day, and a few write in asking where their download is.
Sharing the file automatically the moment payment succeeds means every buyer gets their product straight away, at any hour. The seller stops spending evenings on delivery, and the 'where is my file' emails stop.
What you get out of it
Buyers get their file immediately
Access is granted within seconds of payment. A fast delivery is the first impression of the product, and it reduces refund requests from impatient buyers.
Files are shared with the buyer only
Each buyer is added to the file by email instead of receiving a public link. Links forwarded to friends do not open for people who did not pay.
The right file for each product
Each Stripe price points to its own Drive file, so a buyer of the ebook never receives the templates by mistake. Adding a product means adding one line.
No evening delivery routine
Sales made overnight or on holiday are delivered the same way as any other. The seller's time goes into making products rather than sending them.
How it works
What happens, step by step
When a buyer completes a Stripe checkout, Stripe notifies ClickRuntime straight away.
ClickRuntime checks the notification really came from Stripe and reads which products were bought.
It looks up the Drive file you linked to each product and shares it with the buyer's email address.
Google Drive emails the buyer the link to their file, and you get a short note that it was delivered.
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 stripe
from clickruntime import on_event, credentials, verify, notify
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
FILES = {"price_ebook": "1AbCdEbookFileId", "price_templates": "1XyZTemplatesFileId"}
@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"] != "checkout.session.completed":
return {"ignored": event.json["type"]}
session = event.json["data"]["object"]
email = session["customer_details"]["email"]
stripe.api_key = credentials.secret("STRIPE_API_KEY")
drive = build("drive", "v3", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
shared = []
for item in stripe.checkout.Session.list_line_items(session["id"]).data:
file_id = FILES.get(item.price.id)
if file_id:
drive.permissions().create(fileId=file_id, sendNotificationEmail=True,
emailMessage="Thanks for your purchase! Here is your download.",
body={"type": "user", "role": "reader", "emailAddress": email}).execute()
shared.append(item.description)
notify.email_me(f"Delivered to {email}", ", ".join(shared) or "No matching file for this checkout")
return {"shared": shared}FAQ
Common questions
Does the buyer need a Google account?
What happens if one checkout includes several products?
Can I take access away after a refund?
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
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.
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 “Deliver a Drive file when someone buys on Stripe” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.