Paypal basic integration fails to call the onApprove hook

reisnobre
Contributor
Contributor

I'm learning to use this api and discovering really fast that most of tutorials on the google and youtube are out of date... That's ok, just need to shove my face on the docs and push trough, that's normal, but when even the basic integration on the docs fails without any erros that's kind bad.
Here is the code that I'm using:
https://developer.paypal.com/docs/checkout/integrate/#

paypal.Buttons({
        createOrder: function (data, actions) {
          console.log('creating order')
          // Set up the transaction
          return actions.order.create({
            purchase_units: [{
              amount: {
                value: '0.01'
              }
            }]
          })
        },
        onApprove: function (data, actions) {
          console.log('order aproved')
          // Capture the funds from the transaction
          return actions.order.capture().then(function (details) {
            // Show a success message to your buyer
            alert('Transaction completed by ' + details.payer.name.given_name)
          })
        }
      }).render('#paypal-button-container')

Nothing weird, the login goes trough but the purchase fails and I'm presented with the information that I should another payment method.
When I click on credit card, the order and values appears, but, even when I'm logged in, I'm forced to create another account? 

Could I have some help here to understand what is happening?

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.