cancel
Showing results for 
Search instead for 
Did you mean: 

patch items in Smart Payment

Options
digide
New Community Member
Posted on

Hello,

I am stuck with the following problem: I am trying to patch a Smart Payment Button order. Not only the total price, but also the items.

 

My actions.order.create:

createOrder: function(data, actions) {       

                                     return actions.order.create({

                                               purchase_units: [

                                                           {

                                                             "amount":{

                                                                        "value":"13.85",

                                                                        "currency_code":"EUR",

                                                                        "breakdown":{

                                                                                  "item_total":{

                                                                                     "value":"13.85",

                                                                                     "currency_code":"EUR"

                                                                                  }

                                                                        }

                                                             },

                                                             "invoice_id":"123456",

                                                             "items":[

                                                                        {

                                                                                  "name":"Shampoo",

                                                                                  "unit_amount":{

                                                                                     "value":"7.9",

                                                                                     "currency_code":"EUR"

                                                                                  },

                                                                                  "quantity":"1",

                                                                                  "sku":"132"

                                                                        },

                                                                        {

                                                                                  "name":"Frachtkosten | Shipping costs",

                                                                                  "unit_amount":{

                                                                                     "value":"5.95",

                                                                                     "currency_code":"EUR"

                                                                                  },

                                                                                  "quantity":"1"

                                                                        }

                                                             ]

                                                  }

                                               ]

                                     });

                                   },                                

 

My actions.order.patch:

return actions.order.patch([

                                                {

                                            op: "replace",

                                            path: "/purchase_units/@reference_id=='default'",

                                            value: {

                                              amount: {

                                                currency_code: "EUR",

                                                value: "31.64",

                                                breakdown: {

                                                  item_total: {

                                                    currency_code: "EUR",

                                                    value: "31.64"

                                                  }

                                                }

                                              },

                                               invoice_id : "123456",

                                              items: [

                                                {

                                                  name: " Shampoo",

                                                  unit_amount: {

                                                    currency_code: "EUR",

                                                    value: "6.64"

                                                  },

                                                  quantity:"1",

                                                  "sku":"132"

                                                },

                                                                                                                                             {

                                                  name: "Frachtkosten | Shipping costs",

                                                  unit_amount: {

                                                    currency_code: "EUR",

                                                    value: "25.00"

                                                  },                                                     

                                                  quantity:"1"

                                                }

                                              ]

                                            }

                                          }

                                        ]);//ende return actions.order.patch                                 

 

When patching, unfortunately only the total price is updated, not the items (item price).

Is it possible to update the articles as well? And if so, what am I doing wrong?

Haven't Found your Answer?

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