Developer docs
Create a payment priced in rupiah or dollars, send your customer to the checkout, and get a signed webhook when it’s paid.
Getting started
- Create a merchant account. You connect the wallet that receives payments and sign a message with it. Signup shows your API key and webhook signing secret once, so store them before you leave the page.
- On your server, create a payment for each order and send the customer to its
payment_url. - Set a webhook URL in the dashboard’s settings and fulfil the order on
payment.paid.
Every request in these docs goes to https://sandbox-pwc.sblsblsbl.club. The customer pays in ETH, WETH, USDT or USDC on Ethereum or Base. The coin goes to your wallet in the same transaction, less the fee (1% unless agreed otherwise). paywithcrypto never holds your funds.
Authentication
Send your secret API key as a bearer token on every /api/v1/payments request:
Authorization: Bearer sk_test_...
Sandbox keys start with sk_test_ and live keys with sk_live_; each works only on its own deployment. Keep the key on your server. If it leaks, roll it in the dashboard: the old key stops working immediately.
Create a payment
POST /api/v1/payments makes one payment for one order. It answers 201 with the payment object.
curl -X POST https://sandbox-pwc.sblsblsbl.club/api/v1/payments \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{
"order_id": "order-1042",
"amount": "150000",
"currency": "IDR",
"description": "2x Kopi Susu",
"redirect_url": "https://shop.example.com/orders/1042"
}'| Field | Type | Description |
|---|---|---|
order_id | string, required | Your reference, 1 to 64 characters. Unique per merchant: a second payment with the same order_id is refused with 409, so retrying a create after a timeout can't charge twice. |
amount | string, required | A decimal string in the currency's major unit. IDR is whole rupiah ("150000"); USD takes up to 2 decimals ("12.50"). |
currency | string, required | "IDR" or "USD". |
description | string | Shown on the checkout. Up to 255 characters. |
redirect_url | string | Where the checkout's “Return to” button goes once the payment is paid. |
expiry_minutes | integer | How long the payment can be paid: 5 to 10080 (7 days). Default 60. |
Read a payment back at any time with GET /api/v1/payments/:id. A payment belonging to another merchant answers 404.
The checkout
Redirect the customer to payment_url. The checkout shows your name, the amount and the expiry. The customer picks a chain and a coin, and pays one of two ways:
- Connect a wallet (MetaMask, Phantom, any browser wallet, or WalletConnect). The price is locked for 5 minutes for ETH and WETH and 60 minutes for stablecoins.
- Send to an address from any wallet or exchange. The amount includes a small network fee that pays for moving the coin on to you. This option appears for payments worth $5 or more.
Once the payment is paid, the checkout shows a button back to your redirect_url. Nothing is added to that URL, and a customer can open it without paying, so don’t treat a visit as proof of payment: wait for the webhook or read the payment.
The payment object
API responses and webhooks carry the same object. Amounts in the payment currency are decimal strings; coin amounts are integers in the coin’s base units (wei for ETH, 6 decimals for USDC and USDT), also as strings.
{
"id": "inv_354z1pfgp0pz9xdsf1tdk9yn",
"object": "payment",
"status": "paid",
"order_id": "order-1042",
"amount": "150000",
"currency": "IDR",
"description": "2x Kopi Susu",
"redirect_url": "https://shop.example.com/orders/1042",
"payment_url": "https://sandbox-pwc.sblsblsbl.club/pay/inv_354z1pfgp0pz9xdsf1tdk9yn",
"amount_received": "150000",
"paid_at": "2026-11-29T07:04:31.000Z",
"expires_at": "2026-11-29T08:00:00.000Z",
"created_at": "2026-11-29T07:00:00.000Z",
"payments": [
{
"method": "wallet",
"chain": "base",
"token": "USDC",
"decimals": 6,
"amount": "9231054",
"network_fee": "0",
"value": "150000",
"confirmed": true,
"tx_hash": "0x8f1c...",
"payer": "0x51a4...",
"deposit_address": null
}
]
}| Field | Type | Description |
|---|---|---|
id | string | inv_ followed by 24 characters. |
status | string | See Statuses below. |
amount_received | string | Confirmed value received so far, in the payment currency. Unconfirmed funds aren't counted. |
paid_at | string or null | When the payment became paid (ISO 8601). |
payments | array | What has been received, confirmed or not: one entry per wallet transaction and one per deposit address that received funds. |
payments[] entries
| Field | Type | Description |
|---|---|---|
method | string | "wallet" (paid through a connected wallet) or "deposit" (sent to the payment's address). |
chain | string | "ethereum" or "base". |
token | string | "ETH", "WETH", "USDT" or "USDC". |
amount | string | Gross amount received, in base units. For a deposit, the address's total. |
network_fee | string | The part of amount kept to pay for moving a deposit on to you; "0" for wallet payments. |
value | string | What the entry is credited at, in the payment currency. |
confirmed | boolean | Past the confirmation depth: 12 blocks on Ethereum, 30 blocks on Base. |
tx_hash, payer | string or null | Wallet payments only. Deposits are plain transfers, tracked by balance, so both are null. |
You receive amount minus network_fee, less the platform fee, in the same coin on the same chain. There is no conversion.
Statuses
pending ──funds seen──▶ confirming ──confirmed──▶ paid │ │ │ └──short──▶ partially_paid ──top-up──▶ confirming └──nothing by expires_at──▶ expired
| Status | Meaning |
|---|---|
pending | Waiting for the customer to pay. |
confirming | Funds are in a block but not yet final. Don't ship yet. |
partially_paid | Confirmed, but short of the amount. The customer can pay the rest from the same checkout, on any chain and coin. |
paid | Confirmed in full. Fulfil the order. This is final. |
expired | Nothing was received before expires_at. |
- Up to 0.5% short still counts as
paid, so a wallet rounding a few units down doesn’t leave a payment stuck. - Paying more is still
paid. The extra goes to you, and the webhook carries anoverpaidfield with the excess in the payment currency. - An expired payment can still become paid. Funds sent late to the address are re-priced at the current rate and accepted if they cover the amount. Handle
payment.paidwhatever status you last saw. - A chain reorganisation can drop unconfirmed funds, which moves a payment from
confirmingback topending.
Webhooks
Set your webhook URL in the dashboard’s settings (https only). Each status change is a POST with a JSON body:
{
"id": "evt_7k2m9q4w8x1c5v3b6n0z2a4s",
"type": "payment.paid",
"created_at": "2026-11-29T07:04:31.000Z",
"previous_status": "confirming",
"data": {
"id": "inv_354z1pfgp0pz9xdsf1tdk9yn",
"object": "payment",
"status": "paid",
...
}
}data is the payment object at the time of the event.
| Event | Sent when |
|---|---|
payment.confirming | Funds are seen in a block. |
payment.pending | A reorg dropped the unconfirmed funds that made it confirming. |
payment.partially_paid | Confirmed, but short by more than 0.5%. |
payment.paid | Confirmed in full. |
payment.expired | Nothing was received before expires_at. |
payment.received_after_paid | More confirmed funds arrived on a paid payment; amount_received grew. |
Delivery
- Answer with any 2xx within 10 seconds. Anything else, or no answer, is retried after 1 minute, 5 minutes, 30 minutes, 2, 6, 12 and 24 hours, then dropped: 8 attempts over about two days.
- A retry sends the same body with the same event
id. Record the ids you’ve handled and skip repeats. - Events are sent concurrently and can arrive out of order. Order them by
created_at, or simply re-read the payment withGET /api/v1/payments/:idand act on its current status. - Events are only queued while a webhook URL is set. Events from before you set one aren’t sent later.
import express from "express";
import { verifyWebhook } from "./verify-webhook.js";
const app = express();
// The signature covers the exact bytes sent: read the raw body, not parsed JSON.
app.post(
"/webhooks/paywithcrypto",
express.raw({ type: "application/json" }),
async (req, res) => {
const body = req.body.toString("utf8");
const signature = req.get("paywithcrypto-signature") ?? "";
if (!verifyWebhook(signature, body, process.env.PAYWITHCRYPTO_WEBHOOK_SECRET)) {
return res.sendStatus(400);
}
const event = JSON.parse(body);
if (await alreadyHandled(event.id)) return res.sendStatus(200);
if (event.type === "payment.paid") {
await fulfilOrder(event.data.order_id, event.data);
}
await markHandled(event.id);
res.sendStatus(200);
},
);Verifying signatures
Every webhook has a paywithcrypto-signature header:
paywithcrypto-signature: t=1795957149,v1=55e7b181654e5e1e867ca6df59347bb0d18bf2abed0281f90fc7c3a86e773b5c
t is the send time in Unix seconds, and v1 is the hex HMAC-SHA256 of <t>.<raw body>, keyed with your webhook signing secret. To check it, recompute the HMAC over the body exactly as received, compare in constant time, and reject a t more than 5 minutes from now so a captured request can’t be replayed. Each retry is signed afresh with a new t.
import { createHmac, timingSafeEqual } from "node:crypto";
// header: the paywithcrypto-signature request header
// body: the raw request body as a string, exactly as received
export function verifyWebhook(header, body, secret, toleranceSeconds = 300) {
const parts = Object.fromEntries(
header.split(",").map((part) => part.split("=", 2)),
);
const timestamp = Number(parts.t);
if (!Number.isInteger(timestamp) || !parts.v1) return false;
if (Math.abs(Date.now() / 1000 - timestamp) > toleranceSeconds) return false;
const expected = createHmac("sha256", secret)
.update(`${timestamp}.${body}`)
.digest();
const given = Buffer.from(parts.v1, "hex");
return given.length === expected.length && timingSafeEqual(given, expected);
}Rolling the secret in the dashboard signs every later delivery, retries included, with the new one. Update your server first or deliveries will fail until you do.
Errors
Errors are RFC 9457 problem objects. Branch on type; title and detail are for people.
{
"type": "/errors/order-id-taken",
"status": 409,
"title": "A payment with this order_id already exists",
"order_id": "order-1042"
}{
"type": "/errors/invalid-request",
"status": 400,
"title": "Invalid request",
"detail": "The request payload doesn't match the API: currency: Expected "IDR" | "USD"",
"errors": [
{ "path": ["payload", "currency"], "message": "Expected "IDR" | "USD"" }
]
}| Status | type | When |
|---|---|---|
400 | /errors/invalid-request | The body isn't valid JSON, a field is missing or has the wrong type, or the amount isn't valid for the currency. detail says why, and errors lists each failing field. |
401 | /errors/unauthenticated | The API key is missing, wrong, rolled, or from the other deployment. |
403 | /errors/email-not-confirmed | Live only: confirm the account's email before creating payments. |
404 | /errors/payment-not-found | No payment with that id for this merchant. |
409 | /errors/order-id-taken | A payment with this order_id exists. Look it up by the id you stored, or use a new order_id. |
Testing in the sandbox
The sandbox is a separate deployment on Sepolia and Base Sepolia with its own accounts and sk_test_ keys. It prices payments from the same live rates as production, so amounts look real, but customers pay with test coins.
- Get Sepolia ETH from a faucet and pay with a wallet switched to the test network. The checkout adds the network if the wallet doesn’t have it.
- Sandbox accounts can create payments before confirming their email.
- The webhook URL must be public https. To receive webhooks on your machine, use a tunnel such as cloudflared or ngrok.
- Moving to production: sign up on the live deployment, swap in the
sk_live_key and webhook secret, and point the base URL at it.
This is the sandbox deployment, on Sepolia (chain 11155111) and Base Sepolia (chain 84532).