Skip to main content
POST
/
api
/
trading
/
purchases
/
user
curl -X POST https://oro-tradebook-devnet.up.railway.app/api/trading/purchases/user \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key" \
  -d '{
    "userId": "user-pda-address",
    "goldAmount": 0.1,
    "maxUsdcAmount": 550,
    "co_sign": false,
    "userAsFeePayer": true
  }'
{
  "success": true,
  "data": {
    "purchaseId": "uuid-purchase-id",
    "goldAmount": 0.1,
    "quoteUsdcAmount": 508.62,
    "maxUsdcAmount": 550,
    "quotedGoldPrice": 5086.2,
    "status": "pending_signature",
    "transaction": {
      "serializedTx": "base64-encoded-transaction",
      "signingInstructions": {
        "walletType": "user_wallet",
        "signers": ["UserWalletAddress"],
        "expiresAt": "2024-01-15T10:35:00.000Z"
      }
    },
    "createdAt": "2024-01-15T10:30:00.000Z"
  }
}

Overview

Creates a purchase transaction for a user to buy gold tokens using USDC. Authorization Required: PARTNER_EXECUTIVE_AUTHORITY

Headers

x-api-key
string
required
Your API key for authentication

Request Body

userId
string
required
The user’s PDA address
goldAmount
number
required
Amount of gold to purchase (in troy ounces)
maxUsdcAmount
number
required
Maximum USDC willing to spend (slippage protection)
co_sign
boolean
default:"false"
For self-custody: adds partner as co-signer
userAsFeePayer
boolean
default:"false"
Whether the user pays the SOL transaction fee
metadata
object
Optional transaction metadata

Response

success
boolean
Whether the request was successful
data
object
curl -X POST https://oro-tradebook-devnet.up.railway.app/api/trading/purchases/user \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key" \
  -d '{
    "userId": "user-pda-address",
    "goldAmount": 0.1,
    "maxUsdcAmount": 550,
    "co_sign": false,
    "userAsFeePayer": true
  }'
{
  "success": true,
  "data": {
    "purchaseId": "uuid-purchase-id",
    "goldAmount": 0.1,
    "quoteUsdcAmount": 508.62,
    "maxUsdcAmount": 550,
    "quotedGoldPrice": 5086.2,
    "status": "pending_signature",
    "transaction": {
      "serializedTx": "base64-encoded-transaction",
      "signingInstructions": {
        "walletType": "user_wallet",
        "signers": ["UserWalletAddress"],
        "expiresAt": "2024-01-15T10:35:00.000Z"
      }
    },
    "createdAt": "2024-01-15T10:30:00.000Z"
  }
}

Notes

Transaction Type

This endpoint returns a Versioned Transaction (V0) which requires compatible wallet libraries for signing.

Signing Requirements for Self-Custody Partners

The co_sign and userAsFeePayer parameters determine who must sign:
co_signuserAsFeePayerSigners Required
falsetrueUser wallet only
falsefalseUser wallet + Executive authority
truetrueUser wallet + Executive authority
truefalseUser wallet + Executive authority

Custodial Partners

For custodial partners, only the executive authority signs. The co_sign and userAsFeePayer parameters are ignored.