{
  "id": "txn_01HZXK8M9N2P3Q4R5S6T7U8V9W",
  "bridge_transfer_id": "transfer_abc123xyz456",
  "state": "pending",
  "amount": "100.00",
  "source": {
    "payment_rail": "ethereum",
    "currency": "usdc"
  },
  "destination": {
    "payment_rail": "polygon",
    "currency": "eurc",
    "to_address": "0x742d35Cc6634C0532925a3b8D4C9db96c4b4d8e1"
  },
  "customer": {
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@example.com",
    "address": "123 Main St, New York, NY 10001",
    "country": "United States",
    "phone_number": "+1-555-123-4567"
  },
  "created_at": "2023-07-01T12:00:00.000Z",
  "updated_at": "2023-07-01T12:00:00.000Z"
}
The Create Stablecoin Payment Intent API enables seamless stablecoin-to-stablecoin transfers across different blockchain networks. This feature is perfect for cross-chain transfers, currency conversions (e.g., USDC to EURC), and creating flexible payment flows where users can specify amounts dynamically.

API Endpoint

method
string
POST
url
string
/api/v0/payment-intents/stablecoin
Authentication: Required (API Key & Secret)
Idempotency: Supported (recommended for all operations)

Authentication

All requests require API key authentication using the following headers:
x-client-key
string
required
Your application’s client key
x-client-secret
string
required
Your application’s client secret

Idempotency

The endpoint supports idempotency to prevent duplicate payments:
idempotency-key
string
Include a unique UUID v4 in the header
Subsequent requests with the same key return the original response
Keys expire after 24 hours

Supported Networks

Our platform currently supports the following blockchain networks:
NetworkCodeDescription
EthereumethereumMain Ethereum network
PolygonpolygonPolygon (Matic) network
SolanasolanaSolana blockchain
BasebaseCoinbase’s Base network
ArbitrumarbitrumArbitrum Layer 2
OptimismoptimismOptimism Layer 2
Avalanche C-Chainavalanche_c_chainAvalanche C-Chain
StellarstellarStellar network
TrontronTron blockchain

Supported Stablecoins

CurrencyCodeDescription
USDCusdcUSD Coin
EURCeurcEuro Coin

Request Parameters

Required Parameters

sourceCurrency
enum
required
The stablecoin currency to convert FROM (usdc, eurc)
Example: "usdc"
sourceNetwork
enum
required
The blockchain network where source currency resides
Example: "ethereum"
destinationNetwork
enum
required
The blockchain network where converted currency will be delivered
Example: "polygon"

Optional Parameters

destinationCurrency
enum
The stablecoin currency to convert TO (defaults to sourceCurrency)
Example: "eurc"
destinationAddress
string
Wallet address for receiving funds (Ethereum 0x… or Solana format)
Example: "0x742d35Cc6634C0532925a3b8D4C9db96c4b4d8e1"
amount
string
Payment amount in source currency (omit for flexible amounts)
Example: "100.50"
customer_first_name
string
Customer’s first name (max 100 chars)
Example: "John"
customer_last_name
string
Customer’s last name (max 100 chars)
Example: "Doe"
customer_email
string
Customer’s email address
Example: "john.doe@example.com"
customer_address
string
Customer’s physical address
Example: "123 Main St, New York, NY 10001"
customer_country
string
Customer’s country
Example: "United States"
customer_countryISO
string
Customer’s country ISO code
Example: "US"
customer_province
string
Customer’s province/state
Example: "New York"
customer_provinceISO
string
Customer’s province/state ISO code
Example: "NY"
phoneNumber
string
Customer’s phone number
Example: "+1-555-123-4567"

Examples

curl -X POST https://api.devdraft.ai/api/v0/payment-intents/stablecoin \
  -H "Content-Type: application/json" \
  -H "x-client-key: your-client-key" \
  -H "x-client-secret: your-client-secret" \
  -H "idempotency-key: 550e8400-e29b-41d4-a716-446655440000" \
  -d '{
    "sourceCurrency": "usdc",
    "sourceNetwork": "ethereum",
    "destinationCurrency": "eurc",
    "destinationNetwork": "polygon",
    "destinationAddress": "0x742d35Cc6634C0532925a3b8D4C9db96c4b4d8e1",
    "amount": "100.00",
    "customer_first_name": "John",
    "customer_last_name": "Doe",
    "customer_email": "john.doe@example.com",
    "customer_address": "123 Main St, New York, NY 10001",
    "customer_country": "United States",
    "phoneNumber": "+1-555-123-4567"
  }'

Response Format

Success Response (201 Created)

