1. Go to this page and download the library: Download taqin/jayapay-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/ */
taqin / jayapay-sdk example snippets
aqin\Jayapay\JayaPay;
// Initialize SDK
$jayapay = new JayaPay(
'YOUR_MERCHANT_CODE',
'YOUR_PRIVATE_KEY', // PKCS8 format
'PLATFORM_PUBLIC_KEY',
false, // false for production, true for sandbox
30 // timeout in seconds
);
// Create a fiat collection order
$orderParams = [
'orderNum' => 'ORDER123456',
'payMoney' => '10000',
'productDetail' => 'Test Payment',
'notifyUrl' => 'https://your-domain.com/notify',
'expiryPeriod' => '1440',
'name' => 'John Doe',
'email' => '[email protected]',
'phone' => '081234567890'
];
try {
$response = $jayapay->createFiatCollectionOrder($orderParams);
echo "Order created successfully: " . $response['platOrderNum'];
} catch (Exception $e) {
echo "Error: " . $e->getMessage();
}
$jayapay = new JayaPay($merchantCode, $privateKey, $publicKey, $sandbox, $timeout);
// Create order
$response = $jayapay->fiatCollection()->createOrder($params);
// Get supported payment methods
$methods = $jayapay->fiatCollection()->getSupportedMethods();
// Create order
$response = $jayapay->digitalCollection()->createOrder($params);
// Get supported currencies
$currencies = $jayapay->digitalCollection()->getSupportedMethods();
// Get supported networks
$networks = $jayapay->digitalCollection()->getSupportedNetworks();
// Create payment
$response = $jayapay->fiatPayment()->createPayment($params);
// Get supported bank codes
$banks = $jayapay->fiatPayment()->getSupportedBankCodes();
// Query by order number
$response = $jayapay->queryOrder('ORDER123456', 'ORDER_QUERY');
// Query collection order
$response = $jayapay->orderQuery()->queryCollectionOrder(['orderNum' => 'ORDER123456']);
// Query payment order
$response = $jayapay->orderQuery()->queryPaymentOrder(['orderNum' => 'PAY123456']);
// Verify account
$response = $jayapay->accountVerification()->verifyByBankCode('014', '1234567890');
// Check if verification is supported
$supported = $jayapay->accountVerification()->isVerificationSupported('014');
// Get all balances
$balances = $jayapay->getBalance();
// Get specific currency balance
$idrBalance = $jayapay->getBalance('IDR');
// Parse balance data
$parsed = $jayapay->balanceInquiry()->parseBalanceData($balances);