composer require kurorido/pilluu-php-sdk
$testing = true; // 設定環境
$cashier = new PilluCashier('商戶編號', 'Public Key' , 'SHA2 Key', $testing);
$order = (new PilluOrder)
->setTradeId('商戶訂單號')
->setAmount('888')
->setMemo('測試商品');
$autoSubmit = false; // 是否使用 JavaScript 自動送出?
$cashier->doCheckout($order, $autoSubmit);
目前只檢查 content 與 merchantid 是否符合,如有需要請自行繼承覆寫 check
$callback = new PilluCallback('商戶編號', 'Public Key' , 'SHA2 Key');
$response = $callback->check($payload);
if ($response->body->result === 'success') {
// 付款成功,官方建議再發 Double Check
}
訂單查詢的時間點必須為交易時間的 120 秒以內,否則會被認定為無效參數
$testing = true; // 設定環境
$checker = new PilluCheckOrder('商戶編號', 'Public Key' , 'SHA2 Key', $testing);
$response = $checker->doCheck('交易發起時間', '交易金額', '商戶訂單號 tradeid');
if ($response->result === '111') {
// 付款成功
}