Your first payment
in 10 minutes.
Three steps: create a payment from your server, send the customer to checkout_url, fulfil the order when invoice.paid arrives.
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 success_url="https://shop.example/thanks"
What you need.
A merchant account
Apply via the application form and complete business verification.
Your API key
Shown in Developers → API key. Keep it on your server — never in a browser or app.
A webhook URL
A public HTTPS endpoint on your server, set in Developers → Webhook.
Create a payment.
Send the amount, your currency and your order ID. Use an Idempotency-Key so a retry never creates a second payment.
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 success_url="https://shop.example/thanks"
// Node.js 18+ (built-in fetch)
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",
description: "Order 1042",
success_url: "https://shop.example/thanks",
}),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const payment = await res.json();
// Send the customer to payment.checkout_url<?php
$ch = curl_init("https://api.gaispay.com/v1/payments");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => getenv("GAISPAY_API_KEY") . ":",
CURLOPT_HTTPHEADER => ["Idempotency-Key: order-1042"],
CURLOPT_POSTFIELDS => http_build_query([
"amount" => "249.00",
"currency" => "USD",
"order_id" => "1042",
"success_url" => "https://shop.example/thanks",
]),
]);
$payment = json_decode(curl_exec($ch), true);
header("Location: " . $payment["checkout_url"]);import os, requests
r = requests.post(
"https://api.gaispay.com/v1/payments",
auth=(os.environ["GAISPAY_API_KEY"], ""),
headers={"Idempotency-Key": "order-1042"},
json={"amount": "249.00", "currency": "USD", "order_id": "1042",
"success_url": "https://shop.example/thanks"},
timeout=15,
)
r.raise_for_status()
payment = r.json()
print(payment["checkout_url"])Redirect to checkout.
Send the customer to checkout_url. They choose a coin and network (USDT, USDC, ETH, BNB, SOL, BTC or TRX), pay the locked amount and come back to your success_url.
- The amount is locked for 30 minutes
- The page follows the payment live
- Your success_url receives the customer back
Fulfil on the webhook.
Verify the GaisPay-Signature header, then fulfil the order once. Return 2xx within 10 seconds.
import express from "express";
import crypto from "node:crypto";
const app = express();
const SECRET = process.env.GAISPAY_WEBHOOK_SECRET; // whsec_…
app.post("/webhooks/gaispay", express.raw({ type: "application/json" }), (req, res) => {
const sig = Object.fromEntries((req.get("GaisPay-Signature") || "").split(",").map((p) => p.split("=")));
const expected = crypto.createHmac("sha256", SECRET).update(`${sig.t}.${req.body}`).digest("hex");
const valid = sig.v1 && sig.v1.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(sig.v1), Buffer.from(expected));
if (!valid || Math.abs(Date.now() / 1000 - Number(sig.t)) > 300) return res.sendStatus(400);
const event = JSON.parse(req.body);
if (event.event === "invoice.paid") {
// Fulfil event.data.order_id once — store req.get("X-Delivery-Id")
}
res.sendStatus(200);
});<?php
$secret = getenv("GAISPAY_WEBHOOK_SECRET"); // whsec_…
$body = file_get_contents("php://input");
$header = $_SERVER["HTTP_GAISPAY_SIGNATURE"] ?? "";
parse_str(str_replace(",", "&", $header), $sig);
$expected = hash_hmac("sha256", ($sig["t"] ?? "") . "." . $body, $secret);
if (!hash_equals($expected, $sig["v1"] ?? "") || abs(time() - (int)($sig["t"] ?? 0)) > 300) {
http_response_code(400);
exit;
}
$event = json_decode($body, true);
if ($event["event"] === "invoice.paid") {
// Fulfil $event["data"]["order_id"] once
}
http_response_code(200);import hmac, hashlib, os, time
from flask import Flask, request, abort
app = Flask(__name__)
SECRET = os.environ["GAISPAY_WEBHOOK_SECRET"].encode() # whsec_…
@app.post("/webhooks/gaispay")
def gaispay():
body = request.get_data()
sig = dict(p.split("=", 1) for p in request.headers.get("GaisPay-Signature", "").split(",") if "=" in p)
expected = hmac.new(SECRET, f"{sig.get('t')}.".encode() + body, hashlib.sha256).hexdigest()
if not hmac.compare_digest(expected, sig.get("v1", "")) or abs(time.time() - int(sig.get("t", 0))) > 300:
abort(400)
event = request.get_json()
if event["event"] == "invoice.paid":
pass # fulfil event["data"]["order_id"] once
return "", 200Before you flip the switch.
Key on the server only
Never ship the API key to a browser or mobile app.
Verify every webhook
Reject bad signatures and timestamps older than 5 minutes.
Fulfil once
De-duplicate on X-Delivery-Id or your order status.
Handle underpaid
Decide what your shop does when less arrives.
Use order IDs
Your reference makes support and reconciliation easy.
Test end to end
Make a small real payment and refund it.

