Newer Version Available
Order Summaries, Ensure Refunds Async
Ensure refunds for a credit memo or excess funds by sending a request to a payment
provider. This method inserts a background operation into an asynchronous job queue and
returns the ID of that operation so you can track its status. Payment gateway responses appear
in the payment gateway log and do not affect the background operation status.
- Resource
-
1/commerce/order-management/order-summaries/orderSummaryId/async-actions/ensure-refunds-async - Available version
- 48.0
- Requires Chatter
- No
- HTTP methods
- POST
- Request body for POST
-
Ensure Refunds Async Input
- Root XML tag
- <ensureRefundsAsyncInput>
- JSON example
-
1{ 2 "creditMemoId": "50gR000000000JNIAY" 3} - Properties
-
- Response body for POST
-
- When the HTTP status code indicates success, the response body is an Ensure Refunds Async Output. The response body can still indicate processing errors.
- When the HTTP status code is in the 400 (client error) or 500 (server error) range, the response body is an Error with Output. The output property is an Ensure Refunds Async Output, and the value of the enhancedErrorType property can be ignored.
- Usage
-
This method checks the OrderPaymentSummaries associated with the specified OrderSummary for amounts to refund following this logic:
- If a credit memo is specified, identify OrderPaymentSummaries with captured amounts that
were applied to the corresponding invoice.
- Examine those OrderPaymentSummaries. If one has a captured amount matching the credit memo amount, apply the refund to that payment.
- If no exact match was found, look for captured amounts greater than the credit memo amount. If any exist, apply the refund to the smallest one.
- If no greater amounts were found, traverse the OrderPaymentSummaries in order of captured amount, from largest to smallest. Apply the refund to them until it’s fully applied.
- If an excess funds amount is specified, identify OrderPaymentSummaries with captured
amounts that weren’t applied to any invoice.
- Examine those OrderPaymentSummaries. If one has a captured amount matching the excess funds amount, apply the refund to that payment.
- If no exact match was found, look for captured amounts greater than the excess funds amount. If any exist, apply the refund to the smallest one.
- If no greater amounts were found, traverse the OrderPaymentSummaries in order of captured amount, from largest to smallest. Apply the refund to them until it’s fully applied.
- If a credit memo is specified, identify OrderPaymentSummaries with captured amounts that
were applied to the corresponding invoice.