taqin/jayapay-sdk

Professional PHP SDK for JayaPay payment gateway integration supporting fiat and digital currencies

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

pkg:composer/taqin/jayapay-sdk

v1.0.0 2025-09-08 09:21 UTC

This package is auto-updated.

Last update: 2025-10-08 09:33:34 UTC


README

A professional, semantic PHP SDK for integrating with the JayaPay payment gateway. This SDK provides comprehensive support for fiat and digital currency collections, payments, order queries, account verification, and webhook handling.

Features

  • Fiat Currency Collections - Support for Indonesian banks and e-wallets
  • Digital Currency Collections - USDT, BTC, ETH, TRX with multiple networks
  • Fiat Currency Payments - Payout to bank accounts
  • Digital Currency Payments - Send cryptocurrency to addresses
  • Order Queries - Check status of collection and payment orders
  • Account Verification - Verify bank account details
  • Balance Inquiry - Check available balances
  • Webhook Handling - Secure notification processing with signature verification
  • RSA Signature Support - Built-in signature generation and verification
  • Professional Code Structure - PSR-4 compliant with semantic naming
  • Comprehensive Error Handling - Custom exceptions for different error types
  • Sandbox Support - Test environment support

Installation

composer require taqin/jayapay-sdk

Quick Start

<?php

require_once 'vendor/autoload.php';

use Taqin\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' => 'john@example.com',
    'phone' => '081234567890'
];

try {
    $response = $jayapay->createFiatCollectionOrder($orderParams);
    echo "Order created successfully: " . $response['platOrderNum'];
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}

API Reference

Initialization

$jayapay = new JayaPay($merchantCode, $privateKey, $publicKey, $sandbox, $timeout);

Fiat Currency Collection

// Create order
$response = $jayapay->fiatCollection()->createOrder($params);

// Get supported payment methods
$methods = $jayapay->fiatCollection()->getSupportedMethods();

Required Parameters:

  • orderNum - Merchant order number
  • payMoney - Payment amount (integer, no decimals)
  • productDetail - Payment description
  • notifyUrl - Notification URL
  • expiryPeriod - Expiry time in minutes
  • name - Customer name
  • email - Customer email
  • phone - Customer phone

Optional Parameters:

  • method - Payment method (BCA, MANDIRI, etc.)

Digital Currency Collection

// Create order
$response = $jayapay->digitalCollection()->createOrder($params);

// Get supported currencies
$currencies = $jayapay->digitalCollection()->getSupportedMethods();

// Get supported networks
$networks = $jayapay->digitalCollection()->getSupportedNetworks();

Required Parameters:

  • mchUserId - Merchant user ID
  • payMoney - Payment amount (supports decimals up to 6 places)
  • notifyUrl - Notification URL
  • expiryPeriod - Expiry time in minutes
  • name - Customer name
  • email - Customer email
  • phone - Customer phone

For ordered mode (v1.0, v3.0):

  • orderNum - Merchant order number

For digital currencies:

  • method - Currency type (USDT, BTC, ETH, TRX)
  • currency - Currency code
  • netWork - Network (TRC20, BEP20, etc.)
  • orderVersion - Cashier version (v1.0, v2.0, v3.0, v4.0)

Fiat Currency Payment

// Create payment
$response = $jayapay->fiatPayment()->createPayment($params);

// Get supported bank codes
$banks = $jayapay->fiatPayment()->getSupportedBankCodes();

Required Parameters:

  • orderNum - Merchant order number
  • money - Payment amount (integer, no decimals)
  • feeType - Fee type (0: deduct from amount, 1: separate)
  • bankCode - Bank code
  • number - Account number
  • name - Recipient name
  • mobile - Recipient phone
  • email - Recipient email
  • notifyUrl - Notification URL
  • description - Payment description

Digital Currency Payment

// Create payment
$response = $jayapay->digitalPayment()->createPayment($params);

// Get supported currencies
$currencies = $jayapay->digitalPayment()->getSupportedMethods();

Required Parameters:

  • orderNum - Merchant order number
  • money - Payment amount (supports decimals)
  • feeType - Fee type
  • method - Currency type
  • currency - Currency code
  • netWork - Network
  • inAddress - Recipient address
  • name - Recipient name
  • mobile - Recipient phone
  • email - Recipient email
  • notifyUrl - Notification URL

Order Queries

// 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']);

Account Verification

// Verify account
$response = $jayapay->accountVerification()->verifyByBankCode('014', '1234567890');

// Check if verification is supported
$supported = $jayapay->accountVerification()->isVerificationSupported('014');

Balance Inquiry

// Get all balances
$balances = $jayapay->getBalance();

// Get specific currency balance
$idrBalance = $jayapay->getBalance('IDR');

// Parse balance data
$parsed = $jayapay->balanceInquiry()->parseBalanceData($balances);

Webhook Handling

// Handle incoming webhook
try {
    $notification = $jayapay->webhookHandler()->handleNotification($_POST);

    if ($jayapay->webhookHandler()->isPaymentSuccessful($notification)) {
        // Process successful payment
        echo $jayapay->webhookHandler()->generateSuccessResponse();
    } else {
        // Handle failed payment
        echo $jayapay->webhookHandler()->generateFailureResponse();
    }
} catch (SignatureException $e) {
    // Invalid signature
    echo $jayapay->webhookHandler()->generateFailureResponse();
}

Error Handling

The SDK provides specific exception types:

use Taqin\Jayapay\Exceptions\ApiException;
use Taqin\Jayapay\Exceptions\ValidationException;
use Taqin\Jayapay\Exceptions\SignatureException;

try {
    $response = $jayapay->createFiatCollectionOrder($params);
} catch (ValidationException $e) {
    // Input validation failed
    $errors = $e->getErrors();
} catch (ApiException $e) {
    // API error
    $code = $e->getResponseCode();
    $message = $e->getResponseMessage();
} catch (SignatureException $e) {
    // Signature verification failed
}

Configuration

Sandbox Mode

$jayapay = new JayaPay($merchantCode, $privateKey, $publicKey, true); // true for sandbox

Custom Timeout

$jayapay = new JayaPay($merchantCode, $privateKey, $publicKey, false, 60); // 60 second timeout

Supported Payment Methods

Fiat Currency

  • BCA, MANDIRI, PERMATA, CIMB, BNI, MAYBANK, DANAMON, BRI, BSI, BNC
  • OVO, DANA, LINKAJA, SHOPEEPAY, GOPAY_QRIS, QRIS
  • ALFAMART, TRANSFER_BCA

Digital Currency

  • USDT (TRC20, BEP20, OMNI, ERC20)
  • BTC (OMNI)
  • ETH (ERC20)
  • TRX (TRC20)

Requirements

  • PHP 7.4 or higher
  • cURL extension
  • OpenSSL extension

License

MIT License

Support

For technical support, please contact the development team or refer to the JayaPay official documentation.