PHP code example of xup6m6fu04 / newebpay-sdk-php
1. Go to this page and download the library: Download xup6m6fu04/newebpay-sdk-php library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xup6m6fu04 / newebpay-sdk-php example snippets
use Xup6m6fu04\NewebPay\NewebPay;
/**
* 送出交易範例
*/
// 載入設定檔陣列,內容說明請參考 https://github.com/xup6m6fu04/newebpay-example/blob/master/src/Config/Config.php
$config = [...];
$newebpay = new NewebPay($config);
// 設定訂單內容
$newebpay = $newebpay->payment(
$_POST['MerchantOrderNo'], // 訂單編號
$_POST['Amt'], // 訂單金額
$_POST['ItemDesc'], // 商品名稱
$_POST['Email'] // 付款人電子信箱
);
// 要更改設定用 ->set + 屬性名稱 (ex: setReturnURL)
$newebpay->setReturnURL(....); // 設定交易完成後的返回網址
// 送出表單
echo $newebpay->submit();