Composed Flows
warning
Heads up: API coming soon.
This API is not currently accessible. The documentation below reflects the intended design and is meant for early familiarization, not active integration.
SphereNet allows you to combine multiple transaction steps into a single API request. This enables complex flows like fiat on-ramp with transfer, or crypto on-ramp with currency exchange.
TradFi On-Ramp with Transfer
This example shows how to:
- Receive USD via wire transfer (to Alice's account)
- Transfer USD to another SphereNet account - requires signature
POST v1/transactions
curl https://api.sphere.net/v1/transactions \
-H 'Authorization: Bearer <API_KEY>' \
-H 'Idempotency-Key: <Unique Idempotency Key>' \
-d '{
"amount": "1000.00",
"customer": "cust_alice",
"signature": "base64_encoded_signature",
"source": {
"paymentRail": "wire",
"currency": "usd"
},
"intermaediateAccount": {
"paymentRail": "spherenet",
"account": "sphere1abc..."
},
"destination": {
"paymentRail": "spherenet",
"currency": "usd",
"account": "sphere1xyz..."
}
}'
Response
{
"ok": true,
"object": "object",
"statusCode": 200,
"error": null,
"message": "success",
"data": {
"id": "txn_123",
"state": "processing",
"customer": "cust_alice",
"amount": "1000.00",
"source": {
"paymentRail": "wire",
"currency": "usd"
},
"intermaediateAccount": {
"paymentRail": "spherenet",
"account": "sphere1abc..."
},
"destination": {
"paymentRail": "spherenet",
"currency": "usd",
"account": "sphere1xyz..."
},
"networkData": {
"signature": "2id3YC2jK9G5Wo2phDx4gJVAew8DcY5NAojnVuao8aCxBwKE7k4PoHiH1ViQX8KgB9CKBY2RcKF8PSbBqhqFQXXX",
"slot": 430,
"confirmations": 1,
"commitment": "processed",
"error": null
},
"sourceDepositInstructions": {
"amount": "1000.00",
"currency": "usd",
"sepositMessage": "SPH7depositmessage"
},
"createdAt": "2024-01-20T19:39:14.316Z",
"updatedAt": "2024-01-20T19:39:14.316Z"
},
"ts": "2024-08-22T16:15:42.707Z",
"request": "request_cdde26b2c0534183a1aaba6baebaec1f"
}
Crypto On-Ramp with Exchange and Transfer
The example below shows how to:
- Convert USDC from Solana to USD on SphereNet (to Alice's account)
- Exchange USD to EUR (in Alice's account) - requires signature
- Transfer EUR to another SphereNet account - requires signature
POST v1/transactions
curl https://api.sphere.net/v1/transactions \
-H 'Authorization: Bearer <API_KEY>' \
-H 'Idempotency-Key: <Unique Idempotency Key>' \
-d '{
"amount": "1000.00",
"customer": "cust_alice",
"signature": "base64_encoded_signature",
"source": {
"paymentRail": "solana",
"currency": "usdc",
"fromAddress": "5KL6MAQ4i8ht4PR8uHE4CQrxRMXHNX9Jv9dUBgH7jj3j"
},
"intermaediateAccount": {
"paymentRail": "spherenet",
"account": "sphere1abc..."
},
"destination": {
"paymentRail": "spherenet",
"currency": "eur",
"account": "sphere1xyz..."
},
"slippageTolerance": "0.01"
}'
Response
{
"ok": true,
"object": "object",
"statusCode": 200,
"error": null,
"message": "success",
"data": {
"id": "txn_123",
"state": "processing",
"customer": "cust_alice",
"amount": "1000.00",
"source": {
"paymentRail": "solana",
"currency": "usdc",
"fromAddress": "5KL6MAQ4i8ht4PR8uHE4CQrxRMXHNX9Jv9dUBgH7jj3j"
},
"intermaediateAccount": {
"paymentRail": "spherenet",
"account": "sphere1abc..."
},
"destination": {
"paymentRail": "spherenet",
"currency": "eur",
"account": "sphere1xyz..."
},
"networkData": {
"signature": "2id3YC2jK9G5Wo2phDx4gJVAew8DcY5NAojnVuao8aCxBwKE7k4PoHiH1ViQX8KgB9CKBY2RcKF8PSbBqhqFQXXX",
"slot": 430,
"confirmations": 1,
"commitment": "processed",
"error": null
},
"sourceDepositInstructions": {
"paymentRail": "solana",
"amount": "1000.00",
"currency": "usdc",
"fromAddress": "5KL6MAQ4i8ht4PR8uHE4CQrxRMXHNX9Jv9dUBgH7jj3j",
"toAddress": "8JFTv1FHAqEgupBxHmkzDwtRGtPojCQ4KyxE3HXGVN2i"
},
"exchangeRate": "0.92",
"slippageTolerance": "0.01",
"createdAt": "2024-01-20T19:39:14.316Z",
"updatedAt": "2024-01-20T19:39:14.316Z"
},
"ts": "2024-08-22T16:15:42.707Z",
"request": "request_cdde26b2c0534183a1aaba6baebaec1f"
}
Crypto Exchange and Off-Ramp to Fiat
This example shows how to:
- Convert USDC from Solana to USD on SphereNet (to Alice's account)
- Transfer USD to external bank account via wire - requires signature
POST v1/transactions
curl https://api.sphere.net/v1/transactions \
-H 'Authorization: Bearer <API_KEY>' \
-H 'Idempotency-Key: <Unique Idempotency Key>' \
-d '{
"amount": "1000.00",
"customer": "cust_alice",
"signature": "base64_encoded_signature",
"source": {
"paymentRail": "solana",
"currency": "usdc",
"fromAddress": "5KL6MAQ4i8ht4PR8uHE4CQrxRMXHNX9Jv9dUBgH7jj3j"
},
"intermaediateAccount": {
"paymentRail": "spherenet",
"account": "sphere1abc..."
},
"destination": {
"paymentRail": "wire",
"currency": "usd",
"bankAccountId": "ext_123"
}
}'
Response
{
"ok": true,
"object": "object",
"statusCode": 200,
"error": null,
"message": "success",
"data": {
"id": "txn_123",
"state": "awaitingFunds",
"customer": "cust_alice",
"amount": "1000.00",
"source": {
"paymentRail": "solana",
"currency": "usdc",
"fromAddress": "5KL6MAQ4i8ht4PR8uHE4CQrxRMXHNX9Jv9dUBgH7jj3j"
},
"intermaediateAccount": {
"paymentRail": "spherenet",
"account": "sphere1abc..."
},
"destination": {
"paymentRail": "wire",
"currency": "usd",
"bankAccountId": "ext_123"
},
"sourceDepositInstructions": {
"paymentRail": "solana",
"amount": "1000.00",
"currency": "usdc",
"fromAddress": "5KL6MAQ4i8ht4PR8uHE4CQrxRMXHNX9Jv9dUBgH7jj3j",
"toAddress": "8JFTv1FHAqEgupBxHmkzDwtRGtPojCQ4KyxE3HXGVN2i"
},
"createdAt": "2024-01-20T19:39:14.316Z",
"updatedAt": "2024-01-20T19:39:14.316Z"
},
"ts": "2024-08-22T16:15:42.707Z",
"request": "request_cdde26b2c0534183a1aaba6baebaec1f"
}