Booking with Stripe Payment
Let customers check availability, pick a slot, and pay via Stripe — all in a single WhatsApp or web chat conversation before the booking is confirmed.
What you'll build
An agent that takes a customer from "I'd like to book" to "payment confirmed" without leaving the conversation. It checks real-time availability via Google Calendar, holds the slot while the customer pays via Stripe, and confirms the booking only after payment clears — preventing double-bookings on high-demand schedules.
Prerequisites
- BimpeAI account with an API key (
sk_…) - Read Anatomy of a workflow agent first — this recipe skips steps covered there
- Google Calendar and Stripe connected in the Console dashboard (see Step 4)
- WhatsApp Business number and web chat widget connected in the Console dashboard (see Step 4)
Steps
1. Find the workflow
import { BimpeAI } from "@bimpeai/sdk";
const bimpe = new BimpeAI({ apiKey: process.env.BIMPEAI_API_KEY! });
const page = await bimpe.workflows.list({ scope: "public", search: "booking payment" });
const workflow = page.data[0];
console.log(workflow.id, workflow.name);import os
from bimpeai import BimpeAI
client = BimpeAI(api_key=os.environ["BIMPEAI_API_KEY"])
page = client.workflows.list(scope="public", search="booking payment")
workflow = page.data[0]
print(workflow.id, workflow.name)2. Create the agent
const agent = await bimpe.agents.create(
{
name: "Booking and payment agent",
system_prompt:
"You handle bookings that require payment before confirmation. " +
"Ask the customer what service they want and their preferred date and time. " +
"Check availability via Google Calendar. If the slot is available, present the price from the " +
"booking policy and generate a Stripe payment link. Tell the customer the slot is held for " +
"15 minutes while they pay. Once payment is confirmed, confirm the booking details and send a " +
"calendar invitation reference. If the slot becomes unavailable before payment, apologise and " +
"offer the next available slot. Never confirm a booking without payment confirmation.",
agent_workflow_id: workflow.id,
},
{ idempotencyKey: "create-booking-payment-agent-v1" },
);
console.log(agent.id);agent = client.agents.create(
name="Booking and payment agent",
system_prompt=(
"You handle bookings that require payment before confirmation. "
"Ask the customer what service they want and their preferred date and time. "
"Check availability via Google Calendar. If the slot is available, present the price from the "
"booking policy and generate a Stripe payment link. Tell the customer the slot is held for "
"15 minutes while they pay. Once payment is confirmed, confirm the booking details and send a "
"calendar invitation reference. If the slot becomes unavailable before payment, apologise and "
"offer the next available slot. Never confirm a booking without payment confirmation."
),
agent_workflow_id=workflow.id,
idempotency_key="create-booking-payment-agent-v1",
)
print(agent.id)3. Add knowledge bases
Add booking policy and pricing so the agent can quote accurately and handle cancellation questions without improvising.
// Pricing and service durations
await bimpe.agents.knowledgeBases.create(agent.id, {
type: "text",
name: "Service pricing",
content:
"Consultation (30 min): £75\n" +
"Strategy session (60 min): £140\n" +
"Full-day workshop (6 hours): £650\n" +
"Group session (up to 5 people, 60 min): £200\n" +
"All prices include VAT.",
});
// Booking and cancellation policy
await bimpe.agents.knowledgeBases.create(agent.id, {
type: "text",
name: "Booking policy",
content:
"Slots are held for 15 minutes after a payment link is sent. " +
"If payment is not received within 15 minutes, the slot is released.\n" +
"Full payment is required at the time of booking — no deposits.\n" +
"Cancellations more than 48 hours before the appointment: full refund via Stripe.\n" +
"Cancellations within 48 hours: 50% refund.\n" +
"No-shows: no refund.\n" +
"Reschedules are free if requested at least 24 hours in advance.",
});# Pricing and service durations
client.agents.knowledge_bases.create(agent.id, {
"type": "text",
"name": "Service pricing",
"content": (
"Consultation (30 min): £75\n"
"Strategy session (60 min): £140\n"
"Full-day workshop (6 hours): £650\n"
"Group session (up to 5 people, 60 min): £200\n"
"All prices include VAT."
),
})
# Booking and cancellation policy
client.agents.knowledge_bases.create(agent.id, {
"type": "text",
"name": "Booking policy",
"content": (
"Slots are held for 15 minutes after a payment link is sent. "
"If payment is not received within 15 minutes, the slot is released.\n"
"Full payment is required at the time of booking — no deposits.\n"
"Cancellations more than 48 hours before the appointment: full refund via Stripe.\n"
"Cancellations within 48 hours: 50% refund.\n"
"No-shows: no refund.\n"
"Reschedules are free if requested at least 24 hours in advance."
),
})4. Connect channels and integrations (dashboard)
Google Calendar, Stripe, and channels are configured in the dashboard
The API cannot create channel connections or integrations. Google Calendar, Stripe, the WhatsApp Business number, and the web chat widget are all connected in the Console dashboard. The SDK can list active integrations but cannot create or modify them.
- Open Console dashboard → Agents → select your agent.
- Under Channels, connect your WhatsApp Business number.
- Under Channels, enable the web chat widget and embed it on your booking page.
- Under Integrations, connect Google Calendar. The agent checks availability and creates events on confirmed bookings.
- Under Integrations, connect Stripe. The agent retrieves payment links and listens for payment confirmation webhooks.
5. Go live
const integrations = await bimpe.agents.integrations.list(agent.id);
const channels = await bimpe.agents.channels.list(agent.id);
console.log("Integrations:", integrations.map((i) => i.name));
console.log("Channels:", channels.map((c) => c.type));integrations = client.agents.integrations.list(agent.id)
channels = client.agents.channels.list(agent.id)
print("Integrations:", [i.name for i in integrations])
print("Channels:", [c.type for c in channels])Full example
import { BimpeAI } from "@bimpeai/sdk";
const bimpe = new BimpeAI({ apiKey: process.env.BIMPEAI_API_KEY! });
// 1. Find workflow
const page = await bimpe.workflows.list({ scope: "public", search: "booking payment" });
const workflow = page.data[0];
// 2. Create agent
const agent = await bimpe.agents.create(
{
name: "Booking and payment agent",
system_prompt:
"You handle bookings requiring payment before confirmation. Check availability, hold the slot " +
"for 15 minutes, send a Stripe payment link, and confirm only after payment clears.",
agent_workflow_id: workflow.id,
},
{ idempotencyKey: "create-booking-payment-agent-v1" },
);
// 3. Add knowledge bases
await bimpe.agents.knowledgeBases.create(agent.id, {
type: "text",
name: "Service pricing",
content:
"Consultation (30 min): £75. Strategy session (60 min): £140.\n" +
"Full-day workshop: £650. Group session (up to 5): £200. All prices include VAT.",
});
await bimpe.agents.knowledgeBases.create(agent.id, {
type: "text",
name: "Booking policy",
content:
"Slot held 15 minutes after payment link sent. Full payment required at booking.\n" +
"Cancellations >48 hours: full refund. Within 48 hours: 50% refund. No-shows: no refund.\n" +
"Reschedules free if requested 24 hours in advance.",
});
// 4. Verify integrations (Google Calendar + Stripe must be connected in dashboard)
const integrations = await bimpe.agents.integrations.list(agent.id);
const channels = await bimpe.agents.channels.list(agent.id);
console.log("Agent ID:", agent.id);
console.log("Integrations:", integrations.map((i) => i.name));
console.log("Channels:", channels.map((c) => c.type));
// 5. Stream WhatsApp booking conversations
const controller = new AbortController();
const conversations = await bimpe.conversations.list(agent.id, { channel: "whatsapp" });
const conv = conversations.data[0];
if (conv) {
for await (const event of bimpe.conversations.messages.stream(agent.id, conv.id, {
signal: controller.signal,
})) {
console.log(event.role, event.message);
}
}import os
from bimpeai import BimpeAI
client = BimpeAI(api_key=os.environ["BIMPEAI_API_KEY"])
# 1. Find workflow
page = client.workflows.list(scope="public", search="booking payment")
workflow = page.data[0]
# 2. Create agent
agent = client.agents.create(
name="Booking and payment agent",
system_prompt=(
"You handle bookings requiring payment before confirmation. Check availability, hold the slot "
"for 15 minutes, send a Stripe payment link, and confirm only after payment clears."
),
agent_workflow_id=workflow.id,
idempotency_key="create-booking-payment-agent-v1",
)
# 3. Add knowledge bases
client.agents.knowledge_bases.create(agent.id, {
"type": "text",
"name": "Service pricing",
"content": (
"Consultation (30 min): £75. Strategy session (60 min): £140.\n"
"Full-day workshop: £650. Group session (up to 5): £200. All prices include VAT."
),
})
client.agents.knowledge_bases.create(agent.id, {
"type": "text",
"name": "Booking policy",
"content": (
"Slot held 15 minutes after payment link sent. Full payment required at booking.\n"
"Cancellations >48 hours: full refund. Within 48 hours: 50% refund. No-shows: no refund.\n"
"Reschedules free if requested 24 hours in advance."
),
})
# 4. Verify integrations (Google Calendar + Stripe must be connected in dashboard)
integrations = client.agents.integrations.list(agent.id)
channels = client.agents.channels.list(agent.id)
print("Agent ID:", agent.id)
print("Integrations:", [i.name for i in integrations])
print("Channels:", [c.type for c in channels])
# 5. Stream WhatsApp booking conversations
conversations = client.conversations.list(agent.id, channel="whatsapp")
if conversations.data:
conv = conversations.data[0]
for msg in client.conversations.messages.stream(agent.id, conv.id):
print(msg.role, msg.message)Deploy
Store your API key in BIMPEAI_API_KEY. Confirm that Google Calendar and Stripe both appear in integrations.list before opening bookings — a missing Stripe connection means payment links will not generate and the 15-minute hold will never trigger. Update pricing via knowledgeBases.update rather than touching the agent config.
Variations
- Add a group booking knowledge base entry with capacity rules so the agent can offer group sessions and enforce the five-person maximum automatically.
- Use
conversations.messages.sendto deliver a booking confirmation summary after Stripe confirms payment. - Extend cancellation handling by adding a knowledge base entry with your refund processing timeline and pointing the agent to it when customers ask about their refund status.