@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.
Files changed (169) hide show
  1. package/README.md +30 -0
  2. package/dist/commands/install-current.js +15 -7
  3. package/dist/commands/install.js +20 -16
  4. package/dist/commands/uninstall.js +8 -3
  5. package/dist/commands/update.js +34 -16
  6. package/dist/index.js +10 -4
  7. package/dist/utils/channels.js +67 -0
  8. package/dist/utils/config.js +15 -11
  9. package/dist/utils/file.js +23 -10
  10. package/dist/utils/npm.js +19 -33
  11. package/package.json +8 -3
  12. package/skill/SKILL.md +2 -0
  13. package/skill/references/normal/json/release-channel.json +1 -0
  14. package/skill/references/normal/scripts/self_update.mjs +62 -17
  15. package/skill/references/normal/self-update.md +3 -1
  16. package/skill-pre/SKILL.md +65 -0
  17. package/skill-pre/VERSION +1 -0
  18. package/skill-pre/references/integration/flow.md +602 -0
  19. package/skill-pre/references/integration/modules/alipay-sdk-reminder.md +281 -0
  20. package/skill-pre/references/integration/modules/checklist.md +154 -0
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. 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
  28. 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
  29. 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
  30. 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
  31. 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
  32. 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
  33. 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
  34. 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
  35. 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
  36. 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
  37. 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
  38. 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
  39. 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
  40. 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
  41. 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
  42. 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
  43. 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
  44. 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
  45. 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
  46. 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
  47. 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
  48. 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
  49. 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
  50. 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
  51. 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
  52. 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
  53. 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
  54. 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
  55. 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
  56. 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
  57. 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
  58. 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
  59. 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
  60. 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
  61. package/skill-pre/references/integration/modules/interface-contract/aipay-interface-contract.md +52 -0
  62. package/skill-pre/references/integration/modules/interface-contract/apppay-interface-contract.md +45 -0
  63. package/skill-pre/references/integration/modules/interface-contract/common-trade-contract.md +42 -0
  64. package/skill-pre/references/integration/modules/interface-contract/notify-url-contract.md +68 -0
  65. package/skill-pre/references/integration/modules/interface-contract/webpay-interface-contract.md +44 -0
  66. package/skill-pre/references/integration/modules/interface-guide.md +61 -0
  67. package/skill-pre/references/integration/modules/product-decision.md +73 -0
  68. package/skill-pre/references/integration/modules/sandbox/a2m-sandbox-test.md +235 -0
  69. package/skill-pre/references/integration/modules/sandbox/alipay-sandbox-tool.md +142 -0
  70. package/skill-pre/references/integration/modules/sandbox/sandbox-setup-guide.md +239 -0
  71. package/skill-pre/references/integration/modules/scripts/local_402_sandbox_pay.py +900 -0
  72. package/skill-pre/references/integration/modules/scripts/sandbox_config.sh +347 -0
  73. package/skill-pre/references/integration/modules/troubleshooting-flow.md +28 -0
  74. package/skill-pre/references/normal/alipay-cli-env.md +169 -0
  75. package/skill-pre/references/normal/conversation-telemetry.md +101 -0
  76. package/skill-pre/references/normal/full-process-routing.md +92 -0
  77. package/skill-pre/references/normal/integration-worker.md +90 -0
  78. package/skill-pre/references/normal/json/customer-messages.json +1 -0
  79. package/skill-pre/references/normal/json/managed-jq-assets.json +1 -0
  80. package/skill-pre/references/normal/json/policy-rules.json +1 -0
  81. package/skill-pre/references/normal/json/release-channel.json +1 -0
  82. package/skill-pre/references/normal/rejection-guide.md +41 -0
  83. package/skill-pre/references/normal/scripts/agent_platform.mjs +43 -0
  84. package/skill-pre/references/normal/scripts/alipay_cli_env.mjs +34 -0
  85. package/skill-pre/references/normal/scripts/alipay_cli_env.sh +55 -0
  86. package/skill-pre/references/normal/scripts/alipay_cli_refresh.mjs +129 -0
  87. package/skill-pre/references/normal/scripts/auth_runtime_runner.mjs +60 -0
  88. package/skill-pre/references/normal/scripts/checklist_sections.mjs +43 -0
  89. package/skill-pre/references/normal/scripts/common.sh +365 -0
  90. package/skill-pre/references/normal/scripts/conversation_telemetry.mjs +105 -0
  91. package/skill-pre/references/normal/scripts/detect_dev_tool.sh +79 -0
  92. package/skill-pre/references/normal/scripts/flow_loader.mjs +237 -0
  93. package/skill-pre/references/normal/scripts/integration_context_runner.mjs +151 -0
  94. package/skill-pre/references/normal/scripts/integration_message_runner.mjs +1456 -0
  95. package/skill-pre/references/normal/scripts/interaction_reply.mjs +140 -0
  96. package/skill-pre/references/normal/scripts/managed_jq.mjs +215 -0
  97. package/skill-pre/references/normal/scripts/onboarding_discovery_runner.mjs +387 -0
  98. package/skill-pre/references/normal/scripts/onboarding_message_runner.mjs +1425 -0
  99. package/skill-pre/references/normal/scripts/onboarding_recovery_runner.mjs +100 -0
  100. package/skill-pre/references/normal/scripts/open_official_url.sh +205 -0
  101. package/skill-pre/references/normal/scripts/platform_compat.mjs +42 -0
  102. package/skill-pre/references/normal/scripts/preview_runtime.mjs +151 -0
  103. package/skill-pre/references/normal/scripts/project_route_inspector.sh +132 -0
  104. package/skill-pre/references/normal/scripts/python_script_runner.mjs +58 -0
  105. package/skill-pre/references/normal/scripts/render_customer_message.mjs +1792 -0
  106. package/skill-pre/references/normal/scripts/runtime.mjs +271 -0
  107. package/skill-pre/references/normal/scripts/self_update.mjs +376 -0
  108. package/skill-pre/references/normal/scripts/telemetry.mjs +2102 -0
  109. package/skill-pre/references/normal/self-update.md +7 -0
  110. package/skill-pre/references/normal/telemetry.md +70 -0
  111. package/skill-pre/references/onboarding/assets/keygen.html +927 -0
  112. package/skill-pre/references/onboarding/flow.md +607 -0
  113. package/skill-pre/references/onboarding/modules/app-release.md +90 -0
  114. package/skill-pre/references/onboarding/modules/authorization.md +43 -0
  115. package/skill-pre/references/onboarding/modules/error-handling.md +62 -0
  116. package/skill-pre/references/onboarding/modules/product-sign.md +49 -0
  117. package/skill-pre/references/onboarding/modules/scripts/app.sh +1485 -0
  118. package/skill-pre/references/onboarding/modules/scripts/ar_sign_apply.sh +331 -0
  119. package/skill-pre/references/onboarding/modules/scripts/auth.sh +1040 -0
  120. package/skill-pre/references/onboarding/modules/scripts/download_key_tool.sh +4 -0
  121. package/skill-pre/references/onboarding/modules/scripts/error_handler.sh +841 -0
  122. package/skill-pre/references/onboarding/modules/scripts/mcc.sh +1085 -0
  123. package/skill-pre/references/onboarding/modules/scripts/network_retry.sh +135 -0
  124. package/skill-pre/references/onboarding/modules/scripts/query_sign_status.sh +105 -0
  125. package/skill-pre/references/onboarding/modules/scripts/service.sh +528 -0
  126. package/skill-pre/references/onboarding/modules/scripts/sign_status_parser.sh +58 -0
  127. package/skill-pre/references/onboarding/modules/scripts/upload_screenshots.sh +208 -0
  128. package/skill-pre/references/onboarding/modules/scripts/upload_special_license.sh +195 -0
  129. package/skill-pre/references/onboarding/modules/service-registration.md +40 -0
  130. package/skill-pre/references/runtime-entry.md +99 -0
  131. package/dist/commands/install-current.d.ts +0 -4
  132. package/dist/commands/install-current.d.ts.map +0 -1
  133. package/dist/commands/install-current.js.map +0 -1
  134. package/dist/commands/install.d.ts +0 -10
  135. package/dist/commands/install.d.ts.map +0 -1
  136. package/dist/commands/install.js.map +0 -1
  137. package/dist/commands/prepare-tools.d.ts +0 -5
  138. package/dist/commands/prepare-tools.d.ts.map +0 -1
  139. package/dist/commands/prepare-tools.js.map +0 -1
  140. package/dist/commands/uninstall.d.ts +0 -10
  141. package/dist/commands/uninstall.d.ts.map +0 -1
  142. package/dist/commands/uninstall.js.map +0 -1
  143. package/dist/commands/update.d.ts +0 -10
  144. package/dist/commands/update.d.ts.map +0 -1
  145. package/dist/commands/update.js.map +0 -1
  146. package/dist/index.d.ts +0 -2
  147. package/dist/index.d.ts.map +0 -1
  148. package/dist/index.js.map +0 -1
  149. package/dist/types.d.ts +0 -42
  150. package/dist/types.d.ts.map +0 -1
  151. package/dist/types.js.map +0 -1
  152. package/dist/utils/alipay-cli.d.ts +0 -20
  153. package/dist/utils/alipay-cli.d.ts.map +0 -1
  154. package/dist/utils/alipay-cli.js.map +0 -1
  155. package/dist/utils/config.d.ts +0 -52
  156. package/dist/utils/config.d.ts.map +0 -1
  157. package/dist/utils/config.js.map +0 -1
  158. package/dist/utils/file.d.ts +0 -77
  159. package/dist/utils/file.d.ts.map +0 -1
  160. package/dist/utils/file.js.map +0 -1
  161. package/dist/utils/jq.d.ts +0 -17
  162. package/dist/utils/jq.d.ts.map +0 -1
  163. package/dist/utils/jq.js.map +0 -1
  164. package/dist/utils/npm.d.ts +0 -17
  165. package/dist/utils/npm.d.ts.map +0 -1
  166. package/dist/utils/npm.js.map +0 -1
  167. package/dist/utils/shell.d.ts +0 -24
  168. package/dist/utils/shell.d.ts.map +0 -1
  169. package/dist/utils/shell.js.map +0 -1
