devteam/payon

支持商家调用相关支付API的包

v1.0.5 2022-10-26 04:25 UTC

This package is auto-updated.

Last update: 2024-09-26 10:02:18 UTC


README

  • 该包将支持调用以下文档中的API: https://docs.nextpay.vn/
    • 立即支付
    • 获取支持分期付款的银行列表
    • 分期付款信息
    • 创建分期付款请求
    • 检查交易

安装和加载

使用composer安装

composer require devteam/payon

将代码包含在PHP文件中

<?php
use Payon\PaymentGateway\PayonHelper;
//or require
require 'path/to/paymentgateway/src/PayonHelper.php';

代码示例

  • 传递给PayonHelper函数的参数
    • $secret_key: MC_SECRET_KEY - 用于在业务函数中加密data参数的密钥
    • $app_id: APP_ID - 应用程序ID,用于标识集成应用程序
    • $url: URL_API - API的URL路径
    • $http_auth: MC_AUTH_USER - 基本认证用户名
    • $http_auth_pass: MC_AUTH_PASS - Http基本认证密码
<?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