Laravel Paypal Server Side REST API integration

Blu94
Contributor
Contributor

I'm using laravel building a shopping cart, but i have difficulties on integrating, 

What should the CREATE_URL return?

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;
        });
      },

A json array? or any other thing? is there any proper example that my Controller should return?

and 

// onAuthorize() is called when the buyer approves the payment
      onAuthorize: function(data, actions) {

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

        // Set up the data you need to pass to your server
        var data = {
          paymentID: data.paymentID,
          payerID: data.payerID
        };

        // Make a call to your server to execute the payment
        return paypal.request.post(EXECUTE_URL, data)
        .then(function (res) {
          window.alert('Payment Complete!');
        });
      }


What should the EXECUTE_URL should return?

 

 

Login to Me Too
1 REPLY 1

Quandary
Advisor
Advisor

You may want to redirect your question to the Merhant Tech Support community.

Login to Me Too

Haven't Found your Answer?

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