-------paypal已经添加了Return URL uni.app.xxxxxx://paypalpay(全小写) 也确定了是沙箱模式的配置
-------确认了Client ID的一致性
-------也配置了schemes为uni.app.xxxxxx
登陆成功或者取消返回都能跳回app 但就是不触发回调,成纯登录了
让AI连后端代码都检查几遍了都不得
uni.requestPayment({
provider: "paypal",
orderInfo,
success: async function (res : any) {
console.log("[Payment Flow] ✅ PayPal authorization SUCCESS:", JSON.stringify(res));
try {
const rawdata = JSON.parse(res.rawdata);
console.log("[Payment Flow] Authorized orderId:", rawdata.orderId);
} catch (e) {
console.log("[Payment Flow] rawdata parse info:", res.rawdata);
}
// 授权成功后,调用后端 capture 接口完成扣款
uni.showLoading({ title: "Processing...", mask: true });
},
fail: function (err : any) {
const errMsg = JSON.stringify(err);
console.error("[Payment Flow] ❌ PayPal payment FAILED:", errMsg);
// 使用 modal 弹窗显示错误,确保能看到
uni.showModal({
title: "支付失败 - 调试",
content: errMsg,
showCancel: false
});
},
complete: function (res : any) {
console.log("[Payment Flow] ? PayPal payment COMPLETE (always called):", JSON.stringify(res));
}
});