Skip to content

Tutorials

How to connect Stripe to an AI-built store | FromScratch

How to connect Stripe to an AI-built store: set up test-mode keys, describe checkout to the builder, run test purchases and go live.

On this page
  1. What you need before you connect Stripe
  2. Step 1: Get your Stripe keys in test mode
    1. Publishable key vs secret key
    2. Why test mode comes first
  3. Step 2: Tell the AI builder what payments should do
    1. Example prompt for a simple product store
    2. Reviewing the change in the preview
  4. Step 3: Test a full purchase
    1. Testing a declined payment
    2. Checking that orders are recorded
  5. Step 4: Go live safely
    1. Switching from test keys to live keys
    2. Common mistakes before launch
  6. Build it with FromScratch
  7. FAQ
Laptop screen showing a checkout page, illustrating how to connect Stripe to an AI-built store

To connect Stripe to an AI-built store, you do two things: set up your Stripe account and its keys, then describe the payment flow to the AI builder so it wires the checkout to that account. This guide covers both halves, starting in test mode so you can run fake purchases before any real money moves. The steps work for a simple product store and for a store that imports its catalog from another platform.

What you need before you connect Stripe

Gather these before you start, so you don't stop halfway through setup:

  • A Stripe account owned by the business that will receive the money. Use the company's legal details and a bank account in the company's name. Payouts go to that account, so a personal account used for business sales creates problems later.
  • A store with products, prices and a cart. You can describe these in the builder's chat, or import them from an existing Shopify or WooCommerce store.
  • A clear list of currencies and countries you sell in. Decide this now. It affects which payment methods you offer and what your product prices should display.
  • An understanding of how the money flows. Payments go through the merchant's own Stripe account, not a shared account owned by the app builder. You are the merchant of record for your sales, and Stripe holds your funds until they pay out to you.

If you are new to the process, the overview of AI app builders explains what the builder does for you and what you still handle yourself.

Step 1: Get your Stripe keys in test mode

Stripe uses API keys to let your store talk to its account. Start in test mode for every part of the setup.

  1. Sign in to the Stripe Dashboard.
  2. Switch to test mode before you copy any key. Test mode uses separate keys and separate data, so nothing you do there charges a real card.
  3. Find the publishable key and the secret key in the developer section of the Dashboard. Stripe's API key documentation explains where they live and how they differ.

Publishable key vs secret key

The two keys have different jobs:

Key What it does Where it can go
Publishable key Identifies your account in the browser so Stripe can collect card details Can appear in front-end code and public pages
Secret key Lets your back-end create charges and read account data Must stay private: server-side only

The secret key is the one that needs protection. Anyone holding it can act on your Stripe account. Never paste it into a public page, a shared document, a screenshot, or a chat that other people can read. Treat it like a bank password.

This matters more when you build without coding, because you won't see the code that handles the key. Ask the builder to store the secret key on the server, and check that your store's public pages don't display it. The legal and safety notes on vibe coding cover how to prompt without leaking sensitive information.

Why test mode comes first

Test mode gives you a full copy of the payment flow with no real money. You can:

  • run a purchase from start to finish,
  • trigger a declined card,
  • check that orders appear in your records,
  • and fix problems without refunding customers.

Stripe's testing documentation lists test card numbers for successful payments, declines and other cases. Use those numbers and nothing else while you build. Skipping test mode is the most common reason a store launches with a broken checkout.

Step 2: Tell the AI builder what payments should do

The builder needs a plain-language description of the store and the payment behavior you want. Describe the whole path a customer takes, not just the button.

Cover these stages:

  1. Product page. Name, description, price, image, and an add-to-cart button.
  2. Cart. Quantities, line totals, and the ability to remove items.
  3. Checkout. Customer details and card payment through your own Stripe account.
  4. Confirmation. A page after payment that shows the order number and a summary.

Also say which account receives the money. Ask for card payments "through the merchant's own Stripe account" so the builder doesn't assume a shared account.

Example prompt for a simple product store

Here is a prompt you can adapt. Replace the product details with yours:

Create a product page for three candles, each with a name, description, price and photo. Add a cart where customers can change quantities and remove items. At checkout, collect name, email and shipping address, then take card payment through my own Stripe account. Start in test mode and use a placeholder for the Stripe secret key. Show a confirmation page with the order number after each successful payment.

After you send it, the builder creates the pages and connects them. If something is missing, follow up in the same chat with a specific request, such as "Add a field for a gift message at checkout" or "Show the total including shipping before the payment step."

Reviewing the change in the preview

Most AI builders show the result in a live preview within minutes. Check it before moving on:

  • Click through the product, cart, checkout and confirmation pages in order.
  • Try changing quantities and removing an item.
  • Check that prices and totals match what you described.
  • Confirm that no page shows your secret key.

If something is wrong, describe the problem exactly. "The total doesn't include the second candle" works better than "checkout is broken." Every change is saved as a version, so you can go back if a fix makes things worse.

Step 3: Test a full purchase

