-
Jul 14th, 2020, 12:10 PM
#1
Thread Starter
PowerPoster
Sample code for Paypal interface for shopping cart?
I'm looking for some sample code that will help me implement a Paypal shopping cart and payment methods. I've looked at the Paypal site and acquired my authentication key but trying to implement this is harder than I thought. I need help!
Thanks,
-
Jul 16th, 2020, 08:33 AM
#2
Re: Sample code for Paypal interface for shopping cart?
What technology are you using? JavaScript, jQuery, Angular, etc.?
-
Jul 16th, 2020, 11:03 AM
#3
Thread Starter
PowerPoster
Re: Sample code for Paypal interface for shopping cart?
-
Jul 16th, 2020, 01:39 PM
#4
Re: Sample code for Paypal interface for shopping cart?
Are you familiar with submitting REST requests? Both Javascript and jQuery provide some method of submitting the request, though I find it simpler in jQuery.
If not, that will be the first thing you need to read up on. Here is an example:
Code:
$.ajax({
type: "GET",
dataType: "jsonp",
url: "https://api.sandbox.paypal.com/v1/payment-experience/web-profiles/",
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Bearer my-access-token-here");
},
success: function(data){
console.log(data);
}
});
-
Jul 17th, 2020, 08:49 AM
#5
Thread Starter
PowerPoster
Re: Sample code for Paypal interface for shopping cart?
At what point should this code be executed?
-
Jul 19th, 2020, 09:43 PM
#6
Re: Sample code for Paypal interface for shopping cart?
That particular endpoint returns a web profile I believe. As far as when a REST request would be made, it all depends on when you need the data. Think of the process in events: do you need the data when the webpage loads, when the user clicks on an element (like a button), etc.
-
Jul 19th, 2020, 09:53 PM
#7
Thread Starter
PowerPoster
Re: Sample code for Paypal interface for shopping cart?
Well, the flow...to me...is simple. The user will click on a incrementer/decrementer control to add to the cart for any item. Once they are finished shopping, they will click on the "Cart" icon which should take them to a new page where they can continue checking out. So, I'm not real sure what you mean when you say "it all depends on when you need the data".
Thanks,
-
Jul 19th, 2020, 10:55 PM
#8
Re: Sample code for Paypal interface for shopping cart?
Just to clarify, are you wanting to build a shopping cart or are you wanting to integrate paypal into your existing shopping cart feature?
-
Jul 20th, 2020, 02:34 AM
#9
Thread Starter
PowerPoster
Re: Sample code for Paypal interface for shopping cart?
Well, I believe Paypal has a shopping cart. I'm not crazy about it's design and would prefer to use my own but I've never written a shopping cart app. That's why I'm hoping to find some sample code.
-
Jul 22nd, 2020, 10:46 PM
#10
Re: Sample code for Paypal interface for shopping cart?
I think that you're mistaken. I believe (though not 100%) that Paypal has third parties that have a shopping cart that is already integrated with Paypal.
-
Jul 24th, 2020, 01:04 AM
#11
Thread Starter
PowerPoster
Re: Sample code for Paypal interface for shopping cart?
If I can build the cart myself, I will. I'm just not sure how to integrate that into Paypal? The only thing I would need to pass into Paypal that I can think of would be the item, it's price, and the quantity. I'm sure there is more stuff behind the scenes...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|