-
Notifications
You must be signed in to change notification settings - Fork 0
/
payEcpay.php
46 lines (42 loc) · 1.12 KB
/
payEcpay.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
require('ECPay.Payment.Integration.php');
try {
// 收到綠界科技的付款結果訊息,並判斷檢查碼是否相符
$AL = new ECPay_AllInOne();
$AL->MerchantID = '';
$AL->HashKey = '';
$AL->HashIV = '';
// $AL->EncryptType = ECPay_EncryptType::ENC_MD5; // MD5
$AL->EncryptType = ECPay_EncryptType::ENC_SHA256; // SHA256
$feedback = $AL->CheckOutFeedback();
// 以付款結果訊息進行相對應的處理
/*
回傳的綠界科技的付款結果訊息如下:
Array
(
[MerchantID] =>
[MerchantTradeNo] =>
[StoreID] =>
[RtnCode] =>
[RtnMsg] =>
[TradeNo] =>
[TradeAmt] =>
[PaymentDate] =>
[PaymentType] =>
[PaymentTypeChargeFee] =>
[TradeDate] =>
[SimulatePaid] =>
[CustomField1] =>
[CustomField2] =>
[CustomField3] =>
[CustomField4] =>
[CheckMacValue] =>
)
再個別寫入資料庫更新即可
*/
// 在網頁端回應 1|OK
echo '1|OK';
} catch (Exception $e) {
echo '0|' . $e->getMessage();
}
?>