The moment it happens
Email buyers their product and receipt after a Stripe payment
As soon as someone pays, they get their download link and a receipt from your own Gmail address.
- Runs
- The moment it happens
- Apps
- Gmail, Stripe
- AI
- Not needed
- Access
- Stripe read (checkout, customers); gmail.send
Send this to your assistant
Create a ClickRuntime automation: when Stripe reports a successful checkout, email the customer the download link for what they bought and a receipt from my Gmail.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A designer sells templates and short courses through Stripe payment links. Stripe takes the money, but delivering the product is a manual job: check the dashboard, find the buyer's email, paste the right download link. Sales that happen overnight or while she is travelling wait hours, and buyers email asking where their purchase is.
This automation delivers the moment payment clears. It reads what was bought, picks the matching download link and sends the buyer a short email with the link and a receipt from her own Gmail, so the reply-to is a real person and the product arrives while the buyer is still at their desk.
What you get out of it
Instant delivery at any hour
Buyers get their product within seconds of paying, including at night and at weekends.
Fewer 'where is my order?' emails
Prompt delivery removes the most common support question for digital products.
The right link for the right product
Each product in the checkout is matched to its own download link, so mixed orders are handled correctly.
Sent from your address
The email comes from your Gmail, so customers can reply with questions and you see them in your inbox.
Each payment is delivered once
Stripe's resent events are recognised, so nobody gets the same email twice.
How it works
What happens, step by step
When a checkout is paid, Stripe tells ClickRuntime straight away, and the message is checked to be genuinely from Stripe.
It skips payments it has already handled, so a resent message never sends a second email.
It reads what was bought and finds the matching download link for each item.
An email with the links and a receipt is sent to the buyer from your Gmail.
Before it runs live
- Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
- 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 Gmail and Stripe steps into one automation
Under the hood
The code that runs this automation
import base64
from email.message import EmailMessage
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
import stripe
from clickruntime import on_event, credentials, verify, state
LINKS = {"prod_Templates": "https://files.example.com/templates.zip", "prod_Course": "https://learn.example.com/start"}
def send(to, subject, text):
msg = EmailMessage()
msg["To"], msg["Subject"] = to, subject
msg.set_content(text)
gmail = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
gmail.users().messages().send(userId="me", body={"raw": base64.urlsafe_b64encode(msg.as_bytes()).decode()}).execute()
@on_event
def handle(event):
if not verify.stripe(event.body, event.header("Stripe-Signature"), credentials.secret("STRIPE_WEBHOOK_SECRET")):
return {"ignored": "bad signature"}
session = event.json["data"]["object"]
if state.get(f"done:{session['id']}"):
return {"duplicate": True}
stripe.api_key = credentials.secret("STRIPE_API_KEY")
items = stripe.checkout.Session.list_line_items(session["id"], expand=["data.price.product"]).data
lines = [f"{i.description}: {LINKS.get(i.price.product.id, 'we will send this to you shortly')}" for i in items]
total = f"{session['amount_total'] / 100:,.2f} {session['currency'].upper()}"
send(session["customer_details"]["email"], "Your purchase", "Thanks for your order.\n\n" + "\n".join(lines) + f"\n\nReceipt: {total} paid.")
state.set(f"done:{session['id']}", True)
return {"items": len(items)}FAQ
Common questions
Where do the download links come from?
Does it replace Stripe's own receipt?
What if a product has no download link?
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
Check VAT numbers on Stripe invoices and email the right person
When Stripe drafts an invoice, an invalid VAT number is flagged to finance; when it's finalised, the customer gets an email from you.
See how it worksWin back failed payments with a friendly email
When a card fails, the customer gets a short note from you with a link to pay, and a reminder three days later if it's still unpaid.
See how it worksAsk cancelling customers why, and get a weekly churn summary
Customers who cancel get one personal question by email, their replies are sorted by reason, and you get a weekly summary.
See how it worksKeep exploring
Set up “Email buyers their product and receipt after a Stripe payment” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.