overflowDocs
Dashboard
DocumentationAPI reference

Get started

  • Introduction
  • Quickstart
  • Integrate with AI
  • Agents (MCP)
  • Selling

Payments

  • Checkout
  • Loader
  • Webhooks

Risk and privacy

  • Fraud gate
  • Dispute evidence
  • Privacy
  • Dashboard
  • Sign in

Get started

  • Introduction
  • Quickstart
  • Integrate with AI
  • Agents (MCP)
  • Selling

Payments

  • Checkout
  • Loader
  • Webhooks

Risk and privacy

  • Fraud gate
  • Dispute evidence
  • Privacy

Get started

Quickstart

Take a payment in four steps. You need an Overflow account, which comes with your invite, and a store.

Your store can't take payments, test ones included, until payouts are connected under Settings → Payouts. See How you get paid.

1. Create a secret key

In the dashboard open Developers and choose Create secret key. The key starts with ovf_sk_ and is shown once. Put it in an environment variable on your server:

OVERFLOW_SECRET_KEY=ovf_sk_...

Keep it on the server. Anyone with this key can create checkouts and refund payments for your store. Never put it in browser code or commit it.

2. Create a checkout on your server

A checkout is one thing a buyer is about to pay for. Amounts are integers in the smallest currency unit, so 1900 is 19.00.

// POST /api/checkout on your own server
export async function POST() {
	const res = await fetch("https://overflowpay.net/api/v1/checkouts",{
		method:"POST",
		headers:{
			authorization:`Bearer ${process.env.OVERFLOW_SECRET_KEY}`,
			"content-type":"application/json"
		},
		body:JSON.stringify({
			items:[{name:"Pro license",amount:1900,quantity:1}],
			currency:"eur",
			return_url:"https://yoursite.com/thanks",
			metadata:{order:"1001"}
		})
	})
	const checkout = await res.json()
	return Response.json({id:checkout.id})
}

The same call with curl:

curl https://overflowpay.net/api/v1/checkouts \
  -H "Authorization: Bearer $OVERFLOW_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"items":[{"name":"Pro license","amount":1900}],"currency":"eur","return_url":"https://yoursite.com/thanks"}'

The response has the checkout's id and a url you can send the buyer to.

3. Open it on your site

Add the loader once, then open the checkout when the buyer clicks.

<script src="https://overflowpay.net/v1/overflow.js" async></script>

<button id="buy">Buy Pro</button>

<script>
document.getElementById("buy").onclick = async () => {
	const {id} = await fetch("/api/checkout",{method:"POST"}).then(res => res.json())
	Overflow.checkout({id}).open()
}
</script>

Before this works on your live site, add its origin under Settings → Sites allowed to open the checkout. The checkout frame refuses to load anywhere else. In test mode, localhost is always allowed.

No time for a modal? Skip the loader and redirect the buyer to checkout.url.

4. Fulfil from the webhook

The buyer landing on your thanks page doesn't prove they paid: they can close the tab early or open that URL by hand. Deliver the order when Overflow tells your server.

Add a webhook endpoint under Developers, copy its signing secret, then verify each message:

import {createHmac,timingSafeEqual} from "crypto"

export async function POST(req) {
	const body = await req.text()
	const id = req.headers.get("webhook-id")
	const ts = req.headers.get("webhook-timestamp")
	const key = Buffer.from(process.env.OVERFLOW_WEBHOOK_SECRET.replace("whsec_",""),"base64")
	const want = "v1," + createHmac("sha256",key).update(`${id}.${ts}.${body}`).digest("base64")
	// two signatures for a day after you roll the secret, so accept any match
	const got = (req.headers.get("webhook-signature") || "").split(" ")

	const fresh = Math.abs(Date.now() / 1000 - Number(ts)) < 300
	if (!fresh || !got.some(sig => sig.length == want.length && timingSafeEqual(Buffer.from(sig),Buffer.from(want)))) {
		return new Response("bad signature",{status:400})
	}

	const event = JSON.parse(body)
	if (event.type == "payment.succeeded") {
		// mark the order paid and deliver it. event.id can arrive twice, so make this safe to repeat
		await fulfil(event.data.checkout.metadata.order)
	}
	return new Response("ok")
}

Test it

While Overflow runs in test mode, the dashboard and checkout show a Test mode badge and no real money moves. Pay with card 4242 4242 4242 4242, any future expiry and any CVC. Card 4000 0000 0000 3220 forces a 3D Secure prompt.

Next

  • Log deliveries so you have evidence if a payment is disputed.
  • Tune the fraud gate for your store.
  • Read the full API reference.
PreviousIntroductionNextIntegrate with AI

On this page

  • 1. Create a secret key
  • 2. Create a checkout on your server
  • 3. Open it on your site
  • 4. Fulfil from the webhook
  • Test it
  • Next