uniapp支付之支付宝APP支付
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了uniapp支付之支付宝APP支付相关的知识,希望对你有一定的参考价值。
参考技术A 本篇是 uniapp支付之微信支付 的续篇。uniapp支付宝支付相对于微信支付来说简单的多。
打开项目的manifest.json文件,在“App模块配置”项的“Payment(支付)”下,勾选“支付宝支付”:
调用 [uni.requestPayment(OBJECT)]发起支付,OBJECT参数中provider属性值固定为 alipay 、、orderInfo属性值为订单对象
1.在URL Types 中添加配置: identifier 填写 alixpay ,URL Schemes 填写 alix[后面是您在支付宝平台申请的appid] ,如果没有该项按照图中的格式创建
2.在 info.plist 添加 Schemes 白名单配置
支付宝的universal link-支付宝iOS启动命令-URL Schemes一键打开支付宝-uniapp支付宝登录授权
效果图
实验过程
支付宝的universal link-支付宝iOS启动命令-URL Schemes一键打开支付宝-uniapp支付宝登录授权
测试代码
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Universal Link启动支付宝 - 支付宝iOS启动测试 - Rudon</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body style="word-break: break-all;">
<div style="padding: 20px;">
<h2>支付宝</h2>
<b>URL Schemes (安卓、iOS v9以前)</b> <div>alipays://platformapi/startapp?appId=20000067&url=</div><br />
<b>Universal Link (iOS v9+)</b> <div>https://render.alipay.com/p/s/i/</div><br />
<b>安卓苹果通用</b> <div>https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D20000067%26url%3D</div>
</div>
<div style="padding: 20px;">
<h3>1)不显示支付宝网页,直接打开支付宝 - 直接进入蚂蚁森林</h3>
<div>
<b>商家app内部不弹窗询问,手机浏览器内弹窗询问</b>
</div>
<a href="alipays://platformapi/startapp?appId=60000002&url=%2Fwww%2Fhome.html%3Fsource%3Dfxyoushangjiao%26shareId%3D1FdlVdzs4acQ902SOoS%252B%252ByE38f6AJhcfDlYQCrLWN1g%253D&chInfo=ch_share__chsub_CopyLink&fxzjshareChinfo=ch_share__chsub_CopyLink&apshareid=732CB158-5AA3-4A9A-A08D-42153DAD6108&shareBizType=antforesthongbao">
alipays://platformapi/startapp?appId=60000002&url=%2Fwww%2Fhome.html%3Fsource%3Dfxyoushangjiao%26shareId%3D1FdlVdzs4acQ902SOoS%252B%252ByE38f6AJhcfDlYQCrLWN1g%253D&chInfo=ch_share__chsub_CopyLink&fxzjshareChinfo=ch_share__chsub_CopyLink&apshareid=732CB158-5AA3-4A9A-A08D-42153DAD6108&shareBizType=antforesthongbao
</a>
</div>
<div style="padding: 20px;">
<h3>2)显示支付宝网页,包含“打开支付宝”、“下载支付宝”按钮 - 直接进入蚂蚁森林</h3>
<div>
<b>弹窗询问</b>
</div>
<a href="https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D60000002%26url%3D%252Fwww%252Fhome.html%253Fsource%253Dfxyoushangjiao%2526shareId%253D1FdlVdzs4acQ902SOoS%25252B%25252ByE38f6AJhcfDlYQCrLWN1g%25253D%26chInfo%3Dch_share__chsub_CopyLink%26fxzjshareChinfo%3Dch_share__chsub_CopyLink%26apshareid%3D732CB158-5AA3-4A9A-A08D-42153DAD6108%26shareBizType%3Dantforesthongbao">
https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D60000002%26url%3D%252Fwww%252Fhome.html%253Fsource%253Dfxyoushangjiao%2526shareId%253D1FdlVdzs4acQ902SOoS%25252B%25252ByE38f6AJhcfDlYQCrLWN1g%25253D%26chInfo%3Dch_share__chsub_CopyLink%26fxzjshareChinfo%3Dch_share__chsub_CopyLink%26apshareid%3D732CB158-5AA3-4A9A-A08D-42153DAD6108%26shareBizType%3Dantforesthongbao
</a>
</div>
<div style="padding: 20px;">
<h3>3)显示支付宝网页,包含“打开支付宝”、“下载支付宝”按钮 - 进入支付宝APP首页</h3>
<div>
<b>弹窗询问</b>
</div>
<a href="https://render.alipay.com/p/s/i/">
https://render.alipay.com/p/s/i/
</a>
</div>
<div style="padding: 40px 20px;">
<h4>
支付宝H5授权登录-获取auth_code方法:
</h4>
<div>
支付宝APP内置浏览器,打开
<a href="">
https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=商家的APPID&scope=auth_user&redirect_uri=回调地址ENCODED_URL
</a>
,详询https://opendocs.alipay.com/open/53/104114
</div>
</div>
</body>
</html>
以上是关于uniapp支付之支付宝APP支付的主要内容,如果未能解决你的问题,请参考以下文章
uniapp获取支付宝user_id - 支付宝提现 - 登录授权 - APP支付宝登陆 - H5支付宝授权