Developers

The GaisPay API.

A small, predictable REST API: create a payment, send your customer to the checkout, fulfil the order on a signed webhook. JSON over HTTPS, nothing more.

invoice.paid · signed webhook
POST /v1/payments
curl https://api.gaispay.com/v1/payments \
  -u "$GAISPAY_API_KEY:" \
  -H "Idempotency-Key: order-1042" \
  -d amount=249.00 \
  -d currency=USD \
  -d order_id=1042
201 Created{ "id": "inv_8f2c…41a7", "status": "pending", "checkout_url": "https://pay.gaispay.com/pay/inv_8f2c…" }
webhook → invoice.paid200 OK ✓
Base URLapi.gaispay.com/v1
Checkoutpay.gaispay.com
Rate limit300 requests / min
NetworksTRON · Ethereum · BNB Chain · Solana · Bitcoin

Introduction

The API uses resource-oriented URLs and standard HTTP status codes. Send requests as application/json or application/x-www-form-urlencoded; responses are always JSON. Amounts are decimal strings ("249.00") and timestamps are Unix seconds.

Every response includes an X-Request-Id header — quote it when you contact support.

Authentication

Authenticate with the API key from your dashboard (Developers → API key). Send it as the HTTP Basic user name with an empty password, or as a Bearer token. Rotating the key in the dashboard disables the old one immediately.

cURL
# Basic: key as user name, empty password
curl https://api.gaispay.com/v1/balances -u "$GAISPAY_API_KEY:"

# or Bearer
curl https://api.gaispay.com/v1/balances -H "Authorization: Bearer $GAISPAY_API_KEY"
Keep your key on your server. The API key can create and read payments; read assets, balances, rates and withdrawals; and create and manage plans and subscriptions. It cannot request withdrawals or refunds — those are only possible from the dashboard with your password, and are sent after GaisPay review.

Quickstart

1. Create a payment from your server. 2. Redirect the customer to checkout_url. 3. When invoice.paid arrives at your webhook, verify the signature and fulfil the order.

cURL
curl https://api.gaispay.com/v1/payments \
  -u "$GAISPAY_API_KEY:" \
  -H "Idempotency-Key: order-1042" \
  -d amount=249.00 \
  -d currency=USD \
  -d order_id=1042 \
  -d description="Order 1042" \
  -d success_url="https://shop.example/thanks"
Node.js
// Node.js
const res = await fetch("https://api.gaispay.com/v1/payments", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.GAISPAY_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": "order-1042",
  },
  body: JSON.stringify({ amount: "249.00", currency: "USD", order_id: "1042" }),
});
const payment = await res.json();
// redirect the customer to payment.checkout_url

Payment lifecycle

The status field of a payment is one of the values below. Status changes send the webhooks listed under Webhook events.

StatusMeaning
pendingWaiting for the customer to pay.
confirmingThe transfer was seen on-chain and is being confirmed.
paidConfirmed and credited to your balance. A paid payment never changes status again.
underpaidLess than requested arrived. The received amount is still credited; you decide whether to fulfil or refund.
expiredThe 30-minute window passed without payment.

Extra detail is returned in flags: overpaid (more than requested arrived) and late (paid after the window). A refund sent for a payment triggers invoice.refunded and is shown on the payment in the dashboard.

Idempotency

Add an Idempotency-Key header (1–128 printable characters) when creating a payment. Retrying with the same key returns the original payment with 200 and Idempotent-Replayed: true instead of creating a second one. Reusing a key with different parameters returns 409 idempotency_key_reused.

Pagination

List endpoints return the newest records first and accept limit (1–100, default 25) and offset. total is the number of records matching your filter. Payments can be filtered by status and order_id.

cURL
curl -G https://api.gaispay.com/v1/payments -u "$GAISPAY_API_KEY:" -d status=paid -d limit=25

{ "total": 132, "limit": 25, "offset": 0, "data": [ … ] }

Errors

Errors return a non-2xx status and a body with a machine-readable code and a human-readable message.

JSON
{ "error": { "code": "invalid_amount", "message": "amount must be between 1.00 and 1000000.00" } }
HTTPCodeWhat to do
400invalid_amountAmount must be 1.00–1,000,000.00 with at most two decimals.
400invalid_currencyUse USD, EUR, GBP or TRY.
400invalid_assetUse an asset code from GET /v1/assets.
400invalid_bodyThe body is not valid JSON or form data.
401unauthorizedThe API key is missing or invalid.
403merchant_suspendedThe account is suspended — contact support.
404not_foundThe record does not exist or belongs to another account.
409idempotency_key_reusedSame key, different parameters.
409plan_inactiveThe plan is not available for new subscriptions.
409already_canceledThe subscription is already canceled.
429rate_limitedToo many requests — retry with increasing delays.
503rates_unavailableExchange rates are briefly unavailable — retry shortly.
500internal_errorRetry with the same idempotency key.

Rate limits

Each API key may make 300 requests per minute. Prefer webhooks over polling for payment status.

Payments

POST/v1/payments creates a payment and returns its checkout_url. The same resource is also available as /v1/invoices.

amountdecimal string · required
Amount to collect, e.g. "249.00". Between 1.00 and 1,000,000.00.
currencystring · required
USD, EUR, GBP or TRY.
order_idstring · optional
Your reference, up to 64 characters. Searchable in the dashboard and returned in webhooks.
descriptionstring · optional
Shown to the customer on the checkout, up to 200 characters.
assetstring · optional
Preselect an asset code from GET/v1/assets (e.g. USDT_TRC20, USDC_SPL, BTC); the address and exact amount are returned immediately. Otherwise the customer chooses on the checkout.
success_urlurl · optional
Where the customer is sent after the payment completes (also accepted as redirect_url).
JSON
// 201 Created
{
  "id": "inv_e64d63c31bf396a0e5c2dacb",
  "status": "pending",
  "order_id": "1042",
  "amount": "249.00",
  "currency": "USD",
  "asset": "USDT_TRC20",
  "network": "TRON",
  "address": "TH6qkv3B8qnDX1BSXbD4e3Etg5pLdtrt2t",
  "amount_due": "249.41",
  "amount_paid": "0.00",
  "credited": { "gross": "0", "commission": "0", "net": "0" },
  "checkout_url": "https://pay.gaispay.com/pay/inv_e64d63c31bf396a0e5c2dacb",
  "payments": [],
  "created_at": 1795289407,
  "expires_at": 1795291207
}

Retrieve and list

GET/v1/payments/{id} returns the current status, the on-chain transfers in payments and what was credited after the fee. GET/v1/payments lists payments.

Balances

GET/v1/balances returns your balance per asset with its withdrawal minimum and flat withdrawal fee.

JSON
{ "data": [ { "id": "USDT_TRC20", "symbol": "USDT", "network": "TRON", "withdraw_min": "10", "withdraw_fee": "3", "balance": "1240.50" } ] }

Rates

GET/v1/rates returns the value of one unit of each enabled asset in base (default USD). A payment's rate is locked when the customer chooses the asset; this endpoint is informational.

cURL
curl -G https://api.gaispay.com/v1/rates -u "$GAISPAY_API_KEY:" -d base=USD

{ "base": "USD", "data": [ { "asset": "USDT_TRC20", "rate": "0.998261" }, { "asset": "TRX", "rate": "0.304594" } ] }

Withdrawals

GET/v1/withdrawals lists your withdrawal and refund requests (status, limit, offset). Requests themselves can only be created in the dashboard with your password, and are sent after GaisPay review.

All endpoints

EndpointDescription
POST/v1/paymentsCreate a payment
GET/v1/paymentsList payments
GET/v1/payments/{id}Retrieve a payment
GET/v1/assetsAssets enabled for your account
GET/v1/balancesBalances
GET/v1/ratesRates
GET/v1/withdrawalsList withdrawals and refunds
POST/v1/plansCreate a plan
GET/v1/plansList plans
GET/v1/plans/{id}Retrieve a plan
POST/v1/plans/{id}Update a plan (name, description, redirect, availability)
POST/v1/subscriptionsCreate a subscription
GET/v1/subscriptionsList subscriptions
GET/v1/subscriptions/{id}Retrieve a subscription with its period payments
POST/v1/subscriptions/{id}/cancelCancel now or at period end
POST/v1/subscriptions/{id}/resumeUndo a scheduled cancellation

