如何在 extjs 中更改 PayPal 按钮的金额值?
How to change the amount value of PayPal button in extjs?
我将 PayPal 按钮放在容器的 afterrender 事件中,但问题是此时金额值是固定的,我无法弄清楚如何更改此值。那么,如何在 EXTJS 中动态更改值 ('88.44')?
listeners:{
afterrender: function (){
paypal.Buttons({
// Set up the transaction
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '88.44'
}
}]
});
},
// Finalize the transaction
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
// Show a success message to the buyer
alert('Transaction completed by ' + details.payer.name.given_name + '!');
});
}
}).render('#paypal-button-container');
}
}
value: some_function_call_that_returns_value_you_want();
例如:
value: document.getElementById('amount').value;
我将 PayPal 按钮放在容器的 afterrender 事件中,但问题是此时金额值是固定的,我无法弄清楚如何更改此值。那么,如何在 EXTJS 中动态更改值 ('88.44')?
listeners:{
afterrender: function (){
paypal.Buttons({
// Set up the transaction
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '88.44'
}
}]
});
},
// Finalize the transaction
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
// Show a success message to the buyer
alert('Transaction completed by ' + details.payer.name.given_name + '!');
});
}
}).render('#paypal-button-container');
}
}
value: some_function_call_that_returns_value_you_want();
例如:
value: document.getElementById('amount').value;