Documentation / Quickstart · Updated 16 September 2026
Your first test payment.
1. Create a merchant workspace
Create an account, then enable two-factor authentication under Account & security. Business approval is not required to use the sandbox. Suspended workspaces cannot use the API.
2. Create your key
Open Developers, select the three sandbox permissions, and create a key. Store the one-time secret as CG_SECRET_KEY in your server environment. Do not put it in browser code, a mobile bundle, a URL, or source control.
curl https://cheatgateway.net/api/v1/account -H "Authorization: Bearer $CG_SECRET_KEY"3. Create an intent
This example creates a $25.00 test payment. Use a unique idempotency key for every distinct order.
curl https://cheatgateway.net/api/v1/payment-intents \
-H "Authorization: Bearer $CG_SECRET_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: sandbox-order-00001" \
-d '{"amount_minor":2500,"currency":"USD","reference":"order_00001"}'A new request returns 201 with a body like this:
{
"id": "pi_test_123e4567-e89b-42d3-a456-426614174000",
"object": "payment_intent",
"livemode": false,
"amount_minor": 2500,
"currency": "USD",
"reference": "order_00001",
"status": "pending",
"created_at": 1789603200000,
"updated_at": 1789603200000
}4. Simulate an outcome
Replace PAYMENT_ID with the exact ID from the create response. No card details are needed or accepted.
curl https://cheatgateway.net/api/v1/payment-intents/PAYMENT_ID/simulate \
-H "Authorization: Bearer $CG_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"outcome":"succeeded"}'Use failed to test an unsuccessful result on a different pending intent. A terminal outcome cannot be changed.
5. Retrieve and verify
curl https://cheatgateway.net/api/v1/payment-intents/PAYMENT_ID -H "Authorization: Bearer $CG_SECRET_KEY"Server-side JavaScript
// Node.js 24 — server only
import { randomUUID } from 'node:crypto';
const secret = process.env.CG_SECRET_KEY;
if (!secret) throw new Error('Missing CG_SECRET_KEY');
// Persist this key with your order and reuse it on retries.
const idempotencyKey = randomUUID();
const response = await fetch('https://cheatgateway.net/api/v1/payment-intents', {
method: 'POST',
signal: AbortSignal.timeout(10000),
headers: {
Authorization: 'Bearer ' + secret,
'Content-Type': 'application/json',
'Idempotency-Key': idempotencyKey,
},
body: JSON.stringify({
amount_minor: 2500, currency: 'USD', reference: 'order_00001'
}),
});
const body = await response.json();
if (!response.ok) {
throw new Error(body.error?.message || 'Payment request failed');
}
if (body.livemode !== false) throw new Error('Unexpected environment');
// Save body.id in your test order. No real fulfilment.
console.log({ id: body.id, status: body.status });