Developers

API reference

Accept Bitcoin, Litecoin, Ethereum and Solana with a few REST calls. JSON in, JSON out — no SDK required.

Base URLhttps://payswpgg.vercel.app/api/v1
Version1.0.0
Response envelope

Every response is wrapped in the same envelope. On success, data carries the result. On error, data is empty and error.code describes what went wrong.

Envelope shape
{
  "data":    { },
  "message": "Operation completed successfully!",
  "error":   { },
  "status":  200,
  "version": "1.0.0"
}

Authentication

Bearer token

Every request (except public endpoints) requires your merchant API key as a Bearer token. Create keys in the dashboard under API Keys.

Header
Authorization: Bearer swp_live_...

API keys are scoped per-merchant. Endpoints marked No auth required are public and do not need a key.

Endpoints

Payments

Invoice creation and payment lifecycle

POST/invoice

Generate Invoice

Create a hosted-checkout invoice. Redirect your customer to payment_url so they can select their preferred coin and pay. Poll the returned track_id via GET /invoice/{track_id} to check status, or use callback_url for push notifications.

Request body
FieldTypeDescription
amountrequirednumberPayment amount. Treated as USD when `currency` is omitted.
currencystringCurrency of `amount`. Fiat (`USD`, `EUR`, …) or crypto (`BTC`, `LTC`, `ETH`, `SOL`). Defaults to `USD`.
lifetimeintegerInvoice expiry in minutes.
fee_paid_by_payernumber`1` = payer covers fee; `0` = merchant covers fee.
under_paid_coveragenumberMax acceptable underpayment as a percentage.
to_currencystringAuto-convert received crypto to this currency (only `USDT` supported).
auto_withdrawalbooleanAuto-forward received funds to your configured address.
mixed_paymentbooleanAllow payer to cover remainder with a different coin.
callback_urlstringWebhook URL for payment status updates.
return_urlstringRedirect URL after successful payment.
emailstringCustomer email for receipts.
order_idstringYour internal order reference.
thanks_messagestringMessage shown to customer after successful payment.
descriptionstringOrder details shown in reports and on the payment page.
sandboxboolean`true` = test mode (no real funds).
cURL
curl -X POST "https://payswpgg.vercel.app/api/v1/invoice" \
  -H "Authorization: Bearer swp_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 49.99,
    "currency": "USD",
    "lifetime": 60,
    "order_id": "order-1001",
    "callback_url": "https://example.com/webhook/swp",
    "return_url": "https://example.com/order/1001/thank-you",
    "description": "2× Pro licence"
  }'
Response · 200
{
  "data": {
    "track_id": "ch_8fK2mPqR7nW4",
    "payment_url": "https://swp.gg/pay/ch_8fK2mPqR7nW4",
    "expired_at": 1734546589,
    "date": 1734510589
  },
  "message": "Operation completed successfully!",
  "error": {},
  "status": 200,
  "version": "1.0.0"
}
POST/whiteLabelInvoice

Generate White Label Invoice

Like Generate Invoice but returns the deposit address and crypto amount immediately — no hosted payment page. Use this when you want to build your own checkout UI and manage the coin-selection flow yourself.

You must specify pay_currency (the coin you want to receive). The response includes the on-chain address, the exact amount to request, and a QR code URL.

Request body
FieldTypeDescription
pay_currencyrequired"BTC" | "LTC" | "ETH" | "SOL"The cryptocurrency the customer will pay in.
amountrequirednumberPayment amount (in `currency`, defaults to USD).
currencystringCurrency of `amount`. Fiat or crypto. Defaults to `USD`.
networkstringBlockchain network override (reserved for future multi-network support).
lifetimeinteger
fee_paid_by_payernumber
under_paid_coveragenumber
to_currencystring
auto_withdrawalboolean
callback_urlstring
emailstring
order_idstring
descriptionstring
cURL
curl -X POST "https://payswpgg.vercel.app/api/v1/whiteLabelInvoice" \
  -H "Authorization: Bearer swp_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "pay_currency": "BTC",
    "amount": 49.99,
    "currency": "USD",
    "lifetime": 60,
    "order_id": "order-1001",
    "callback_url": "https://example.com/webhook/swp"
  }'
