Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支付宝支付相关 #191

Open
sjxt opened this issue Jan 13, 2021 · 3 comments
Open

支付宝支付相关 #191

sjxt opened this issue Jan 13, 2021 · 3 comments

Comments

@sjxt
Copy link

sjxt commented Jan 13, 2021

MonkeyKing 对于后台返回了签名字符串进行支付宝支付没有进行相关的文档,只是在【请问支持现在支付宝最新的APP支付吗?】这个问题的回复中找到了相关步骤说明,已成功调起支付,在此贡献一下粗略的代码,给后面集成支付宝支付的朋友节省点时间

// 1、拿到服务端生成的字符串
let dataString = json["data"].stringValue

// 2、拼接成一个json
let json: [String: Any] = ["fromAppUrlScheme":"ap11111111","requestType":"SafePay","dataString":dataString]

// 3、拼接完后,对整个json进行 url encode
let encodeString = json.jsonString()?.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)

// 4、最前面加上:alipay://alipayclient/?
let url = URL(string: "alipay://alipayclient/?(encodeString ?? "")")
let order = MonkeyKing.Order.alipay(url: url!)
MonkeyKing.deliver(order) { (result) in

}

@nixzhu
Copy link
Owner

nixzhu commented Jan 14, 2021

@sjxt 你可考虑增加一个 Alipay.md 把你的经验整理出来作为文档(步骤和常见疑问点),然后发个 PR

@sjxt
Copy link
Author

sjxt commented Jan 18, 2021

@nixzhu 好的呢 之后把微信支付弄好了,有时间的话一起弄一个

@CoderLGL
Copy link

CoderLGL commented Jul 8, 2021

@nixzhu @sjxt 感谢,我也遇到同样的问题,正好借此解决

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants