Create Stablecoin Payment Intent

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 EndpointCopied!

POST /api/v0/payment-intents/stablecoin

AuthenticationCopied!

All requests require API key authentication using the following headers:

  • x-client-key: Your application's client key

  • x-client-secret: Your application's client secret

IdempotencyCopied!

The endpoint supports idempotency to prevent duplicate payments:

  • idempotency-key: Include a unique UUID v4 in the header

  • Subsequent requests with the same key return the original response

  • Keys expire after 24 hours

Supported NetworksCopied!

Our platform currently supports the following blockchain networks:

Network

Code

Description

Ethereum

ethereum

Main Ethereum network

Polygon

polygon

Polygon (Matic) network

Solana

solana

Solana blockchain

Base

base

Coinbase's Base network

Arbitrum

arbitrum

Arbitrum Layer 2

Optimism

optimism

Optimism Layer 2

Avalanche C-Chain

avalanche_c_chain

Avalanche C-Chain

Stellar

stellar

Stellar network

Tron

tron

Tron blockchain

Supported StablecoinsCopied!

Currency

Code

Description

USDC

usdc

USD Coin

EURC

eurc

Euro Coin

Request ParametersCopied!

Required Parameters

Parameter

Type

Description

sourceCurrency

enum

The stablecoin currency to convert FROM (usdc, eurc)

sourceNetwork

enum

The blockchain network where source currency resides

destinationNetwork

enum

The blockchain network where converted currency will be delivered

Optional Parameters

Parameter

Type

Description

destinationCurrency

enum

The stablecoin currency to convert TO (defaults to sourceCurrency)

destinationAddress

string

Wallet address for receiving funds (Ethereum 0x... or Solana format)

amount

string

Payment amount in source currency (omit for flexible amounts)

customer_first_name

string

Customer's first name (max 100 chars)

customer_last_name

string

Customer's last name (max 100 chars)

customer_email

string

Customer's email address

customer_address

string

Customer's physical address

customer_country

string

Customer's country

customer_countryISO

string

Customer's country ISO code

customer_province

string

Customer's province/state

customer_provinceISO

string

Customer's province/state ISO code

phoneNumber

string

Customer's phone number

ExamplesCopied!

1. Basic USDC to EURC Conversion

Convert 100 USDC from Ethereum to EURC on Polygon:

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"
  }'

2. Cross-Chain USDC Transfer (Ethereum to Solana)

Transfer USDC from Ethereum to Solana without currency conversion:

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-446655440001" \
  -d '{
    "sourceCurrency": "usdc",
    "sourceNetwork": "ethereum",
    "destinationCurrency": "usdc",
    "destinationNetwork": "solana",
    "destinationAddress": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
    "amount": "250.00",
    "customer_email": "customer@example.com"
  }'

3. Flexible Amount Payment Intent

Create a payment intent where users specify the amount during checkout:

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-446655440002" \
  -d '{
    "sourceCurrency": "usdc",
    "sourceNetwork": "ethereum",
    "destinationCurrency": "usdc",
    "destinationNetwork": "polygon",
    "destinationAddress": "0x742d35Cc6634C0532925a3b8D4C9db96c4b4d8e1",
    "customer_email": "customer@example.com"
  }'

4. Multi-Network Examples

Polygon to Base Transfer
{
  "sourceCurrency": "usdc",
  "sourceNetwork": "polygon",
  "destinationCurrency": "usdc",
  "destinationNetwork": "base",
  "destinationAddress": "0x742d35Cc6634C0532925a3b8D4C9db96c4b4d8e1",
  "amount": "500.00",
  "customer_email": "customer@example.com"
}
Arbitrum to Optimism Transfer
{
  "sourceCurrency": "usdc",
  "sourceNetwork": "arbitrum",
  "destinationCurrency": "usdc",
  "destinationNetwork": "optimism",
  "destinationAddress": "0x742d35Cc6634C0532925a3b8D4C9db96c4b4d8e1",
  "amount": "75.50",
  "customer_email": "customer@example.com"
}
Avalanche to Solana Transfer
{
  "sourceCurrency": "usdc",
  "sourceNetwork": "avalanche_c_chain",
  "destinationCurrency": "usdc",
  "destinationNetwork": "solana",
  "destinationAddress": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
  "amount": "1000.00",
  "customer_email": "customer@example.com"
}

