2017-03-11 59 views
0

下面是checkout.js腳本無法獲得貝寶checkout.js創建成功交易

https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/basic-integration/

複製修改爲使用「生產」,而不是「沙箱」,並在粘貼我們通過登錄創建的LiveAPI密鑰,轉到Dashboard/Rest API Apps。

此網站的設立是爲了獲得會議的註冊費用。用戶在HTML表單上輸入信息,然後將用戶發送到顯示欠款總額的另一個頁面。這是我插入結帳腳本的頁面。

結果:一個貝寶按鈕顯示在頁面上,點擊後,將用戶連接到貝寶。顯示我們組織的電子郵件地址(不是用戶的電子郵件);用戶必須改變這一點,然後可以登錄到他們的個人PayPal帳戶或輸入信用卡信息。

問題:當用戶完成交易後,它們會返回到包含結帳的頁面,而不會傳遞到我們在PayPal中註冊的結果頁面。另外,我們的賬戶沒有顯示發生的交易記錄(無論是在沙盒還是在線)。據悉,作爲儀表板是「失敗的事務」在

https://developer.paypal.com/developer/applications/

發佈此問題[email protected]techsupport.com數天前,但至今沒有得到任何答覆。

任何幫助,將不勝感激!

BEGIN CODE

<div id="paypal-button"></div> 
<script src="https://www.paypalobjects.com/api/checkout.js"></script> 
<script> 
    paypal.Button.render({ 
     env: 'production', // Specify 'sandbox' for the test environment 
//  env: 'sandbox', // Specify 'sandbox' for the test environment 
    client: { 
//   sandbox:  
      production: 'xxxxx' 
     }, 
     payment: function() { 
      var env = this.props.env; 
      var client = this.props.client; 
      return paypal.rest.payment.create(env, client, { 
       transactions: [ 
        { 
         amount: { total: <?echo $Fees?>, currency: 'USD' } 
        } 
       ] 
      }); 
     }, 
      // Set up the payment here, when the buyer clicks on the button 
     commit: true, // Optional: show a 'Pay Now' button in the checkout flow 
     onAuthorize: function(data, actions) { 
      // Execute the payment here, when the buyer approves the transaction 
     } 
    }, '#paypal-button'); 
</script> 

結束代碼

回答

0

請參閱在https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/basic-integration/

當用戶完成在貝寶檢查出完整的例子,你onAuthorize函數將被調用。在這裏,你可以選擇你想要的任何東西,包括:

  • 執行付款(將錢)
  • 重定向頁面

例如,如果你想執行付款再展一個成功的頁面,你可以這樣做:

onAuthorize: function(data, actions) { 

     return actions.payment.execute().then(function() { 
      return actions.redirect(window, 'http://some-success-page'); 
     }); 
    } 

原因​​不會自動發生,是因爲你有一個顯示你之前確認頁面的選項完成付款。