Payment processing with Stripe for Google Antigravity IDE
# Stripe Payments Complete Guide for Google Antigravity
Master payment processing with Stripe in Google Antigravity IDE.
## Configuration
```typescript
// .antigravity/stripe.ts
export const stripeConfig = {
features: { checkout: true, subscriptions: true, webhooks: true }
};
```
## Checkout Session
```typescript
import Stripe from "stripe";
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);
export async function createCheckoutSession(priceId: string, customerId: string) {
return stripe.checkout.sessions.create({
customer: customerId,
mode: "subscription",
line_items: [{ price: priceId, quantity: 1 }],
success_url: `${process.env.APP_URL}/success`,
cancel_url: `${process.env.APP_URL}/cancel`
});
}
```
## Webhook Handler
```typescript
export async function POST(request: Request) {
const body = await request.text();
const sig = request.headers.get("stripe-signature")!;
const event = stripe.webhooks.constructEvent(
body, sig, process.env.STRIPE_WEBHOOK_SECRET!
);
if (event.type === "checkout.session.completed") {
await handleCheckoutComplete(event.data.object);
}
return new Response("OK");
}
```
## Best Practices
1. **Validate webhooks**
2. **Use idempotency keys**
3. **Store customer IDs**
Google Antigravity IDE provides Stripe scaffolding.This Stripe prompt is ideal for developers working on:
By using this prompt, you can save hours of manual coding and ensure best practices are followed from the start. It's particularly valuable for teams looking to maintain consistency across their stripe implementations.
Yes! All prompts on Antigravity AI Directory are free to use for both personal and commercial projects. No attribution required, though it's always appreciated.
This prompt works excellently with Claude, ChatGPT, Cursor, GitHub Copilot, and other modern AI coding assistants. For best results, use models with large context windows.
You can modify the prompt by adding specific requirements, constraints, or preferences. For Stripe projects, consider mentioning your framework version, coding style, and any specific libraries you're using.