Response FormatCopied!

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

Field

Type

Description

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

destination

object

Destination payment details

customer

object

Customer information (if provided)

created_at

string

Creation timestamp (ISO 8601)

updated_at

string

Last update timestamp (ISO 8601)

Error ResponsesCopied!

400 Bad Request

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

401 Unauthorized

{
  "statusCode": 401,
  "message": "Unauthorized - Invalid API credentials",
  "error": "Unauthorized"
}

404 Not Found

{
  "statusCode": 404,
  "message": "App not found",
  "error": "Not Found"
}

409 Conflict (Idempotency)

{
  "statusCode": 409,
  "message": "Idempotency key already used with different parameters",
  "error": "Conflict"
}

Network-Specific ConsiderationsCopied!

Address Formats

  • Ethereum-compatible networks (Ethereum, Polygon, Base, Arbitrum, Optimism, Avalanche): Use hexadecimal format starting with

    0x

    • Example: 0x742d35Cc6634C0532925a3b8D4C9db96c4b4d8e1

  • Solana: Use base58 format

    • Example: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM

Gas Fees & Transaction Speed

Network

Typical Fee

Speed

Best For

Ethereum

High

Slow

Large transfers, maximum security

Polygon

Very Low

Fast

Frequent small transfers

Solana

Very Low

Very Fast

High-frequency trading

Base

Low

Fast

Consumer applications

Arbitrum

Low

Fast

DeFi applications

Optimism

Low

Fast

DeFi applications

Avalanche

Medium

Fast

Cross-chain transfers

Use CasesCopied!

1. Cross-Chain Arbitrage

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

2. Currency Conversion

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

3. Layer 2 Onboarding

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

4. Multi-Chain Portfolio Management

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

5. Dynamic Pricing

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

Best PracticesCopied!

1. 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

2. 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

3. Error Handling

  • Implement proper retry logic for network failures

  • Handle insufficient balance scenarios gracefully

  • Provide clear error messages to users

4. 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 ExamplesCopied!

JavaScript/TypeScript

interface CreateStablecoinPaymentIntentRequest {
  sourceCurrency: 'usdc' | 'eurc';
  sourceNetwork: string;
  destinationCurrency?: 'usdc' | 'eurc';
  destinationNetwork: string;
  destinationAddress?: string;
  amount?: string;
  customer_email?: string;
  // ... other customer fields
}

async function createStablecoinPaymentIntent(
  data: CreateStablecoinPaymentIntentRequest
): Promise<PaymentIntentResponse> {
  const response = await fetch('/api/v0/payment-intents/stablecoin', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-client-key': process.env.CLIENT_KEY!,
      'x-client-secret': process.env.CLIENT_SECRET!,
      'idempotency-key': crypto.randomUUID(),
    },
    body: JSON.stringify(data),
  });
  
  if (!response.ok) {
    throw new Error(`HTTP error! status: ${response.status}`);
  }
  
  return response.json();
}

Python

import requests
import uuid
from typing import Optional, Dict, Any

def create_stablecoin_payment_intent(
    source_currency: str,
    source_network: str,
    destination_network: str,
    destination_currency: Optional[str] = None,
    destination_address: Optional[str] = None,
    amount: Optional[str] = None,
    customer_email: Optional[str] = None,
    **customer_data
) -> Dict[Any, Any]:
    
    url = "https://api.example.com/api/v0/payment-intents/stablecoin"
    
    headers = {
        "Content-Type": "application/json",
        "x-client-key": os.getenv("CLIENT_KEY"),
        "x-client-secret": os.getenv("CLIENT_SECRET"),
        "idempotency-key": str(uuid.uuid4())
    }
    
    payload = {
        "sourceCurrency": source_currency,
        "sourceNetwork": source_network,
        "destinationNetwork": destination_network,
        **({} if destination_currency is None else {"destinationCurrency": destination_currency}),
        **({} if destination_address is None else {"destinationAddress": destination_address}),
        **({} if amount is None else {"amount": amount}),
        **({} if customer_email is None else {"customer_email": customer_email}),
        **customer_data
    }
    
    response = requests.post(url, json=payload, headers=headers)
    response.raise_for_status()
    
    return response.json()

SupportCopied!

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