1

在设置 Paypal 智能支付按钮时,我想从按钮侦听器 onAuthorize 调用外部函数。怎么做?外部函数在按钮侦听器中不可见。为了调用它们,它们必须附加到窗口对象。

/* Paypal button code */
// Execute the payment
onAuthorize: function(data, actions) {$(this).attr('action')
    return actions.payment.execute().then(function(data) {
    // Show a confirmation message to the buyer
    window.user_membership_activation(data);
    });
}

/* Elsewhere in your page or included script */
window.user_membership_activation = function(data) {

    // do something here
} 
4

0 回答 0