SendMoney Function

General

The SendMoney API function allows you to send money instantly with Weezzo e-currency to any other user by using the balance of your wallet.

Function

 TxnInfo SendMoney(
string signature,
decimal amount,
integer apiKeyID,
string comment,
string currency,
bool isReceiverPaysFees,
long integer nonce,
string receiver,
string walletID);

Parameters

Argument Type Description Example
signature string This parameter consists of a SHA256 hashed line of text formed by concatenating using ":" as a delimiter for the parameters list in alphabetical order and the APIKeyPassword at the end. Detailed instructions can be found in the Authorization scheme section. "5950F9BDA723ECDF9859AD205412BB44...
...E0DAB16630CA4462490DE64B02305F8D"
amount amount decimal The amount must have two decimal places. 1.26, 456.78, etc.
apiKeyID integer The API Key ID user wishes to perform an API call. "123456"
comment string Text comment for the transaction. Up to 128 characters long. "Some comment for the payment"
currency currency string One of a currency supported by Weezzo.

"USD", "EUR", etc.

isReceiverPaysFees boolean The field assumes one of two values. 0 - commission payable by sender, i.e. you (default); 1 - commission payable by receiver. 1 or 0
nonce long integer Variable parameter, so that an attacker intercepting traffic could not repeat the operation by sending the same request. Read more about nonce here. "123456789101112"
receiver AccountInfo string One of the following: email address or walletID. "user@mail.com", "WZ987654321", etc.
walletID wallet ID string The wallet user wishes to query with enabled API access. "WZ123456789"

Return Value

A general JSON Response containing a Transaction ID number.

Field Type Description Example
ID TransactionID integer Merchant's original transaction identification number. 1401265, 1802587, etc.

Response Sample

  {
    "ErrorMessage": null,
    "IsSuccess": true,
    "Result": 20081547
  }

Error Handling

This function can throw Authentication and Security exceptions and specific exceptions listed below:

Code Samples

Sample in PHP
 <?php
 	$apiPassword = "YourApiPassword";
 	$apiKeyID = "YourApiKey";
 	$okWallet = "#prefixAccount#123456789";
 	$apiURL = "https://api.weezzo.com/v2/";
 	$methodName = "SendMoney";
 
 	//Incoming parameters
 	$parameters = array(
 		'walletID' => $okWallet,
 		'apiKeyID' => $apiKeyID,
 		'nonce' => time(),
 		'receiver' => "receiver@mail.com",
 		'currency' => "USD",
 		'amount' => "0.02",
 		'isReceiverPaysFees' => "0",
 		'comment' => "An API transfer"
 	);
 
 	//1. Sort the parameter values by their name (in alphabetical order)
 	ksort($parameters);
 
 	//2. Form a string from the parameter values, using ":" as a delimiter, add API password at the end of this line using the same ":" delimiter
 	$data = implode(":", $parameters) . ":" . $apiPassword;
 	//3. Generate signature and add it to parameters
 	$parameters["signature"] = hash('sha256', $data);
 
 	//4. Encode parameters and send it to the server
 	$url = $apiURL . $methodName . "?" . http_build_query($parameters);
 
 	echo file_get_contents($url);
