Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to send an item list using the paypal version 2 button. I am trying to send a list that is static before I try to send a dynamic list. To my understanding, my items sould be posted to my IPN script. I created an IPN script and nothing being posted to the script. I checked the data being posted to my GetOrder.php script and I do not see the item list there either. All I see is the dollar amount being purchase and the order number. Please help me send the item to my IPN script so I can process the data with my data base and run security scripts on it. My code is below:

JavaScript
var notifyUrl = "BurgerJointIPN.php";
      paypal.Buttons({
        createOrder: function(data, actions) {
          return actions.order.create({
             "purchase_units": [{
                 "amount":{
                     "value":"22.00"
                 },
            "item_list": {
              "items": [{
                "name": 'hat',
                "quantity":'5',
                "price":'2.00'
              },{
                "name": 'bat',
                "quantity":'2',
                "price":'20.00'
              }]
            },
            "NOTIFYURL": "@notifyUrl"
             }]
          });
        },
        onError: function (err) {
    // Show an error page here, when an error occurs
    alert(err);
  },
        onApprove: function(data, actions){
          return actions.order.capture().then(function(details) {
            alert('Transaction completed by ' + details.payer.name.given_name);
            // Call your server to save the transaction
            return fetch('/PPTest/BurgerJoint/GetOrder.php', {
              method: 'post',
              headers: {
                'Content-Type': 'application/json'
              },
              body: JSON.stringify({
                orderID: data.orderID
              })
            });
          });
        }
      }).render('#paypal-button-container');


What I have tried:

I tried looking for documentation on paypal's deveopment website but, I can not find any solution.
Posted

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