PHP code example of jpay-api / php-sdk

1. Go to this page and download the library: Download jpay-api/php-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/ */

    

jpay-api / php-sdk example snippets


use JPayApiLib\Logging\LoggingConfigurationBuilder;
use JPayApiLib\Logging\RequestLoggingConfigurationBuilder;
use JPayApiLib\Logging\ResponseLoggingConfigurationBuilder;
use Psr\Log\LogLevel;
use JPayApiLib\Environment;
use JPayApiLib\JPayApiClientBuilder;

$client = JPayApiClientBuilder::init()
    ->apiKey('your-merchant-api-key')
    ->environment(Environment::SANDBOX)
    ->loggingConfiguration(
        LoggingConfigurationBuilder::init()
            ->level(LogLevel::INFO)
            ->requestConfiguration(RequestLoggingConfigurationBuilder::init()->body(true))
            ->responseConfiguration(ResponseLoggingConfigurationBuilder::init()->headers(true))
    )
    ->build();

use JPayApiLib\Models\Requests\Builders\CreatePayoutRequestBuilder;

$request = CreatePayoutRequestBuilder::init()
    ->orderType('BANK')
    ->memberid('10153')
    ->outTradeNo('PO20260101001')
    ->amount('100.00')
    ->currency('USD')
    ->notifyurl('https://example.com/payout/notify')
    ->remark('Salary payout')
    ->sign($md5Sign)
    ->firstname('John')
    ->payeeCountry('US')
    ->payeeaccount('1234567890')
    ->bankcode('001')
    ->bankname('Test Bank')
    ->build();

$response = $client->getPayoutsApi()->createFromRequest($request);
/** @var \JPayApiLib\Models\ApiV1PaymentCreateOrderResponse $result */
$result = $response->getResult();

$ composer 
json
{
  "y-api/php-sdk": "~1.0"
  }
}