【发布时间】:2020-12-14 11:45:22
【问题描述】:
我需要检测按下了哪个按钮来执行操作 enter image description here
如果按下按钮 paypal 或按钮信用卡 或者存在一些功能来帮助我进入 sdk paypal
我使用文档中的代码
paypal.Buttons({
style: {
shape: 'rect',
color: 'gold',
layout: 'vertical',
label: 'paypal',
},
createOrder: function(data, actions) {
return actions.order.create({
"purchase_units": [
{
"amount": {
"currency_code": "USD",
"value": monto,
"breakdown": {
"item_total": {
"currency_code": "USD",
"value": monto
}
}
},
"items": [
{
"name": "Donacion",
"description": "Donacion a Inti Academy",
"unit_amount": {
"currency_code": "USD",
"value": monto
},
"quantity": "1",
},
],
}
]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
});
}
}).render('#paypal-button-container');
我试图从信用按钮的类名中获取操作,但它不起作用
【问题讨论】:
-
onApprove 中的数据不是给你你需要的吗?
-
我只需要检测按下了哪个按钮
-
其他操作
标签: javascript jquery paypal