Subscriptions: how it works

Crypto has no card-style automatic charges, so GaisPay collects recurring payments with a payment link every period. You create a plan (price and billing period); each customer gets a subscription on that plan.

WhenWhat happens
StartThe customer pays the first period (or starts a free trial). On confirmation the subscription becomes active.
Period endsA new period is due: the customer is e-mailed a payment link and you receive subscription.payment_due.
Day 1 unpaidReminder e-mail.
Day 3 unpaidStatus becomes past_due (subscription.past_due).
Day 7 unpaidStatus becomes canceled with cancel_reason: "unpaid".
PaidThe next period starts where the previous one ended, so a late payment does not shorten it (subscription.renewed).

Customers can subscribe themselves on the plan's subscribe_url, or you create the subscription from the dashboard or API. Every e-mail contains the customer's payment_url, where they can pay, see the status and cancel. Each period is a normal payment (with subscription_id), so the usual invoice.* webhooks, balances and the 0.5% fee apply.

StatusMeaning
incompleteWaiting for the first payment. Expires after 7 days (1 day if started from the subscribe link).
trialingIn a free trial; the first payment is due when it ends.
activePaid for the current period. Stays active while a renewal is due, for up to 3 days.
past_dueThe renewal is 3+ days late.
canceledEnded by you, by the customer, or for non-payment.
incomplete_expiredThe first payment was never made.

Plans

POST/v1/plans creates a plan. Price and period cannot be changed later; create a new plan for a different price. POST/v1/plans/{id} updates name, description, redirect_url and active (set false to stop new subscriptions; existing ones continue).

namestring · required
Shown to customers, up to 80 characters.
amountdecimal string · required
Price per period, e.g. "29.00".
currencystring · required
USD, EUR, GBP or TRY.
intervalstring · required
day, week, month or year.
interval_countinteger · optional
Bill every N intervals (default 1), e.g. 3 with month for quarterly.
trial_daysinteger · optional
Free trial length, 0–365 (default 0).
descriptionstring · optional
Shown on the subscribe page, up to 300 characters.
redirect_urlurl · optional
Where customers go after paying a period.
cURL
curl https://api.gaispay.com/v1/plans \
  -u "$GAISPAY_API_KEY:" \
  -d name="Pro monthly" -d amount=29.00 -d currency=USD -d interval=month

// 201 Created
{ "id": "plan_4b73…", "name": "Pro monthly", "amount": "29.00", "currency": "USD",
  "interval": "month", "interval_count": 1, "trial_days": 0, "active": true,
  "subscribe_url": "https://pay.gaispay.com/subscribe/plan_4b73…",
  "subscribers": { "active": 0, "past_due": 0, "canceled": 0 } }

Share subscribe_url anywhere: the customer enters their e-mail and goes straight to the checkout for the first payment.

Subscriptions

POST/v1/subscriptions subscribes a customer to a plan and e-mails them the first payment link (or starts the trial). Send the returned payment_url yourself if you prefer.

plan_idstring · required
An available plan.
emailstring · optional
Customer e-mail. Without it no e-mails are sent; share payment_url yourself.
namestring · optional
Customer name, up to 100 characters.
referencestring · optional
Your customer or account ID, up to 64 characters. Filterable and used as order_id on period payments.
JSON
// 201 Created
{ "id": "sub_e323…", "status": "incomplete",
  "plan": { "id": "plan_4b73…", "name": "Pro monthly", "amount": "29.00", "currency": "USD", "interval": "month", "interval_count": 1 },
  "customer": { "email": "ada@example.com", "name": "Ada" }, "reference": "cust-42",
  "current_period_start": null, "current_period_end": null,
  "payment_due": { "since": 1795435400, "period": 1, "amount": "29.00", "currency": "USD" },
  "payment_url": "https://pay.gaispay.com/sub/IzrJ…", "cancel_at_period_end": false }

