Quickstart
Create a customer, send them to checkout and receive the webhook. In test mode, from your server.
gpy_test_…. Sign in to create a test key of your own.Start freeInstall and authenticate
A secret key starts with
gpy_test_orgpy_live_. Send it asAuthorization: Bearer …from your server only. The key's prefix decides the mode, so a test key can never touch live data.Create a test key in the dashboard under Developers › API keys. It is shown once.
lib/mint.ts Create the customer
A customer is keyed by your own id for the account: a workspace or organisation id. Upserting is safe to repeat, so call it on every sign-in.
Checkout does not create customers. A session for an id we have not seen answers 404.
customer.ts Open a checkout
Name the plan by its code. Create plans in the dashboard under Products, or with
mint.catalog.upsertPlan. Both URLs are required and must be https (http is accepted for localhost).Redirect the browser to
session.url. The link is valid for 24 hours. The page collects the card through Stripe, so connect your Stripe test keys under Settings › Payments first, then pay with Stripe's test card4242 4242 4242 4242.checkout.ts Receive the webhook
Add an endpoint under Developers › Webhooks and copy its
whsec_secret; it is shown once. The URL must be https on a public host, so use a tunnel while you develop locally.When the payer finishes, we send
checkout.session.completedand, once the first invoice is paid,invoice.paid. Grant access on the webhook, not on the redirect to your success URL. Order is not guaranteed and delivery is at least once, so skip anyevent.idyou have already handled.app/api/mint/webhooks/route.ts No test event sent yet.Not released yet. Sending a test event from this page arrives with test events. Until then, complete a checkout in test mode and watch the delivery under Developers › Webhooks.
Next
- Verify signatures without the SDK.
- Gate features on entitlements so your app asks GlobalyMint what a customer may use.
- Open the customer portal from your settings page.