Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have a shopping cart that holds an array or my objects. I have all my customer user details serialized with a form and jQuery. I would like to insert the user data I got from my user details form (maybe I use payer or payer_info? Object. Also I would like to insert my items to the paypal

JavaScript
CreateOrder:        actions.order.create({

I am guessing I do it like this?

JavaScript
"item_list": {
"items": [
{
"name": "hat",
"description": "Brown color hat",
"quantity": "5",
"price": "3",
"tax": "0.01",
"sku": "1",
"currency": "USD"
},
{
"name": "handbag",
"description": "Black color hand bag",
"quantity": "1",

OR maybe in

JavaScript
"data": {

and I can have my own custom objects for the paypal order class. Could any one give me an example or more input on how I will do this. In the developer.paypal.com/docs I been reading pretty much all the different project SDKs for javascript / php I would like to use my javascript to insert the information

This is what I have
JavaScript
$fname = $_POST['txtFirstname'];
    $lname = $_POST['txtLastname'];
    $email = $_POST['txtEmail'];
var totalPrice = <?php echo $newTotal; ?>

paypal.Buttons({
    createOrder: function(data, actions) {
        // setup transaction
        return actions.order.create({
            payer: {
                name:
            },
            purchase_units: [{
               amount: {
                   value: totalPrice
               } 
            }]
        });
    },


What I have tried:

I have tried multiple different ways to insert my items into the create order. I been reading the paypal development docs and i just need a little bit more just a reference for 1 custom item and to insert the user details from my custom variables and ill have it
Posted
Comments
F-ES Sitecore 22-Feb-19 5:22am    
How you use paypal depends entirely on the integration option you have gone for which you haven't said. And the reason there is no javascript support is because what you're doing is a terrible idea. There is nothing stopping the user changing the prices to anything they want. That kind of data should only ever be held in data structures on the server and never exposed to the client.
TheBigBearNow 22-Feb-19 16:07pm    
Thank you. I did not know this is my first shopping cart with paypal so i should use the PHP integration of making the createOrder object and put the fields in on that side
This is the paypal integration
https://www.paypal.com/sdk/js?client-id=

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900