Create transaction
In this section you'll learn how to send the essential API request to NexaStake aka creating an transaction.
After you have successfully authenticated your user and you have obtain the user uuid it's now time to create your first transaction.
Deposit
You need to form your API request in the following manner: URL: https://www.nexastake.com/api/token/transaction Post Fields:
reference_number
This is the ID of the transaction in your system. Use it as identifier
customer_uuid
This is the uuid generated from the previous step - Authenticate User
payment_method
DEPOSIT
token
USDT
fiat_amount
Write the amount in the fiat currency you have selected.
fiat_currency
Supported currencies: USD,EUR,GBP,JPY,AUD,CAD,CHF,CNY,SEK,TRY,NZD
return_to_merchant_url
Optional: A valid URL to where you want the user to return to if he clicks the button - Go Back to Merchant
Code examples:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://www.nexastake.com/api/token/transaction',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => 'reference_number=cc0a2b2-cc0a2b2c-592f-4&customer_uuid=becd4412-06df-4c17-8c06-b7e3179fd4eb&payment_method=DEPOSIT&token=USDT&fiat_amount=5000&fiat_currency=USD',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/x-www-form-urlencoded',
'Authorization: Bearer nexastake_API_KEY'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;<?php
$client = new Client();
$headers = [
'Content-Type' => 'application/x-www-form-urlencoded',
'Authorization' => 'Bearer nexastake_API_KEY'
];
$options = [
'form_params' => [
'reference_number' => 'cc0a2b2-cc0a2b2c-592f-4',
'customer_uuid' => 'becd4412-06df-4c17-8c06-b7e3179fd4eb',
'payment_method' => 'DEPOSIT',
'token' => 'USDT',
'fiat_amount' => '5000',
'fiat_currency' => 'USD'
]];
$request = new Request('POST', 'https://www.nexastake.com/api/token/transaction', $headers);
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();const axios = require('axios');
const qs = require('qs');
let data = qs.stringify({
'reference_number': 'cc0a2b2-cc0a2b2c-592f-4',
'customer_uuid': 'becd4412-06df-4c17-8c06-b7e3179fd4eb',
'payment_method': 'DEPOSIT',
'token': 'USDT',
'fiat_amount': '5000',
'fiat_currency': 'USD'
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://www.nexastake.com/api/token/transaction',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Bearer nexastake_api_key'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://www.nexastake.com/api/token/transaction");
request.Headers.Add("Authorization", "Bearer nexastake_api_key");
var collection = new List<KeyValuePair<string, string>>();
collection.Add(new("reference_number", "cc0a2b2-cc0a2b2c-592f-4"));
collection.Add(new("customer_uuid", "becd4412-06df-4c17-8c06-b7e3179fd4eb"));
collection.Add(new("payment_method", "DEPOSIT"));
collection.Add(new("token", "USDT"));
collection.Add(new("fiat_amount", "5000"));
collection.Add(new("fiat_currency", "USD"));
var content = new FormUrlEncodedContent(collection);
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());Regardless of which programming language you have chosen you'll receive response for deposit transaction like this:
{
"status": "success",
"transaction": "7dda9007-3b29-461b-b399-ac6d37e97dff",
"fiat_amount": "5000",
"currency": "EUR",
"converted_amount": 122.28,
"converted_in_token": "USDT",
"conversion_rate": 40.89,
"reference_number": "cc0a2b2-cc0a2b2c-592f-4",
"customer_uuid": "becd4412-06df-4c17-8c06-b7e3179fd4eb",
"method": "TokenDeposit",
"payment_url": "https://www.nexastake.com/payment/7dda9007-3b29-461b-b399-ac6d37e97dff"
}Use the payment_url to redirect your user to the payment page. There he will complete the payment.
Withdraw
You need to form your API request in the following manner: URL: https://www.nexastake.com/api/token/transaction Post Fields:
reference_number
This is the ID of the transaction in your system. Use it as identifier
customer_uuid
This is the uuid generated from the previous step - Authenticate User
payment_method
WITHDRAW
token
USDT
fiat_amount
Write the amount in the fiat currency you have selected.
fiat_currency
Supported currencies: USD,EUR,GBP,JPY,AUD,CAD,CHF,CNY,SEK,TRY,NZD
address
The address of the user's wallet where withdraw funds will be sent.
blockchain
Pick one of the Allowed blockchains: ETH, TRX, BNB, SOL
You'll receive response in the following format:
{
"status": "success",
"transaction": "207407a5-8b1f-42a0-92cd-5c45eabb6e26",
"fiat_amount": "5000",
"currency": "USD",
"converted_amount": 122.25,
"converted_in_token": "USDT",
"conversion_rate": 40.9,
"reference_number": "cc0a2b2-cc0a2b2c-592",
"customer_uuid": "becd4412-06df-4c17-8c06-b7e3179fd4eb",
"method": "TokenWithdraw"
}Last updated