加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 创业 > C语言 > 正文

支付宝SDK的 报网络繁忙的错。

发布时间:2020-12-15 00:44:18 所属栏目:C语言 来源:网络整理
导读:table class="css" tr class="li1" td class="ln"pre class="de1"1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 6
<tr class="li1">
<td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

系统繁忙,请稍后再试 前言 ? 支付宝的iOS SDK真是个奇葩的存在 按理说这么重要的SDK 理应提供详尽的文档和技术支持虽然说实际使用较简单 但是跑到官方论坛一看 都是各种各样的问题 以及千篇一律的解答 ? 这里不谈如何集成和使用SDK 只谈问题 如果你按照官方文档一步一步的调试发现任何问题没有 那么 恭喜你 运气不错 ? 如果你跟我一样 遇到跳转支付时现实”系统繁忙请稍后再试” 的问题如图 没截到iOS的 找了一张android的图凑数 ? 问题 ? 官方示例中支付相关的代码 ? //构造订单 NSString appScheme @ NSString orderInfo self getOrderInfoindexPath.row NSString signedStr self doRsaorderInfo ? //形成订单参数 NSString orderString NSString stringWithFormat@ ? ? ? ? ? ? ? ? ? ? ? ? ?orderInfo signedStr @ ? //调用支付借口 AlixLibService payOrderorderString AndSchemeappScheme seletor_result self ? 问题就出在orderInfo这里 那么orderInfo是什么呢? -NSStringgetOrderInfoNSIntegerindex ? ? ? ? Product product _products objectAtIndexindex ? ? ? ? AlixPayOrder AlixPayOrder alloc init ? ? order PartnerID ? ? order SellerID ? ? ? order self generateTradeNO //订单ID(由商家自行制定) ? ? order product.subject //商品标题 ? ? order product.body //商品描述 ? ? order NSString stringWithFormat@product.price //商品价格 ? ? order ?@ //回调URL ? ? ? ? return description 可以到看orderInfo就是AlixPayOrder的字符串化 再看看其description函数 - NSString description ? ? NSMutableString discription NSMutableString string ? ? discription appendFormat@ self ? self @ ? ? discription appendFormat@ self ? self @ ? ? discription appendFormat@ self ? self @ ? ? discription appendFormat@ self ? self @ ? ? discription appendFormat@ self ? self @ ? ? discription appendFormat@ self ? self @ ? ? discription appendFormat@ self ? self @ ? ? ? ? discription appendFormat@ self ? self @ ? ? discription appendFormat@ self ? self @ ? ? discription appendFormat@ self ? self @ ? ? ? //下面的这些参数,如果没有必要(为空),则无需添加 ? ? discription appendFormat@ self ? self @ ? ? discription appendFormat@ self ? self @ ? ? discription appendFormat@ self ? self @ ? ? ? ? ? for NSString key in self allKeys ? ? ? ? discription appendFormat@ key self objectForKeykey ? ? ? ? return discription 我猜问题可能出现在这里 ? discription appendFormat@ self ? self @ discription appendFormat@ self ? self @ discription appendFormat@ self ? self @ 可能是这种莫名其妙的默认值导致了问题的出现代码里注释了无需添加 可为啥官方demo是没有问题的? orderInfo也不过是一堆参数的拼凑而已 同时 我求证了同事在android的sdk里 参数也都是手工拼凑的 那么将必填参数自行组织一下 应该就可以了 ? 方案 ? 经过实践 只需要填下下面出现的这些参数 就没有问题了 ? -NSStringgetOrderInfo ? ? ? ? NSMutableString discription NSMutableString string ? ? discription appendFormat@ PartnerID ? ? discription appendFormat@ SellerID ? ? discription appendFormat@ self getOrderID ? ? discription appendFormat@ yourSubject ? ? discription appendFormat@ yourBody ? ? discription appendFormat@ yourPrice ? ? discription appendFormat@ yourHandleAction ? ? discription appendFormat@ @ ? ? ? ? return discription 尾声 ? 当然 回过头来看 问题有这么几个 ? 官方demo写得不严谨 且注释太少 官方文档写没有指出相关问题 以及对相应参数的解释对于参数仅提到了一句”支付参数提交时需要组装订单信息 orderInfo其中 参数以 key”形式呈现参数之间以“&”分割 获取 Alipay 支付对象调用支付。“” 官方论坛没有相应的技术支持 ?(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

<table class="css">

    推荐文章
      热点阅读