2017-06-02 21 views
0

我試圖讓PayPal的服務器端REST工作。如何取消/避免的條件之前彈出PayPal的結算模式得到滿足?

這是我的工作形式:

enter image description here

我想要做的是防止/取消支付如果任amountemail字段爲空。

docs,點擊按鈕後payment()被調用。該文檔包括如何處理「樂觀」的使用情況,但他們沒有提到如何取消支付流程:

// payment() is called when the button is clicked 
payment: function() { 

    // Set up a url on your server to create the payment 
    var CREATE_URL = '/demo/checkout/api/paypal/payment/create/'; 

    // Make a call to your server to set up the payment 
    return paypal.request.post(CREATE_URL) 
     .then(function(res) { 
      return res.paymentID; 
     }); 
}, 

簡單地返回null似乎並沒有擦出火花。這該如何處理?

回答