@alipay/alipay-aipay 1.7.0 → 1.7.2
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 +30 -0
- package/dist/commands/install-current.js +15 -7
- package/dist/commands/install.js +20 -16
- package/dist/commands/uninstall.js +8 -3
- package/dist/commands/update.js +34 -16
- package/dist/index.js +10 -4
- package/dist/utils/channels.js +67 -0
- package/dist/utils/config.js +15 -11
- package/dist/utils/file.js +23 -10
- package/dist/utils/npm.js +19 -33
- package/package.json +8 -3
- package/skill/SKILL.md +2 -0
- package/skill/references/normal/json/release-channel.json +1 -0
- package/skill/references/normal/scripts/self_update.mjs +62 -17
- package/skill/references/normal/self-update.md +3 -1
- package/skill-pre/SKILL.md +65 -0
- package/skill-pre/VERSION +1 -0
- package/skill-pre/references/integration/flow.md +602 -0
- package/skill-pre/references/integration/modules/alipay-sdk-reminder.md +281 -0
- package/skill-pre/references/integration/modules/checklist.md +154 -0
- package/skill-pre/references/integration/modules/code-examples/csharp/1-/351/200/232/347/224/250/346/216/245/345/217/243//345/274/202/346/255/245/351/200/232/347/237/245/345/244/204/347/220/206/344/273/243/347/240/201/347/244/272/344/276/213.md +199 -0
- package/skill-pre/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-pre/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 +83 -0
- package/skill-pre/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 +80 -0
- package/skill-pre/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-pre/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 +62 -0
- package/skill-pre/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 +132 -0
- package/skill-pre/references/integration/modules/code-examples/csharp/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.md +640 -0
- package/skill-pre/references/integration/modules/code-examples/java/1-/351/200/232/347/224/250/346/216/245/345/217/243//345/274/202/346/255/245/351/200/232/347/237/245/345/244/204/347/220/206/344/273/243/347/240/201/347/244/272/344/276/213.md +184 -0
- package/skill-pre/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-pre/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 +96 -0
- package/skill-pre/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 +81 -0
- package/skill-pre/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-pre/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 +69 -0
- package/skill-pre/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 +138 -0
- package/skill-pre/references/integration/modules/code-examples/java/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemoController.md +623 -0
- package/skill-pre/references/integration/modules/code-examples/nodejs/1-/351/200/232/347/224/250/346/216/245/345/217/243//345/274/202/346/255/245/351/200/232/347/237/245/345/244/204/347/220/206/344/273/243/347/240/201/347/244/272/344/276/213.md +135 -0
- package/skill-pre/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-pre/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 +63 -0
- package/skill-pre/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 +59 -0
- package/skill-pre/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-pre/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 +84 -0
- package/skill-pre/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 +71 -0
- package/skill-pre/references/integration/modules/code-examples/nodejs/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.md +498 -0
- package/skill-pre/references/integration/modules/code-examples/php/1-/351/200/232/347/224/250/346/216/245/345/217/243//345/274/202/346/255/245/351/200/232/347/237/245/345/244/204/347/220/206/344/273/243/347/240/201/347/244/272/344/276/213.md +157 -0
- package/skill-pre/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-pre/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 +73 -0
- package/skill-pre/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 +69 -0
- package/skill-pre/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-pre/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 +59 -0
- package/skill-pre/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 +110 -0
- package/skill-pre/references/integration/modules/code-examples/php/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.md +806 -0
- package/skill-pre/references/integration/modules/code-examples/python/1-/351/200/232/347/224/250/346/216/245/345/217/243//345/274/202/346/255/245/351/200/232/347/237/245/345/244/204/347/220/206/344/273/243/347/240/201/347/244/272/344/276/213.md +128 -0
- package/skill-pre/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-pre/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 +70 -0
- package/skill-pre/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 +65 -0
- package/skill-pre/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-pre/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 +51 -0
- package/skill-pre/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 +47 -0
- package/skill-pre/references/integration/modules/code-examples/python/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.md +541 -0
- package/skill-pre/references/integration/modules/interface-contract/aipay-interface-contract.md +52 -0
- package/skill-pre/references/integration/modules/interface-contract/apppay-interface-contract.md +45 -0
- package/skill-pre/references/integration/modules/interface-contract/common-trade-contract.md +42 -0
- package/skill-pre/references/integration/modules/interface-contract/notify-url-contract.md +68 -0
- package/skill-pre/references/integration/modules/interface-contract/webpay-interface-contract.md +44 -0
- package/skill-pre/references/integration/modules/interface-guide.md +61 -0
- package/skill-pre/references/integration/modules/product-decision.md +73 -0
- package/skill-pre/references/integration/modules/sandbox/a2m-sandbox-test.md +235 -0
- package/skill-pre/references/integration/modules/sandbox/alipay-sandbox-tool.md +142 -0
- package/skill-pre/references/integration/modules/sandbox/sandbox-setup-guide.md +239 -0
- package/skill-pre/references/integration/modules/scripts/local_402_sandbox_pay.py +900 -0
- package/skill-pre/references/integration/modules/scripts/sandbox_config.sh +347 -0
- package/skill-pre/references/integration/modules/troubleshooting-flow.md +28 -0
- package/skill-pre/references/normal/alipay-cli-env.md +169 -0
- package/skill-pre/references/normal/conversation-telemetry.md +101 -0
- package/skill-pre/references/normal/full-process-routing.md +92 -0
- package/skill-pre/references/normal/integration-worker.md +90 -0
- package/skill-pre/references/normal/json/customer-messages.json +1 -0
- package/skill-pre/references/normal/json/managed-jq-assets.json +1 -0
- package/skill-pre/references/normal/json/policy-rules.json +1 -0
- package/skill-pre/references/normal/json/release-channel.json +1 -0
- package/skill-pre/references/normal/rejection-guide.md +41 -0
- package/skill-pre/references/normal/scripts/agent_platform.mjs +43 -0
- package/skill-pre/references/normal/scripts/alipay_cli_env.mjs +34 -0
- package/skill-pre/references/normal/scripts/alipay_cli_env.sh +55 -0
- package/skill-pre/references/normal/scripts/alipay_cli_refresh.mjs +129 -0
- package/skill-pre/references/normal/scripts/auth_runtime_runner.mjs +60 -0
- package/skill-pre/references/normal/scripts/checklist_sections.mjs +43 -0
- package/skill-pre/references/normal/scripts/common.sh +365 -0
- package/skill-pre/references/normal/scripts/conversation_telemetry.mjs +105 -0
- package/skill-pre/references/normal/scripts/detect_dev_tool.sh +79 -0
- package/skill-pre/references/normal/scripts/flow_loader.mjs +237 -0
- package/skill-pre/references/normal/scripts/integration_context_runner.mjs +151 -0
- package/skill-pre/references/normal/scripts/integration_message_runner.mjs +1456 -0
- package/skill-pre/references/normal/scripts/interaction_reply.mjs +140 -0
- package/skill-pre/references/normal/scripts/managed_jq.mjs +215 -0
- package/skill-pre/references/normal/scripts/onboarding_discovery_runner.mjs +387 -0
- package/skill-pre/references/normal/scripts/onboarding_message_runner.mjs +1425 -0
- package/skill-pre/references/normal/scripts/onboarding_recovery_runner.mjs +100 -0
- package/skill-pre/references/normal/scripts/open_official_url.sh +205 -0
- package/skill-pre/references/normal/scripts/platform_compat.mjs +42 -0
- package/skill-pre/references/normal/scripts/preview_runtime.mjs +151 -0
- package/skill-pre/references/normal/scripts/project_route_inspector.sh +132 -0
- package/skill-pre/references/normal/scripts/python_script_runner.mjs +58 -0
- package/skill-pre/references/normal/scripts/render_customer_message.mjs +1792 -0
- package/skill-pre/references/normal/scripts/runtime.mjs +271 -0
- package/skill-pre/references/normal/scripts/self_update.mjs +376 -0
- package/skill-pre/references/normal/scripts/telemetry.mjs +2102 -0
- package/skill-pre/references/normal/self-update.md +7 -0
- package/skill-pre/references/normal/telemetry.md +70 -0
- package/skill-pre/references/onboarding/assets/keygen.html +927 -0
- package/skill-pre/references/onboarding/flow.md +607 -0
- package/skill-pre/references/onboarding/modules/app-release.md +90 -0
- package/skill-pre/references/onboarding/modules/authorization.md +43 -0
- package/skill-pre/references/onboarding/modules/error-handling.md +62 -0
- package/skill-pre/references/onboarding/modules/product-sign.md +49 -0
- package/skill-pre/references/onboarding/modules/scripts/app.sh +1485 -0
- package/skill-pre/references/onboarding/modules/scripts/ar_sign_apply.sh +331 -0
- package/skill-pre/references/onboarding/modules/scripts/auth.sh +1040 -0
- package/skill-pre/references/onboarding/modules/scripts/download_key_tool.sh +4 -0
- package/skill-pre/references/onboarding/modules/scripts/error_handler.sh +841 -0
- package/skill-pre/references/onboarding/modules/scripts/mcc.sh +1085 -0
- package/skill-pre/references/onboarding/modules/scripts/network_retry.sh +135 -0
- package/skill-pre/references/onboarding/modules/scripts/query_sign_status.sh +105 -0
- package/skill-pre/references/onboarding/modules/scripts/service.sh +528 -0
- package/skill-pre/references/onboarding/modules/scripts/sign_status_parser.sh +58 -0
- package/skill-pre/references/onboarding/modules/scripts/upload_screenshots.sh +208 -0
- package/skill-pre/references/onboarding/modules/scripts/upload_special_license.sh +195 -0
- package/skill-pre/references/onboarding/modules/service-registration.md +40 -0
- package/skill-pre/references/runtime-entry.md +99 -0
- package/dist/commands/install-current.d.ts +0 -4
- package/dist/commands/install-current.d.ts.map +0 -1
- package/dist/commands/install-current.js.map +0 -1
- package/dist/commands/install.d.ts +0 -10
- package/dist/commands/install.d.ts.map +0 -1
- package/dist/commands/install.js.map +0 -1
- package/dist/commands/prepare-tools.d.ts +0 -5
- package/dist/commands/prepare-tools.d.ts.map +0 -1
- package/dist/commands/prepare-tools.js.map +0 -1
- package/dist/commands/uninstall.d.ts +0 -10
- package/dist/commands/uninstall.d.ts.map +0 -1
- package/dist/commands/uninstall.js.map +0 -1
- package/dist/commands/update.d.ts +0 -10
- package/dist/commands/update.d.ts.map +0 -1
- package/dist/commands/update.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types.d.ts +0 -42
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/alipay-cli.d.ts +0 -20
- package/dist/utils/alipay-cli.d.ts.map +0 -1
- package/dist/utils/alipay-cli.js.map +0 -1
- package/dist/utils/config.d.ts +0 -52
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/config.js.map +0 -1
- package/dist/utils/file.d.ts +0 -77
- package/dist/utils/file.d.ts.map +0 -1
- package/dist/utils/file.js.map +0 -1
- package/dist/utils/jq.d.ts +0 -17
- package/dist/utils/jq.d.ts.map +0 -1
- package/dist/utils/jq.js.map +0 -1
- package/dist/utils/npm.d.ts +0 -17
- package/dist/utils/npm.d.ts.map +0 -1
- package/dist/utils/npm.js.map +0 -1
- package/dist/utils/shell.d.ts +0 -24
- package/dist/utils/shell.d.ts.map +0 -1
- package/dist/utils/shell.js.map +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# 统一收单交易关闭接口 - PHP 示例
|
|
2
|
+
|
|
3
|
+
## 请求示例
|
|
4
|
+
|
|
5
|
+
```php
|
|
6
|
+
<?php
|
|
7
|
+
require_once __DIR__ . '/aop/AopClient.php';
|
|
8
|
+
require_once __DIR__ . '/aop/request/AlipayTradeCloseRequest.php';
|
|
9
|
+
|
|
10
|
+
// 初始化 SDK(PHP 使用 PKCS#1 格式私钥,Java 使用 PKCS#8 格式,请勿混用)
|
|
11
|
+
$aop = new AopClient();
|
|
12
|
+
$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
|
|
13
|
+
// 沙箱环境: $aop->gatewayUrl = 'https://openapi-sandbox.dl.alipaydev.com/gateway.do';
|
|
14
|
+
$aop->appId = '<-- 请填写您的AppId,例如:20190xxxxxx -->';
|
|
15
|
+
$aop->rsaPrivateKey = '<-- 请填写您的应用私钥(PKCS#1格式),例如:MIIE...(脱敏示例) -->';
|
|
16
|
+
$aop->alipayrsaPublicKey = '<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->';
|
|
17
|
+
$aop->format = 'json';
|
|
18
|
+
$aop->postCharset = 'UTF-8';
|
|
19
|
+
$aop->signType = 'RSA2';
|
|
20
|
+
|
|
21
|
+
// 构造请求参数
|
|
22
|
+
$request = new AlipayTradeCloseRequest();
|
|
23
|
+
$bizContent = [
|
|
24
|
+
'out_trade_no' => 'MERCHANT_ORDER_NO_PLACEHOLDER', // 商户订单号,与 trade_no 二选一
|
|
25
|
+
// 'trade_no' => 'ALIPAY_TRADE_NO_PLACEHOLDER', // 支付宝交易号,同时传时以 trade_no 为准
|
|
26
|
+
];
|
|
27
|
+
$request->setBizContent(json_encode($bizContent, JSON_UNESCAPED_UNICODE));
|
|
28
|
+
|
|
29
|
+
// 调用接口
|
|
30
|
+
$response = $aop->execute($request);
|
|
31
|
+
$responseApiName = str_replace('.', '_', $request->getApiMethodName()) . '_response';
|
|
32
|
+
$result = $response->$responseApiName;
|
|
33
|
+
|
|
34
|
+
if (!empty($result->code) && $result->code == '10000') {
|
|
35
|
+
echo "交易关闭成功";
|
|
36
|
+
} else {
|
|
37
|
+
echo "调用失败: " . $result->sub_code . " - " . $result->sub_msg;
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 响应示例
|
|
42
|
+
### 正常示例
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"code": "10000",
|
|
46
|
+
"msg": "Success",
|
|
47
|
+
"trade_no": "ALIPAY_TRADE_NO_PLACEHOLDER",
|
|
48
|
+
"out_trade_no": "MERCHANT_ORDER_NO_PLACEHOLDER"
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
### 异常示例
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"code": "20000",
|
|
55
|
+
"msg": "Service Currently Unavailable",
|
|
56
|
+
"sub_code": "isp.unknow-error",
|
|
57
|
+
"sub_msg": "系统繁忙"
|
|
58
|
+
}
|
|
59
|
+
```
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# 统一收单交易查询接口 - PHP 示例
|
|
2
|
+
|
|
3
|
+
## 请求示例
|
|
4
|
+
|
|
5
|
+
```php
|
|
6
|
+
<?php
|
|
7
|
+
require_once __DIR__ . '/aop/AopClient.php';
|
|
8
|
+
require_once __DIR__ . '/aop/request/AlipayTradeQueryRequest.php';
|
|
9
|
+
|
|
10
|
+
// 初始化 SDK(PHP 使用 PKCS#1 格式私钥,Java 使用 PKCS#8 格式,请勿混用)
|
|
11
|
+
$aop = new AopClient();
|
|
12
|
+
$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
|
|
13
|
+
// 沙箱环境: $aop->gatewayUrl = 'https://openapi-sandbox.dl.alipaydev.com/gateway.do';
|
|
14
|
+
$aop->appId = '<-- 请填写您的AppId,例如:20190xxxxxx -->';
|
|
15
|
+
$aop->rsaPrivateKey = '<-- 请填写您的应用私钥(PKCS#1格式),例如:MIIE...(脱敏示例) -->';
|
|
16
|
+
$aop->alipayrsaPublicKey = '<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->';
|
|
17
|
+
$aop->format = 'json';
|
|
18
|
+
$aop->postCharset = 'UTF-8';
|
|
19
|
+
$aop->signType = 'RSA2';
|
|
20
|
+
|
|
21
|
+
// 构造请求参数
|
|
22
|
+
$request = new AlipayTradeQueryRequest();
|
|
23
|
+
$bizContent = [
|
|
24
|
+
'out_trade_no' => 'MERCHANT_ORDER_NO_PLACEHOLDER', // 商户订单号,与 trade_no 二选一
|
|
25
|
+
// 'trade_no' => 'ALIPAY_TRADE_NO_PLACEHOLDER', // 支付宝交易号,同时传时以 trade_no 为准
|
|
26
|
+
];
|
|
27
|
+
$request->setBizContent(json_encode($bizContent, JSON_UNESCAPED_UNICODE));
|
|
28
|
+
|
|
29
|
+
// 调用接口
|
|
30
|
+
$response = $aop->execute($request);
|
|
31
|
+
$responseApiName = str_replace('.', '_', $request->getApiMethodName()) . '_response';
|
|
32
|
+
$result = $response->$responseApiName;
|
|
33
|
+
|
|
34
|
+
if (!empty($result->code) && $result->code == '10000') {
|
|
35
|
+
$businessStates = [
|
|
36
|
+
'TRADE_SUCCESS' => 'PAID',
|
|
37
|
+
'TRADE_FINISHED' => 'PAID',
|
|
38
|
+
'WAIT_BUYER_PAY' => 'PENDING_PAYMENT',
|
|
39
|
+
'TRADE_CLOSED' => 'CLOSED',
|
|
40
|
+
];
|
|
41
|
+
$businessState = $businessStates[$result->trade_status] ?? 'UNKNOWN';
|
|
42
|
+
echo "业务状态: {$businessState}, 支付宝状态: {$result->trade_status}, 订单金额: {$result->total_amount}";
|
|
43
|
+
} else {
|
|
44
|
+
echo "调用失败: " . $result->sub_code . " - " . $result->sub_msg;
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 响应示例
|
|
49
|
+
### 正常示例
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"code": "10000",
|
|
53
|
+
"msg": "Success",
|
|
54
|
+
"trade_no": "ALIPAY_TRADE_NO_PLACEHOLDER",
|
|
55
|
+
"out_trade_no": "MERCHANT_ORDER_NO_PLACEHOLDER",
|
|
56
|
+
"trade_status": "TRADE_SUCCESS",
|
|
57
|
+
"total_amount": "88.88",
|
|
58
|
+
"buyer_pay_amount": "8.88",
|
|
59
|
+
"receipt_amount": "15.25",
|
|
60
|
+
"buyer_logon_id": "159****5620",
|
|
61
|
+
"buyer_user_id": "<BUYER_USER_ID>",
|
|
62
|
+
"send_pay_date": "2014-11-27 15:45:57"
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
### 异常示例
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"code": "20000",
|
|
69
|
+
"msg": "Service Currently Unavailable",
|
|
70
|
+
"sub_code": "isp.unknow-error",
|
|
71
|
+
"sub_msg": "系统繁忙"
|
|
72
|
+
}
|
|
73
|
+
```
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# 统一收单交易退款接口 - PHP 示例
|
|
2
|
+
|
|
3
|
+
## 请求示例
|
|
4
|
+
|
|
5
|
+
```php
|
|
6
|
+
<?php
|
|
7
|
+
require_once __DIR__ . '/aop/AopClient.php';
|
|
8
|
+
require_once __DIR__ . '/aop/request/AlipayTradeRefundRequest.php';
|
|
9
|
+
|
|
10
|
+
// 初始化 SDK(PHP 使用 PKCS#1 格式私钥,Java 使用 PKCS#8 格式,请勿混用)
|
|
11
|
+
$aop = new AopClient();
|
|
12
|
+
$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
|
|
13
|
+
// 沙箱环境: $aop->gatewayUrl = 'https://openapi-sandbox.dl.alipaydev.com/gateway.do';
|
|
14
|
+
$aop->appId = '<-- 请填写您的AppId,例如:20190xxxxxx -->';
|
|
15
|
+
$aop->rsaPrivateKey = '<-- 请填写您的应用私钥(PKCS#1格式),例如:MIIE...(脱敏示例) -->';
|
|
16
|
+
$aop->alipayrsaPublicKey = '<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->';
|
|
17
|
+
$aop->format = 'json';
|
|
18
|
+
$aop->postCharset = 'UTF-8';
|
|
19
|
+
$aop->signType = 'RSA2';
|
|
20
|
+
|
|
21
|
+
// 构造请求参数
|
|
22
|
+
$request = new AlipayTradeRefundRequest();
|
|
23
|
+
$bizContent = [
|
|
24
|
+
'out_trade_no' => 'MERCHANT_ORDER_NO_PLACEHOLDER', // 商户订单号
|
|
25
|
+
// 'trade_no' => 'ALIPAY_TRADE_NO_PLACEHOLDER', // 支付宝交易号,与 out_trade_no 二选一
|
|
26
|
+
'refund_amount' => '0.01', // 使用十进制定点金额;调用前校验累计退款不超过原订单实付金额
|
|
27
|
+
'refund_reason' => '测试退款', // 退款原因
|
|
28
|
+
'out_request_no' => 'OUT_REQUEST_NO_PLACEHOLDER', // 新退款使用新编号;同一退款失败重试必须复用原编号和原参数
|
|
29
|
+
];
|
|
30
|
+
$request->setBizContent(json_encode($bizContent, JSON_UNESCAPED_UNICODE));
|
|
31
|
+
|
|
32
|
+
// 调用接口
|
|
33
|
+
$response = $aop->execute($request);
|
|
34
|
+
$responseApiName = str_replace('.', '_', $request->getApiMethodName()) . '_response';
|
|
35
|
+
$result = $response->$responseApiName;
|
|
36
|
+
|
|
37
|
+
if (!empty($result->code) && $result->code == '10000') {
|
|
38
|
+
if (($result->fund_change ?? null) === 'Y') {
|
|
39
|
+
echo "退款资金已发生变化,退款金额: " . $result->refund_fee;
|
|
40
|
+
} else {
|
|
41
|
+
echo "退款结果待确认:使用同一 out_request_no 调用 alipay.trade.fastpay.refund.query";
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
echo "调用失败: " . $result->sub_code . " - " . $result->sub_msg;
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 响应示例
|
|
49
|
+
### 正常示例
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"code": "10000",
|
|
53
|
+
"msg": "Success",
|
|
54
|
+
"trade_no": "ALIPAY_TRADE_NO_PLACEHOLDER",
|
|
55
|
+
"out_trade_no": "MERCHANT_ORDER_NO_PLACEHOLDER",
|
|
56
|
+
"buyer_logon_id": "159****5620",
|
|
57
|
+
"fund_change": "Y",
|
|
58
|
+
"refund_fee": "0.01"
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
### 异常示例
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"code": "20000",
|
|
65
|
+
"msg": "Service Currently Unavailable",
|
|
66
|
+
"sub_code": "isp.unknow-error",
|
|
67
|
+
"sub_msg": "系统繁忙"
|
|
68
|
+
}
|
|
69
|
+
```
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# 统一收单交易退款查询接口 - PHP 示例
|
|
2
|
+
|
|
3
|
+
## 请求示例
|
|
4
|
+
|
|
5
|
+
```php
|
|
6
|
+
<?php
|
|
7
|
+
require_once __DIR__ . '/aop/AopClient.php';
|
|
8
|
+
require_once __DIR__ . '/aop/request/AlipayTradeFastpayRefundQueryRequest.php';
|
|
9
|
+
|
|
10
|
+
// 初始化 SDK(PHP 使用 PKCS#1 格式私钥,Java 使用 PKCS#8 格式,请勿混用)
|
|
11
|
+
$aop = new AopClient();
|
|
12
|
+
$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
|
|
13
|
+
// 沙箱环境: $aop->gatewayUrl = 'https://openapi-sandbox.dl.alipaydev.com/gateway.do';
|
|
14
|
+
$aop->appId = '<-- 请填写您的AppId,例如:20190xxxxxx -->';
|
|
15
|
+
$aop->rsaPrivateKey = '<-- 请填写您的应用私钥(PKCS#1格式),例如:MIIE...(脱敏示例) -->';
|
|
16
|
+
$aop->alipayrsaPublicKey = '<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->';
|
|
17
|
+
$aop->format = 'json';
|
|
18
|
+
$aop->postCharset = 'UTF-8';
|
|
19
|
+
$aop->signType = 'RSA2';
|
|
20
|
+
|
|
21
|
+
// 构造请求参数
|
|
22
|
+
$request = new AlipayTradeFastpayRefundQueryRequest();
|
|
23
|
+
$bizContent = [
|
|
24
|
+
'out_trade_no' => 'MERCHANT_ORDER_NO_PLACEHOLDER', // 商户订单号
|
|
25
|
+
'out_request_no' => 'OUT_REQUEST_NO_PLACEHOLDER', // 退款请求号,必填
|
|
26
|
+
];
|
|
27
|
+
$request->setBizContent(json_encode($bizContent, JSON_UNESCAPED_UNICODE));
|
|
28
|
+
|
|
29
|
+
// 调用接口
|
|
30
|
+
$response = $aop->execute($request);
|
|
31
|
+
$responseApiName = str_replace('.', '_', $request->getApiMethodName()) . '_response';
|
|
32
|
+
$result = $response->$responseApiName;
|
|
33
|
+
|
|
34
|
+
if (!empty($result->code) && $result->code == '10000') {
|
|
35
|
+
// refund_status: REFUND_SUCCESS 表示退款成功
|
|
36
|
+
echo "退款状态: " . $result->refund_status . ", 退款金额: " . $result->refund_amount;
|
|
37
|
+
} else {
|
|
38
|
+
echo "调用失败: " . $result->sub_code . " - " . $result->sub_msg;
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 响应示例
|
|
43
|
+
### 正常示例
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"code": "10000",
|
|
47
|
+
"msg": "Success",
|
|
48
|
+
"trade_no": "ALIPAY_TRADE_NO_PLACEHOLDER",
|
|
49
|
+
"out_trade_no": "MERCHANT_ORDER_NO_PLACEHOLDER",
|
|
50
|
+
"out_request_no": "OUT_REQUEST_NO_PLACEHOLDER",
|
|
51
|
+
"total_amount": "0.01",
|
|
52
|
+
"refund_amount": "0.01",
|
|
53
|
+
"refund_status": "REFUND_SUCCESS",
|
|
54
|
+
"gmt_refund_pay": "2014-11-27 15:45:57"
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
### 异常示例
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"code": "20000",
|
|
61
|
+
"msg": "Service Currently Unavailable",
|
|
62
|
+
"sub_code": "isp.unknow-error",
|
|
63
|
+
"sub_msg": "系统繁忙"
|
|
64
|
+
}
|
|
65
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# 统一收单下单并支付页面接口 - PHP 示例
|
|
2
|
+
|
|
3
|
+
## 请求示例
|
|
4
|
+
|
|
5
|
+
```php
|
|
6
|
+
<?php
|
|
7
|
+
require_once __DIR__ . '/aop/AopClient.php';
|
|
8
|
+
require_once __DIR__ . '/aop/request/AlipayTradePagePayRequest.php';
|
|
9
|
+
|
|
10
|
+
// 初始化 SDK(PHP 使用 PKCS#1 格式私钥,Java 使用 PKCS#8 格式,请勿混用)
|
|
11
|
+
$aop = new AopClient();
|
|
12
|
+
$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
|
|
13
|
+
// 沙箱环境: $aop->gatewayUrl = 'https://openapi-sandbox.dl.alipaydev.com/gateway.do';
|
|
14
|
+
$aop->appId = '<-- 请填写您的AppId,例如:20190xxxxxx -->';
|
|
15
|
+
$aop->rsaPrivateKey = '<-- 请填写您的应用私钥(PKCS#1格式),例如:MIIE...(脱敏示例) -->';
|
|
16
|
+
$aop->alipayrsaPublicKey = '<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->';
|
|
17
|
+
$aop->format = 'json';
|
|
18
|
+
$aop->postCharset = 'UTF-8';
|
|
19
|
+
$aop->signType = 'RSA2';
|
|
20
|
+
|
|
21
|
+
// 构造请求参数
|
|
22
|
+
$request = new AlipayTradePagePayRequest();
|
|
23
|
+
$notifyUrl = trim(getenv('ALIPAY_NOTIFY_URL') ?: '');
|
|
24
|
+
if ($notifyUrl !== '') {
|
|
25
|
+
$request->setNotifyUrl($notifyUrl); // 真实生产或公网联调时传入;本地没有公网 HTTPS notify_url 时不要传 null、空字符串或占位 URL
|
|
26
|
+
}
|
|
27
|
+
$request->setReturnUrl('https://your-domain.com/return'); // 默认传入并替换为已验证结果页;仅用户明确关闭同步回跳时省略
|
|
28
|
+
|
|
29
|
+
$bizContent = [
|
|
30
|
+
'out_trade_no' => date('YmdHis') . mt_rand(1000, 9999), // 商户订单号
|
|
31
|
+
'total_amount' => '0.01', // 订单总金额
|
|
32
|
+
'subject' => '测试商品', // 订单标题
|
|
33
|
+
'product_code' => 'FAST_INSTANT_TRADE_PAY', // 网站支付固定值
|
|
34
|
+
];
|
|
35
|
+
$request->setBizContent(json_encode($bizContent, JSON_UNESCAPED_UNICODE));
|
|
36
|
+
|
|
37
|
+
// ⚠️ 网站支付必须使用 pageExecute(),不能使用 execute()
|
|
38
|
+
// ⚠️ 必须使用 POST 模式:pageExecute($request, 'POST')
|
|
39
|
+
$response = $aop->pageExecute($request, 'POST');
|
|
40
|
+
|
|
41
|
+
// pageExecute 返回的是 HTML 表单字符串,前端需要渲染并自动提交
|
|
42
|
+
echo $response;
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
> **⚠️ 关键注意事项:**
|
|
46
|
+
> 1. 必须使用 `pageExecute()` 方法,不能使用 `execute()` 方法
|
|
47
|
+
> 2. 必须使用 POST 模式:`$aop->pageExecute($request, 'POST')`
|
|
48
|
+
> 3. 返回的 HTML 需要前端渲染并自动提交,禁止直接在服务端 redirect
|
|
49
|
+
> 4. PHP 使用 PKCS#1 格式私钥,Java 使用 PKCS#8 格式,请勿混用
|
|
50
|
+
|
|
51
|
+
## 响应示例
|
|
52
|
+
### 正常示例
|
|
53
|
+
```html
|
|
54
|
+
<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">
|
|
55
|
+
<input type="hidden" name="biz_content" value="{"out_trade_no":"MERCHANT_ORDER_NO_PLACEHOLDER","total_amount":"0.01","subject":"测试商品","product_code":"FAST_INSTANT_TRADE_PAY"}">
|
|
56
|
+
<input type="submit" value="立即支付" style="display:none" >
|
|
57
|
+
</form>
|
|
58
|
+
<script>document.forms[0].submit();</script>
|
|
59
|
+
```
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# APP 支付接口 - PHP 示例
|
|
2
|
+
|
|
3
|
+
## 请求示例
|
|
4
|
+
|
|
5
|
+
```php
|
|
6
|
+
<?php
|
|
7
|
+
require_once '../aop/AopClient.php';
|
|
8
|
+
require_once '../aop/AopCertClient.php';
|
|
9
|
+
require_once '../aop/AopCertification.php';
|
|
10
|
+
require_once '../aop/AlipayConfig.php';
|
|
11
|
+
require_once '../aop/request/AlipayTradeAppPayRequest.php';
|
|
12
|
+
|
|
13
|
+
// 初始化SDK
|
|
14
|
+
$alipayClient = new AopClient(getAlipayConfig());
|
|
15
|
+
// 构造请求参数以调用接口
|
|
16
|
+
$request = new AlipayTradeAppPayRequest();
|
|
17
|
+
$notifyUrl = trim(getenv('ALIPAY_NOTIFY_URL') ?: '');
|
|
18
|
+
if ($notifyUrl !== '') {
|
|
19
|
+
$request->setNotifyUrl($notifyUrl); // 真实生产或公网联调时传入;本地没有公网 HTTPS notify_url 时不要传 null、空字符串或占位 URL
|
|
20
|
+
}
|
|
21
|
+
$model = array();
|
|
22
|
+
|
|
23
|
+
// 设置商户订单号
|
|
24
|
+
$model['out_trade_no'] = "MERCHANT_ORDER_NO_PLACEHOLDER";
|
|
25
|
+
|
|
26
|
+
// 设置订单总金额
|
|
27
|
+
$model['total_amount'] = "9.00";
|
|
28
|
+
|
|
29
|
+
// 设置订单标题
|
|
30
|
+
$model['subject'] = "大乐透";
|
|
31
|
+
|
|
32
|
+
// 设置产品码
|
|
33
|
+
$model['product_code'] = "QUICK_MSECURITY_PAY";
|
|
34
|
+
|
|
35
|
+
// 设置订单包含的商品列表信息
|
|
36
|
+
$goodsDetail = array();
|
|
37
|
+
$goodsDetail0 = array();
|
|
38
|
+
$goodsDetail0['goods_name'] = "ipad";
|
|
39
|
+
$goodsDetail0['alipay_goods_id'] = "20010001";
|
|
40
|
+
$goodsDetail0['quantity'] = 1;
|
|
41
|
+
$goodsDetail0['price'] = "2000";
|
|
42
|
+
$goodsDetail0['goods_id'] = "apple-01";
|
|
43
|
+
$goodsDetail0['goods_category'] = "34543238";
|
|
44
|
+
$goodsDetail0['categories_tree'] = "124868003|126232002|126252004";
|
|
45
|
+
$goodsDetail0['show_url'] = "http://www.alipay.com/xxx.jpg";
|
|
46
|
+
$goodsDetail[] = $goodsDetail0;
|
|
47
|
+
$model['goods_detail'] = $goodsDetail;
|
|
48
|
+
|
|
49
|
+
// 设置订单绝对超时时间
|
|
50
|
+
$model['time_expire'] = "2016-12-31 10:05:00";
|
|
51
|
+
|
|
52
|
+
// 设置业务扩展参数
|
|
53
|
+
$extendParams = array();
|
|
54
|
+
$extendParams['sys_service_provider_id'] = "<SYS_SERVICE_PROVIDER_ID>";
|
|
55
|
+
$extendParams['hb_fq_seller_percent'] = "100";
|
|
56
|
+
$extendParams['hb_fq_num'] = "3";
|
|
57
|
+
$extendParams['industry_reflux_info'] = "{\"scene_code\":\"metro_tradeorder\",\"channel\":\"xxxx\",\"scene_data\":{\"asset_name\":\"ALIPAY\"}}";
|
|
58
|
+
$extendParams['royalty_freeze'] = "true";
|
|
59
|
+
$extendParams['card_type'] = "S0JP0000";
|
|
60
|
+
$model['extend_params'] = $extendParams;
|
|
61
|
+
|
|
62
|
+
// 设置公用回传参数
|
|
63
|
+
$model['passback_params'] = "merchantBizType%3d3C%26merchantBizNo%3dMERCHANT_BIZ_NO_PLACEHOLDER";
|
|
64
|
+
|
|
65
|
+
// 设置商户的原始订单号
|
|
66
|
+
$model['merchant_order_no'] = "MERCHANT_ORDER_NO_PLACEHOLDER";
|
|
67
|
+
|
|
68
|
+
// 设置外部指定买家
|
|
69
|
+
$extUserInfo = array();
|
|
70
|
+
$extUserInfo['cert_type'] = "IDENTITY_CARD";
|
|
71
|
+
$extUserInfo['cert_no'] = "<CERT_NO>";
|
|
72
|
+
$extUserInfo['mobile'] = "<MOBILE>";
|
|
73
|
+
$extUserInfo['name'] = "李明";
|
|
74
|
+
$extUserInfo['min_age'] = "18";
|
|
75
|
+
$extUserInfo['need_check_info'] = "F";
|
|
76
|
+
$extUserInfo['identity_hash'] = "<IDENTITY_HASH>";
|
|
77
|
+
$model['ext_user_info'] = $extUserInfo;
|
|
78
|
+
|
|
79
|
+
// 设置通知参数选项
|
|
80
|
+
$queryOptions = array();
|
|
81
|
+
$queryOptions[] = "hyb_amount";
|
|
82
|
+
$queryOptions[] = "enterprise_pay_info";
|
|
83
|
+
$model['query_options'] = $queryOptions;
|
|
84
|
+
|
|
85
|
+
$request->setBizContent(json_encode($model,JSON_UNESCAPED_UNICODE));
|
|
86
|
+
// 如果是第三方代调用模式,请设置app_auth_token(应用授权令牌)
|
|
87
|
+
$orderStr = $alipayClient->sdkExecute($request, "<-- 请填写应用授权令牌 -->");
|
|
88
|
+
echo $orderStr;
|
|
89
|
+
|
|
90
|
+
function getAlipayConfig()
|
|
91
|
+
{
|
|
92
|
+
$privateKey = '<-- 请填写您的应用私钥,例如:MIIE...(脱敏示例) -->';
|
|
93
|
+
$alipayPublicKey = '<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->';
|
|
94
|
+
$alipayConfig = new AlipayConfig();
|
|
95
|
+
$alipayConfig->setServerUrl('https://openapi.alipay.com/gateway.do');
|
|
96
|
+
$alipayConfig->setAppId('<-- 请填写您的AppId,例如:20190xxxxxx -->');
|
|
97
|
+
$alipayConfig->setPrivateKey($privateKey);
|
|
98
|
+
$alipayConfig->setFormat('json');
|
|
99
|
+
$alipayConfig->setAlipayPublicKey($alipayPublicKey);
|
|
100
|
+
$alipayConfig->setCharset('UTF-8');
|
|
101
|
+
$alipayConfig->setSignType('RSA2');
|
|
102
|
+
return $alipayConfig;
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 响应示例
|
|
107
|
+
### 正常示例
|
|
108
|
+
```
|
|
109
|
+
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
|
|
110
|
+
```
|