Swap channel

Swap

A swap is an agreement or a derivative contract between two parties for a financial exchange

To access detailed information about a specific swap from the Tulu Switch API, you can utilize a POST request directed at the swap endpoint. Below is an example employing cURL:

Request payload

Name

Type

Description

from_channel

string

The originating financial channel (e.g,fiat).

from_currency

string

The currency being swapped (e.g ,ngn).

from_amount

number

Tped.he amount to be swap

exchange_rate

number

he applicable exchange rate for the swap.

to_channel

string

The target financial channel (e.g ,cryptocurrency).

to_currency

string

The currency to receive (e.g.,usdt).

to_amount

number

The calculated amount after the swap.


    let headersList = {
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV
        CJ9.eyJyb2xlaWQiOiI2NDEiLCJ1c2VySWQiOiI4MzR
        kNDVmZS0xZjVkLTQ1YTItYmRiZi05ZmQ3NTFkNTliMT
        YiLCJpYXQiOjE3MTAxNDEwOTIsImV4cCI6MTcxMDIyN
        zQ5Mn0.Uheu2Sf3spkA1i9e6t97oMb8spwsmjSkjLvu
        vGYO1GM",
        "Content-Type": "application/json"
       }

       let bodyContent = JSON.stringify({
         "from_channel":"fiat",
           "from_currency":"ngn",
           "from_amount": 200,
           "exchange_rate":762,
           "to_channel":"cryptocurrency",
           "to_currency":"usdt",
           "to_amount":4000
       });

       let response = await
       fetch("http://api.switch.tulupay.com/transactions/swap", {
         method: "POST",
         body: bodyContent,
         headers: headersList
       });

       let data = await response.text();
       console.log(data);

   

Request details

  • Endpoint:`https://api.switch.tulupay.com/transactions/swap`
  • Method:`POST`
  • Headers:
  • Content-Type:`application/json`
  • Authorization:`Bearer token`
  • Response details

    After a successful response, you'll receive a simple JSON object with swap details. Here's an example:

    
        {
            "statusCode": "02",
            "status": "Invalid swap",
            "message": "insufficient funds"
          }
        

    Contact Us for Developer Support

    Contact our dedicated developer support team for assistance, guidance, or any questions you have regarding Tuluswitch API integration. We're here to ensure your development experience is smooth and successful.

    Read Our Developer FAQ for Insights

    Master the Tuluswitch API with our Developer Blog! Get expert insights, advanced tips, and industry trends beyond the documentation. Stay connected with the developer community to build exceptional payment platforms. Visit the blog now and unlock your full potential!