Hello, I am trying to update the order tax_amount, shipping_amount, and total amount, but keep getting an error that I don't understand GuzzleHttp\Exception\ClientException: Client error: `PATCH https://api-m.sandbox.paypal.com/v2/checkout/orders/xxxxxxxxxxxxxx` resulted in a `422 Unprocessable Entity` response:
{"name":"UNPROCESSABLE_ENTITY","details":[{"field":"path","value":"/purchase_units/[0]/amount/tax/amount","location":"bo (truncated...) I was following the documentation on https://developer.paypal.com/docs/checkout/standard/customize/update-order-details, but the example doesn't really show much. Here is the code I came up with based on it that I think is incorrect: // Update PayPal Order Information
$postOrderClient = new Client();
$getOrderResponse = $postOrderClient->request('PATCH', env('PAYMENT_MODE') === 'production' ? 'https://api-m.paypal.com/v2/checkout/orders/' . $order->paypal_order_id : 'https://api-m.sandbox.paypal.com/v2/checkout/orders/' . $order->paypal_order_id, [
'headers' => [
'Authorization' => 'Bearer ' . $accessToken,
'Content-Type' => 'application/json',
],
'json' => [
[
"op" => "replace",
"path" => "/purchase_units/@reference_id=='PUHF'/amount/tax/amount",
"value" => $order->tax_total
],
[
"op" => "replace",
"path" => "/purchase_units/@reference_id=='PUHF'/amount/shipping/amount",
"value" => $order->shipping_total
],
[
"op" => "replace",
"path" => "/purchase_units/@reference_id=='PUHF'/amount/total",
"value" => $order->grand_total
]
]
]); I don't really understand what the @reference_id=='PUHF' means, so maybe that is my issue? I've also tried replacing @reference_id=='PUHF' with [0], but that still didn't work.
... View more