Express Checkout REST API & Itemised Bill

evileye
Contributor
Contributor

Hi all,

 

I've followed the Client-side REST integration steps and changed the following code to include my info and can complete payments fine. However, I want to display the items customers are paying for but can't figure out how to send this information with the amount in the included code. Is this even possible?

 

<div id="paypal-button"></div>

<script src="https://www.paypalobjects.com/api/checkout.js"></script>

<script>
    paypal.Button.render({

        env: 'production', // Or 'sandbox'

        client: {
            sandbox:    'xxxxxxxxx',
            production: 'xxxxxxxxx'
        },

        commit: true, // Show a 'Pay Now' button

        payment: function(data, actions) {
            return actions.payment.create({
                payment: {
                    transactions: [
                        {
                            amount: { total: '1.00', currency: 'USD' }
                        }
                    ]
                }
            });
        },

        onAuthorize: function(data, actions) {
            return actions.payment.execute().then(function(payment) {

                // The payment is complete!
                // You can now show a confirmation message to the customer
            });
        }

    }, '#paypal-button');
</script>
Login to Me Too
1 ACCEPTED SOLUTION

Accepted Solutions
Solved

MTS_Jennifer
Moderator
Moderator

You can pass the line item details in the Items object.

Below is a sample from the Rest API PayPal Payments section of the  PayPal Developer Site:

 

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

Thank you,

Jennifer

View solution in original post

Login to Me Too
1 REPLY 1
Solved

MTS_Jennifer
Moderator
Moderator

You can pass the line item details in the Items object.

Below is a sample from the Rest API PayPal Payments section of the  PayPal Developer Site:

 

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

Thank you,

Jennifer

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.