Response · 200
{
  "data": {
    "track_id": "ch_8fK2mPqR7nW4",
    "amount": 49.99,
    "currency": "usd",
    "pay_amount": 0.00120048,
    "pay_currency": "btc",
    "network": "Bitcoin Network",
    "address": "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq",
    "memo": "",
    "callback_url": "https://example.com/webhook/swp",
    "description": "2× Pro licence",
    "email": "",
    "fee_paid_by_payer": 0,
    "lifetime": 60,
    "order_id": "order-1001",
    "under_paid_coverage": 0,
    "rate": 41650.25,
    "qr_code": "https://api.qrserver.com/v1/create-qr-code/?data=bitcoin%3Abc1q...&size=200x200",
    "expired_at": 1734546589,
    "date": 1734510589
  },
  "message": "Operation completed successfully!",
  "error": {},
  "status": 200,
  "version": "1.0.0"
}
GET/invoice/{track_id}

Payment Information

Retrieve the current state of an invoice. Call this to poll for status changes or to reconcile a webhook notification. Add ?refresh=1 to trigger a live on-chain check before returning.

Parameters
NameInTypeDescription
track_idrequiredpathstringThe `track_id` returned when the invoice was created.
Query Parameters
NameTypeDescription
refresh"0" | "1"default: 0Set to `1` to force a live on-chain re-check before responding.
cURL
curl "https://payswpgg.vercel.app/api/v1/invoice/ch_8fK2mPqR7nW4" \
  -H "Authorization: Bearer swp_live_..."
GET/invoices

Payment History

Paginated list of all invoices for the authenticated merchant, sorted newest-first. Filter by status, currency, or date range.

Query Parameters
NameTypeDescription
pageintegerdefault: 1
sizeintegerdefault: 20
status"pending" | "confirming" | "paid" | "expired"Filter by invoice status.
currencystringFilter by payment currency (e.g. `BTC`).
from_dateintegerUnix timestamp — only return invoices created after this time.
to_dateintegerUnix timestamp — only return invoices created before this time.
cURL
curl "https://payswpgg.vercel.app/api/v1/invoices" \
  -H "Authorization: Bearer swp_live_..."
GET/statistics

Payment Statistics

Aggregate statistics for the authenticated merchant.

Query Parameters
NameTypeDescription
period"day" | "week" | "month" | "all"default: monthTime period to aggregate over.
cURL
curl "https://payswpgg.vercel.app/api/v1/statistics" \
  -H "Authorization: Bearer swp_live_..."
Response · 200
{
  "data": {
    "period": "month",
    "total_invoices": 45,
    "paid_invoices": 32,
    "pending_invoices": 8,
    "expired_invoices": 5,
    "total_received_usd": 1580.5,
    "by_currency": {
      "BTC": {
        "amount": "0.01250000",
        "usd": 840.5
      },
      "ETH": {
        "amount": "0.32000000",
        "usd": 740
      }
    }
  },
  "message": "Operation completed successfully!",
  "error": {},
  "status": 200,
  "version": "1.0.0"
}
GET/currenciesNo auth required

Accepted Currencies

Returns all cryptocurrencies currently accepted by swp.gg, including their required confirmation counts (as configured by the platform admin).

cURL
curl "https://payswpgg.vercel.app/api/v1/currencies"
Response · 200
{
  "data": [
    {
      "symbol": "BTC",
      "name": "Bitcoin",
      "network": "Bitcoin Network",
      "confirmations": 2,
      "decimals": 8
    },
    {
      "symbol": "LTC",
      "name": "Litecoin",
      "network": "Litecoin Network",
      "confirmations": 6,
      "decimals": 8
    },
    {
      "symbol": "ETH",
      "name": "Ethereum",
      "network": "Ethereum Network",
      "confirmations": 12,
      "decimals": 18
    },
    {
      "symbol": "SOL",
      "name": "Solana",
      "network": "Solana Network",
      "confirmations": 1,
      "decimals": 9
    }
  ],
  "message": "Operation completed successfully!",
  "error": {},
  "status": 200,
  "version": "1.0.0"
}
GET/statusesNo auth required