Retrieve, list and cancel

GET/v1/subscriptions/{id} returns the subscription with its period payments in invoices. GET/v1/subscriptions lists them and accepts status, plan_id, email and reference filters.

POST/v1/subscriptions/{id}/cancel ends the subscription now, or with at_period_end=true at the end of the paid period. POST/v1/subscriptions/{id}/resume undoes a scheduled cancellation. The customer is e-mailed either way.

Subscription events

Subscription webhooks are signed and retried like payment webhooks. The data object is the subscription.

subscription.createdCreated from the dashboard or API, or a trial started
subscription.activatedFirst payment confirmed — grant access
subscription.renewedA renewal was paid — extend access
subscription.payment_dueA new period started; payment link sent
subscription.past_dueRenewal 3 days late
subscription.updatedCancellation scheduled or undone
subscription.canceledEnded — revoke access at the end of the period
Grant access on subscription.activated and subscription.renewed, and use current_period_end as the paid-until date.

Webhook events

Set your endpoint in Developers → Webhook. GaisPay sends a POST for each payment event below (and for the subscription events); return 2xx within 10 seconds and do heavy work asynchronously. De-duplicate with the X-Delivery-Id header.

invoice.confirmingTransfer seen on-chain, confirming
invoice.paidPayment final — fulfil the order
invoice.underpaidLess than requested arrived
invoice.expiredWindow passed without payment
invoice.refundedA refund was sent
HTTP
POST /webhooks/gaispay
GaisPay-Signature: t=1795289461,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
X-Event: invoice.paid
X-Delivery-Id: 418

{ "event": "invoice.paid", "created_at": 1795289461,
  "data": { "id": "inv_e64d…", "status": "paid", "order_id": "1042", "amount_paid": "249.41",
            "credited": { "gross": "249.41", "commission": "1.25", "net": "248.16" } } }

Verifying signatures

The GaisPay-Signature header holds a timestamp t and an HMAC-SHA256 signature v1 of t + "." + raw_body, computed with your whsec_ secret. Verify against the raw body and reject timestamps older than five minutes.

Node.js
import crypto from "node:crypto";

export function verifyGaisPay(rawBody, header, secret) {
  const p = Object.fromEntries(header.split(",").map((kv) => kv.split("=")));
  const expected = crypto.createHmac("sha256", secret).update(p.t + "." + rawBody).digest("hex");
  const fresh = Math.abs(Date.now() / 1000 - Number(p.t)) < 300;
  return fresh && expected.length === (p.v1 || "").length
    && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(p.v1));
}
PHP
<?php
function gaispay_verify(string $raw, string $header, string $secret): bool {
    parse_str(str_replace(',', '&', $header), $p);
    $expected = hash_hmac('sha256', ($p['t'] ?? '') . '.' . $raw, $secret);
    return abs(time() - (int) ($p['t'] ?? 0)) < 300 && hash_equals($expected, $p['v1'] ?? '');
}

Retries

If your endpoint does not answer with 2xx, the event is retried, with 10 attempts in total. Retries start after about one minute and the delay doubles each time, up to six hours apart. Every attempt is visible on the payment detail page in your dashboard.

Assets & networks

Asset codeAssetNetworkStatus
USDT_TRC20Tether USDTRON (TRC-20)Live
TRXTRONTRONLive
USDT_ERC20Tether USDEthereum (ERC-20)Live · from 50 USD
USDC_ERC20USD CoinEthereum (ERC-20)Live · from 50 USD
ETHEtherEthereumLive · from 50 USD
USDT_BEP20Tether USDBNB Chain (BEP-20)Live
USDC_BEP20USD CoinBNB Chain (BEP-20)Live
BNBBNBBNB ChainLive
USDT_SPLTether USDSolana (SPL)Live
USDC_SPLUSD CoinSolana (SPL)Live
SOLSolanaSolanaLive
BTCBitcoinBitcoinLive · from 20 USD

Call GET/v1/assets for the list enabled on your account. Customers must send the asset shown on the checkout, on the network shown — transfers in another asset or on another network are not detected automatically.