> ## Documentation Index
> Fetch the complete documentation index at: https://help.emergent.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Stripe Integration

> Accept payments and subscriptions in your app with Stripe

## What is Stripe?

Stripe lets you accept credit card payments, subscriptions, and one-time purchases in your app. It's the most popular payment platform used by companies like Shopify, Lyft, and Amazon.

**Perfect for:**

* Selling products or services
* Monthly subscriptions (like Netflix)
* Taking donations
* Membership fees

## What You'll Need

<Steps>
  <Step title="Stripe Account">
    Sign up at [stripe.com](https://stripe.com) - it's free!
  </Step>

  <Step title="Get API Keys">
    Copy two keys from your Stripe dashboard
  </Step>

  <Step title="A good initial prompt">
    That's all you need to set this up
  </Step>
</Steps>

<Tip>
  Here's a helpful video to get you started.
</Tip>

<iframe src="https://www.youtube.com/embed/eVHmjP6lE7U" title="YouTube video player" frameborder="0" className="w-full aspect-video rounded-xl" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen />

## Step 1: Get Your Stripe Keys

### Create Your Stripe Account

1. Go to [stripe.com](https://stripe.com)
2. Click **Sign up**
3. Enter your email and create a password
4. Verify your email

**That's it!** You can start testing immediately. Stripe gives you **test mode** to try everything before going live.

### Find Your API Keys

1. Log into your [Stripe Dashboard](https://dashboard.stripe.com)
2. Look in the top right corner - switch to **Test mode** (there's a toggle)
3. Click **Developers** at the top
4. Click **API keys**
5. You'll see two keys:

<CardGroup cols={2}>
  <Card title="Publishable Key" icon="eye">
    **Starts with:** `pk_test_`

    This one is safe to share - it should be accessible via the dashboard
  </Card>

  <Card title="Secret Key" icon="shield-keyhole">
    **Starts with:** `sk_test_`

    Keep this one private!

    Click **Reveal** to see it
  </Card>
</CardGroup>

6. Copy both keys somewhere safe

## Step 2: Tell the Emergent Agent

Now just tell the Emergent agent what you want! Copy this template and fill in your details:

### For One-Time Payments

```
I need to accept payments with Stripe.

What I'm selling:
- [Product 1] for $XX
- [Product 2] for $XX

My Stripe keys:
- Publishable key: pk_test_xxxxx
- Secret key: sk_test_xxxxx

I want customers to:
1. Click a "Buy Now" button
2. Enter their card details
3. Get a confirmation after payment

Please set this up for me.
```

### For Monthly Subscriptions

```
I need to accept monthly subscriptions with Stripe.

My pricing plans:
- Basic: $9/month
- Pro: $19/month
- Premium: $49/month

My Stripe keys:
- Publishable key: pk_test_xxxxx
- Secret key: sk_test_xxxxx

I want customers to:
1. Choose a plan
2. Enter payment details
3. Get charged automatically each month
4. Be able to cancel anytime

Please set this up for me.
```

<Tip>
  **That's all you need to say!** The agent will handle all the technical setup.
</Tip>

## Step 3: Test It Works

After the agent sets everything up:

<Steps>
  <Step title="Click Preview">
    In Emergent, click the **Preview** button
  </Step>

  <Step title="Try Buying Something">
    Go through the purchase flow like a customer would
  </Step>

  <Step title="Use Test Card">
    When it asks for a card, use: **4242 4242 4242 4242**

    * Expiry: Any future date
    * CVC: Any 3 digits
    * ZIP: Any ZIP code
  </Step>

  <Step title="Complete Purchase">
    Finish the payment
  </Step>

  <Step title="Check It Worked">
    You should see a success message!
  </Step>
</Steps>

**Check Stripe Dashboard:** Go to Stripe → Payments. You'll see your test payment there!

### More Test Cards

<CardGroup cols={2}>
  <Card title="Successful Payment" icon="check" color="#10b981">
    **4242 4242 4242 4242**

    Use this for successful test payments
  </Card>

  <Card title="Declined Card" icon="xmark" color="#ef4444">
    **4000 0000 0000 0002**

    Use this to test payment failures
  </Card>
</CardGroup>

## Step 4: Go Live (Accept Real Payments)

When you're ready to accept real money:

<Steps>
  <Step title="Switch to Live Mode">
    In Stripe, toggle from **Test mode** to **Live mode** (top right)
  </Step>

  <Step title="Get Live Keys">
    Go to Developers → API keys

    Copy your **live** keys (start with `pk_live_` and `sk_live_`)
  </Step>

  <Step title="Update in Emergent">
    When deploying, enter your live keys instead of test keys
  </Step>

  <Step title="Complete Stripe Setup">
    Stripe will ask for:

    * Business details
    * Bank account (to receive money)
    * Identity verification
  </Step>

  <Step title="Deploy!">
    Deploy your app and start accepting real payments!
  </Step>
</Steps>

<Warning>
  **Important:** Test everything thoroughly before going live with real customer payments!
</Warning>

## Common Questions

<AccordionGroup>
  <Accordion title="How much does Stripe cost?">
    **2.9% + 30¢ per successful transaction**

    For example:

    * On a sale of 10, you get 9.41
    * On a sale of 100, you get 96.80

    No monthly fees, no setup fees. You only pay when you make a sale.
  </Accordion>

  <Accordion title="When do I get paid?">
    Stripe pays you automatically every 2 days (after initial 7-day period).

    Money goes directly to your bank account.
  </Accordion>

  <Accordion title="What if a customer disputes a charge?">
    Stripe handles this for you. They'll notify you and help manage the dispute process.
  </Accordion>

  <Accordion title="Can I offer refunds?">
    Yes! Just tell the agent:

    ```
    I need to be able to refund payments. 
    Please add a refund feature to my Stripe integration.
    ```
  </Accordion>

  <Accordion title="What countries does Stripe support?">
    Stripe works in 45+ countries. Check [stripe.com/global](https://stripe.com/global) to see if your country is supported.
  </Accordion>
</AccordionGroup>

## Something Not Working?

### Payment Button Doesn't Work

**Tell the agent:**

```
The payment button isn't working when I click it.
Can you check the Stripe integration?
```

### Customer Sees an Error

**Tell the agent:**

```
Customers are seeing this error when trying to pay:
[Copy and paste the exact error message]

Can you fix this?
```

### Payments Not Showing in Stripe

**Tell the agent:**

```
I completed a test payment but don't see it in my Stripe dashboard.
Can you check if Stripe is connected correctly?
```

## Real Examples

### Example 1: Selling a Course

```
I'm selling an online course for $97.

I need Stripe to:
- Let students pay with credit card
- Give them instant access after payment
- Send them a receipt email

My Stripe keys: [paste keys]

Please set this up.
```

### Example 2: SaaS Subscription

```
I'm building a SaaS app with these plans:
- Starter: $15/month
- Business: $49/month  
- Enterprise: $99/month

I need:
- Monthly recurring billing
- Let users upgrade or downgrade
- Cancel anytime
- 7-day free trial

My Stripe keys: [paste keys]

Please set this up.
```

### Example 3: Accepting Donations

```
I need to accept donations of any amount.

Features I need:
- Let donors enter custom amount
- Suggested amounts: $5, $10, $25, $50
- One-time or monthly donations
- Thank you message after donating

My Stripe keys: [paste keys]

Please set this up.
```

## Quick Checklist

Before you go live:

* Tested payment with test card (4242...)
* Checked payment appears in Stripe dashboard
* Tested on mobile phone
* Set up your Stripe account completely
* Switched to live keys
* Tried a small real payment yourself
* Know how to issue refunds

## Help & Resources

<CardGroup cols={2}>
  <Card title="Stripe Dashboard" icon="chart-line" href="https://dashboard.stripe.com">
    See all your payments and customers
  </Card>

  <Card title="Stripe Help" icon="question" href="https://support.stripe.com">
    24/7 support from Stripe
  </Card>

  <Card title="Ask Emergent Agent" icon="message">
    Just describe what's not working or what you want to change
  </Card>

  <Card title="Test Cards" icon="credit-card" href="https://stripe.com/docs/testing">
    More test card numbers for you to test out before going live
  </Card>
</CardGroup>

## Remember

**Always test first** with test mode before accepting real payments

**Keep your secret key private** - never share it publicly

**Start simple** - You can always add more features later

**Ask the agent** if you're unsure about anything

<Info>
  Need help? Just tell the agent: "I need help with my Stripe integration" and describe what's not working.
</Info>
