PHP code example of devteam / payon

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

    

devteam / payon example snippets



use Payon\PaymentGateway\PayonHelper;
//or php';



use Payon\PaymentGateway\PayonHelper;

$payon = new PayonHelper( $secret_key, $app_id, $url, $http_auth, $http_auth_pass);
$data = [
    "merchant_id" => $mc_id, //MC_ID - ID Merchant để định danh khách hàng trên PayOn
    "merchant_request_id" => $merchant_request_id,
    "amount" => (int)$order->get_total(),
    'bank_code' => $bank_code,
    'cycle' => (int) $cycle,
    'card_type' => $card_type,
    'userfee' => (int)(($user_fee == 'yes') ? 1 : 2),
    "description" => 'Thanh toán đơn hàng trả góp #' . $order_id,
    "url_redirect" => $url_redirect,
    "url_notify" => $url_notify,
    "url_cancel" => $url_cancel,
    "customer_fullname" => $customer_fullname,
    "customer_email" => $customer_email,
    "customer_mobile" => $customer_mobile,
];
return $payon->createOrderInstallment($data); //Tạo thanh toán trả góp