public function query($array)
 {
     $array['nonce'] = intval(time());
     $params = $this->params($array);
     $header = array("X-CASH2VN-KEY: " . $this->apiKey, "X-CASH2VN-PARAMS: " . $params, "X-CASH2VN-SIGNATURE: " . $this->signature($params));
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $this->url);
     curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
     curl_setopt($curl, CURLOPT_POST, 1);
     curl_setopt($curl, CURLOPT_POSTFIELDS, $array);
     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     $res = curl_exec($curl);
     $res = iconv("UTF-8", "UTF-8//IGNORE", $res);
     $res = cash2vnClient::removeUtf8Bom($res);
     $res = json_decode($res, TRUE);
     $res['error'] ? $this->error = $res['error'] : null;
     return $res;
 }
Example #2
0
<?php

include 'cash2vnClient.php';
$apiKey = '[[ YOUR API KEY ]]';
$apiSecret = '[[ YOUR API SECRET ]]';
$apiUrl = 'https://www.cash2vn.com/api/v1';
$cash2vn = new cash2vnClient($apiKey, $apiSecret, $apiUrl);
$recipient = array('name' => 'Test Client 3000', 'email' => '*****@*****.**');
$delivery = array('option' => '0', 'HOLDER_OF_ACC' => 'Test Holder', 'BANK_NAME' => 'Bla bla Bank', 'BANK_BRANCH' => 'HCMC', 'ACC_NUMBER' => '12345');
$rsp = $cash2vn->submit(500000, $recipient, $delivery);
?>

<pre><?php 
echo print_r($rsp);
?>
</pre>