我正在尝试将贝宝的angular指令用于贝宝按钮。这是我的代码:
<paypal-button
payment="paymentDetails.createPayment"
on-authorize="paymentDetails.executePayment"
ng-attr-style="paymentDetails.paypalButtonStyle"
commit="true"
env="sandbox"
style="position: absolute; bottom: 0;"
></paypal-button>
显示了该按钮,但是当我单击它时出现此错误:
This transaction is invalid. Please return to the
recipient's website to complete your transaction using their regular checkout flow.
我尝试不使用指令,并且效果很好。
HTML代码:
<div id="paypal-button" style="position: absolute; bottom: 0;"></div>
控制器中的代码
$timeout(function() {
paypal.Button.render({
env: 'sandbox',
commit: true,
payment: createPayment,
onAuthorize: executePayment,
style: vm.paypalButtonStyle
}, '#paypal-button');
});
为什么指令方式无效?只是我提到了这一点: https://github.com/paypal/paypal-checkout/blob/master/docs/frameworks.md#angularjs-element