πŸ”„Swap Crypto

Swap crypto balances in your Swapped Commerce account

Why Swap via API?

Merchants may wish to enable Webhook-based payout orchestration.

You may want to settle all incoming payments to a Stablecoin, like USDT, and then allow a customer to receive a different token when receiving a Payout.

For example:

  • A customer deposits ~100.00 USDT equivalent of BTC (they pay BTC), which then the merchant auto-converts into USDT. Great, now the merchant has what they want: USDT

  • Now, a customer wishes to withdraw ~50.00 USDT equivalent of ETH, which can be sourced from the merchant's USDT balance.

  • Now you the Merchant need to convert ~$50.00 USDT into ETH, and initiate an ETH Payout to the end-customer.

How it works

  1. GET a Quote for a Swap:

    GET https://pay-api.swapped.com/v1/convert/quote?fromCurrency=USDT&fromAmount=50&toCurrency=ETH
  2. POST a Swap:

    POST https://pay-api.swapped.com/v1/convert
    
    {
        "fromAmount": "50",
        "fromCurrency": "USDT",
        "toCurrency": "ETH"
    }

  3. Listen for Webhooks to get the amount, then proceed with your next action (e.g: Send a Crypto Payout):

    POST https://pay-api.swapped.com/v1/payouts
    
    {
      "payouts": [
        {
          chain: "ethereum",
          currency: "ETH",
          amount: "0.004521",
          memo: "", // optional
          address: "0x0123456789..."
          customerName: "John Doe",
          customerEmail: "[email protected]"
        }
      ]
    }
circle-check

Get convert quote

get

Gets a quote to perform a conversion for the authenticated merchant

Authorizations
X-API-KeystringRequired
Query parameters
fromCurrencystringRequired
fromAmountstringRequiredPattern: ^(?:[1-9]\d*|0?\.\d+|\d+\.\d+)$
toCurrencystringRequired
Responses
chevron-right
200

Successful

*/*
get
/v1/convert/quote
200

Successful

Convert funds between currencies

post

Convert funds between currency groups

Authorizations
X-API-KeystringRequired
Body
fromAmountstringRequiredPattern: ^(?:[1-9]\d*|0?\.\d+|\d+\.\d+)$
fromCurrencystringRequired
toCurrencystringRequired
Responses
chevron-right
200

Successful

*/*
post
/v1/convert
200

Successful

Last updated