Forked from ycs77/laravel-newebpay
This document provides a brief overview. For a complete usage guide and detailed examples, please refer to:
https://github.com/xup6m6fu04/newebpay-example
Adjusted Items
- Not restricted for use within Laravel
- Updated to support the latest version of NewebPay
- Comes with a detailed explanation that's easy to understand
Official NewebPay Documentation: https://www.newebpay.com/website/Page/content/download_api
Currently supports NewebPay API version: 2.0
Document version: NDNF-1.0.6
Currently supported features
- MPG Transaction
- Credit Card Billing
- Credit Card Authorization Cancellation
- Credit Card Refund
- Credit Card Billing Cancellation
- Credit Card Refund Cancellation
Requires at least PHP 7.2.5 or above, also supports PHP 8 and above
$ composer require xup6m6fu04/newebpay-sdk-php
<?php
use Xup6m6fu04\NewebPay\NewebPay;
/**
* Transaction submission example
*/
// Load the configuration array. For more information, please refer to: https://github.com/xup6m6fu04/newebpay-example/blob/master/src/Config/Config.php
$config = [...];
$newebpay = new NewebPay($config);
// Set the order details
$newebpay = $newebpay->payment(
$_POST['MerchantOrderNo'], // Order Number
$_POST['Amt'], // Order Amount
$_POST['ItemDesc'], // Product Name
$_POST['Email'] // Payer's Email
);
// To change the settings, use ->set + property name (ex: setReturnURL)
$newebpay->setReturnURL(....); // Set the return URL after the transaction is completed
// Submit the form
echo $newebpay->submit();
This project respects semantic versioning.