1. Go to this page and download the library: Download crushjs/aba-payway 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/ */
crushjs / aba-payway example snippets
$response = PayWay::checkTransaction('INV-1001');
$response->successful(); // PayWay status code "00" or "0"
$response->message(); // PayWay's status message
$response->paymentStatus(); // APPROVED | PENDING | DECLINED | REFUNDED | CANCELLED ...
$response->isPaid(); // successful() && APPROVED
$response->get('data.total_amount'); // read a value with dot notation
$response->toArray();
PayWay::checkTransaction('INV-1001'); // payment status
PayWay::isPaid('INV-1001'); // bool
PayWay::transactionDetail('INV-1001'); // full details and operation history
PayWay::closeTransaction('INV-1001'); // stop an unpaid transaction from being paid
PayWay::exchangeRate();
PayWay::transactionList([
'from_date' => now()->subDays(2), // DateTimeInterface or 'Y-m-d H:i:s'; max range 3 days
'to_date' => now(),
'status' => ['APPROVED', 'REFUNDED'],
'from_amount' => 1, 'to_amount' => 100,
'page' => 1, 'pagination' => 40, // max 1000 per page
]);
PayWay::transactionsByMerchantRef('ref00001'); // not available on the sandbox
PayWay::refund('INV-1001', 5.00); // full or partial refund
// Start a pre-auth with checkoutForm([... 'type' => 'pre-auth']), then:
PayWay::completePreAuth('INV-1002', 20.00);
PayWay::completePreAuth('INV-1002', 20.00, payout: [['acc' => '000133879', 'amt' => 20]]);
PayWay::cancelPreAuth('INV-1002');
PayWay::addBeneficiary('318111358120004'); // ABA account or MID
PayWay::updateBeneficiaryStatus('318111358120004', false); // disable
PayWay::payout('PO-0001', [
['account' => '200030000', 'amount' => 1.72],
['account' => '012538302', 'amount' => 1.72],
], currency: 'USD', customFields: ['invoice' => 'INV-9']); // amount defaults to the sum
// Link an ABA account: returns a deeplink and a QR string.
PayWay::linkAccount([
'ctid' => 'customer00042', // your customer id, 5-24 letters/numbers
'request_id' => 'link00001', // 5-24 letters/numbers, unique
'token_flag' => 'CITI_FLEX', // CITI_FLEX | CITO_FLEX
'currency' => 'USD',
'callback_url' => route('payway.token'),
'return_deeplink' => ['ios_scheme' => 'myapp://linked', 'android_scheme' => 'myapp://linked'],
]);
// Link a card: PayWay hosts the card form.
$url = PayWay::linkCard([...]); // URL of the hosted form, for an iframe or redirect
$form = PayWay::linkCardForm([...]); // or a form that posts into <iframe name="aba_link_card">
// Charge a saved token (pwt) that PayWay sent to your callback_url.
PayWay::payWithToken([
'tran_id' => 'INV-2001', 'amount' => 3.5, 'currency' => 'USD',
'ctid' => 'customer00042', 'pwt' => $token,
'token_flag' => 'CITU_FLEX', // CITU_FLEX | MITU_FLEX | MITR_FIX
]);
PayWay::tokenDetails('link00001');
PayWay::renewToken('customer00042', $token, 'renew00001');
PayWay::removeToken('customer00042', $token);