Skip to content

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.

Paste it into your assistant. It tells you what it will send or change before it runs live.

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

  1. When a checkout is paid, Stripe tells ClickRuntime straight away, and the message is checked to be genuinely from Stripe.

  2. It skips payments it has already handled, so a resent message never sends a second email.

  3. It reads what was bought and finds the matching download link for each item.

  4. 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

RunsThe moment it happens
Email buyers their product and receipt after a Stripe paymentjust nowSucceeded
Email · Sent to buyerThanks for your order. Brand starter templates: https://files.example.com/templates.zip. Receipt: 49.00 GBP paid.

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • 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

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
email_the_product_or_receipt_after_a_stripe_payment.pyexample
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?
You give your AI assistant a list of your Stripe products and their links, and it keeps them in the automation. When you add a product, ask it to add the link too.
Does it replace Stripe's own receipt?
It can sit alongside it. If you prefer to send only this email, switch off Stripe's automatic receipts in your Stripe settings.
What if a product has no download link?
The buyer still gets the receipt, and the email says you'll be in touch, so you can deliver that item yourself.
What permissions does it need?
Stripe read (checkout, customers); gmail.send. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run for each event the app sends.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

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.