Stripe Payments
Configure Stripe for online card payments — API keys, webhooks, multi-currency, deposits, and refunds.
Step 1: Get Your Stripe API Keys
- Go to dashboard.stripe.com/apikeys
- Copy your Publishable key (starts with
pk_live_) — this goes into the public site settings - Copy your Secret key (starts with
sk_live_) — this goes into the API Worker as a secret
wrangler secret put STRIPE_SECRET_KEYFor local development, use test keys:
# Test keys (safe to use in development)
Publishable: pk_test_...
Secret: sk_test_...
# Test card that always succeeds
Card number: 4242 4242 4242 4242
Expiry: Any future date (e.g. 12/30)
CVC: Any 3 digits
ZIP: Any 5 digitsStep 2: Set Up the Stripe Webhook
The webhook is critical — it's how the platform knows a payment was successful and triggers booking confirmation + WhatsApp notifications.
For local development (using Stripe CLI):
- Install Stripe CLI: stripe.com/docs/stripe-cli
- Login:
stripe login - Forward events to your local API:
stripe listen --forward-to http://localhost:8787/api/stripe/webhookwhsec_) and set it as STRIPE_WEBHOOK_SECRETFor production (Stripe Dashboard):
- Go to dashboard.stripe.com/webhooks
- Click Add endpoint
- Enter your webhook URL:
https://api.bestphuketguide.com/api/stripe/webhook- Select events to listen for:
checkout.session.completedandpayment_intent.payment_failed - Click Add endpoint then copy the Signing secret
- Add it to Cloudflare:
wrangler secret put STRIPE_WEBHOOK_SECRET
Multi-Currency Configuration
The platform supports multiple currencies to match your customers' locations. Prices are set in THB and automatically converted at checkout.
| Currency | Symbol | Typical Market |
|---|---|---|
| Thai Baht (THB) | ฿ | Local bookings |
| US Dollar (USD) | $ | Americas, international |
| Euro (EUR) | € | Europe |
| Australian Dollar (AUD) | A$ | Australia (large market) |
| British Pound (GBP) | £ | UK |
Exchange rates are fetched from the Stripe API at checkout time. Enable currencies in your Stripe account settings.
Deposit Payments
The platform supports collecting a partial deposit at booking time, with the balance paid later (bank transfer or cash on day).
- When creating or editing a tour, enable Deposit Payment
- Set the deposit as a percentage (e.g. 30%) or a fixed amount (e.g. ฿500)
- Stripe charges only the deposit amount at checkout
- The booking is confirmed immediately after the deposit is paid
- Follow up with the customer for the balance via WhatsApp or email
Processing Refunds
- Go to Bookings and find the booking to refund
- Click the booking to open its detail view
- Click Refund and enter the amount (full or partial)
- The refund is processed immediately via Stripe
- Customer receives a refund notification from Stripe (email)
- Booking status is updated to "refunded" or "cancelled"
For bank transfer and cash bookings, refunds are manual — contact the customer directly and mark the booking as refunded in the admin.
Stripe Test Cards
| Card Number | Scenario |
|---|---|
| 4242 4242 4242 4242 | Payment succeeds |
| 4000 0025 0000 3155 | 3D Secure authentication required |
| 4000 0000 0000 9995 | Payment declined (insufficient funds) |
| 4000 0000 0000 0002 | Payment declined (generic decline) |
Use any future expiry date, any 3-digit CVC, and any 5-digit ZIP code with test cards.
Related Guides