//订单对象
var orderInfo = {
"customer": "Stripe的Customer", //Customer
"ephemeralKey": "Stripe的Customer Ephemeral Key", //临时访问Customer的Key
"isAllowDelay": true, //是否支持延迟支付 默认false
"merchantName": "DCloud", //商户名
"paymentIntent": "Stripe的PaymentIntent", //订单信息
"publishKey": "Public Key", //公钥
"billingDetails":{ //账单信息(可选)
"name":"",
"email":"",
"phone":"",
"address":{
"city":"",
"country":"CN",//国家代码(ISO 3166-1 alpha-2)
"line1":"",
"line2":"",
"postalCode":"",
"state":""
}
}
};
// 从Stripe测试服务器获取订单数据
uni.request({
url: 'https://stripe-mobile-payment-sheet.glitch.me/checkout',
method: "POST",
success: (res) => {
orderInfo = {
"customer": res.data.customer,
"ephemeralKey": res.data.ephemeralKey,
"isAllowDelay": true,
"merchantName": "DCloud",
"paymentIntent": res.data.paymentIntent,
"publishKey": res.data.publishableKey,
"billingDetails": res.data.billingDetails
};
}
});
//...
//发起支付
uni.getProvider({
service: 'payment',
success: function(res) {
if (~res.provider.indexOf('stripe')) {
uni.requestPayment({
"provider": "stripe",
"orderInfo": orderInfo,
success(res) {
console.log("requestPayment Success: "+JSON.stringify(res));
},
fail(e) {
console.log("requestPayment failed: "+JSON.stringify(e));
}
});
}
}
});
这种是支付模式的,如何订阅阿,就是每个月固定扣费,然后还可以取消订阅
a***@163.com (作者)
目前解决方案是嵌h5
2024-11-26 16:29