1. Go to this page and download the library: Download muzik/omnipay-esafe 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/ */
muzik / omnipay-esafe example snippets
use Omnipay\Omnipay;
use Muzik\OmnipayEsafe\EsafeGatewayFactory;
use Muzik\OmnipayEsafe\CreditCardGateway;
Omnipay::setFactory(new EsafeGatewayFactory());
$gateway = Omnipay::create(CreditCardGateway::class);
// When using testing endpoint for refunding, please use `$gateway->setTestMode(true)`
$gateway->setTestMode(true);
$gateway->setApiKey('abcd5888');
// The following two methods also can setting transaction password(API KEY)
// $gateway->initialize(['api_key' => 'abcd5888']);
// $gateway->initialize(['transaction_password' => 'abcd5888']);
$response = $gateway->completePurchase([
// POST from esafe.com.tw webhook
])->send();
if ($response->isSuccessful()) {
// 付款成功
var_dump($response->getData()); // 取得紅陽的回傳資料
} else {
// 付款失敗
var_dump($response);
}