PHP code example of muzik / esafe-php-sdk

1. Go to this page and download the library: Download muzik/esafe-php-sdk 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 / esafe-php-sdk example snippets




use Muzik\EsafeSdk\Esafe;
 
$sdk = new Esafe([
    // string of password when transaction, it should be set in esafe.com.tw
    // IMPORTANT: The value is **NOT** login password for esafe.com.tw!
    'transaction_password' => 'abcd5888',
]);

$sdk->handle(Esafe::HANDLER_CREDIT_CARD, \GuzzleHttp\Psr7\ServerRequest::fromGlobals());
// The following method is also allowed: 
// $sdk->handle(Esafe::HANDLER_CREDIT_CARD, $_POST);



use Muzik\EsafeSdk\Esafe;

$sdk = new Esafe([
    // string of password when transaction, it should be set in esafe.com.tw
    // IMPORTANT: The value is **NOT** login password for esafe.com.tw!
    'transaction_password' => 'abcd5888',
]);

$sdk->check([
    // 商家代號
    'web' => 'S1103020010',
    // 交易金額
    'MN' => '110',
    // 紅陽交易編號
    'buysafeno' => '2400009912300000019',
    // 商家訂單編號
    'Td' => 'AC9087201',
    // 備註
    'note1' => '',
    'note2' => '',
], $isTesting = false);



use Muzik\EsafeSdk\Esafe;

$sdk = new Esafe([
    // string of password when transaction, it should be set in esafe.com.tw
    // IMPORTANT: The value is **NOT** login password for esafe.com.tw!
    'transaction_password' => 'abcd5888',
]);

$sdk->refund([
    // 商家代號
    'web' => 'S1103020010',
    // 交易金額
    'MN' => '1000',
    // 紅陽交易編號
    'buysafeno' => '2400009912300000019',
    // 訂單編號(通常由商家自行生成)
    'Td' => 'AC9087201',
    // 退款原因
    'RefundMemo' => 'Hello World',
], $isTesting = false);
base
composer