Payment Status Table

Returns all possible invoice statuses and their meanings.

cURL
curl "https://payswpgg.vercel.app/api/v1/statuses"
Response · 200
{
  "data": [
    {
      "status": "pending",
      "description": "Invoice created, awaiting payment."
    },
    {
      "status": "confirming",
      "description": "Payment detected on-chain, waiting for required confirmations."
    },
    {
      "status": "paid",
      "description": "Payment confirmed and credited to your merchant balance."
    },
    {
      "status": "expired",
      "description": "Invoice expired without receiving a full payment."
    }
  ],
  "message": "Operation completed successfully!",
  "error": {},
  "status": 200,
  "version": "1.0.0"
}
Endpoints

Static Addresses

Permanent deposit addresses that accept multiple payments over time

GET/staticAddresses

Static Address List

Returns all active static deposit addresses for the authenticated merchant. Static addresses accept payments indefinitely — unlike invoices they never expire.

cURL
curl "https://payswpgg.vercel.app/api/v1/staticAddresses" \
  -H "Authorization: Bearer swp_live_..."
POST/staticAddresses

Generate Static Address

Activate a permanent deposit address for the specified currency on your merchant account. Funds sent to this address at any time are credited to your balance. Only one active static address per currency is allowed.

Request body
FieldTypeDescription
currencyrequired"BTC" | "LTC" | "ETH" | "SOL"The cryptocurrency for this static address.
labelstringOptional label for your reference.
cURL
curl -X POST "https://payswpgg.vercel.app/api/v1/staticAddresses" \
  -H "Authorization: Bearer swp_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "currency": "BTC",
    "label": "My BTC deposit address"
  }'
DELETE/staticAddresses/{id}

Revoke Static Address

Deactivate a static address. Funds sent to a revoked address after revocation will not be credited. Revocation is permanent — generate a new static address if you need one again.

Parameters
NameInTypeDescription
idrequiredpathstringThe static address `id` to revoke.
cURL
curl -X DELETE "https://payswpgg.vercel.app/api/v1/staticAddresses/YOUR_ID" \
  -H "Authorization: Bearer swp_live_..."
Response · 200
{
  "data": {
    "id": "sa_abc123",
    "revoked": true
  },
  "message": "Operation completed successfully!",
  "error": {},
  "status": 200,
  "version": "1.0.0"
}
Endpoints

Payouts

Request crypto withdrawals to external addresses

POST/payouts

Generate Payout

Request a crypto withdrawal to an external address. The payout is created with status pending and processed by the platform. Track it with GET /payouts/{id} or poll GET /payouts until completed or failed.

Request body
FieldTypeDescription
currencyrequired"BTC" | "LTC" | "ETH" | "SOL"The cryptocurrency to send.
addressrequiredstringThe destination on-chain address.
amountrequirednumberCrypto amount to send.
order_idstringYour internal reference for this payout.
notestringOptional note stored with the payout.
cURL
curl -X POST "https://payswpgg.vercel.app/api/v1/payouts" \
  -H "Authorization: Bearer swp_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "currency": "BTC",
    "address": "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq",
    "amount": 0.05,
    "order_id": "payout-2024-001",
    "note": "Weekly withdrawal"
  }'
Response · 200
{
  "data": {
    "id": "cm4payout123",
    "currency": "btc",
    "network": "Bitcoin Network",
    "address": "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq",
    "amount": 0.05,
    "amount_usd": 3300,
    "tx_hash": null,
    "status": "pending",
    "order_id": "payout-2024-001",
    "note": "Weekly withdrawal",
    "date": 1734510589,
    "updated_at": 1734510589
  },
  "message": "Operation completed successfully!",
  "error": {},
  "status": 200,
  "version": "1.0.0"
}
GET/payouts

Payout History

Paginated list of all payout requests for the authenticated merchant, sorted newest-first. Filter by status, currency, or date range.

