Cygnus Pay API

Developer Documentation

Accept crypto payments, create payment links, and build integrations with the Cygnus Pay platform. No fees. No monthly charges.

Base URL https://api.cygnuspay.org
Auth Session / API Key
Format application/json

How It Works

The merchant payment flow in four steps.

1

Create Pay Link

Use the API or dashboard to create a one-time or donation payment link.

2

Share Link / QR

Send the generated URL or QR code to your customer via any channel.

3

Customer Pays

Customer sends crypto on-chain or pays instantly with their Cygnus balance.

4

Payment Confirmed

Poll the status endpoint to detect confirmation and deliver the product.

Authentication

Authenticate a user and establish a session for subsequent API calls.

POST /api/login

Request Body

Field Type Required Description
username string Required Account username
password string Required Account password
otp string Conditional 2FA code (required if 2FA is enabled)

Response

{
    "success": true,
    "user": {
        "username": "merchant123",
        "email": "merchant@example.com"
    }
}
{
    "success": false,
    "require_2fa": true
}
{
    "success": false,
    "message": "Invalid credentials"
}

Example

curl -X POST https://api.cygnuspay.org/api/login \
  -H "Content-Type: application/json" \
  -d '{"username": "merchant123", "password": "securepassword", "otp": "123456"}' \
  -c cookies.txt
Note — All subsequent authenticated requests must include the session cookie. Use -b cookies.txt in cURL.

API Keys

API keys are generated from Settings > API in your dashboard. Format: cns_live_<48_char_hex>

POST /settings/api/generate

Request Body

Field Type Required Description
label string Optional Friendly name for the key (default: "Default Key")
Important — API key generation requires an active session. The key is shown once — save it immediately.
POST /settings/api/revoke/<key_id>

Permanently deletes the specified API key. Requires session authentication and ownership verification.

Payment Status

Poll to check if a payment has been received. Ideal for server-side verification.

GET /pay/check/<identifier>

Query Parameters

Field Type Required Description
initial_balance float Recommended Wallet balance when payment page loaded. Used to detect incoming deposits.

Response

{
    "confirmed": true,
    "current_balance": 150.50,
    "initial_balance": 100.50,
    "tx_hash": null
}
{
    "confirmed": false,
    "current_balance": 100.50,
    "initial_balance": 100.50,
    "tx_hash": null
}
{
    "confirmed": true,
    "new_balance": 0,
    "method": "internal"
}

Confirmation Logic

Type Condition
onetime current_balance >= initial_balance + link.amount — Marks link as "completed"
donation current_balance > initial_balance — Any increase triggers confirmation

Polling Example (JavaScript)

async function checkPayment(identifier, initialBalance) {
    const res = await fetch(
        `/pay/check/${identifier}?initial_balance=${initialBalance}`
    );
    const data = await res.json();
    if (data.confirmed) {
        console.log("Payment received!");
        // Redirect to success page, deliver product, etc.
    }
    return data.confirmed;
}
// Poll every 15 seconds
const pollInterval = setInterval(async () => {
    const confirmed = await checkPayment("a1b2c3d4e5f6", 0.0);
    if (confirmed) clearInterval(pollInterval);
}, 15000);
POST /pay/delete/<link_id> Auth Required

Deletes a payment link you own. Requires session authentication.

Internal Transfers

Pay a payment link using your Cygnus Pay balance. Zero fees, instant settlement.

POST /pay/process_internal Auth Required

Request Body

Field Type Required Description
identifier string Required Payment link identifier
amount float Conditional Required for donation links (amount = 0)

Response

// Success
{"success": true}
// Errors
{"success": false, "message": "Insufficient balance"}
{"success": false, "message": "Cannot pay yourself"}
{"success": false, "message": "Asset not supported"}

Send Funds

Transfer crypto to any Cygnus Pay user by username or email.

POST /wallet/send Auth + 2FA

Request Body

Field Type Required Description
recipient string Required Username or email of recipient
amount float Required Amount to send
symbol string Required Asset symbol (e.g. USDT, BTC)
otp string Conditional 2FA code if 2FA is enabled

Example

curl -X POST https://api.cygnuspay.org/wallet/send \
  -H "Content-Type: application/json" \
  -b cookies.txt \
  -d '{
    "recipient": "alice_user",
    "amount": 25.0,
    "symbol": "USDT",
    "otp": "789012"
  }'

Error Responses

{"success": false, "message": "2FA Code required"}
{"success": false, "message": "Invalid 2FA Code"}
{"success": false, "message": "Invalid recipient"}
{"success": false, "message": "Asset not supported"}
{"success": false, "message": "Insufficient balance"}

User Lookup

