金流串

智付寶 Pay2go

看官方文件最快

官方MPG API文件

如果實在不行再參考這個吧

$time=time();

//金額 自己改
$amt='10'; // 10 塊

//訂單標號 自己改
$No="CD".$time;

$mer_array = array(
 'MerchantID' => '自己補上',
 'TimeStamp' => $time,
 'MerchantOrderNo'=> $No,
 'Version' => '1.2',
 'Amt' => $amt,
);
ksort($mer_array);
$check_merstr = http_build_query($mer_array);
$CheckValue_str ="HashKey=自己補上&$check_merstr&HashIV=自己補上";
$CheckValue = strtoupper(hash("sha256", $CheckValue_str));

// 測試環境僅接受以下的測試卡號。
// 4000-2222-2222-2222(一次付清與分期付款)
// 4000-1322-2222-2222(一次付清與分期付款)
// 4003-5522-2222-2222(紅利折抵)
<!--這是正式的網址-->
<form name='Pay2go' method='post' action='https://api.pay2go.com/MPG/mpg_gateway' >
<input type='hidden' name='MerchantID' value='自己補上'>
<input type='hidden' name='RespondType' value='JSON'>
<input type='hidden' name='CheckValue' value='<?=$CheckValue?>'>
<input type='hidden' name='TimeStamp' value='<?=$time;?>'>
<input type='hidden' name='Version' value='1.2'>
<input type='hidden' name='MerchantOrderNo' value='<?=$No?>'>
<input type='hidden' name='Amt' value='<?=$amt?>'>
<input type='hidden' name='ItemDesc' value='服務'>
<input type='hidden' name='Email' value='<?=$orderrow['fs_email']?>'>
<input type='hidden' name='ClientBackURL' value='自己補上'> // 失敗時
<input type='hidden' name='ReturnURL' value='自己補上'> // 成功時 // 可以自帶參數
<input type='hidden' name='LoginType' value='0'>
<input type="submit" value="線上支付" class="btn btn-primary" tabindex="7">
</form>

ReturnURL

  $json=$_POST["JSONData"];
  $enjson=JSON_DECODE($json);//接收回傳資料

  // console_log($enjson);  // 可以用 js 偷看一下
  // echo '<pre>',$enjson,'</pre>'; // 或 PHP

  $rejson=JSON_DECODE($enjson->Result);//接收回傳資料
  if($enjson->Status=="SUCCESS"){
    // ...
  }

ClientBackURL - 錯誤碼


var error={
"MPG10001":"商店代號空白,","MPG10002":"串接程式版本參數值有誤,","MPG10003":"回傳格式參數值錯誤,","MPG10005":"TimeStamp 錯誤,","MPG10006":"CheckValue [ 檢查碼 ]空白,","MPG10007":"查無商店資料,","MPG10008":"CheckValue [ 檢查碼 ]驗證失敗,","MPG10009":"商店訂單編號空白,","MPG10010":"商店訂單編號格式錯誤 限英數字、底線,長度 20 字,","MPG10012":"商店訂單金額空白,","MPG10013":"金額填入非數字資訊,","MPG10014":"訂單金額超過 9999999999,","MPG10015":"商品資訊空白,","MPG10016":"繳費期限日期格式錯誤,","MPG10017":"商店狀態關閉或暫停,無法交易,","MPG10018":"商店 Form Post 資料加密失敗,","MPG10019":"登入智付寶會員參數空白,","MPG10020":"回傳參數資料不存在,","MPG10021":"回傳參數資料解密失敗,","MPG10022":"查無商店金流設定資料,","MPG10024":"付款人電子信箱格式錯誤,","MPG10028":"信用卡卡號格式錯誤,","MPG10029":"未輸入信用卡有效期,","MPG10030":"未輸入信用卡背面末三碼,","MPG10031":"服務未啟用,","MPG10033":"信用卡未選擇一次刷卡或是分期交易,","MPG10034":"信用卡支付未選擇分期期數,","MPG10035":"信用卡支付分期交易旗標空白或參數格式錯誤,","MPG10036":"URL 非為 http 或 https 開頭,","MPG10037":"URL 格式錯誤,","MPG10038":"禁止使用 localhost 或是 127.0.0.1 的網址格式,","MPG20001":"驗證資料不存在,","MPG20002":"驗證資料空白-商店代號,","MPG20003":"驗證資料空白-訂單金額,","MPG20004":"驗證資料空白-商店自訂訂單編號,","MPG20005":"頁面停留超過 30 分鐘,","MPG20006":"未選擇金融機構別,","MPG20007":"未選擇支付方式,","MPG20009":"未選擇超商別,","TRA10003":"總數量格式錯誤,","TRA10043":"信用卡到期日格式錯誤"
}

results matching ""

    No results matching ""