这是挑起paypal的代码。除了参数是接口返回,其他的和文档中一样。返回的报错信息:fail:{"errMsg":"requestPayment:fail Error approving order","errCode":-100,"code":-100}
let orderInfo = {
clientId:params.clientId, //开发者中心clientId
orderId: params.orderId, //订单id
userAction: params.userAction, //按钮样式 paynow/continue
currency: params.currency, //币种
environment: params.environment, //运行环境 sandbox(沙盒) / live(线上)
};
uni.getProvider({
service: 'payment',
success: function(res) {
console.log(res);
if (~res.provider.indexOf('paypal')) {
uni.requestPayment({
provider: 'paypal',
orderInfo: orderInfo,
success: function(response) {
console.log('success:' + JSON.parse(response.rawdata));
},
fail: function(err) {
console.log('fail:' + JSON.stringify(err));
},
});
} else {
uni.showToast({
title: 'error',
icon: 'none',
});
}
},
});
这是访问h5打开的paypa页面,可以正常打开
移动端跳转后显示