Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.stablepay.global/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through your first StablePay integration — from creating a user to completing an offramp transaction.

Prerequisites

  • A StablePay partner account with API keys
  • A webhook endpoint to receive notifications
  • Sandbox environment for testing

Step 1: Create a User

Register a user who will transact on your platform:
curl -X POST https://api.stablepay.global/v2/users \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Rahul Kumar",
    "mobile": "+919876543210",
    "email": "rahul@example.com"
  }'
{
  "success": true,
  "data": {
    "userId": "usr_abc123",
    "depositAddresses": {
      "evm": "0x742d35Cc6634C0532925a3b844Bc9e7595f3A123",
      "tron": "TN7FbQz9Mwi4pPYkXRmpVMaccut3Fk8BBB"
    },
    "kycStatus": "pending"
  }
}

Step 2: Complete KYC

Complete identity verification before transacting. See the KYC Flow guide for details.

Step 3: Create a Transaction

Once KYC is verified, create a transaction:
curl -X POST https://api.stablepay.global/v2/transactions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000" \
  -d '{
    "type": "sell",
    "userId": "usr_abc123",
    "amount": "100",
    "asset": "USDT",
    "network": "polygon"
  }'
{
  "success": true,
  "data": {
    "transactionId": "txn_xyz789",
    "depositAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f3A123",
    "depositNetwork": "polygon",
    "depositAsset": "USDT",
    "expectedAmount": "100",
    "quote": {
      "exchangeRate": 84.50,
      "grossInr": "8450.00",
      "netInr": "8407.75"
    },
    "expiresAt": "2025-06-16T10:30:00Z"
  }
}

Step 4: Deposit & Payout

The user sends USDT to the deposit address. StablePay detects it automatically and initiates the INR payout once confirmations are met. You’ll receive webhooks at each step:
transaction.deposit_detected  → Deposit seen on blockchain
transaction.deposit_confirmed → Required confirmations met
transaction.payout_completed  → INR delivered to user's bank

Alternative: Pool Settlement

If you manage liquidity centrally, use pool_settlement instead:
# Sweep from your pool wallet
curl -X POST https://api.stablepay.global/v2/transactions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: unique-key-123" \
  -d '{ "type": "pool_settlement", "userId": "usr_abc123", "amount": "100", "asset": "USDT", "network": "tron" }'

# After sweep confirmed (via webhook), trigger payout
curl -X POST https://api.stablepay.global/v2/transactions/txn_xyz789/payout \
  -H "Authorization: Bearer YOUR_API_KEY"
See the Pool Settlement guide for details.

What’s Next

How It Works

Understand the full architecture

KYC Flow

Set up user verification

Transaction Lifecycle

Understand all transaction states

Webhooks

Configure real-time notifications