Stripe Payment Service
Stripe Payment Provider
Create Payment orders with Stripe Checkout and issue Credits after a paid webhook.
const payment = new PaymentService({
providers: [stripePaymentProvider()],
resolve_topup: ({ topup_amount_minor }) => ({ credits: topup_amount_minor * 10_000 }),
on_paid: async (record) => {
await credits.topup({
card: { kind: "primary", user_id: record.user_id },
credits: record.credits,
source: "payment",
ref: record.payment_id,
idempotency_key: `payment:${record.payment_id}`,
});
},
});Configure both STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET. Without webhook verification configuration the Provider is disabled and webhook requests are rejected. Send webhooks to /v1/payment/webhook?provider=stripe.
await city.payment.method("stripe").invoke({
topup_amount_minor: 500,
idempotency_key: "order_123",
});