ref :the transaction reference zitopay_transaction_reference :the internal transaction reference on ZitopayThis section describes how to programatically validate/check a transaction status on Zitopay server, using the transaction information posted to your notification URL
https://zitopay.africa/api_v1
Input Field Name | Description | Example Value |
---|---|---|
action | The value for this key must be get_transaction |
get_transaction |
receiver | The receiver's username or email | [email protected] |
ref | Transaction reference | User:123-Product:ABC |
Optional Fields | ||
amount | If supplied, the value will be checked against the original transaction amount supplied on the payment request, and an error will be returned if the values does not match | 0.053 |
currency | If supplied, the value will be checked against the original transaction currency supplied on the payment request, and an error will be returned if the values does not match | BTC |
trade_id | Since it is possible to also specify a ref during trades, this value is important to check and ensure that a user isn't trying to use ref from a trade transaction to validate a payment transaction. In short, for a payment transaction, this value will be zero. |
0 |
https://zitopay.africa/api_v1?action=get_transaction&receiver=sample%40gmail.com&ref=User%3A123-Product%3AABC&trade_id=0
<?php $my_username='[email protected]'; //this should be replaced with your Zitopay username or email if(empty($_POST['ref']))$msg="Transaction reference not supplied."; else { $ref=$_POST['ref']; //$ext_txn_ref=$_POST['zitopay_transaction_reference']; $post_data=array( 'action'=>'get_transaction', 'receiver'=>$my_username, 'ref'=>$ref, 'trade_id'=>0, //'amount'=>'0.1', //the amount that you are expecting (this is optional) //'currency'=>'BTC', //the currency that you are expecting (this is optional) ); $api_url='https://zitopay.africa/api_v1'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $api_url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //only uncomment if you do not have SSL, not-recomended $response = curl_exec($ch); $response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if($response_code != 200)$response=curl_error($ch); curl_close($ch); if($response_code != 200)$msg="HTTP ERROR $response_code: $response"; else { $json=@json_decode($response,true); if($json===null)$msg="INVALID RESPONSE: $response"; elseif(!empty($json['error']))$msg=$json['error']; elseif($json['status_msg']!='COMPLETED')$msg="Transaction Not Completed. STATUS: ".$json['status_msg']; else { //Transaction successfully validated, further processing can proceed here $msg="Transaction Completed, amount: ".$json['amount']; } } } echo $msg; ?>
{ "username": "[email protected]", "email": "[email protected]", "ref": "User:123-Product:ABC", "trade_id": 0, "currency_code": "BTC", "amount": 0.00106, "commission_for_receiver": 0, "total_received": 0.00106, "memo": "Buying Product ABC With 2000.00 XAF", "date_time": "2018-04-12T13:17:10 BST", "status": 1, "status_msg": "COMPLETED", "probation_successful": 1, "probation_until": "2018-04-12T16:17:10 BST", "type": "TRANSFER", "payment_method": "bitcoin", "blockchain_txid": "", "original_amount": 2000, "original_currency_code": "XAF", "info": "", "meta_info":{} }
meta_info
may contain additional information, depending on the payment mode used."meta_info":{ "payment_meta_info":{ "last4"=>1234, "exp_month"=>"09" "exp_year"=>"2022", "card_type"=>"debit-Mastercard", "bank"=>"UBA Bank", "country_code"=>"CM", }, "kyc_info":{ "credit_card_last_digits":"1236", "credit_card_admin_comment":"documents verified" "id_validation_expiry":"1593801223", "card_validation_expiry":"1664492400", "card_expiry_month":"09", "card_epiry_year":"2022" } }Below is a sample response to a failed process, a JSON Object
{"error":"Transaction record not found"}
https://zitopay.africa/api_v1
Input Field Name | Description | Example Value |
---|---|---|
action | The value for this key must be get_balance |
get_balance |
Your email address on Zitopay | [email protected] | |
token | A md5 hashing of sha512 hash generated from your account's password, email, and token key in this patternmd5(sha512(password+email)+token_key)+ here means concatenation of of values, not to include the + sign |
3d51f06ca4a6454f4480113191e24e84 |
token_key | A very random string; preferrably the unix timestamp generated and used when making this request | 1502910803 |
Optional Fields | ||
currency | If supplied, the only the ballance of the supplied currency will be returned. Currency can be any of XAF, BTC | BTC |
https://zitopay.africa/api_v1?action=get_balance&email=sample%40gmail.com&token_key=1502910803&token=3d51f06ca4a6454f4480113191e24e84
<?php $account_email='[email protected]'; $account_pass='password'; $token_key=time(); $token=md5(hash('sha512',$account_pass.$account_email).$token_key); $post_data=array( 'action'=>'get_transaction', 'email'=>$account_email, 'token_key'=>$token_key, 'token'=>$token, ); $api_url='https://zitopay.africa/api_v1'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $api_url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //only uncomment if you do not have SSL, not-recomended $response = curl_exec($ch); $response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if($response_code != 200)$response=curl_error($ch); curl_close($ch); if($response_code != 200)$msg="HTTP ERROR $response_code: $response"; else { $json=@json_decode($response,true); if($json===null)$msg="INVALID RESPONSE: $response"; elseif(!empty($json['error']))$msg=$json['error']; else { //Balance for each currency is now available under corresponding currency code $msg="Bitcoin balance: ".$json['BTC']; } } echo $msg; ?>
{"XAF":0,"BTC":0}Below is a sample response to a failed process, a JSON Object
{"error":"Invalid token"}
https://zitopay.africa/api_v1
Input Field Name | Description | Example Value |
---|---|---|
action | The value for this key must be release_escrow |
release_escrow |
Your email address on Zitopay | [email protected] | |
token | A md5 hashing of sha512 hash generated from your account's password, email, and token key in this patternmd5(sha512(password+email)+token_key)+ here means concatenation of of values, not to include the + sign |
3d51f06ca4a6454f4480113191e24e84 |
token_key | A very random string; preferrably the unix timestamp generated and used when making this request | 1502910803 |
ref | The transaction reference | 15349519661068 |
https://zitopay.africa/api_v1?action=release_escrow&email=sample%40gmail.com&token_key=1502910803&token=3d51f06ca4a6454f4480113191e24e84&ref=15349519661068
<?php $account_email='[email protected]'; $account_pass='password'; $token_key=time(); $token=md5(hash('sha512',$account_pass.$account_email).$token_key); $post_data=array( 'action'=>'get_transaction', 'email'=>$account_email, 'token_key'=>$token_key, 'token'=>$token, 'ref'=>'15349519661068' ); $api_url='https://zitopay.africa/api_v1'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $api_url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //only uncomment if you do not have SSL, not-recomended $response = curl_exec($ch); $response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if($response_code != 200)$response=curl_error($ch); curl_close($ch); if($response_code != 200)$msg="HTTP ERROR $response_code: $response"; else { $json=@json_decode($response,true); if($json===null)$msg="INVALID RESPONSE: $response"; elseif(!empty($json['error']))$msg=$json['error']; elseif(!empty($json['success'])) { //Escrow succesfully released $msg=$json['success']['msg']; } } echo $msg; ?>
{"XAF":0,"BTC":0}Below is a sample response to a failed process, a JSON Object
{"error":"Invalid token"}
https://zitopay.africa/transaction?receipt={receiver_username}::{receiver_ref}
https://zitopay.africa/api_v1
in order to intiate a fund-transfer transactionInput Field Name | Description | Example Value |
---|---|---|
action | The value for this key must be transfer |
transfer |
proceed | The value for this key should be confirm . If otherwise, the transaction will not actually be commited, you will only see the preview information and be sure that this transaction would have gone through successfully |
confirm |
Your email address on Zitopay | [email protected] | |
token | A md5 hashing of sha512 hash generated from your account's password, email, and token key in this patternmd5(sha512(password+email)+token_key)+ here means concatenation of of values, not to include the + sign |
3d51f06ca4a6454f4480113191e24e84 |
transaction_pin_hash | A md5 hashing of md5 hash generated from your account's transaction pin, email, and token key in this patternmd5(md5(transaction_pin+email)+token_key)+ here means concatenation of of values, not to include the + sign |
42edb714dd02540466591fe6edf154fd |
token_key | A very random string; preferrably the unix timestamp generated and used when making this request | 1502910803 |
payment_currency | The wallet to transfer this fund from; as long as you have sufficient balance in that wallet. Presently the value can be any of XAF, BTC | BTC |
amount | The numerical amount to be transferred, depending on the specified wallet's currency | 1000 |
recipient | This can either be the registered email or username of the receiver at Zitopay CAUTION: Double-check to make sure to avoid transferring into a wrong account |
[email protected] |
Optional Fields | ||
escrow | 0 and 1 are the values that are allowed here; If you supply '1', then the fund will not be released to the receiver until you approve. Supplying '0' has no effect, it's the default, and means that the fund should be released immediately |
0 |
receiver_bear_charges | 0 and 1 are the values that are allowed here; If you supply '1', then the transfer fee will be deducted from the amount that you supplied. |
0 |
auto_approval_date | A valid date (such as 2017-04-01 14:30) UIf supplied, the fund will only be realeased to the receiver on or after the date. | 0 |
ref | Your custom transaction reference | Invoice:123-Product:ABC |
https://zitopay.africa/api_v1?action=transfer&proceed=confirm&payment_currency=USD&recipient=b%40c.com&amount=1000&escrow=0&ref=User%3A123-Product%3AABC&email=sample%40gmail.com&token_key=1502910803&token=3d51f06ca4a6454f4480113191e24e84&transaction_pin_hash=42edb714dd02540466591fe6edf154fd
<?php $recipient_email=$_POST['recipient']; $account_email='[email protected]'; $account_pass='password'; $transaction_pin='123456'; $token_key=time(); $token=md5(hash('sha512',$account_pass.$account_email).$token_key); $transaction_pin_hash=md5(md5($transaction_pin.$account_email).$token_key); $post_data=array( 'action'=>'transfer', 'proceed'=>'confirm', 'payment_currency'=>'USD', 'recipient'=>$recipient_email, 'amount'=>'1000', 'escrow'=>0, 'ref'=>$ref, 'email'=>$account_email, 'token_key'=>$token_key, 'token'=>$token, 'transaction_pin_hash'=>$transaction_pin_hash, ); $api_url='https://zitopay.africa/api_v1'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $api_url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //only uncomment if you do not have SSL, not-recomended $response = curl_exec($ch); $response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if($response_code != 200)$response=curl_error($ch); curl_close($ch); if($response_code != 200)$msg="HTTP ERROR $response_code: $response"; else { $json=@json_decode($response,true); if($json===null)$msg="INVALID RESPONSE: $response"; elseif(!empty($json['error']))$msg=$json['error']; else { //Transaction successfully processed, further processing can proceed here $msg=$json['success']; $temp=print_r($json['transaction'],true); } } echo $msg; ?>
{"success":"Transaction Successful Reference: 1492486939","transaction":{"transaction_id":"24","date_time":"2017-04-18 04:42:19","user_id":"1","related":"0","amount":"0.1","site_charges":"5.01","type":"2","currency_code":"BTC","original_currency_code":"BTC","status":"1","payment_method":"transfer","transaction_reference":"1492486939","batch_used":"","details":"Transferring 0.1 BTC","json_details":{"percentage_commission":0.5,"fixed_commission":5,"percentage_commission_amount":0.0005,"preview_info":{"Sender's Details":{"Sender's Name":"firstname lastname","Sender's Email":"[email protected]","Sender's Phone":"+2348000000000","Sender's Country":"Nigeria"},"Receiver's Details":{"Name":"firstname lastname","Country":"Nigeria","Escrow Transaction":"NO"},"Summary":{"Amount":"0.1 BTC","Fixed Charges":"5 BTC","Transfer Commission":"0.0005 BTC (0.5 %)","Total Amount":"5.11 BTC"}}},"json_info":null,"time":"1492486939","escrow_status":"0","related_user_id":"2","ref":"","to_amount":"0.1","to_currency_code":"BTC","firstname":"firstname","lastname":"lastname","email":"[email protected]","phone":"+3311111111"}}Below is a sample response to a failed process, a JSON Object
{"error":"Invalid account credentials"}
https://zitopay.africa/api_v1
in order to intiate a fund withdrawal transactionInput Field Name | Description | Example Value |
---|---|---|
action | The value for this key must be withdraw |
withdraw |
proceed | The value for this key should be confirm . If otherwise, the transaction will not actually be commited, you will only see the preview information and be sure that this transaction would have gone through successfully |
confirm |
Your email address on Zitopay | [email protected] | |
token | A md5 hashing of sha512 hash generated from your account's password, email, and token key in this patternmd5(sha512(password+email)+token_key)+ here means concatenation of of values, not to include the + sign |
3d51f06ca4a6454f4480113191e24e84 |
transaction_pin_hash | A md5 hashing of md5 hash generated from your account's transaction pin, email, and token key in this patternmd5(md5(transaction_pin+email)+token_key)+ here means concatenation of of values, not to include the + sign |
42edb714dd02540466591fe6edf154fd |
token_key | A very random string; preferrably the unix timestamp generated and used when making this request | 1502910803 |
payment_currency | The wallet to transfer this fund from; as long as you have sufficient balance in that wallet. Presently the value can be any of XAF, BTC | BTC |
amount | The numerical amount to be transferred, depending on the specified wallet's currency | 1000 |
Optional Fields
Your specified payment currency will determine if you should supply 'destination_account' or bank details. If you are withdrawing e-currencies, you will need to rather supply 'destination_account'
|
||
destination_account | e.g If the payment_currency is BTC, the destination_account should be the bitcoin address | 1PyTX2UzWuxNu3dywPdrJa1SE2dTcUKfqf |
ref | Your custom transaction reference | Invoice:123-Product:ABC |
notification_url | When a transaction has been succesfuly completed, the transaction reference (under an HTTP POST key 'ref') will be posted to this url | http://example.com/payment/withdrawal_completed_notification |
https://zitopay.africa/api_v1?action=withdraw&proceed=confirm&payment_currency=BTC&email=sample%40gmail.com&token_key=1502910803&token=3d51f06ca4a6454f4480113191e24e84&transaction_pin_hash=42edb714dd02540466591fe6edf154fd&amount=1000&destination_account=1PyTX2UzWuxNu3dywPdrJa1SE2dTcUKfqf&ref=User%3A123-Product%3AABC
<?php $account_email='[email protected]'; $account_pass='password'; $transaction_pin='123456'; $token_key=time(); $token=md5(hash('sha512',$account_pass.$account_email).$token_key); $transaction_pin_hash=md5(md5($transaction_pin.$account_email).$token_key); $post_data=array( 'action'=>'withdraw', 'proceed'=>'confirm', 'payment_currency'=>'USD', 'email'=>$account_email, 'token_key'=>$token_key, 'token'=>$token, 'transaction_pin_hash'=>$transaction_pin_hash, 'amount'=>'1000', 'destination_account'=>'1PyTX2UzWuxNu3dywPdrJa1SE2dTcUKfqf', 'ref'=>$ref, ); $api_url='https://zitopay.africa/api_v1'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $api_url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //only uncomment if you do not have SSL, not-recomended $response = curl_exec($ch); $response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if($response_code != 200)$response=curl_error($ch); curl_close($ch); if($response_code != 200)$msg="HTTP ERROR $response_code: $response"; else { $json=@json_decode($response,true); if($json===null)$msg="INVALID RESPONSE: $response"; elseif(!empty($json['error']))$msg=$json['error']; else { //Transaction successfully processed, further processing can proceed here $msg=$json['success']; $temp=print_r($json['transaction'],true); } } echo $msg; ?>