Exemple #1
0
 function request($info)
 {
     $httpObj = new http_class();
     $nhHttp = new nhhttp($httpObj);
     $partnerId = 10;
     //Điền partnerID đc cung cấp
     $key = 'x@l0-th1nkn3t';
     // Điền key của Partner đc cung cấp
     //print_r($_REQUEST);
     $paymentMethodList = split("\\.", trim($_REQUEST['m']));
     //print_r($paymentMethodList);
     $paymentMethod = trim($paymentMethodList[0]);
     $postValue = array();
     $postValue['o'] = "requestTransaction";
     $postValue['itemid'] = $info['product_id'];
     $postValue['itemdesc'] = urlencode($info['name']);
     $postValue['price'] = $info['price'];
     $postValue['method'] = 'Mua_ngay';
     $postValue['partnerId'] = $partnerId;
     $signal = $this->encodeSignal($postValue['itemid'] . $postValue['itemdesc'] . $postValue['price'] . $postValue['method'] . '|' . $key);
     $postValue['signal'] = $signal;
     $postValue['param'] = "";
     $return = $nhHttp->post("http://payment.xalo.vn/api", $postValue);
     $result = explode("|", $return[0]);
     return $result;
 }
Exemple #2
0
<?php

/**
 * Bắt đầu quá trình bằng việc đặt link để người dùng click thanh toán dạng:
 * 	<a href="payment.php?genUrl=1">THANH TOÁN</a>
 * 
 */
session_start();
ini_set('display_errors', "On");
error_reporting(0);
include "http.php";
include "nhhttp.php";
$httpObj = new http_class();
$nhHttp = new nhhttp($httpObj);
$partnerId = 10;
//Điền partnerID đc cung cấp
$key = 'x@l0-th1nkn3t';
// Điền key của Partner đc cung cấp
//print_r($_REQUEST);
$paymentMethodList = split("\\.", trim($_REQUEST['m']));
//print_r($paymentMethodList);
$paymentMethod = trim($paymentMethodList[0]);
$postValue = array();
$postValue['o'] = "requestTransaction";
$postValue['itemid'] = 'MC15000';
$postValue['itemdesc'] = 'NAP';
$postValue['price'] = 1000;
//$postValue['method'] = 'Mua_ngay';
$postValue['partnerId'] = $partnerId;
$signal = encodeSignal($postValue['itemid'] . $postValue['itemdesc'] . $postValue['price'] . $postValue['method'] . '|' . $key);
$postValue['signal'] = $signal;