Query Parameters
NameTypeDescription
pageintegerdefault: 1
sizeintegerdefault: 20
status"pending" | "processing" | "completed" | "failed" | "cancelled"Filter by payout status.
currencystringFilter by currency (e.g. `BTC`).
from_dateintegerUnix timestamp — only return payouts created after this time.
to_dateintegerUnix timestamp — only return payouts created before this time.
cURL
curl "https://payswpgg.vercel.app/api/v1/payouts" \
  -H "Authorization: Bearer swp_live_..."
GET/payouts/{id}

Payout Information

Retrieve the current state of a single payout request.

Parameters
NameInTypeDescription
idrequiredpathstringThe payout `id` returned when the payout was created.
cURL
curl "https://payswpgg.vercel.app/api/v1/payouts/cm4payout123" \
  -H "Authorization: Bearer swp_live_..."
GET/payout-statusesNo auth required

Payout Status Table

Returns all possible payout statuses and their meanings.

cURL
curl "https://payswpgg.vercel.app/api/v1/payout-statuses"
Response · 200
{
  "data": [
    {
      "status": "pending",
      "description": "Payout requested and queued for processing."
    },
    {
      "status": "processing",
      "description": "Transaction is being broadcast to the network."
    },
    {
      "status": "completed",
      "description": "Transaction confirmed on-chain. Funds delivered."
    },
    {
      "status": "failed",
      "description": "Payout could not be sent. Contact support to resolve."
    },
    {
      "status": "cancelled",
      "description": "Payout was cancelled before processing began."
    }
  ],
  "message": "Operation completed successfully!",
  "error": {},
  "status": 200,
  "version": "1.0.0"
}
Webhooks

Webhooks

POSTyour callback_urlIncoming

Invoice status update

swp.gg sends an HTTP POST to your callback_url whenever an invoice's status changes. Each request is signed so you can verify it came from us.

Signature verification

Every webhook POST includes:

The hex value is HMAC-SHA256(rawBody, webhookSecret) where webhookSecret is the whsec_… secret shown in your merchant dashboard under API Keys → Webhook signing secret.

Example (Node.js):

Retry policy

Webhooks are best-effort (single attempt per status check cycle). If your endpoint is unreachable, poll GET /invoice/{track_id} to reconcile missed events.

Signature verification · Node.js
verify.js
const crypto = require("crypto");
function verifyWebhook(rawBody, header, secret) {
  const expected = crypto
    .createHmac("sha256", secret)
    .update(rawBody)
    .digest("hex");
  const received = header.replace("sha256=", "");
  return crypto.timingSafeEqual(
    Buffer.from(expected, "hex"),
    Buffer.from(received, "hex"),
  );
}
Payload fields
FieldTypeDescription
event"invoice.confirming" | "invoice.paid" | "invoice.expired"The specific event that triggered this delivery.
track_idstringUnique invoice identifier.
status"pending" | "confirming" | "paid" | "expired"
order_idstring | nullYour original order reference, if provided.
amountstringRequested amount in `currency` (decimal string).
currencystring
pay_currencystring | nullCryptocurrency the customer is paying with.
networkstring | nullHuman-readable network name (e.g. `Bitcoin Network`).
addressstring | nullOn-chain deposit address.
pay_amountstring | nullExact crypto amount requested (decimal string).
received_amountstringCrypto amount received on-chain so far.
tx_hashstring | nullFunding transaction hash once seen on-chain.
confirmationsintegerCurrent on-chain confirmation count.
required_confirmationsinteger | nullConfirmations needed before `paid` status is set.
expired_atinteger | nullUnix timestamp when the invoice expires/expired.
paid_atinteger | nullUnix timestamp when the invoice was settled (null until paid).
dateintegerUnix timestamp when the invoice was created.
Example payload
{
  "event": "invoice.paid",
  "track_id": "ch_8fK2mPqR7nW4",
  "status": "paid",
  "order_id": "order-1001",
  "amount": "49.99",
  "currency": "USD",
  "pay_currency": "BTC",
  "network": "Bitcoin Network",
  "address": "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq",
  "pay_amount": "0.00120048",
  "received_amount": "0.00120048",
  "tx_hash": "a1b2c3d4e5f6...",
  "confirmations": 2,
  "required_confirmations": 2,
  "expired_at": 1734546589,
  "paid_at": 1734546590,
  "date": 1734510589
}