patch transaction amount error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a transaction, running through the javascript sdk, that authorizes the payment. That is all working find, and I'm getting an order id, and auth id etc.
I need to update the /amount before doing a capture, this time using the back end (ColdFusion). I'm referencing the docs at https://developer.paypal.com/docs/checkout/integration-features/update-order-details/#2-patch-the-tr... but keep getting invalid request etc
url: https://api.sandbox.paypal.com/v2/checkout/orders/[order id]
auth: access token generation is successful, and allows a 'get' on the same url, returns the correct order details.
body: {
op: 'replace',
path: '/purchase_units/@reference_id==\'default\'/amount',
value: {currency_code: 'USD', value: '500.00'}
}
I'm not using a reference id, but do see the 'default' in the listing. I'm guessing the issue is something in the formatting of the body. I'll get invalid request, with syntax or missing param issues.
Am I missing something?
- Labels:
-
Payments REST APIs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The patch object is an array of objects, so you can do multiple patches with one request. Makes sense, since sometimes there are some consistency boundaries such as property A + property B must equal property C, so you need to patch A, B and C at the same time.
Just put your object in an array, e.g. put [ brackets ] around it.
[
{
op: 'replace',
path: '/purchase_units/@reference_id==\'default\'/amount',
value: {currency_code: 'USD', value: '500.00'}
}
]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey DevAcct,
By default, GreenjesterAt, gave a good suggestion there.
However, I'd like to add:
You can only replace an object that you provided in the order/payment create, so you have to add it if it was not there to begin with. Which is a common enough error people tend to make.
When asking for help in the forum, it's best to show what you sent in full (minus confidential things like client IDs) and the entire return information from us. Our servers reply tend to tell you exactly what you are missing/sent wrong and it is easier for us to point to it, if you provide the tangible data.
Regards,
Stefan
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- "System error. Please try again later" when connecting to paypal sandbox account with my android app in Sandbox Environment
- Paypal create transaction with QR - API in REST APIs
- Inquiry About Documentation and Support for Tokenization and Future Payment in Payflow
- PayPal Express Error #10413 when people use a discount code on my Magento2 store in PayPal Payments Standard
- Are there any restrictions to charge using only html, vanilla javascript and php with rest api? in REST APIs