Sample in C#
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Net;
 using System.Text;
 using System.Threading.Tasks;
 using System.Web; //Add reference to System.Web
 
 namespace TestAPI
 {
     class Program
     {
 	      static void Main(string[] args)
         {
             string apiPassword = "YourApiPassword";
             string apiKeyID = "YourApiKey";
             string okWallet = "#prefixAccount#123456789";
             string apiURL = @"https://api.weezzo.com/v2/";
             string methodName = "SendMoney";
 
             long nonce = DateTime.UtcNow.Ticks;
 
             //Incoming parameters
             Dictionary<string, string> parameters = new Dictionary<string, string>();
             parameters["walletID"] = okWallet;
             parameters["apiKeyID"] = apiKeyID;
             parameters["nonce"] = nonce.ToString();
             parameters["receiver"] = "receiver@mail.com";
             parameters["currency"] = "USD";
             parameters["amount"] = "0.02";
             parameters["isReceiverPaysFees"] = "0";
             parameters["comment"] = "An API transfer";
 
 
             //1. Sort the parameter values by their name (in alphabetical order)
             parameters = parameters.OrderBy(x => x.Key).ToDictionary(x => x.Key, y => y.Value);
             //2. Form a string from the parameter values, using ":" as a delimiter, add API password at the end of this line using the same ":" delimiter
             string data = string.Join(":", parameters.Values) + ":" + apiPassword;
             //3. Generate signature and add it to parameters
             parameters["signature"] = GetSHA256Hash(data);
 
             //4. Encode parameters and send it to the server
             string url = apiURL + methodName + "?" + string.Join("&", parameters.Select(c => HttpUtility.UrlEncode(c.Key) + "=" + HttpUtility.UrlEncode(c.Value)));
             string result = null;
             using (WebClient wc = new WebClient())
             {
                 result = wc.DownloadString(url);
             }
             Console.WriteLine(result);
             Console.ReadLine();
         }
 
         internal static string GetSHA256Hash(string input)
         {
             using (var sha256 = System.Security.Cryptography.SHA256.Create())
             {
                 var arr = System.Text.Encoding.ASCII.GetBytes(input);
                 arr = sha256.ComputeHash(arr);
                 return BitConverter.ToString(arr).Replace("-", "");
             }
         }
     }
 }
Sample in Python
import time
import collections
from hashlib import sha256
from urllib import request, parse
apiPassword = "YourApiPassword"
apiKeyID = "YourApiKey"
okWallet = "#prefixAccount#123456789"
apiURL = "https://api.weezzo.com/v2/"
methodName = "SendMoney"
#Incoming parameters
parameters = {
'walletID': okWallet,
'apiKeyID': apiKeyID,
'nonce': int(time.time()),
'receiver': "receiver@mail.com",
'currency': "USD",
'amount': "0.02",
'isReceiverPaysFees': "0",
'comment': "An API transfer"
}
#1. Sort the parameter values by their name (in alphabetical order)
parameters = collections.OrderedDict(sorted(parameters.items()))
#2. Form a string from the parameter values, using ":" as a delimiter, add API password at the end of this line using the same ":" delimiter
data = ":".join(str(value) for value in parameters.values()) + ":" + apiPassword
#3. Generate signature and add it to parameters
parameters['signature'] = sha256(data.encode('utf-8')).hexdigest()
#4. Encode parameters and send it to the server
url = apiURL + methodName + "?" + parse.urlencode(parameters)
with request.urlopen(url) as url:
data = url.read()
print(data)
Sample in NodeJS
 var https = require('https');
 var crypto = require('crypto');
 
 var apiPassword = "YourApiPassword";
 var apiKeyID = "YourApiKey";
 var okWallet = "#prefixAccount#123456789";
 var apiURL = "https://api.weezzo.com/v2/";
 var methodName = "SendMoney";
 
 //Incoming parameters
 var parameters = {
 	walletID: okWallet,
 	apiKeyID: apiKeyID,
 	nonce: Math.floor(new Date().getTime() / 1000),
 	receiver: "receiver@mail.com",
 	currency: "USD",
 	amount: "0.02",
 	isReceiverPaysFees: "0",
 	comment: "An API transfer"
 }
 
 //1. Sort the parameter values by their name (in alphabetical order)
 var parameters_sorted = {}
 var values = new Array();
 
 Object.keys(parameters)
 	.sort()
 	.forEach(function(v, i) {
 		parameters_sorted[v] = parameters[v]
 		values.push(parameters[v]);
 	});
 
 //2. Form a string from the parameter values, using ":" as a delimiter, add API password at the end of this line using the same ":" delimiter
 var data = values.join(":") + ":" + apiPassword;
 
 //3. Generate signature and add it to parameters
 parameters_sorted['signature'] = crypto.createHash('sha256').update(data).digest('hex');
 
 //4. Encode parameters and send it to the server
 var url = apiURL + methodName + "?";
 
 Object.keys(parameters_sorted).map(function(objectKey, index) {
 	url += "&" + objectKey + "=" + encodeURIComponent(parameters_sorted[objectKey]);
 });
 
 https.get(url, function(res) {
 	var body = '';
 
 	res.setEncoding('utf8')
 
 	res.on("data", function(chunk) {
 		console.log(chunk);
 	});
 
 	res.on('end', function() {
 		console.log(body);
 	});
 }).on('error', function(e) {
 	console.error(e);
 });