@@ -0,0 +1,68 @@
1
+ # 统一收单交易关闭接口 - C# 示例
2
+
3
+ ## 请求示例
4
+
5
+ ```csharp
6
+ using Aop.Api;
7
+ using Aop.Api.Request;
8
+ using Aop.Api.Response;
9
+ using Aop.Api.Domain;
10
+
11
+ // 初始化SDK(C#/.NET 使用 PKCS#1 格式私钥,Java 使用 PKCS#8 格式,请勿混用)
12
+ IAopClient alipayClient = new DefaultAopClient(GetAlipayConfig());
13
+
14
+ var request = new AlipayTradeCloseRequest();
15
+ var model = new AlipayTradeCloseModel
16
+ {
17
+ OutTradeNo = "MERCHANT_ORDER_NO_PLACEHOLDER", // 商户订单号,与 TradeNo 二选一
18
+ // TradeNo = "ALIPAY_TRADE_NO_PLACEHOLDER", // 支付宝交易号,同时传时以 TradeNo 为准
19
+ };
20
+ request.SetBizModel(model);
21
+
22
+ AlipayTradeCloseResponse response = alipayClient.Execute(request);
23
+
24
+ if (!response.IsError)
25
+ {
26
+ Console.WriteLine("交易关闭成功");
27
+ }
28
+ else
29
+ {
30
+ Console.WriteLine($"调用失败: {response.SubCode} - {response.SubMsg}");
31
+ }
32
+
33
+ private static AlipayConfig GetAlipayConfig()
34
+ {
35
+ string privateKey = "<-- 请填写您的应用私钥,例如:MIIE...(脱敏示例) -->";
36
+ string alipayPublicKey = "<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->";
37
+ AlipayConfig alipayConfig = new AlipayConfig();
38
+ alipayConfig.ServerUrl = "https://openapi.alipay.com/gateway.do";
39
+ // 沙箱环境: alipayConfig.ServerUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
40
+ alipayConfig.AppId = "<-- 请填写您的AppId,例如:20190xxxxxx -->";
41
+ alipayConfig.PrivateKey = privateKey;
42
+ alipayConfig.Format = "json";
43
+ alipayConfig.AlipayPublicKey = alipayPublicKey;
44
+ alipayConfig.Charset = "UTF-8";
45
+ alipayConfig.SignType = "RSA2";
46
+ return alipayConfig;
47
+ }
48
+ ```
49
+
50
+ ## 响应示例
51
+ ### 正常示例
52
+ ```json
53
+ {
54
+ "code": "10000",
55
+ "msg": "Success",
56
+ "trade_no": "ALIPAY_TRADE_NO_PLACEHOLDER",
57
+ "out_trade_no": "MERCHANT_ORDER_NO_PLACEHOLDER"
58
+ }
59
+ ```
60
+ ### 异常示例
61
+ ```json
62
+ {
63
+ "code": "20000",
64
+ "msg": "Service Currently Unavailable",
65
+ "sub_code": "isp.unknow-error",
66
+ "sub_msg": "系统繁忙"
67
+ }
68
+ ```
@@ -0,0 +1,83 @@
1
+ # 统一收单交易查询接口 - C# 示例
2
+
3
+ ## 请求示例
4
+
5
+ ```csharp
6
+ using Aop.Api;
7
+ using Aop.Api.Request;
8
+ using Aop.Api.Response;
9
+ using Aop.Api.Domain;
10
+
11
+ // 初始化SDK(C#/.NET 使用 PKCS#1 格式私钥,Java 使用 PKCS#8 格式,请勿混用)
12
+ IAopClient alipayClient = new DefaultAopClient(GetAlipayConfig());
13
+
14
+ var request = new AlipayTradeQueryRequest();
15
+ var model = new AlipayTradeQueryModel
16
+ {
17
+ OutTradeNo = "MERCHANT_ORDER_NO_PLACEHOLDER", // 商户订单号,与 TradeNo 二选一
18
+ // TradeNo = "ALIPAY_TRADE_NO_PLACEHOLDER", // 支付宝交易号,同时传时以 TradeNo 为准
19
+ };
20
+ request.SetBizModel(model);
21
+
22
+ AlipayTradeQueryResponse response = alipayClient.Execute(request);
23
+
24
+ if (!response.IsError)
25
+ {
26
+ var businessState = response.TradeStatus switch
27
+ {
28
+ "TRADE_SUCCESS" or "TRADE_FINISHED" => "PAID",
29
+ "WAIT_BUYER_PAY" => "PENDING_PAYMENT",
30
+ "TRADE_CLOSED" => "CLOSED",
31
+ _ => "UNKNOWN"
32
+ };
33
+ Console.WriteLine($"业务状态: {businessState}, 支付宝状态: {response.TradeStatus}");
34
+ Console.WriteLine($"订单金额: {response.TotalAmount}");
35
+ }
36
+ else
37
+ {
38
+ Console.WriteLine($"调用失败: {response.SubCode} - {response.SubMsg}");
39
+ }
40
+
41
+ private static AlipayConfig GetAlipayConfig()
42
+ {
43
+ string privateKey = "<-- 请填写您的应用私钥,例如:MIIE...(脱敏示例) -->";
44
+ string alipayPublicKey = "<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->";
45
+ AlipayConfig alipayConfig = new AlipayConfig();
46
+ alipayConfig.ServerUrl = "https://openapi.alipay.com/gateway.do";
47
+ // 沙箱环境: alipayConfig.ServerUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
48
+ alipayConfig.AppId = "<-- 请填写您的AppId,例如:20190xxxxxx -->";
49
+ alipayConfig.PrivateKey = privateKey;
50
+ alipayConfig.Format = "json";
51
+ alipayConfig.AlipayPublicKey = alipayPublicKey;
52
+ alipayConfig.Charset = "UTF-8";
53
+ alipayConfig.SignType = "RSA2";
54
+ return alipayConfig;
55
+ }
56
+ ```
57
+
58
+ ## 响应示例
59
+ ### 正常示例
60
+ ```json
61
+ {
62
+ "code": "10000",
63
+ "msg": "Success",
64
+ "trade_no": "ALIPAY_TRADE_NO_PLACEHOLDER",
65
+ "out_trade_no": "MERCHANT_ORDER_NO_PLACEHOLDER",
66
+ "trade_status": "TRADE_SUCCESS",
67
+ "total_amount": "88.88",
68
+ "buyer_pay_amount": "8.88",
69
+ "receipt_amount": "15.25",
70
+ "buyer_logon_id": "159****5620",
71
+ "buyer_user_id": "<BUYER_USER_ID>",
72
+ "send_pay_date": "2014-11-27 15:45:57"
73
+ }
74
+ ```
75
+ ### 异常示例
76
+ ```json
77
+ {
78
+ "code": "20000",
79
+ "msg": "Service Currently Unavailable",
80
+ "sub_code": "isp.unknow-error",
81
+ "sub_msg": "系统繁忙"
82
+ }
83
+ ```
@@ -0,0 +1,80 @@
1
+ # 统一收单交易退款接口 - C# 示例
2
+
3
+ ## 请求示例
4
+
5
+ ```csharp
6
+ using Aop.Api;
7
+ using Aop.Api.Request;
8
+ using Aop.Api.Response;
9
+ using Aop.Api.Domain;
10
+
11
+ // 初始化SDK(C#/.NET 使用 PKCS#1 格式私钥,Java 使用 PKCS#8 格式,请勿混用)
12
+ IAopClient alipayClient = new DefaultAopClient(GetAlipayConfig());
13
+
14
+ var request = new AlipayTradeRefundRequest();
15
+ var model = new AlipayTradeRefundModel
16
+ {
17
+ OutTradeNo = "MERCHANT_ORDER_NO_PLACEHOLDER", // 商户订单号,与 TradeNo 二选一
18
+ RefundAmount = "200.12", // 使用 decimal 等十进制定点金额;调用前校验累计退款不超过原订单实付金额
19
+ RefundReason = "正常退款", // 退款原因,选填
20
+ OutRequestNo = "OUT_REQUEST_NO_PLACEHOLDER", // 新退款使用新编号;同一退款失败重试必须复用原编号和原参数
21
+ };
22
+ request.SetBizModel(model);
23
+
24
+ AlipayTradeRefundResponse response = alipayClient.Execute(request);
25
+
26
+ if (!response.IsError)
27
+ {
28
+ if (response.FundChange == "Y")
29
+ {
30
+ Console.WriteLine($"退款资金已发生变化,退款金额: {response.RefundFee}");
31
+ }
32
+ else
33
+ {
34
+ Console.WriteLine("退款结果待确认:使用同一 OutRequestNo 调用 alipay.trade.fastpay.refund.query");
35
+ }
36
+ }
37
+ else
38
+ {
39
+ Console.WriteLine($"调用失败: {response.SubCode} - {response.SubMsg}");
40
+ }
41
+
42
+ private static AlipayConfig GetAlipayConfig()
43
+ {
44
+ string privateKey = "<-- 请填写您的应用私钥,例如:MIIE...(脱敏示例) -->";
45
+ string alipayPublicKey = "<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->";
46
+ AlipayConfig alipayConfig = new AlipayConfig();
47
+ alipayConfig.ServerUrl = "https://openapi.alipay.com/gateway.do";
48
+ // 沙箱环境: alipayConfig.ServerUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
49
+ alipayConfig.AppId = "<-- 请填写您的AppId,例如:20190xxxxxx -->";
50
+ alipayConfig.PrivateKey = privateKey;
51
+ alipayConfig.Format = "json";
52
+ alipayConfig.AlipayPublicKey = alipayPublicKey;
53
+ alipayConfig.Charset = "UTF-8";
54
+ alipayConfig.SignType = "RSA2";
55
+ return alipayConfig;
56
+ }
57
+ ```
58
+
59
+ ## 响应示例
60
+ ### 正常示例
61
+ ```json
62
+ {
63
+ "code": "10000",
64
+ "msg": "Success",
65
+ "trade_no": "ALIPAY_TRADE_NO_PLACEHOLDER",
66
+ "out_trade_no": "MERCHANT_ORDER_NO_PLACEHOLDER",
67
+ "buyer_logon_id": "159****5620",
68
+ "fund_change": "Y",
69
+ "refund_fee": "88.88"
70
+ }
71
+ ```
72
+ ### 异常示例
73
+ ```json
74
+ {
75
+ "code": "20000",
76
+ "msg": "Service Currently Unavailable",
77
+ "sub_code": "isp.unknow-error",
78
+ "sub_msg": "系统繁忙"
79
+ }
80
+ ```
@@ -0,0 +1,73 @@
1
+ # 统一收单交易退款查询接口 - C# 示例
2
+
3
+ ## 请求示例
4
+
5
+ ```csharp
6
+ using Aop.Api;
7
+ using Aop.Api.Request;
8
+ using Aop.Api.Response;
9
+ using Aop.Api.Domain;
10
+
11
+ // 初始化SDK(C#/.NET 使用 PKCS#1 格式私钥,Java 使用 PKCS#8 格式,请勿混用)
12
+ IAopClient alipayClient = new DefaultAopClient(GetAlipayConfig());
13
+
14
+ var request = new AlipayTradeFastpayRefundQueryRequest();
15
+ var model = new AlipayTradeFastpayRefundQueryModel
16
+ {
17
+ OutTradeNo = "MERCHANT_ORDER_NO_PLACEHOLDER", // 商户订单号,与 TradeNo 二选一
18
+ OutRequestNo = "OUT_REQUEST_NO_PLACEHOLDER", // 退款请求号,必填,同一笔交易多次部分退款时用于区分
19
+ };
20
+ request.SetBizModel(model);
21
+
22
+ AlipayTradeFastpayRefundQueryResponse response = alipayClient.Execute(request);
23
+
24
+ if (!response.IsError)
25
+ {
26
+ // refund_status: REFUND_SUCCESS 表示退款成功,REFUND_PROCESSING 表示退款处理中
27
+ Console.WriteLine($"退款状态: {response.RefundStatus}, 退款金额: {response.RefundAmount}");
28
+ }
29
+ else
30
+ {
31
+ Console.WriteLine($"调用失败: {response.SubCode} - {response.SubMsg}");
32
+ }
33
+
34
+ private static AlipayConfig GetAlipayConfig()
35
+ {
36
+ string privateKey = "<-- 请填写您的应用私钥,例如:MIIE...(脱敏示例) -->";
37
+ string alipayPublicKey = "<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->";
38
+ AlipayConfig alipayConfig = new AlipayConfig();
39
+ alipayConfig.ServerUrl = "https://openapi.alipay.com/gateway.do";
40
+ // 沙箱环境: alipayConfig.ServerUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
41
+ alipayConfig.AppId = "<-- 请填写您的AppId,例如:20190xxxxxx -->";
42
+ alipayConfig.PrivateKey = privateKey;
43
+ alipayConfig.Format = "json";
44
+ alipayConfig.AlipayPublicKey = alipayPublicKey;
45
+ alipayConfig.Charset = "UTF-8";
46
+ alipayConfig.SignType = "RSA2";
47
+ return alipayConfig;
48
+ }
49
+ ```
50
+
51
+ ## 响应示例
52
+ ### 正常示例
53
+ ```json
54
+ {
55
+ "code": "10000",
56
+ "msg": "Success",
57
+ "trade_no": "ALIPAY_TRADE_NO_PLACEHOLDER",
58
+ "out_trade_no": "MERCHANT_ORDER_NO_PLACEHOLDER",
59
+ "out_request_no": "OUT_REQUEST_NO_PLACEHOLDER",
60
+ "total_amount": "100.20",
61
+ "refund_amount": "12.33",
62
+ "refund_status": "REFUND_SUCCESS"
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,62 @@
1
+ # 统一收单下单并支付页面接口 - C# 示例
2
+
3
+ ## 请求示例
4
+
5
+ ```csharp
6
+ using Aop.Api;
7
+ using Aop.Api.Request;
8
+ using Aop.Api.Response;
9
+ using Aop.Api.Domain;
10
+
11
+ // 初始化SDK(C#/.NET 使用 PKCS#1 格式私钥,Java 使用 PKCS#8 格式,请勿混用)
12
+ IAopClient alipayClient = new DefaultAopClient(GetAlipayConfig());
13
+
14
+ var request = new AlipayTradePagePayRequest();
15
+ var notifyUrl = Environment.GetEnvironmentVariable("ALIPAY_NOTIFY_URL");
16
+ if (!string.IsNullOrWhiteSpace(notifyUrl))
17
+ {
18
+ request.SetNotifyUrl(notifyUrl.Trim()); // 真实生产或公网联调时传入;本地没有公网 HTTPS notify_url 时不要传 null、空字符串或占位 URL
19
+ }
20
+ request.SetReturnUrl("https://your-domain.com/return"); // 默认传入并替换为已验证结果页;仅用户明确关闭同步回跳时省略
21
+
22
+ var model = new AlipayTradePagePayModel
23
+ {
24
+ OutTradeNo = "MERCHANT_ORDER_NO_PLACEHOLDER", // 商户订单号,必填
25
+ TotalAmount = "88.88", // 订单总金额,必填,单位为元
26
+ Subject = "Iphone6 16G", // 订单标题,必填
27
+ ProductCode = "FAST_INSTANT_TRADE_PAY", // 网站支付固定值,必填
28
+ };
29
+ request.SetBizModel(model);
30
+
31
+ // ⚠️ 网站支付必须使用 PageExecute(),不能使用 Execute()
32
+ // ⚠️ 第二个参数传 null(accessToken),第三个参数 "POST" 表示生成 POST 表单
33
+ AlipayTradePagePayResponse response = alipayClient.PageExecute(request, null, "POST");
34
+ string formHtml = response.Body;
35
+ // PageExecute 返回的是 HTML 表单字符串,前端需要渲染并自动提交
36
+
37
+ private static AlipayConfig GetAlipayConfig()
38
+ {
39
+ string privateKey = "<-- 请填写您的应用私钥,例如:MIIE...(脱敏示例) -->";
40
+ string alipayPublicKey = "<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->";
41
+ AlipayConfig alipayConfig = new AlipayConfig();
42
+ alipayConfig.ServerUrl = "https://openapi.alipay.com/gateway.do";
43
+ // 沙箱环境: alipayConfig.ServerUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
44
+ alipayConfig.AppId = "<-- 请填写您的AppId,例如:20190xxxxxx -->";
45
+ alipayConfig.PrivateKey = privateKey;
46
+ alipayConfig.Format = "json";
47
+ alipayConfig.AlipayPublicKey = alipayPublicKey;
48
+ alipayConfig.Charset = "UTF-8";
49
+ alipayConfig.SignType = "RSA2";
50
+ return alipayConfig;
51
+ }
52
+ ```
53
+
54
+ ## 响应示例
55
+ ### 正常示例
56
+ ```html
57
+ <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&timestamp=2014-07-24+03%3A07%3A50">
58
+ <input type="hidden" name="biz_content" value="{&quot;out_trade_no&quot;:&quot;MERCHANT_ORDER_NO_PLACEHOLDER&quot;,&quot;total_amount&quot;:&quot;88.88&quot;,&quot;subject&quot;:&quot;Iphone6 16G&quot;,&quot;product_code&quot;:&quot;FAST_INSTANT_TRADE_PAY&quot;}">
59
+ <input type="submit" value="立即支付" style="display:none" >
60
+ </form>
61
+ <script>document.forms[0].submit();</script>
62
+ ```
@@ -0,0 +1,132 @@
1
+ # APP 支付接口 - C# 示例
2
+
3
+ ## 请求示例
4
+
5
+ ```csharp
6
+ using System;
7
+ using System.Collections.Generic;
8
+ using Aop.Api;
9
+ using Aop.Api.Request;
10
+ using Aop.Api.Response;
11
+ using Aop.Api.Domain;
12
+ using Aop.Api.Util;
13
+ namespace SdkDemoTest
14
+ {
15
+ public class AlipayTradeAppPay
16
+ {
17
+ public static void Main(string[] args)
18
+ {
19
+ // 初始化SDK
20
+ IAopClient alipayClient = new DefaultAopClient(GetAlipayConfig());
21
+ // 构造请求参数以调用接口
22
+ AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
23
+ var notifyUrl = Environment.GetEnvironmentVariable("ALIPAY_NOTIFY_URL");
24
+ if (!string.IsNullOrWhiteSpace(notifyUrl))
25
+ {
26
+ request.SetNotifyUrl(notifyUrl.Trim()); // 真实生产或公网联调时传入;本地没有公网 HTTPS notify_url 时不要传 null、空字符串或占位 URL
27
+ }
28
+ AlipayTradeAppPayModel model = new AlipayTradeAppPayModel();
29
+
30
+ // 设置商户订单号
31
+ model.OutTradeNo = "MERCHANT_ORDER_NO_PLACEHOLDER";
32
+
33
+ // 设置订单总金额
34
+ model.TotalAmount = "9.00";
35
+
36
+ // 设置订单标题
37
+ model.Subject = "大乐透";
38
+
39
+ // 设置产品码
40
+ model.ProductCode = "QUICK_MSECURITY_PAY";
41
+
42
+ // 设置订单包含的商品列表信息
43
+ List<GoodsDetail> goodsDetail = new List<GoodsDetail>();
44
+ GoodsDetail goodsDetail0 = new GoodsDetail();
45
+ goodsDetail0.GoodsName = "ipad";
46
+ goodsDetail0.AlipayGoodsId = "20010001";
47
+ goodsDetail0.Quantity = 1;
48
+ goodsDetail0.Price = "2000";
49
+ goodsDetail0.GoodsId = "apple-01";
50
+ goodsDetail0.GoodsCategory = "34543238";
51
+ goodsDetail0.CategoriesTree = "124868003|126232002|126252004";
52
+ goodsDetail0.ShowUrl = "http://www.alipay.com/xxx.jpg";
53
+ goodsDetail.Add(goodsDetail0);
54
+ model.GoodsDetail = goodsDetail;
55
+
56
+ // 设置订单绝对超时时间
57
+ model.TimeExpire = "2016-12-31 10:05:00";
58
+
59
+ // 设置业务扩展参数
60
+ ExtendParams extendParams = new ExtendParams();
61
+ extendParams.SysServiceProviderId = "<SYS_SERVICE_PROVIDER_ID>";
62
+ extendParams.HbFqSellerPercent = "100";
63
+ extendParams.HbFqNum = "3";
64
+ extendParams.IndustryRefluxInfo = "{\"scene_code\":\"metro_tradeorder\",\"channel\":\"xxxx\",\"scene_data\":{\"asset_name\":\"ALIPAY\"}}";
65
+ extendParams.RoyaltyFreeze = "true";
66
+ extendParams.CardType = "S0JP0000";
67
+ model.ExtendParams = extendParams;
68
+
69
+ // 设置公用回传参数
70
+ model.PassbackParams = "merchantBizType%3d3C%26merchantBizNo%3dMERCHANT_BIZ_NO_PLACEHOLDER";
71
+
72
+ // 设置商户的原始订单号
73
+ model.MerchantOrderNo = "MERCHANT_ORDER_NO_PLACEHOLDER";
74
+
75
+ // 设置外部指定买家
76
+ ExtUserInfo extUserInfo = new ExtUserInfo();
77
+ extUserInfo.CertType = "IDENTITY_CARD";
78
+ extUserInfo.CertNo = "<CERT_NO>";
79
+ extUserInfo.Mobile = "<MOBILE>";
80
+ extUserInfo.Name = "李明";
81
+ extUserInfo.MinAge = "18";
82
+ extUserInfo.NeedCheckInfo = "F";
83
+ extUserInfo.IdentityHash = "<IDENTITY_HASH>";
84
+ model.ExtUserInfo = extUserInfo;
85
+
86
+ // 设置通知参数选项
87
+ List<String> queryOptions = new List<String>();
88
+ queryOptions.Add("hyb_amount");
89
+ queryOptions.Add("enterprise_pay_info");
90
+ model.QueryOptions = queryOptions;
91
+
92
+ request.SetBizModel(model);
93
+ // 第三方代调用模式下请设置app_auth_token
94
+ // request.PutOtherTextParam("app_auth_token", "<-- 请填写应用授权令牌 -->");
95
+
96
+ AlipayTradeAppPayResponse response = alipayClient.SdkExecute(request);
97
+ string orderStr = response.Body;
98
+ Console.WriteLine(orderStr);
99
+
100
+ if(!response.IsError)
101
+ {
102
+ Console.WriteLine("调用成功");
103
+ }
104
+ else
105
+ {
106
+ Console.WriteLine("调用失败");
107
+ }
108
+ }
109
+
110
+ private static AlipayConfig GetAlipayConfig()
111
+ {
112
+ string privateKey = "<-- 请填写您的应用私钥,例如:MIIE...(脱敏示例) -->";
113
+ string alipayPublicKey = "<-- 请填写您的支付宝公钥,例如:MIIB...(脱敏示例) -->";
114
+ AlipayConfig alipayConfig = new AlipayConfig();
115
+ alipayConfig.ServerUrl = "https://openapi.alipay.com/gateway.do";
116
+ alipayConfig.AppId = "<-- 请填写您的AppId,例如:20190xxxxxx -->";
117
+ alipayConfig.PrivateKey = privateKey;
118
+ alipayConfig.Format = "json";
119
+ alipayConfig.AlipayPublicKey = alipayPublicKey;
120
+ alipayConfig.Charset = "UTF-8";
121
+ alipayConfig.SignType = "RSA2";
122
+ return alipayConfig;
123
+ }
124
+ }
125
+ }
126
+ ```
127
+
128
+ ## 响应示例
129
+ ### 正常示例
130
+ ```
131
+ 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&timestamp=2014-07-24+03%3A07%3A50&version=1.0
132
+ ```