Create Transaction
Creates a new transaction for a user to deposit stablecoins.
Idempotency Required: This endpoint requires an Idempotency-Key header to prevent duplicate transactions.
A unique UUID for each transaction. One key = one transaction.
Body Parameters
Amount in USD (e.g., “100”)
Blockchain: polygon, ethereum, arbitrum, base, solana
Your internal transaction reference
Request
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 '{
"userId": "usr_abc123",
"amount": "100",
"asset": "USDC",
"network": "polygon",
"partnerReference": "order_456"
}'
Generate a new UUID for each transaction request.
Response
{
"success": true,
"data": {
"transactionId": "txn_xyz789",
"depositAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f3A123",
"depositNetwork": "polygon",
"depositAsset": "USDC",
"expectedAmount": "100",
"quote": {
"exchangeRate": 84.50,
"grossInr": "8450.00",
"netInr": "8407.75"
},
"expiresAt": "2025-01-06T10:30:00Z"
}
}
Errors
| Code | Description |
|---|
IDEMPOTENCY_KEY_REQUIRED | Missing Idempotency-Key header |
IDEMPOTENCY_CONFLICT | Same key used with different request body |
USER_NOT_FOUND | User doesn’t exist |
KYC_INCOMPLETE | User hasn’t completed KYC |
NO_BANK_ACCOUNT | No verified bank account |
PENDING_TRANSACTION_EXISTS | User has an active transaction |
AMOUNT_TOO_LOW | Below minimum ($10) |
AMOUNT_TOO_HIGH | Above maximum ($10,000) |
Idempotency Behavior
| Scenario | Response |
|---|
| New unique key | Transaction created |
| Duplicate key | 409 Conflict error |