【发布时间】:2020-06-27 17:20:41
【问题描述】:
我已经以简单的方式完成了看起来像这样的每月订阅付款......
paypal.Buttons({
createSubscription: function(data, actions) {
return actions.subscription.create({
'plan_id': 'P-2UF78835G6983425GLSM44MA'
});
},
onApprove: function(data, actions) {
alert('You have successfully created subscription ' + data.subscriptionID);
}
}).render('#paypal-button-container');
正如您在上面看到的,您首先通过邮递员制定计划并传入plan_id。有了这些计划,您可以修补什么不可以。
既然我是一次性付款,我猜你应该这样做吗?
paypal.Buttons({
createOrder: function(data, actions) {
// This function sets up the details of the transaction, including the amount and line item details.
return actions.order.create({
purchase_units: [{
amount: {
value: '0.01'
}
}]
});
}
}).render('#paypal-button-container');
是否有 order_id 或我可以传入的东西,因为您可以使用邮递员正确创建订单?因此,您可以根据需要修补金额或任何内容。
paypal 文档到处都是,而且不是很清楚。我使用的是智能按钮,而不是 SDK。
【问题讨论】:
标签: paypal paypal-sandbox