If you want to patch the entire purchase unit, use the below syntax [
{
"op": "replace",
"path": "/purchase_units/@reference_id=='default'",
"value": {
"amount": {
"currency_code": "USD",
"value": "53.42",
"breakdown": {
"item_total": {
"currency_code": "USD",
"value": "39.98"
},
"shipping": {
"currency_code": "USD",
"value": "9.99"
},
"tax_total": {
"currency_code": "USD",
"value": "3.45"
},
"shipping_discount": {
"currency_code": "USD",
"value": "0.00"
}
}
},
"items": [
{
"name": "test",
"unit_amount": {
"currency_code": "USD",
"value": "39.98"
},
"quantity":"1"
}
]
}
}
] Note: the value contains is an object and not array. so it will automatically patch purchase_unit[0]. You can update items, amount, shipping address and other this way.
... View more