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 "invoicesToPay": [ 4 { 5 .."invoiceId": "inVR000000000JNIAY" 6 } 7] 8} - Properties
-
Name Type Description Required or Optional Available Version creditMemoId String ID of the credit memo that represents a refund amount. Optional, but at least one input property is required 48.0 excessFundsAmount Double Amount of excess funds to refund. Optional, but at least one input property is required 49.0 invoicesToPay Invoice To Pay Input[] List of invoices for any fees that reduce the refund, such as return fees. Optional 56.0 isAllowPartial Boolean This value controls the behavior when the amounts included in the sequences list don’t cover the entire refund amount. If this value is false, then the default refund logic is applied to ensure the remaining refund amount. If this value is true, then the unrefunded balance remains on the credit memo. If you don’t specify a sequences list, this value is ignored and the default refund logic is applied. The default value is false. Optional 56.0 sequences Sequence Order Payment Summary Input[] Ordered list of refund amounts and OrderPaymentSummaries to apply them to. The process traverses this list in order and stops when it’s refunded the full amount. Optional 56.0
- 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
-
By default, this action checks the order payment summaries associated with the specified order summary for amounts to refund following this logic. If you specify refund sequences that don’t cover the full refund amount, and isAllowPartial is false, then the remaining amount is refunded according to 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.