# Stripe → Launch27 card collection workflow

## Goal
Collect a customer's card securely with Stripe, then tie that Stripe customer back to Launch27.

## Current confirmed state
- Launch27 supports Stripe-backed booking/payment flows.
- Launch27 has a field to link a Stripe customer ID to the customer record.
- Stripe dashboard customer pages do not appear to expose a simple hosted "collect card for future use" link from that page.
- The clean Stripe pattern is a hosted Checkout Session in `mode=setup`.

## Manual workflow
1. Create or open the customer in Launch27.
2. Create or open the customer in Stripe.
3. Create a Stripe Checkout Session in `mode=setup` for that Stripe customer.
4. Send the hosted Checkout URL to the customer.
5. After completion, confirm the payment method was attached in Stripe.
6. Copy the Stripe customer ID into the Launch27 customer's Stripe-link field.
7. Record any notes needed for later charging.

## Why use setup mode
- Collects and saves a card for later use.
- Stripe hosts the PCI-sensitive form.
- Cleaner than a one-time payment link when the goal is card-on-file.

## What is still needed to automate or create links directly
At least one of the following:
- Stripe secret API key with permission to create Checkout Sessions / SetupIntents
- An existing internal script or service account already wired to Stripe
- A no-code automation platform already connected to Stripe with the right permissions

In this workspace, direct API creation worked once a standard Stripe secret key was added at:
- `~/.openclaw/secrets/stripe-secret-key.txt`

## Minimal API pattern
Create a Checkout Session with:
- `mode=setup`
- `customer=cus_...`
- `success_url=https://example.com/success?session_id={CHECKOUT_SESSION_ID}`
- `cancel_url=https://example.com/cancel`

The returned `url` is what gets sent to the customer.

## Example curl
```bash
curl https://api.stripe.com/v1/checkout/sessions \
  -u "$STRIPE_SECRET_KEY:" \
  -d mode=setup \
  -d customer=cus_123456789 \
  -d currency=cad \
  --data-urlencode success_url="https://example.com/success?session_id={CHECKOUT_SESSION_ID}" \
  --data-urlencode cancel_url="https://example.com/cancel"
```

### Important note from testing
For this Stripe account, `currency` was required even in setup mode. `cad` worked.

## Output to save
- Launch27 customer ID
- Stripe customer ID
- Stripe Checkout Session URL
- Optional: default payment method ID after completion

## Recommended next step
Create a tiny script that accepts a Stripe customer ID and returns a setup-mode Checkout URL.
