miposent/wechatpaypoint

There is no license information available for the latest version (2.0.0) of this package.

This is the development of the WeChat payment point

2.0.0 2021-04-19 15:38 UTC

This package is auto-updated.

Last update: 2024-06-14 10:49:56 UTC


README

📦 基于微信支付分的文档开发的PHP SDK

Requirement

  1. PHP >= 7.2
  2. Composer
  3. openssl 拓展

Installation

$ composer require miposent/wechatpaypoint 2.0.0

Usage

先初始化:

<?php

use WxPayPoint\Request\WxPayPointRequest;

$config = [
	'appid'       => 'wx0f3a4b0dcafxxxx',//公众账号ID
	'mch_id'      => '157952xxxx',   //支付商户号
	'service_id'  => '0000200000000015984369xxxxxxxxxx',//服务ID
	'key'         => '009DA8BDD9A5AECFED72F3xxxxxxxxxx',//支付key
	'v3key'       => '1BA00441A40AD15D1D2C54xxxxxxxxxx',//支付v3key
	'serial_no'   => '3F389F9F2D414CF22E156Dxxxxxxxxxxxxxxxxx',//证书序号
	'private_key' => '/cert/apiclient_key.pem',//证书
	'public_key'  => '/cert/apiclient_cert.pem',
];

$app = WxPayPointRequest::getInstance( $config );

使用公共API中创建支付分订单API:

$param = [
	'out_order_no'         => '202009171036252525',
	'service_introduction' => '租借飞机服务',
	'time_range'           => [
		'start_time' => date( "YmdHis" )
	],
	'risk_fund'            => [
		'name'   => 'DEPOSIT',
		'amount' => 9900,
	],
	'notify_url'           => 'https://www.baidu.com'
];
$data = $app->createBill($param);

以上为基本使用的操作,API需要的参数请根据 微信支付分通用文档需求进行传入,无需考虑参数是path、query、body,把必选的参数传入即可。

More

免确认模式特有API中的创单结单合并API:

$data = $app->directComplete($param);

免确认特有API(普通授权方式)中的查询用户授权状态API:

$data = $app->userServiceState($param);

免确认特有API(普通授权方式)中的商户解除用户授权关系API:

$data = $app->terminate($param);

免确认特有API(预授权方式)中的商户预授权API:

$data = $app->permission($param);

免确认特有API(预授权方式)中的查询与用户授权记录(授权协议号)API:

$data = $app->authCodePermission($param);

免确认特有API(预授权方式)中的解除用户授权关系(授权协议号)API:

$data = $app->authCodeTerminate($param);

免确认特有API(预授权方式)中的查询与用户授权记录(openid)API:

$data = $app->openidPermission($param);

免确认特有API(预授权方式)中的解除用户授权关系(openid)API:

$data = $app->openidTerminate($param);

公共API中的创建支付分订单API:

$data = $app->createBill($param);

公共API中的查询支付分订单API:

$data = $app->queryBill($param);

公共API中的取消支付分订单API:

$data = $app->cancelBill($param);

公共API中的修改订单金额API:

$data = $app->modifyBill($param);

公共API中的完结支付分订单API:

$data = $app->completeBill($param);

公共API中的商户发起催收扣款API:

$data = $app->payBill($param);

公共API中的同步服务订单信息API:

$data = $app->syncBill($param);

公共API中的申请退款API:

$data = $app->applyRefund($param);

公共API中的查询单笔退款API:

$data = $app->queryRefund($param);

异步通知操作静态类

异步通知参数解密:

$data=NotifyHandle::notifyDecode($associatedData, $nonce, $ciphertext, $v3key);

异步通知返回:

#成功
return NotifyHandle::sendSuccessReturn();
#失败
return NotifyHandle::sendFailReturn("FAIL","ORDER_ERROR");

更多请参考 微信支付分通用文档