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 UPI. The payment is settled in USDT into the merchants wallet.
HMAC SHA-256 signature generated using the API Secret Key to secure the request.
When using the API, ensure to include your API Key and generate the signature for the request payload using your API Secret. The tables provided above contain example values for illustration purposes only. Please refer to the code snippets for detailed instructions on how to sign the request and generate the signature properly.
Request Body
Field Name
Type
Description
isBuyTrade
number
Must be set to 1 for a Pay-In transaction.
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
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.
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: 1,
userDetails: {},
merchantOrderId: 'b73b73b-87wtbc-q36gbc-331n3',
callBackUrl: 'https://www.test.com/callback',
redirectUrl: 'https://www.test.com/callback',
};
// 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/p2pRampsMerchant/createInstance', raw, { headers })
.then(response => console.log("Success:", response.data))
.catch(error => console.error("Error:", error));
import requests
import hmac
import hashlib
import json
# Replace with your API Key and Secret
api_key = 'your-api-key'
api_secret = 'your-api-secret'
# Request body
request_body = {
"isBuyTrade": 1,
"userDetails": {},
"merchantOrderId": 'b73b73b-87wtbc-q36gbc-331n3',
"callBackUrl": 'https://www.test.com/callback',
"redirectUrl": 'https://www.test.com/callback',
}
# Convert request body to JSON
raw = json.dumps(request_body)
# Function to create HMAC SHA-256 signature
def create_signature(secret, data):
return hmac.new(secret.encode(), data.encode(), hashlib.sha256).hexdigest()
# Generate signature
signature = create_signature(api_secret, raw)
# Define headers
headers = {
"Content-Type": "application/json",
"X-TLP-APIKEY": api_key,
"X-TLP-SIGNATURE": signature
}
# Send the request
response = requests.post('https://api.tylt.money/p2pRampsMerchant/createInstance', headers=headers, data=raw)
print("Response:", response.json())
const fetch = require('node-fetch');
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: 1,
userDetails: {},
merchantOrderId: 'b73b73b-87wtbc-q36gbc-331n3',
callBackUrl: 'https://www.test.com/callback',
redirectUrl: 'https://www.test.com/callback',
};
// 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
};
// Function to send the request
const sendRequest = async (url, headers, body) => {
const response = await fetch(url, {
method: 'POST',
headers: headers,
body: body,
});
return response.json();
};
// Send the request
sendRequest('https://api.tylt.money/p2pRampsMerchant/createInstance', headers, raw)
.then(result => console.log("Success:", result))
.catch(error => console.error("Error:", error));