Create a Pay-out Instance

This endpoint allows you to create a new payment instance and receive a URL that can be used to launch the Tylt Prime Pay-In widget. Through the widget, the merchant's end customer can make a deposit or payment to the merchant using PIX. The payment is settled in USDT into the merchants wallet.

Endpoint

POSThttps://api.tylt.money/v2/prime/BR/PIX/instance

Request Headers

Name
Type
Example
Description

X-TLP-APIKEY

string

93ee3c5e133697251b5362bcf9cc8532476785t8768075616f58d88

Your Tylt API Key, used to identify your account in API requests.

X-TLP-SIGNATURE

string

d0afef3853dfc8489c8b9affa5825171fdd7y7685675e4966a05f66ed2b3eaf9462b3c9c0

HMAC SHA-256 signature generated using the API Secret Key to secure the request.

Request Body

Field Name

Type

Description

isBuyTrade

number

Must be set to 0 for a Pay-out transaction.

userDetails

JSON Object

Custom fields associated with the user, supplied by the merchant. These fields are included in web-hook notifications and other API responses for easy reference and tracking. An empty object can be sent.

merchantOrderId

string

A UUID used by the merchant to reference this instance or any transaction related to it.

callBackUrl

string

The URL to which payment status updates are sent.

redirectUrl

string

The URL to redirect the user after completing the payment.

amount

number

Mandatory. This is the amount the user wants to withdraw in USDT or BRL equivalent.

currencySymbol

string

Supported Currency is "USDT" or "BRL" only.

autoPayout

integer

Set to 1 if you want the payout to be processed automatically, without requiring the user to interact with the Pay-Out widget. When set to 0, the user must manually confirm the payout through the widget interface.

pixDetails

JSON Object

Object containing the beneficiary’s payout details — required if autoPayout is 1

fullName

Full legal name of the bank account holder, as registered with their bank.

cpfKey

CPF (individual) or CNPJ (business) number linked to the account.

pixKeyType

Type of PIX key associated with the account. Accepted values: CPF, EMAIL, MOBILE.

pixKey

Actual PIX key value corresponding to the selected pixKeyType.

Code Snippet

const axios = require('axios');
const crypto = require('crypto');

// Replace with your API Key and Secret
const apiKey = 'your-api-key';
const apiSecret = 'your-api-secret';

// Request body
const requestBody = {
  isBuyTrade: 0, // 0 = Sell (Off-Ramp), 1 = Buy (On-Ramp)
  userDetails: {}, // Optional user metadata (e.g., email, phone, userId)
  merchantOrderId: crypto.randomUUID(),
  callBackUrl: 'https://www.test.com/callback',
  redirectUrl: 'https://www.test.com/callback',
  amount: 10,
  currencySymbol: 'BRL',
  autoPayout: 1, // 1 = Auto process payout, 0 = Manual via widget ( Default)
  pixDetails: { // Required if autoPayout is set to 1
    fullName: 'João Pereira',
    cpfKey: '123.456.789-10',
    pixKeyType: 'CPF', // Accepted values: 'CPF', 'EMAIL', 'MOBILE'
    pixKey: '123.456.789-10'
  }
};

// Print request body for reference
console.log('requestBody',requestBody);

// Convert request body to JSON
const raw = JSON.stringify(requestBody);

// Function to create HMAC SHA-256 signature
const createSignature = (secret, data) => {
    return crypto.createHmac('sha256', secret)
                 .update(data)
                 .digest('hex');
};

// Generate signature
const signature = createSignature(apiSecret, raw);

// Define headers
const headers = {
    "X-TLP-APIKEY": apiKey,
    "X-TLP-SIGNATURE": signature
};

// Send the request
axios.post('https://api.tylt.money/v2/prime/BR/PIX/instance', raw, { headers })
    .then(response => console.log("Success:", response.data))
    .catch(error => console.error("Error:", error));

Response

{
    "msg": "Instance created successfully",
    "data": {
        "url": "https://app.tylt.money/prime-brl/d0f6cc25-e8f8-11ef-830e-02d8461243e9", // will not be sent if autoPayout is set to 1
        "instanceId": "d0f6cc25-e8f8-11ef-830e-02d8461243e9",
        "tradeId": 10432

        }    
}

Last updated