cancel
Showing results for 
Search instead for 
Did you mean: 

HOW to pass the items array while creating an order in javascript while using php

Options
samebenezer
Contributor
Posted on

I have a shopping cart that can contain variable number of products based on the customer's preference.

I would line to know how to create and pass an array containing all the items in php to the javascript code before order creation.

Any help regarding this would be really helpful.

 

 

 

      createOrder: function(data, actions) {
      return actions.order.create({
        intent:"CAPTURE",
        application_context:{
          shipping_preference: 'SET_PROVIDED_ADDRESS',
          return_url :"",
        },
        purchase_units: [{
          amount: {
            currency_code: "USD",
            value: "<?php echo $total ?>"
          },
          items: {  //THIS IS WHERE I WANT TO INCLUDE EACH ITEM USING PHP 
          }
        }]
      });
    }

 

 

 

1 REPLY 1

HOW to pass the items array while creating an order in javascript while using php

Options
Chiranjeevi_L
PayPal Employee

Hi @samebenezer,

 

Thank you for contacting PayPal community.

 

We apologize for any inconvenience.

 

I request to please use the "items" array  under "purchase_unit_request ".

 

Thank you for understanding and patience.

 

Sincerely,

Chiranjeevi

PayPal, Inc. 

 

If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.

Haven't Found your Answer?

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