Swipelux
Rails/Our OnRamp

Server-side Integration

Server-side integration provides complete control over the card rail purchasing flow. By creating orders programmatically, you can implement custom pricing logic, pre-fill user data, track orders in your system, and handle completion events via webhooks.

Server-side Benefits

Enhanced Control

  • Create orders with pre-filled amounts, currencies, and destinations
  • Restrict payment methods using paymentChannel customization
  • Implement dynamic pricing and promotional logic
  • Generate orders based on your internal business rules

Better User Experience

  • Skip manual input by pre-populating user information
  • Direct users to payment completion with prepared orders
  • Provide order tracking and history in your application

Business Intelligence

  • Track order creation and completion rates
  • Analyze conversion funnels and user behavior
  • Integrate with your existing analytics and reporting systems

Operational Efficiency

  • Handle order completion events automatically via webhooks
  • Reconcile payments with your internal systems
  • Automate post-purchase workflows

Integration Guides

Implementation Flow

1. Order Creation

Create orders server-side with all necessary parameters:

{
  "amounts": {
    "from": {
      "amount": 100,
      "currency": "USD"
    },
    "to": {
      "currency": "USDC"
    }
  },
  "user": {
    "email": "user@example.com",
    "phone": "+1234567890"
  },
  "targetAddress": "0x1234...",
  "externalId": "order_123_from_my_system",
  "paymentChannel": "CARD_PAYMENT"
}

2. User Redirection

Direct users to complete payment using either:

Payment Link: Direct browser redirect

https://track.swipelux.com?specificSettings={orderData}

Widget Integration: Embedded widget with order token

<swipelux-widget 
  api-key="YOUR_PUBLISHABLE_API_KEY"
  order-token="ord_token_abc123..."
></swipelux-widget>

3. Event Handling

Receive real-time updates via webhooks:

{
  "type": "order.completed",
  "data": {
    "orderId": "ord_abc123",
    "externalId": "order_123_from_my_system",
    "status": "SUCCESS",
    "amounts": {
      "from": { "amount": 100, "currency": "USD" },
      "to": { "amount": 99.2, "currency": "USDC" }
    },
    "transactions": [...],
    "completedAt": "2024-01-31T14:16:16.798Z"
  }
}

Security Considerations

  • API Keys: Store secret API keys securely, never expose them in client-side code
  • Webhook Verification: Verify webhook signatures to ensure authenticity
  • Order Validation: Validate order parameters before processing
  • Error Handling: Implement proper error handling for API failures

Next Steps

Once you have server-side integration working:

On this page