xinetzone/SpecWeave / .agents/skills/alipay-payment-integration
alipay-payment-integration
Flagged支付宝开放平台支付产品接入最佳实践。涵盖当面付、订单码支付、App 支付、JSAPI 支付、手机网站支付、电脑网站支付、预授权支付、商家扣款等全场景产品选型与集成指导。 当用户提到"接入支付宝"、"集成支付宝支付"、"对接支付"、"支付宝收款"、"加个支付功能"、"支付宝下单"、"H5 支付"、"小程序支付"、"预授权"、"付款码"、"扫码支付"、"网页支付"、"PC 支付"、"周期扣款"、"自动续费"、"会员订阅"、"连续包月"、"代扣"时,或咨询支付产品相关报错、排查问题时使用此 Skill。
references/code-examples/php/8_预授权支付/资金授权操作查询接口代码示例.md
View on GitHub# 资金授权操作查询接口 - PHP 示例
## 请求示例
```php
<?php
require_once '../aop/AopClient.php';
require_once '../aop/AopCertClient.php';
require_once '../aop/AopCertification.php';
require_once '../aop/AlipayConfig.php';
require_once '../aop/request/AlipayFundAuthOperationDetailQueryRequest.php';
// 初始化SDK
$alipayClient = new AopClient(getAlipayConfig());
// 构造请求参数以调用接口
$request = new AlipayFundAuthOperationDetailQueryRequest();
$model = array();
// 设置支付宝授权资金订单号
$model['auth_no'] = "2014021601002000640012345678";
// 设置商户的授权资金订单号
$model['out_order_no'] = "8077735255938023";
// 设置支付宝的授权资金操作流水号
$model['operation_id'] = "20140216010020006400";
// 设置商户的授权资金操作流水号
$model['out_request_no'] = "20140216001001";
// 设置需要查询的授权资金操作类型
$model['operation_type'] = "FREEZE";
$request->setBizContent(json_encode($model,JSON_UNESCAPED_UNICODE));
// 如果是第三方代调用模式,请设置app_auth_token(应用授权令牌)
$responseResult = $alipayClient->execute($request, null, "<-- 请填写应用授权令牌 -->", null);
$responseApiName = str_replace(".","_",$request->getApiMethodName())."_response";
$response = $responseResult->$responseApiName;
if(!empty($response->code)&&$response->code==10000){
echo("调用成功");
}
else{
echo("调用失败");
}
function getAlipayConfig()
{
$privateKey = '<-- 请填写您的应用私钥,例如:MIIEvQIBADANB ... ... -->';
$alipayPublicKey = '<-- 请填写您的支付宝公钥,例如:MIIBIjANBg... -->';
$alipayConfig = new AlipayConfig();
$alipayConfig->setServerUrl('https://openapi.alipay.com/gateway.do');
$alipayConfig->setAppId('<-- 请填写您的AppId,例如:2019091767145019 -->');
$alipayConfig->setPrivateKey($privateKey);
$alipayConfig->setFormat('json');
$alipayConfig->setAlipayPublicKey($alipayPublicKey);
$alipayConfig->setCharset('UTF-8');
$alipayConfig->setSignType('RSA2');
return $alipayConfig;
}
```
## 响应示例
### 正常示例
```json
{
"alipay_fund_auth_operation_detail_query_response": {
"code": "10000",
"msg": "Success",
"auth_no": "2014031600002001260000001000",
"out_order_no": "20140216001",
"order_status": "AUTHORIZED",
"total_freeze_amount": "4800.00",
"rest_amount": "4600.00",
"total_pay_amount": "0.00",
"order_title": "0元购土豪金",
"payer_logon_id": "ali*@alipay.com",
"payer_user_id": "2088402019148643",
"payer_open_id": "03914IMEfXsS9K-tSvHy-IisrLlOfthFgDVo-hU30XtKPg9",
"extra_param": "{\"merchantExt\":\"key1=value1,key2=value2\"}",
"operation_id": "20140216355864862002",
"out_request_no": "20140216001001",
"amount": "200.00",
"operation_type": "UNFREEZE",
"status": "SUCCESS",
"remark": "2014-05期解冻200.00元",
"gmt_create": "2014-01-01 20:00:00",
"gmt_trans": "2014-01-01 20:00:00",
"pre_auth_type": "CREDIT_AUTH",
"trans_currency": "USD",
"total_freeze_credit_amount": "0.01",
"total_freeze_fund_amount": "0.01",
"total_pay_credit_amount": "0.01",
"total_pay_fund_amount": "0.01",
"rest_credit_amount": "0.01",
"rest_fund_amount": "0.01",
"credit_amount": "0.01",
"fund_amount": "0.01",
"credit_merchant_ext": "{\"1003190\":\"true\"}"
},
"sign": "ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE"
}
```
### 异常示例
```json
{
"alipay_fund_auth_operation_detail_query_response": {
"code": "20000",
"msg": "Service Currently Unavailable",
"sub_code": "isp.unknow-error",
"sub_msg": "系统繁忙"
},
"sign": "ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE"
}
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |