← All recipes

MCP Recipe

Implement a Stripe PaymentIntent with Context7

Influzer starter recipe: use Stripe MCP for account/product context, then pull current Stripe API docs via Context7 before writing PaymentIntent code — test mode only.

Engineering
By Influzer Published 2026-11-22 Updated 2026-11-22 1 worked for me

MCP servers used

Compatible clients (author-reported, not verified by Influzer): Cursor, Claude Desktop, Claude Code, ChatGPT

Prerequisites

  • Stripe remote MCP authorized for a test-mode account you own
  • Context7 remote MCP access
  • Never paste live secret keys into chat — configure OAuth / client secrets in MCP settings

Required permissions

Stripe MCP can read and mutate payment objects depending on scopes. Stay in test mode. Context7 is read-only docs lookup. This is not a PCI or security approval.

Setup

1. Connect Stripe and Context7

Add Stripe at https://mcp.stripe.com (test-mode account) and Context7 at https://mcp.context7.com/mcp. Confirm tools appear before asking for payment code.

2. Example dual-server mcp.json · json
{
  "mcpServers": {
    "stripe": {
      "url": "https://mcp.stripe.com"
    },
    "context7": {
      "url": "https://mcp.context7.com/mcp"
    }
  }
}
3. Docs first, then a test-mode PaymentIntent · markdown
Using Context7, fetch the current Stripe docs for creating a PaymentIntent (server SDK + client confirm).
Using Stripe MCP in **test mode only**, list whether any products/prices already exist that fit a $20 one-time checkout (do not create live charges).
Start from the Node / Python / PHP snippets in this recipe, then adapt them to my stack.
Prefer Context7 over the snippets if the API shape differs.
Do not use live secret keys, do not disable webhooks guidance, and do not invent PCI-sensitive shortcuts.
4. Starter snippets (test mode)

Use these as copy-paste starting points for a $20.00 USD PaymentIntent. Replace YOUR_STRIPE_SECRET_KEY via env only. Confirm the final SDK calls with Context7 before shipping.

5. Node — create PaymentIntent · javascript
// npm i stripe
import Stripe from 'stripe';

const stripe = new Stripe(process.env.STRIPE_SECRET_KEY); // sk_test_...

export async function createCheckoutIntent() {
  const intent = await stripe.paymentIntents.create({
    amount: 2000, // $20.00
    currency: 'usd',
    automatic_payment_methods: { enabled: true },
  });
  return { clientSecret: intent.client_secret };
}
6. Python — create PaymentIntent · python
# pip install stripe
import os
import stripe

stripe.api_key = os.environ["STRIPE_SECRET_KEY"]  # sk_test_...

def create_checkout_intent():
    intent = stripe.PaymentIntent.create(
        amount=2000,  # $20.00
        currency="usd",
        automatic_payment_methods={"enabled": True},
    )
    return {"client_secret": intent.client_secret}
7. PHP — create PaymentIntent · php
<?php
// composer require stripe/stripe-php
require 'vendor/autoload.php';

$stripe = new \Stripe\StripeClient(getenv('STRIPE_SECRET_KEY')); // sk_test_...

$intent = $stripe->paymentIntents->create([
  'amount' => 2000, // $20.00
  'currency' => 'usd',
  'automatic_payment_methods' => ['enabled' => true],
]);

return ['client_secret' => $intent->client_secret];
8. Keep secrets out of the thread

Put Stripe secrets in MCP / env config. Reject prompts that ask you to paste sk_live or production customer PII into chat.

Expected result

A minimal PaymentIntent create flow (server-side) grounded in current Stripe docs, plus the client confirm steps — with test-mode caveats called out.

Sample output

Context7 (stripe-node): paymentIntents.create({ amount, currency, automatic_payment_methods })
Proposed route: POST /api/checkout/intent → returns client_secret
Test card: use Stripe test PANs only; do not charge live customers from this recipe.

Troubleshooting

  • Auth / empty tools: re-add https://mcp.stripe.com and complete OAuth for the test account
  • Wrong API shape: prefer Context7 over training memory for Stripe SDK versions
  • If the agent suggests live keys or skipping webhooks: stop and tighten the prompt

Report an issue