{
  "id": "txn_01HZXK8M9N2P3Q4R5S6T7U8V9W",
  "bridge_transfer_id": "transfer_abc123xyz456",
  "state": "pending",
  "amount": "100.00",
  "source": {
    "payment_rail": "ethereum",
    "currency": "usdc"
  },
  "destination": {
    "payment_rail": "polygon",
    "currency": "eurc",
    "to_address": "0x742d35Cc6634C0532925a3b8D4C9db96c4b4d8e1"
  },
  "customer": {
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@example.com",
    "address": "123 Main St, New York, NY 10001",
    "country": "United States",
    "phone_number": "+1-555-123-4567"
  },
  "created_at": "2023-07-01T12:00:00.000Z",
  "updated_at": "2023-07-01T12:00:00.000Z"
}

Response Fields

id
string
Unique transaction identifier in our database
bridge_transfer_id
string
External bridge service transfer ID
state
string
Current state: pending, processing, completed, failed, cancelled
amount
string
Payment amount (null for flexible amounts until user specifies)
source
object
Source payment details including payment rail and currency
destination
object
Destination payment details including payment rail, currency, and address
customer
object
Customer information (if provided)
created_at
string
Creation timestamp (ISO 8601)
updated_at
string
Last update timestamp (ISO 8601)

Error Responses

{
  "statusCode": 400,
  "message": [
    "Please select a valid source currency",
    "Destination network is required"
  ],
  "error": "Bad Request"
}

Network-Specific Considerations

Address Formats

Networks: Ethereum, Polygon, Base, Arbitrum, Optimism, AvalancheUse hexadecimal format starting with 0xExample: 0x742d35Cc6634C0532925a3b8D4C9db96c4b4d8e1

Gas Fees & Transaction Speed

NetworkTypical FeeSpeedBest For
EthereumHighSlowLarge transfers, maximum security
PolygonVery LowFastFrequent small transfers
SolanaVery LowVery FastHigh-frequency trading
BaseLowFastConsumer applications
ArbitrumLowFastDeFi applications
OptimismLowFastDeFi applications
AvalancheMediumFastCross-chain transfers

Use Cases

Cross-Chain Arbitrage

Enable users to move assets between networks to take advantage of price differences or liquidity opportunities.

Currency Conversion

Allow seamless conversion between USDC and EURC for international payments and regional preferences.

Layer 2 Onboarding

Help users move from expensive Layer 1 (Ethereum) to cheaper Layer 2 solutions (Polygon, Arbitrum, Optimism).

Multi-Chain Portfolio Management

Enable users to distribute their holdings across multiple networks for diversification and risk management.

Dynamic Pricing

Create flexible payment intents for services with variable pricing, allowing users to specify amounts during checkout.

Best Practices

Amount Validation

  • Use string format for amounts to avoid floating-point precision issues
  • Support up to 6 decimal places
  • Validate minimum amounts based on network gas fees

Address Validation

  • Always validate destination addresses before creating payment intents
  • Use different validation patterns for different networks
  • Consider implementing address checksums for Ethereum-compatible networks

Error Handling

  • Implement proper retry logic for network failures
  • Handle insufficient balance scenarios gracefully
  • Provide clear error messages to users

Idempotency

  • Always use unique idempotency keys for each request
  • Store and reuse keys for retries of the same operation
  • Implement proper key expiration handling

Integration Examples

React Integration

import { useState } from 'react';

interface PaymentIntentData {
  sourceCurrency: 'usdc' | 'eurc';
  sourceNetwork: string;
  destinationNetwork: string;
  destinationCurrency?: 'usdc' | 'eurc';
  destinationAddress?: string;
  amount?: string;
  customer_email?: string;
}

export function useStablecoinPaymentIntent() {
  const [loading, setLoading] = useState(false);
  const [error, setError] = useState<string | null>(null);

  const createPaymentIntent = async (data: PaymentIntentData) => {
    setLoading(true);
    setError(null);

    try {
      const response = await fetch('/api/payment-intents/stablecoin', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
        },
        body: JSON.stringify(data),
      });

      if (!response.ok) {
        throw new Error('Failed to create payment intent');
      }

      const result = await response.json();
      return result;
    } catch (err) {
      setError(err instanceof Error ? err.message : 'An error occurred');
      throw err;
    } finally {
      setLoading(false);
    }
  };

  return { createPaymentIntent, loading, error };
}

Support

For additional support or questions about the Create Stablecoin Payment Intent API:
  1. Check our API status page for known issues
  2. Review the error codes and messages in your responses
  3. Contact our support team with your bridge_transfer_id for specific transaction issues
  4. Use our testing environment to validate integrations before going live
Based on the Scalar documentation from Create Stablecoin Payment Intent.