Verify if a username or email exists on the platform before sending funds.

POST /api/check_user

Request Body

Field Type Required Description
identifier string Required Username or email to look up

Response

{"valid": true, "username": "alice_user"}
{"valid": false}

Webhooks & Polling

Cygnus Pay currently uses a polling model for payment verification.

Current Approach — After displaying a payment link to a customer, poll the /pay/check/<identifier> endpoint at regular intervals (recommended: every 15 seconds).

Integration Pattern (Python)

import requests
import time
BASE_URL = "https://api.cygnuspay.org"
SESSION = requests.Session()
# 1. Login
SESSION.post(f"{BASE_URL}/api/login", json={
    "username": "your_username",
    "password": "your_password",
    "otp": "123456"  # if 2FA enabled
})
# 2. Create Payment Link
SESSION.post(f"{BASE_URL}/pay/create", data={
    "type": "onetime",
    "title": "Order #1234",
    "amount": 29.99,
    "currency": "USDT"
})
# 3. Share the link: https://app.cygnuspay.org/pay/@your_username/<identifier>
# 4. Poll for confirmation
def wait_for_payment(identifier, initial_balance=0.0, timeout=600):
    """Poll payment status. Returns True when confirmed."""
    start = time.time()
    while time.time() - start < timeout:
        resp = SESSION.get(
            f"{BASE_URL}/pay/check/{identifier}",
            params={"initial_balance": initial_balance}
        )
        data = resp.json()
        if data.get("confirmed"):
            return True
        time.sleep(15)
    return False

Error Handling

All API endpoints return consistent JSON error responses.

{
    "success": false,
    "message": "Human-readable error description"
}

HTTP Status Codes

Code Meaning
200 Success (check success field in body)
302 Redirect (form submissions)
401 Not authenticated
403 Forbidden (not your resource)
404 Resource not found

Common Error Messages

Message Cause
"Invalid credentials" Wrong username or password
"Invalid 2FA Code" Incorrect or expired OTP
"Insufficient balance" Not enough funds for transfer
"Cannot pay yourself" Sender and recipient are the same user
"Asset not supported" Currency symbol not configured
"Payments are disabled for {SYMBOL}" Admin disabled payments for this asset

Quick Start Guide

Accept payments in three steps.

1

Create an Account

Register at https://api.cygnuspay.org/register. Enable 2FA in Settings for security.

2

Create a Payment Link

Go to Pay > Create Link in your dashboard, or use the API:

curl -X POST https://app.cygnuspay.org/pay/create \
  -b cookies.txt \
  -d "type=onetime&title=Premium Plan&amount=99.99&currency=USDT"
3

Share & Get Paid

Your payment link URL: https://app.cygnuspay.org/pay/@yourusername/<id>

Embed it on your website:

<a href="https://app.cygnuspay.org/pay/@yourusername/abc123"
   style="background:#111; color:white; padding:12px 24px;
          border-radius:8px; text-decoration:none; font-weight:600;">
    Pay with Crypto
</a>

Complete Integration Example — Python / Flask

"""Example: E-commerce checkout integration with Cygnus Pay"""
from flask import Flask, redirect, jsonify
import requests
app = Flask(__name__)
CNSPAY_BASE = "https://api.cygnuspay.org"
CNSPAY_SESSION = requests.Session()
# Login once on startup
CNSPAY_SESSION.post(f"{CNSPAY_BASE}/api/login", json={
    "username": "your_merchant_account",
    "password": "your_password"
})
@app.route("/checkout/<order_id>")
def checkout(order_id):
    """Redirect customer to Cygnus Pay payment page"""
    pay_link = "abc123def456"
    return redirect(f"{CNSPAY_BASE}/pay/@yourusername/{pay_link}")
@app.route("/api/check-payment/<order_id>")
def check_payment(order_id):
    """Backend endpoint to verify payment status"""
    pay_link = "abc123def456"
    resp = CNSPAY_SESSION.get(f"{CNSPAY_BASE}/pay/check/{pay_link}")
    data = resp.json()
    if data.get("confirmed"):
        return jsonify({"paid": True})
    return jsonify({"paid": False})

API Reference

Complete endpoint summary at a glance.

Method Endpoint Auth Description
POST /api/login None Authenticate user
POST /api/check_user Session Look up user by username/email
POST /pay/create Session Create payment link
GET /pay/@<user>/<id> None Public payment page
GET /pay/check/<id> None Poll payment status
POST /pay/process_internal Session Pay link with balance
POST /pay/delete/<id> Session Delete payment link
POST /wallet/send Session + 2FA Transfer to user
POST /settings/api/generate Session Create API key
POST /settings/api/revoke/<id> Session Delete API key