Run the test end to end at least once before you consider the store ready. A test that only checks the product page tells you very little.

  1. Open the preview and choose a product.
  2. Add it to the cart, change the quantity, and open checkout.
  3. Enter test customer details.
  4. Pay with a Stripe test card number from the testing documentation. A common success card is 4242 4242 4242 4242, with any future expiry date and any three-digit code.
  5. Confirm you land on the confirmation page with the correct order number and total.

Testing a declined payment

A successful purchase is only half the test. Stripe provides test numbers that simulate declines, and you should use one to check that the store handles failure gracefully. Try a declined test card and confirm three things:

  • The customer sees a clear message, not a blank page or an error code.
  • No confirmation page appears, and no order is marked as paid.
  • The customer can try a different card without restarting the cart.

If a decline breaks the flow, tell the builder what happened in plain words and ask it to fix that specific path.

Checking that orders are recorded

After each test purchase, check two places:

  • Your store's records. The order should appear with the right items, quantities, total and customer details.
  • The Stripe test dashboard. The payment should appear in test mode with the matching amount.

If the order appears in the store but not in Stripe, the keys or the payment step are wrong. If it appears in Stripe but not in the store, the order-saving step needs fixing. Either way, describe the mismatch to the builder with the order number and the amount.

Save a version before you make big changes during testing. If a fix breaks checkout, restore the earlier version and try again with a smaller request.

Step 4: Go live safely

Only move to live mode after test purchases work reliably, including the decline case.

Switching from test keys to live keys

When you are ready to take real payments:

  1. In Stripe, complete any identity and bank verification the account requires. Stripe asks for these details before it will pay out, and the requirements depend on your country and business type.
  2. Switch the Dashboard to live mode and copy the live publishable and secret keys.
  3. Give the builder the live keys in the place it asks for them, and confirm in the chat that the store now uses live mode.
  4. Run one small real purchase with your own card. Check that the order and the Stripe payment both appear, then refund yourself from the Stripe Dashboard.

The refund step matters. It proves the money path works end to end without leaving a real sale in your records.

Then publish the store to a public URL, or to your own custom domain, once checkout works in live mode. The guide to building an app without coding covers the publishing steps in more detail.

Common mistakes before launch

  • Live keys in test mode, or the reverse. Check the mode indicator in Stripe before you paste any key, and check the store's behavior after the switch.
  • Secret key in a public page. Search your store's pages for the key's first characters after launch.
  • No confirmation page. Customers who don't see confirmation often pay twice. Make sure the success page appears after every successful payment.
  • Untested decline path. A checkout that only works for successful cards will frustrate real customers.
  • Missing business details. Incomplete Stripe verification can delay payouts, so finish it before launch day.

Build it with FromScratch

FromScratch builds stores from a plain-language description. You describe the products, the cart and the checkout in chat, and the builder creates a React front end, a Python (FastAPI) back end and a database. Card payments go through your own Stripe account.

Follow these steps:

  1. Start with one prompt. Describe the products, cart, checkout and confirmation page in a single message. Say that payments should go through your Stripe account and start in test mode.
  2. Import an existing catalog if you have one. If your products already live in Shopify or WooCommerce, import them rather than retyping them.
  3. Check the live preview. Walk through a full test purchase with a Stripe test card, then try a declined card.
  4. Refine in chat. Ask for specific changes one at a time, such as a shipping field or a different confirmation message.
  5. Restore a version if needed. Each change is saved, so you can return to an earlier version if a change breaks checkout.
  6. Switch to live keys and publish. Replace the test keys with live keys, run one small real purchase, then publish to a public URL or your own custom domain.

Use this prompt to start:

Build an online store with a product catalog, product pages, a shopping cart and checkout. Take card payments through my own Stripe account, starting in test mode, and add a confirmation page after each order. Show me where I can paste my Stripe test keys before I go live.

Ask the builder where to paste the keys in your store's setup, and never paste the secret key anywhere public. If you want to compare plans before you start, see pricing. For questions about your setup, contact support.

FAQ

Do I need to write code to connect Stripe?

No. You describe the payment flow in plain language and the builder handles the connection. You still need to handle your keys carefully: keep the secret key private, and never paste it into public pages or shared chats.

Can I use test mode and live mode in the same store?

You use test keys while you build and test, then switch to live keys at launch. Don't run real customers on test keys, and don't put live keys into a store you are still testing. Check the mode indicator in Stripe before each switch.

What if a payment fails during testing?

Check the Stripe test dashboard for the payment's status and error message. Then retry with a different Stripe test card, such as a successful one, to confirm the flow works. If the failure happens in your store rather than in Stripe, describe the exact step and the result to the builder so it can fix that path.

Does my AI store need its own Stripe account?

Yes. The business that sells the products should own the Stripe account, so payouts go directly to its bank account. A shared account owned by someone else adds risk and complicates refunds and accounting.

Written by

FromScratch TeamEditorial team

The team building FromScratch, the AI app builder that turns a plain-language description into a real, published full-stack app.