Swipelux
Rails/Our OnRamp/Server-side Integration

Payment Method Customization

Restrict the onramp widget to specific payment methods using the paymentChannel parameter. This provides a streamlined user experience when you want to limit payment options based on your business requirements.

Available Payment Channels

Payment ChannelDescriptionProcessing TimeTypical Limits
CARD_PAYMENTCredit/debit card payments using Visa, Mastercard, or other supported networksInstantStandard card limits
WIRE_TRANSFERDirect bank transfer payments1-3 business daysHigher limits available
OPEN_BANKINGInstant bank account payments using Open Banking protocolsInstantVaries by bank
APPLE_PAYQuick payments using Apple Pay on supported devicesInstantApple Pay limits

When paymentChannel is specified, only that payment method will be available in the widget. If not provided, all supported payment methods for the currency pair will be shown.

Implementation

Add the paymentChannel parameter to your order creation request:

Basic Card Payment Example

{
  "amounts": {
    "from": {
      "amount": 20,
      "currency": "EUR"
    },
    "to": {
      "currency": "MATIC"
    }
  },
  "paymentChannel": "CARD_PAYMENT",
  "targetAddress": "0x4E549404D2F883cA6c94135B7144b28Eb9B1CEA5",
  "user": {
    "email": "tlee@gmail.com",
    "phone": "+447455121444"
  }
}

Wire Transfer for Larger Amounts

For higher-value transactions, wire transfers often provide better limits:

{
  "amounts": {
    "from": {
      "amount": 5000,
      "currency": "USD"
    },
    "to": {
      "currency": "USDC"
    }
  },
  "paymentChannel": "WIRE_TRANSFER",
  "targetAddress": "0x1234567890abcdef...",
  "user": {
    "email": "business@company.com",
    "phone": "+1234567890"
  }
}

Open Banking for European Markets

Instant bank payments in supported European countries:

{
  "amounts": {
    "from": {
      "amount": 150,
      "currency": "EUR"
    },
    "to": {
      "currency": "ETH"
    }
  },
  "paymentChannel": "OPEN_BANKING",
  "targetAddress": "0xabcdef1234567890...",
  "user": {
    "email": "user@europe.eu",
    "phone": "+49123456789"
  }
}

Apple Pay for Mobile Users

Optimized for iOS and Safari users:

{
  "amounts": {
    "from": {
      "amount": 50,
      "currency": "USD"
    },
    "to": {
      "currency": "BTC"
    }
  },
  "paymentChannel": "APPLE_PAY",
  "targetAddress": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
  "user": {
    "email": "mobile@user.com",
    "phone": "+1555123456"
  }
}

Code Integration

JavaScript Function with Payment Channel

async function createOrderWithPaymentMethod(
  secretKey,
  {
    amount,
    fromCurrency = "USD",
    toCurrency = "USDC",
    targetAddress,
    userEmail,
    userPhone,
    paymentChannel, // Required for customization
  },
) {
  const response = await fetch(
    "https://api.swipelux.com/api/orders/createPrepared",
    {
      method: "POST",
      headers: {
        Authorization: secretKey,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        amounts: {
          from: { amount, currency: fromCurrency },
          to: { currency: toCurrency },
        },
        user: { email: userEmail, phone: userPhone },
        targetAddress,
        paymentChannel,
      }),
    },
  );
 
  if (!response.ok) {
    const error = await response.json();
    throw new Error(`API Error: ${error.message}`);
  }
 
  return await response.json();
}
 
// Usage
const response = await createOrderWithPaymentMethod("YOUR_SECRET_KEY", {
  amount: 100,
  fromCurrency: "USD",
  toCurrency: "USDC",
  targetAddress: "0x1234...",
  userEmail: "user@example.com",
  userPhone: "+1234567890",
  paymentChannel: "CARD_PAYMENT", // Only card payments will be available
});

Python Implementation

def create_order_with_payment_method(
    secret_key: str,
    amount: float,
    user_email: str,
    user_phone: str,
    target_address: str,
    payment_channel: str,  # Required for customization
    from_currency: str = 'USD',
    to_currency: str = 'USDC',
):
    import requests
    
    url = 'https://api.swipelux.com/api/orders/createPrepared'
    data = {
        'amounts': {
            'from': {'amount': amount, 'currency': from_currency},
            'to': {'currency': to_currency}
        },
        'targetAddress': target_address,
        'user': {'email': user_email, 'phone': user_phone},
        'paymentChannel': payment_channel
    }
    
    headers = {
        'Authorization': secret_key,
        'Content-Type': 'application/json'
    }
    
    response = requests.post(url, json=data, headers=headers)
    response.raise_for_status()
    return response.json()
 
# Usage
response = create_order_with_payment_method(
    'your-secret-key-here',
    amount=500,
    target_address='0x1234...',
    user_email='user@example.com', 
    user_phone='+1234567890',
    payment_channel='WIRE_TRANSFER'  # Only wire transfers will be available
)

Business Use Cases

E-commerce Integration

Restrict to card payments for standard retail transactions:

{ "paymentChannel": "CARD_PAYMENT" }

B2B High-Value Transactions

Use wire transfers for enterprise customers:

{ "paymentChannel": "WIRE_TRANSFER" }

Mobile-First Applications

Optimize for Apple Pay on iOS platforms:

{ "paymentChannel": "APPLE_PAY" }  

European Fintech Apps

Leverage instant Open Banking payments:

{ "paymentChannel": "OPEN_BANKING" }

Dynamic Payment Channel Selection

You can dynamically choose payment channels based on user context:

function selectOptimalPaymentChannel(userAgent, amount, currency) {
  // High-value transactions
  if (amount > 1000) {
    return "WIRE_TRANSFER";
  }
  
  // iOS/Safari users
  if (userAgent.includes('iPhone') || userAgent.includes('Safari')) {
    return "APPLE_PAY";
  }
  
  // European users with EUR
  if (currency === 'EUR') {
    return "OPEN_BANKING";
  }
  
  // Default to card payments
  return "CARD_PAYMENT";
}
 
// Usage in your order creation
const paymentChannel = selectOptimalPaymentChannel(
  navigator.userAgent,
  orderAmount,
  orderCurrency
);
 
const order = await createOrderWithPaymentMethod(apiKey, {
  amount: orderAmount,
  fromCurrency: orderCurrency, 
  // ... other parameters
  paymentChannel,
});

Next Steps