composer install txnpay
After installing, initialize by importing the package and using the public and secret keys.
use txnpay\TraxionPay;
$traxionpay = new TraxionPay($yourApiKey, $yourSecretKey);
# Sample arguments are the bare minimum for cash_in
$response = $traxionpay->cashIn([
'merchant_id' => 6328,
'merchant_ref_no' => 'ABC123DEF456',
'merchant_additional_data' => (object)array("payment_code" => "ABC123DEF456"),
'description' => 'My test payment',
'amount' => 1500.0,
'status_notification_url' => 'https://devapi.traxionpay.com/callback',
'success_page_url' => 'https://dev.traxionpay.com',
'failure_page_url' => 'https://dev.traxionpay.com',
'cancel_page_url' => 'https://dev.traxionpay.com',
'pending_page_url' => 'https://dev.traxionpay.com',
'billing_details' => array(
'billing_email' => '[email protected]'
)
]);
$otp = $traxionpay->fetchOTP();
$response = $traxionpay->cashOut([
'OTP' => $otp->code,
'amount' => 100.0,
'bank_account' => 413
]);
$response = $traxionpay->linkBankAccount([
'bank' => '6311',
'bank_type' => 'savings',
'account_number' => '9012345678',
'account_name' => 'John Doe'
]);
$otp = $traxionpay->fetchOTP();
$bankAccounts = $traxionpay->fetchBankAccounts();
$banks = $traxionpay->fetchBanks();