--- title: Payments description: How kreogen handles payments and billing. product: Payments type: reference summary: How payments and billing are configured with Stripe. related: - /en/docs/apps/api - /en/docs/packages/rate-limit --- # Payments kreogen uses [Stripe](https://stripe.com/) by default for payments and billing. Implementing Stripe in your project is straightforward. Stripe is an optional integration. If `STRIPE_SECRET_KEY` is not set, the `stripe` export will be `undefined` and payment webhooks will be skipped. ## In-App Purchases You can use Stripe anywhere in your app by importing the `stripe` object like so: ```ts title="page.tsx {1,5}" import { stripe } from '@kreogen/payments'; // ... await stripe?.prices.list(); ``` ## Webhooks kreogen ships a Stripe webhook handler at `apps/api/app/webhooks/payments`. It verifies the signature, rejects a bad one with 400, and records the event id before handling it so that a redelivery is a no-op. See [the API app](/en/docs/apps/api#webhooks) for why each of those matters. ## Anti-Fraud As your app grows, you will inevitably encounter credit card fraud. [Stripe Radar](https://stripe.com/radar) is enabled by default if you integrate payments using their SDK as described above. This provides a set of tools to help you detect and prevent fraud. Stripe Radar supports more [advanced anti-fraud features](https://docs.stripe.com/disputes/prevention/advanced-fraud-detection) if you embed the Stripe JS script in every page load. This is not enabled by default in kreogen, but you can add it as follows: ### 1. Load Stripe.js in the app Add the script to `apps/app/app/layout.tsx`, between the opening `` and `` tags: ```tsx title="apps/app/app/layout.tsx" import './styles.css'; import { AnalyticsProvider } from '@kreogen/analytics/provider'; import { DesignSystemProvider } from '@kreogen/design-system'; import { fonts } from '@kreogen/design-system/lib/fonts'; import Script from 'next/script'; import type { ReactNode } from 'react'; interface RootLayoutProperties { readonly children: ReactNode; } const RootLayout = ({ children }: RootLayoutProperties) => (