Create a Pay-in Instance

This endpoint allows you to create a new payment instance and receive a in the response an instanceId.The instanceId can be used further along with the other exposed API's to create a completely customisable host to host integration.

Endpoint

POSThttps://api.tylt.money/h2h/in/upi/createPayinInstance

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

userDetails

JSON Object

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

merchantOrderId

string

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

callBackUrl

string

Mandatory.The URL to which payment status updates are sent.

amount

number

Mandatory. This is the amount the user wants to deposit in USDT or INR equivalent. If this field is empty user can enter the value in the payment flow.

currencySymbol

string

Mandatory. Supported Currency is "USDT" or "INR" only.

userEmail

string

Mandatory. The emailId of the end user.

isKYCNeeded

number

1 or 0. If set to 0 the user will not be required to complete KYC or provide KYC. If field is in passed, default behaviour is KYC is required. This bypass needs to be approved by the admin for the Merchant.

isUTRNeeded

number

To be set Mandatorily as 1. The user will be required to provide the UTR (Unique Transaction Reference) number after making the payment. This is a recommended setting as it significantly reduces payment failures, disputes, and chargebacks while also enabling seamless processing through our automated Lightning Bridge.

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 = {
    userDetails: {},
    amount: 250,
    currencySymbol: 'INR',
    merchantOrderId: 'b73b73b-87wtbc-q36gbc-331n3',
    callBackUrl: 'https://www.test.com/callback',
    redirectUrl: 'https://www.test.com/callback',
    userEmail: '[email protected]'
};

// 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 = {
    "Content-Type": "application/json",
    "X-TLP-APIKEY": apiKey,
    "X-TLP-SIGNATURE": signature
};

// Send the request
axios.post('https://api.tylt.money/h2h/in/upi/createPayinInstance', raw, { headers })
    .then(response => console.log("Success:", response.data))
    .catch(error => console.error("Error:", error));

Response

{
    "msg": "Trade created successfully.",
    "data": {
        "instanceId": "51138bbb-fe4e-11ef-bcfd-42010a280107",
        "tradeId": 2081,
        "accounts": {
            "transactionType": "pay-in",
            "amountPaidInLocalCurrency": 215.04999999999998,
            "localCurrency": "INR",
            "conversionRate": 93.5,
            "amountPaidInCryptoCurrency": 2.3,
            "cryptoCurrencySymbol": "USDT",
            "MDR_Rate": 4,
            "merchantAccountCredited": null,
            "merchantAccountDebited": null
        }
    }
}

Last updated