PHP code example of yuansfertest / yuansfer-php-test-sdk
1. Go to this page and download the library: Download yuansfertest/yuansfer-php-test-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/ */
yuansfertest / yuansfer-php-test-sdk example snippets
use Yuansfer\Yuansfer;
$config = array(
Yuansfer::MERCHANT_NO => 'The merchant NO.',
Yuansfer::STORE_NO => 'The store NO.',
Yuansfer::API_TOKEN => 'Yuansfer API token',
Yuansfer::TEST_API_TOKEN => 'Yuansfer API token for test mode',
);
$yuansfer = new Yuansfer($config);
$api = $yuansfer->createSecurePay();
$api
->setAmount(9.9) //The amount of the transaction.
->setCurrency('USD') // The currency, USD, CAD supported yet.
->setVendor('alipay') // The payment channel, alipay, wechatpay, unionpay, enterprisepay are supported yet.
->setReference('44444') //The unque ID of client's system.
->setIpnUrl('http://domain/example/callback_secure_pay_ipn.php') // The asynchronous callback method.
->setCallbackUrl('http://domain/example/callback_secure_pay.php'); // The Synchronous callback method.