Skip to main content
POST
https://api.stablepay.global
/
v2
/
transactions
/
prefunded
Create Prefunded Transaction
curl --request POST \
  --url https://api.stablepay.global/v2/transactions/prefunded \
  --header 'Authorization: Bearer <token>'

Create Prefunded Transaction

Create a transaction that processes the INR payout immediately, before receiving the stablecoin deposit. This endpoint is only available for approved partners with a credit limit.
This endpoint requires prior approval. Contact support to enable prefunded transactions for your account.

How It Works

Standard Flow:
  1. Partner creates transaction
  2. User sends stablecoins
  3. System detects and confirms deposit
  4. System processes INR payout
Prefunded Flow:
  1. Partner creates prefunded transaction
  2. System immediately processes INR payout
  3. Partner releases stablecoins to deposit address
  4. System detects and confirms deposit
  5. Transaction marked complete, credit limit restored

Request

curl -X POST https://api.stablepay.global/v2/transactions/prefunded \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: unique-key-for-this-transaction" \
  -d '{
    "userId": "usr_abc123",
    "amount": "100.00",
    "asset": "USDC",
    "network": "polygon"
  }'

Body Parameters

FieldTypeRequiredDescription
userIdstringYesUser ID (must have completed KYC)
amountstringYesAmount in USD (e.g., “100.00”)
assetstringYesUSDC or USDT
networkstringYespolygon, ethereum, arbitrum, base, or solana
partnerReferencestringNoYour reference ID
metadataobjectNoCustom metadata

Response

{
  "success": true,
  "data": {
    "transactionId": "tx_def456",
    "depositAddress": "0x1234...abcd",
    "depositNetwork": "polygon",
    "depositAsset": "USDC",
    "expectedAmount": "100.00",
    "quote": {
      "exchangeRate": 84.50,
      "feePercent": 0.005,
      "feeInr": "42.25",
      "grossInr": "8450.00",
      "netInr": "8407.75"
    },
    "expiresAt": "2024-01-02T12:00:00Z"
  }
}

Transaction Status Flow

For prefunded transactions:
  1. payout_processing - Payout initiated immediately
  2. payout_completed - INR sent to user’s bank
  3. awaiting_funds - Waiting for stablecoin deposit
  4. completed - Deposit confirmed, transaction complete

Credit Limit

Your prefunded credit limit determines the maximum outstanding amount (payouts made but funds not yet received).
FieldDescription
creditLimitUsdMaximum outstanding prefunded amount
outstandingUsdCurrent outstanding amount
availableUsdRemaining available credit
When a prefunded transaction is created, the amount is added to outstandingUsd. When funds are received and confirmed, the amount is subtracted.

Errors

CodeDescription
PREFUNDED_NOT_ALLOWEDPrefunded transactions not enabled for this account
CREDIT_LIMIT_EXCEEDEDAmount exceeds available credit limit
USER_NOT_FOUNDUser does not exist
KYC_INCOMPLETEUser KYC not verified
NO_BANK_ACCOUNTUser has no verified bank account
PAYOUT_FAILEDPayout initiation failed

Important Notes

You must release the stablecoins to the depositAddress after the payout is processed. Failure to do so will affect your credit limit and account standing.
  • The deposit address is the same as standard transactions
  • You have 24 hours to send the funds after payout
  • Credit limit is restored when funds are confirmed on-chain