@alipay/alipay-aipay 0.1.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/bin/alipay-aipay.js +6 -0
- package/dist/commands/install.d.ts +10 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +92 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/uninstall.d.ts +10 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +82 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.d.ts +10 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +125 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +43 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/alipay-cli.d.ts +15 -0
- package/dist/utils/alipay-cli.d.ts.map +1 -0
- package/dist/utils/alipay-cli.js +228 -0
- package/dist/utils/alipay-cli.js.map +1 -0
- package/dist/utils/config.d.ts +48 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +207 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/file.d.ts +55 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +154 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/gpg.d.ts +14 -0
- package/dist/utils/gpg.d.ts.map +1 -0
- package/dist/utils/gpg.js +247 -0
- package/dist/utils/gpg.js.map +1 -0
- package/dist/utils/jq.d.ts +14 -0
- package/dist/utils/jq.d.ts.map +1 -0
- package/dist/utils/jq.js +221 -0
- package/dist/utils/jq.js.map +1 -0
- package/dist/utils/npm.d.ts +17 -0
- package/dist/utils/npm.d.ts.map +1 -0
- package/dist/utils/npm.js +42 -0
- package/dist/utils/npm.js.map +1 -0
- package/dist/utils/shell.d.ts +11 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +54 -0
- package/dist/utils/shell.js.map +1 -0
- package/package.json +53 -0
- package/skill/SKILL.md +118 -0
- package/skill/references/integration/flow.md +487 -0
- package/skill/references/integration/modules/alipay-sdk-reminder.md +256 -0
- package/skill/references/integration/modules/checklist.md +122 -0
- package/skill/references/integration/modules/code-examples/csharp/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/345/205/263/351/227/255/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +68 -0
- package/skill/references/integration/modules/code-examples/csharp/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +77 -0
- package/skill/references/integration/modules/code-examples/csharp/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +74 -0
- package/skill/references/integration/modules/code-examples/csharp/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +73 -0
- package/skill/references/integration/modules/code-examples/csharp/2-/347/275/221/347/253/231/346/224/257/344/273/230//347/273/237/344/270/200/346/224/266/345/215/225/344/270/213/345/215/225/345/271/266/346/224/257/344/273/230/351/241/265/351/235/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +58 -0
- package/skill/references/integration/modules/code-examples/csharp/3-APP/346/224/257/344/273/230/APP/346/224/257/344/273/230/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +128 -0
- package/skill/references/integration/modules/code-examples/csharp/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.cs +500 -0
- package/skill/references/integration/modules/code-examples/java/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/345/205/263/351/227/255/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +72 -0
- package/skill/references/integration/modules/code-examples/java/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +80 -0
- package/skill/references/integration/modules/code-examples/java/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +78 -0
- package/skill/references/integration/modules/code-examples/java/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +77 -0
- package/skill/references/integration/modules/code-examples/java/2-/347/275/221/347/253/231/346/224/257/344/273/230//347/273/237/344/270/200/346/224/266/345/215/225/344/270/213/345/215/225/345/271/266/346/224/257/344/273/230/351/241/265/351/235/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +66 -0
- package/skill/references/integration/modules/code-examples/java/3-APP/346/224/257/344/273/230/APP/346/224/257/344/273/230/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +135 -0
- package/skill/references/integration/modules/code-examples/java/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemoController.java +610 -0
- package/skill/references/integration/modules/code-examples/nodejs/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/345/205/263/351/227/255/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +51 -0
- package/skill/references/integration/modules/code-examples/nodejs/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +57 -0
- package/skill/references/integration/modules/code-examples/nodejs/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +55 -0
- package/skill/references/integration/modules/code-examples/nodejs/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +54 -0
- package/skill/references/integration/modules/code-examples/nodejs/2-/347/275/221/347/253/231/346/224/257/344/273/230//347/273/237/344/270/200/346/224/266/345/215/225/344/270/213/345/215/225/345/271/266/346/224/257/344/273/230/351/241/265/351/235/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +77 -0
- package/skill/references/integration/modules/code-examples/nodejs/3-APP/346/224/257/344/273/230/APP/346/224/257/344/273/230/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +65 -0
- package/skill/references/integration/modules/code-examples/nodejs/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.js +461 -0
- package/skill/references/integration/modules/code-examples/php/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/345/205/263/351/227/255/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +59 -0
- package/skill/references/integration/modules/code-examples/php/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +67 -0
- package/skill/references/integration/modules/code-examples/php/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +66 -0
- package/skill/references/integration/modules/code-examples/php/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +65 -0
- package/skill/references/integration/modules/code-examples/php/2-/347/275/221/347/253/231/346/224/257/344/273/230//347/273/237/344/270/200/346/224/266/345/215/225/344/270/213/345/215/225/345/271/266/346/224/257/344/273/230/351/241/265/351/235/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +56 -0
- package/skill/references/integration/modules/code-examples/php/3-APP/346/224/257/344/273/230/APP/346/224/257/344/273/230/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +107 -0
- package/skill/references/integration/modules/code-examples/php/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.php +444 -0
- package/skill/references/integration/modules/code-examples/python/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/345/205/263/351/227/255/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +57 -0
- package/skill/references/integration/modules/code-examples/python/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +65 -0
- package/skill/references/integration/modules/code-examples/python/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +63 -0
- package/skill/references/integration/modules/code-examples/python/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +62 -0
- package/skill/references/integration/modules/code-examples/python/2-/347/275/221/347/253/231/346/224/257/344/273/230//347/273/237/344/270/200/346/224/266/345/215/225/344/270/213/345/215/225/345/271/266/346/224/257/344/273/230/351/241/265/351/235/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +48 -0
- package/skill/references/integration/modules/code-examples/python/3-APP/346/224/257/344/273/230/APP/346/224/257/344/273/230/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +43 -0
- package/skill/references/integration/modules/code-examples/python/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.py +465 -0
- package/skill/references/integration/modules/interface-guide.md +90 -0
- package/skill/references/integration/modules/product-decision.md +90 -0
- package/skill/references/integration/modules/sandbox/a2m-sandbox-test.md +270 -0
- package/skill/references/integration/modules/sandbox/alipay-sandbox-tool.md +133 -0
- package/skill/references/integration/modules/sandbox/sandbox-setup-guide.md +218 -0
- package/skill/references/integration/modules/scripts/local_402_sandbox_pay.py +659 -0
- package/skill/references/normal/alipay-cli-env.md +211 -0
- package/skill/references/normal/rejection-guide.md +37 -0
- package/skill/references/normal/scripts/common.sh +32 -0
- package/skill/references/normal/scripts/detect_dev_tool.sh +46 -0
- package/skill/references/onboarding/flow.md +571 -0
- package/skill/references/onboarding/modules/app-release.md +411 -0
- package/skill/references/onboarding/modules/authorization.md +269 -0
- package/skill/references/onboarding/modules/error-handling.md +247 -0
- package/skill/references/onboarding/modules/mcc-reference.md +209 -0
- package/skill/references/onboarding/modules/product-sign.md +304 -0
- package/skill/references/onboarding/modules/scripts/app.sh +705 -0
- package/skill/references/onboarding/modules/scripts/ar_sign_apply.sh +248 -0
- package/skill/references/onboarding/modules/scripts/auth.sh +505 -0
- package/skill/references/onboarding/modules/scripts/error_handler.sh +312 -0
- package/skill/references/onboarding/modules/scripts/query_sign_status.sh +146 -0
- package/skill/references/onboarding/modules/scripts/service.sh +267 -0
- package/skill/references/onboarding/modules/scripts/upload_screenshots.sh +152 -0
- package/skill/references/onboarding/modules/service-registration.md +294 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# 统一收单交易查询接口 - Node.js 示例
|
|
2
|
+
|
|
3
|
+
## 请求示例
|
|
4
|
+
|
|
5
|
+
```javascript
|
|
6
|
+
const { AlipaySdk } = require("alipay-sdk");
|
|
7
|
+
|
|
8
|
+
const alipaySdk = new AlipaySdk({
|
|
9
|
+
appId: "<-- 请填写您的AppId,例如:20190xxxxxx -->",
|
|
10
|
+
privateKey: "<-- 请填写您的应用私钥,例如:MIIE...(脱敏示例) -->", // Node.js 使用 PKCS#1 格式私钥
|
|
11
|
+
alipayPublicKey: "<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->",
|
|
12
|
+
gateway: "https://openapi.alipay.com/gateway.do",
|
|
13
|
+
signType: "RSA2",
|
|
14
|
+
// 第三方代调用模式下请设置 appAuthToken
|
|
15
|
+
// appAuthToken: "<-- 请填写应用授权令牌 -->",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const result = await alipaySdk.exec("alipay.trade.query", {
|
|
19
|
+
bizContent: {
|
|
20
|
+
out_trade_no: "MERCHANT_ORDER_NO_PLACEHOLDER",
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
if (result.code === "10000") {
|
|
25
|
+
console.log("调用成功");
|
|
26
|
+
} else {
|
|
27
|
+
console.log("调用失败");
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 响应示例
|
|
32
|
+
### 正常示例
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"code": "10000",
|
|
36
|
+
"msg": "Success",
|
|
37
|
+
"trade_no": "ALIPAY_TRADE_NO_PLACEHOLDER",
|
|
38
|
+
"out_trade_no": "MERCHANT_ORDER_NO_PLACEHOLDER",
|
|
39
|
+
"buyer_logon_id": "159****5620",
|
|
40
|
+
"trade_status": "TRADE_SUCCESS",
|
|
41
|
+
"total_amount": "88.88",
|
|
42
|
+
"buyer_pay_amount": "8.88",
|
|
43
|
+
"receipt_amount": "15.25",
|
|
44
|
+
"invoice_amount": "12.11",
|
|
45
|
+
"buyer_user_id": "<BUYER_USER_ID>",
|
|
46
|
+
"send_pay_date": "2014-11-27 15:45:57"
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
### 异常示例
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"code": "20000",
|
|
53
|
+
"msg": "Service Currently Unavailable",
|
|
54
|
+
"sub_code": "isp.unknow-error",
|
|
55
|
+
"sub_msg": "系统繁忙"
|
|
56
|
+
}
|
|
57
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# 统一收单交易退款接口 - Node.js 示例
|
|
2
|
+
|
|
3
|
+
## 请求示例
|
|
4
|
+
|
|
5
|
+
```javascript
|
|
6
|
+
const { AlipaySdk } = require("alipay-sdk");
|
|
7
|
+
|
|
8
|
+
const alipaySdk = new AlipaySdk({
|
|
9
|
+
appId: "<-- 请填写您的AppId,例如:20190xxxxxx -->",
|
|
10
|
+
privateKey: "<-- 请填写您的应用私钥,例如:MIIE...(脱敏示例) -->", // Node.js 使用 PKCS#1 格式私钥
|
|
11
|
+
alipayPublicKey: "<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->",
|
|
12
|
+
gateway: "https://openapi.alipay.com/gateway.do",
|
|
13
|
+
signType: "RSA2",
|
|
14
|
+
// 第三方代调用模式下请设置 appAuthToken
|
|
15
|
+
// appAuthToken: "<-- 请填写应用授权令牌 -->",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const result = await alipaySdk.exec("alipay.trade.refund", {
|
|
19
|
+
bizContent: {
|
|
20
|
+
out_trade_no: "MERCHANT_ORDER_NO_PLACEHOLDER", // 商户订单号,与 trade_no 二选一
|
|
21
|
+
refund_amount: "200.12", // 退款金额,必填,单位为元
|
|
22
|
+
refund_reason: "正常退款", // 退款原因,选填
|
|
23
|
+
out_request_no: "OUT_REQUEST_NO_PLACEHOLDER", // 退款请求号,同一笔交易多次部分退款时必填且必须不同
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
if (result.code === "10000") {
|
|
28
|
+
console.log("调用成功");
|
|
29
|
+
} else {
|
|
30
|
+
console.log("调用失败");
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 响应示例
|
|
35
|
+
### 正常示例
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"code": "10000",
|
|
39
|
+
"msg": "Success",
|
|
40
|
+
"trade_no": "ALIPAY_TRADE_NO_PLACEHOLDER",
|
|
41
|
+
"out_trade_no": "MERCHANT_ORDER_NO_PLACEHOLDER",
|
|
42
|
+
"buyer_logon_id": "159****5620",
|
|
43
|
+
"fund_change": "Y",
|
|
44
|
+
"refund_fee": "88.88"
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
### 异常示例
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"code": "20000",
|
|
51
|
+
"msg": "Service Currently Unavailable",
|
|
52
|
+
"sub_code": "isp.unknow-error",
|
|
53
|
+
"sub_msg": "系统繁忙"
|
|
54
|
+
}
|
|
55
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# 统一收单交易退款查询接口 - Node.js 示例
|
|
2
|
+
|
|
3
|
+
## 请求示例
|
|
4
|
+
|
|
5
|
+
```javascript
|
|
6
|
+
const { AlipaySdk } = require("alipay-sdk");
|
|
7
|
+
|
|
8
|
+
const alipaySdk = new AlipaySdk({
|
|
9
|
+
appId: "<-- 请填写您的AppId,例如:20190xxxxxx -->",
|
|
10
|
+
privateKey: "<-- 请填写您的应用私钥,例如:MIIE...(脱敏示例) -->", // Node.js 使用 PKCS#1 格式私钥
|
|
11
|
+
alipayPublicKey: "<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->",
|
|
12
|
+
gateway: "https://openapi.alipay.com/gateway.do",
|
|
13
|
+
signType: "RSA2",
|
|
14
|
+
// 第三方代调用模式下请设置 appAuthToken
|
|
15
|
+
// appAuthToken: "<-- 请填写应用授权令牌 -->",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const result = await alipaySdk.exec("alipay.trade.fastpay.refund.query", {
|
|
19
|
+
bizContent: {
|
|
20
|
+
out_trade_no: "MERCHANT_ORDER_NO_PLACEHOLDER", // 商户订单号,与 trade_no 二选一
|
|
21
|
+
out_request_no: "OUT_REQUEST_NO_PLACEHOLDER", // 退款请求号,必填,同一笔交易多次部分退款时用于区分
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
if (result.code === "10000") {
|
|
26
|
+
console.log("调用成功");
|
|
27
|
+
} else {
|
|
28
|
+
console.log("调用失败");
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 响应示例
|
|
33
|
+
### 正常示例
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"code": "10000",
|
|
37
|
+
"msg": "Success",
|
|
38
|
+
"trade_no": "ALIPAY_TRADE_NO_PLACEHOLDER",
|
|
39
|
+
"out_trade_no": "MERCHANT_ORDER_NO_PLACEHOLDER",
|
|
40
|
+
"out_request_no": "OUT_REQUEST_NO_PLACEHOLDER",
|
|
41
|
+
"total_amount": "100.20",
|
|
42
|
+
"refund_amount": "12.33",
|
|
43
|
+
"refund_status": "REFUND_SUCCESS"
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
### 异常示例
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"code": "20000",
|
|
50
|
+
"msg": "Service Currently Unavailable",
|
|
51
|
+
"sub_code": "isp.unknow-error",
|
|
52
|
+
"sub_msg": "系统繁忙"
|
|
53
|
+
}
|
|
54
|
+
```
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# 统一收单下单并支付页面接口 - Node.js 示例
|
|
2
|
+
|
|
3
|
+
## 请求示例
|
|
4
|
+
|
|
5
|
+
```javascript
|
|
6
|
+
const { AlipaySdk } = require("alipay-sdk");
|
|
7
|
+
|
|
8
|
+
const alipaySdk = new AlipaySdk({
|
|
9
|
+
appId: "<-- 请填写您的AppId,例如:20190xxxxxx -->",
|
|
10
|
+
privateKey: "<-- 请填写您的应用私钥,例如:MIIE...(脱敏示例) -->", // Node.js 使用 PKCS#1 格式私钥
|
|
11
|
+
alipayPublicKey: "<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->",
|
|
12
|
+
gateway: "https://openapi.alipay.com/gateway.do",
|
|
13
|
+
signType: "RSA2",
|
|
14
|
+
// 第三方代调用模式下请设置 appAuthToken
|
|
15
|
+
// appAuthToken: "<-- 请填写应用授权令牌 -->",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// ⚠️ 网站支付必须使用 pageExec() 方法,不能使用 exec()
|
|
19
|
+
// ⚠️ pageExec() 第二个参数必须传 'POST'
|
|
20
|
+
// ⚠️ notifyUrl 和 returnUrl 必须传入,否则可能导致验签失败
|
|
21
|
+
const result = alipaySdk.pageExec(
|
|
22
|
+
"alipay.trade.page.pay",
|
|
23
|
+
"POST",
|
|
24
|
+
{
|
|
25
|
+
notifyUrl: "https://your-domain.com/notify", // 异步通知地址,必须传入
|
|
26
|
+
returnUrl: "https://your-domain.com/return", // 同步跳转地址,必须传入
|
|
27
|
+
bizContent: {
|
|
28
|
+
out_trade_no: "MERCHANT_ORDER_NO_PLACEHOLDER", // 商户订单号,必填
|
|
29
|
+
total_amount: "88.88", // 订单总金额,必填,单位为元,精确到小数点后两位
|
|
30
|
+
subject: "Iphone6 16G", // 订单标题,必填
|
|
31
|
+
product_code: "FAST_INSTANT_TRADE_PAY", // 网站支付固定值,必填
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
// pageExec 返回的是 HTML 表单字符串,前端需要渲染并自动提交
|
|
37
|
+
// ⚠️ 禁止用 URL 直接跳转,否则页面只会显示参数而无法跳转支付宝
|
|
38
|
+
console.log(result);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 前端渲染支付表单
|
|
42
|
+
|
|
43
|
+
```javascript
|
|
44
|
+
// pageExec 返回的 result 是包含自动提交脚本的 HTML <form> 字符串
|
|
45
|
+
// 前端必须将此 HTML 渲染到页面并自动提交表单
|
|
46
|
+
|
|
47
|
+
// ✅ 正确写法(以浏览器端 JavaScript 为例)
|
|
48
|
+
if (data.paymentHtml) {
|
|
49
|
+
const container = document.createElement('div');
|
|
50
|
+
container.innerHTML = data.paymentHtml;
|
|
51
|
+
container.style.position = 'fixed';
|
|
52
|
+
container.style.top = '0';
|
|
53
|
+
container.style.left = '0';
|
|
54
|
+
container.style.width = '100%';
|
|
55
|
+
container.style.height = '100%';
|
|
56
|
+
container.style.zIndex = '9999';
|
|
57
|
+
container.style.background = 'white';
|
|
58
|
+
document.body.appendChild(container);
|
|
59
|
+
const form = container.querySelector('form');
|
|
60
|
+
if (form) form.submit();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ❌ 错误写法 — 禁止用 URL 直接跳转
|
|
64
|
+
// window.location.href = data.paymentHtml; // 页面只会显示参数,无法跳转支付宝
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## 响应示例
|
|
68
|
+
|
|
69
|
+
### 正常示例
|
|
70
|
+
|
|
71
|
+
```html
|
|
72
|
+
<form name="punchout_form" method="post" action="https://openapi.alipay.com/gateway.do?charset=UTF-8&method=alipay.trade.page.pay&format=json&sign=SIGN_PLACEHOLDER&version=1.0&app_id=20190xxxxxx&sign_type=RSA2×tamp=2014-07-24+03%3A07%3A50">
|
|
73
|
+
<input type="hidden" name="biz_content" value="{"out_trade_no":"MERCHANT_ORDER_NO_PLACEHOLDER","total_amount":"88.88","subject":"Iphone6 16G","product_code":"FAST_INSTANT_TRADE_PAY"}">
|
|
74
|
+
<input type="submit" value="立即支付" style="display:none" >
|
|
75
|
+
</form>
|
|
76
|
+
<script>document.forms[0].submit();</script>
|
|
77
|
+
```
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# APP支付接口 - Node.js 示例
|
|
2
|
+
|
|
3
|
+
## 请求示例
|
|
4
|
+
|
|
5
|
+
```javascript
|
|
6
|
+
const { AlipaySdk } = require("alipay-sdk");
|
|
7
|
+
|
|
8
|
+
const alipaySdk = new AlipaySdk({
|
|
9
|
+
appId: "<-- 请填写您的AppId,例如:20190xxxxxx -->",
|
|
10
|
+
privateKey: "<-- 请填写您的应用私钥,例如:MIIE...(脱敏示例) -->",
|
|
11
|
+
alipayPublicKey: "<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->",
|
|
12
|
+
gateway: "https://openapi.alipay.com/gateway.do",
|
|
13
|
+
appAuthToken: "<-- 请填写应用授权令牌 -->",
|
|
14
|
+
});
|
|
15
|
+
const result = await alipaySdk.sdkExec("alipay.trade.app.pay", {
|
|
16
|
+
bizContent: {
|
|
17
|
+
out_trade_no: "MERCHANT_ORDER_NO_PLACEHOLDER",
|
|
18
|
+
total_amount: "9.00",
|
|
19
|
+
subject: "大乐透",
|
|
20
|
+
product_code: "QUICK_MSECURITY_PAY",
|
|
21
|
+
goods_detail: [
|
|
22
|
+
{
|
|
23
|
+
goods_name: "ipad",
|
|
24
|
+
alipay_goods_id: "20010001",
|
|
25
|
+
quantity: 1,
|
|
26
|
+
price: "2000",
|
|
27
|
+
goods_id: "apple-01",
|
|
28
|
+
goods_category: "34543238",
|
|
29
|
+
categories_tree: "124868003|126232002|126252004",
|
|
30
|
+
show_url: "http://www.alipay.com/xxx.jpg",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
time_expire: "2016-12-31+10:05:00",
|
|
34
|
+
extend_params: {
|
|
35
|
+
sys_service_provider_id: "<SYS_SERVICE_PROVIDER_ID>",
|
|
36
|
+
hb_fq_seller_percent: "100",
|
|
37
|
+
hb_fq_num: "3",
|
|
38
|
+
industry_reflux_info:
|
|
39
|
+
'{\\"scene_code\\":\\"metro_tradeorder\\",\\"channel\\":\\"xxxx\\",\\"scene_data\\":{\\"asset_name\\":\\"ALIPAY\\"}}',
|
|
40
|
+
royalty_freeze: "true",
|
|
41
|
+
card_type: "S0JP0000",
|
|
42
|
+
},
|
|
43
|
+
passback_params: "merchantBizType%3d3C%26merchantBizNo%3dMERCHANT_BIZ_NO_PLACEHOLDER",
|
|
44
|
+
merchant_order_no: "MERCHANT_ORDER_NO_PLACEHOLDER",
|
|
45
|
+
ext_user_info: {
|
|
46
|
+
cert_type: "IDENTITY_CARD",
|
|
47
|
+
cert_no: "<CERT_NO>",
|
|
48
|
+
mobile: "<MOBILE>",
|
|
49
|
+
name: "李明",
|
|
50
|
+
min_age: "18",
|
|
51
|
+
need_check_info: "F",
|
|
52
|
+
identity_hash:
|
|
53
|
+
"<IDENTITY_HASH>",
|
|
54
|
+
},
|
|
55
|
+
query_options: ["hyb_amount", "enterprise_pay_info"],
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 响应示例
|
|
61
|
+
### 正常示例
|
|
62
|
+
```
|
|
63
|
+
app_id=20190xxxxxx&biz_content=%7B%22time_expire%22%3A%222016-12-31+10%3A05%3A00%22%2C%22extend_params%22%3A%22%22%2C%22query_options%22%3A%22%5B%5C%22hyb_amount%5C%22%2C%5C%22enterprise_pay_info%5C%22%5D%22%2C%22subject%22%3A%22%E5%A4%A7%E4%B9%90%E9%80%8F%22%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%2C%22body%22%3A%22Iphone6+16G%22%2C%22passback_params%22%3A%22merchantBizType%253d3C%2526merchantBizNo%253dMERCHANT_BIZ_NO_PLACEHOLDER%22%2C%22specified_channel%22%3A%22pcredit%22%2C%22goods_detail%22%3A%22%22%2C%22merchant_order_no%22%3A%22MERCHANT_ORDER_NO_PLACEHOLDER%22%2C%22enable_pay_channels%22%3A%22pcredit%2CmoneyFund%2CdebitCardExpress%22%2C%22out_trade_no%22%3A%22MERCHANT_ORDER_NO_PLACEHOLDER%22%2C%22ext_user_info%22%3A%22%22%2C%22total_amount%22%3A%229.00%22%2C%22timeout_express%22%3A%2290m%22%2C%22disable_pay_channels%22%3A%22pcredit%2CmoneyFund%2CdebitCardExpress%22%2C%22agreement_sign_params%22%3A%22%22%7D&charset=UTF-8&format=json&method=alipay.trade.app.pay&sign=SIGN_PLACEHOLDER&sign_type=RSA2×tamp=2014-07-24+03%3A07%3A50&version=1.0
|
|
64
|
+
```
|
|
65
|
+
|