2017-06-30 3 views
1

Hallo Ich bin mit dem folgenden SetupPaypal webhooks Ereignisse werden nicht im Sandkasten ausgelöst

  • Erstellt paypal Händler und Kunden Sandbox-Konten
  • Konfiguriert paypal REST API App
  • Added a Webhook URL zu meinem Server und hat bestätigt, dass es die webhook simulator
  • verwendet, um den Express-Checkout funktioniert mit javaScript-Implementierung here
gefunden 10

Ich kann Zahlungen erfolgreich durchführen, wenn ich die Benachrichtigungen in der Sandbox sehe, aber kein Webhook wird jemals ausgelöst ???

Unten ist ein Beispiel meiner Javascript-Implementierung, die ich verwendet habe, bitte nicht, dass es in eine Coldfusion-Skriptdatei eingebettet ist, daher die Verwendung von Hashtags.

`

var items = #paypalItems#; 

// Render the PayPal button 
paypal.Button.render({ 

    env: '#application.config.paypal.bSandbox ? "sandbox" : "production"#', // sandbox | production 
    commit: true, 

    //style the button 
    style: { 
     label: 'pay' 
    }, 

    // PayPal Client IDs - replace with your own 
    client: { 
     sandbox: '#application.config.paypal.sandbox_key#', 
     production: '#application.config.paypal.live_key#' 
    }, 

    // Wait for the PayPal button to be clicked 
    payment: function(data, actions) { 

     // Make a client-side call to the REST api to create the payment 
     return actions.payment.create({ 
      payment: { 
       transactions: [{ 
        amount: { 
         total: #trim(numberFormat(application.oCart.getTotal(bDiscount=1,bShipping=1) , "99999999.99"))#, 
         currency: "AUD", 
         details: { 
         subtotal: #trim(numberFormat(application.oCart.getTotal() - application.oCart.getAmountGST(amount=application.oCart.getTotal(bDiscount=1), addGST=false), "99999999.99"))#, 
         tax: #trim(numberFormat(application.oCart.getAmountGST(amount=application.oCart.getTotal(bDiscount=1), addGST=false), "99999999.99"))#, 
         shipping: #trim(numberFormat(application.oCart.oShipping.getCartShippingAmount(country=session.fcbshoppingCart.order.shippingCountry), "99999999.99"))# 
         } 
        }, 
        invoice_number: "#orderNumber#", 
        item_list: { 
         items: items, 
         shipping_address: { 
         recipient_name: "#session.fcbshoppingCart.customer.firstName# #session.fcbshoppingCart.customer.lastName#", 
         line1: "#session.fcbshoppingCart.order.shippingAddress1#", 
         line2: "#session.fcbshoppingCart.order.shippingAddress2#", 
         city: "#session.fcbshoppingCart.order.shippingSuburb#", 
         country_code: "#paypalCountryCode#", 
         postal_code: "#session.fcbshoppingCart.order.shippingPostCode#", 
         state: "#session.fcbshoppingCart.order.shippingState#" 
         } 
        } 
       }] 
      } 
     }); 
    }, 

    // Wait for the payment to be authorized by the customer 
    onAuthorize: function(data, actions) { 

     console.log("Paypal Authorize:", data); 

     // Execute the payment 
     return actions.payment.execute().then(function(payment) { 

      console.log("Paypal Response:", payment); 

      //payment has been accepted so we can now generate an order 
      $.ajax({ 
       type: "get", 
       url: "/apps/paypal/createOrder.cfm", 
       data: { 
        transactionNumber: "#orderNumber#", 
        payPalPaymentId: data.paymentID 
       }, 
       dataType: "json", 
       success: function(res) { 
        console.log('edharry create order data', res); 

        if(res.BPAYMENTPROCEED) { 
         $('##paypal-message').addClass("show success").text('Payment Successfully Complete!'); 
         //lets redirect to the checkout success page. 
         window.location.href = window.location.origin + '/shop/checkout/confirmation?productOrder=' + res.PRODUCTORDER.OBJECTID; 
        } else { 
         //need to handle a failed transaction 
         $('##paypal-message').addClass("show failure").text('Payment did not complete on server!'); 
        } 
       }, 
       error: function() { 
        //lets show an error 
        $('##paypal-message').addClass("show failure").text('Payment did not complete on server!'); 
       } 
      }) 

      $('##paypal-message').addClass("show success").text('Payment Successfully Complete!'); 
     }); 
    }, 

    onCancel: function(data) { 
     console.log('The payment was cancelled!'); 
    } 

}, '##paypal-button-container');` 

Antwort

0

Dies ist ein Dauerthema mit Paypal. Sie sind sich dieses Problems bewusst und arbeiten derzeit daran, dies zu beheben.

+0

irgendwelche Updates zu diesem Problem? – Dimitri

Verwandte Themen