This article shares some possible use cases your app could support, as well as
a sample flow that could support each use case. This can be a helpful jumping
off point as you plan your app's implementation.
To authorize a payment for an order with a saved payment method, follow these steps:
- Ensure the order has a saved payment method. To do this, pass the order ID to the List Transactions For Single Order method.
- Search the response for a payment with
regularPaymentDetails.savedPaymentMethod
set to true
. If no such payment exists, you will not be able to use Authorize Charge With Saved Payment Method.
- Pass the order ID and the other required fields to Authorize Charge With Saved Payment Method. Use the
delayedCaptureSettings
field to define whether to automatically capture or void the authorized charge.
- To capture the payment manually, pass the order ID and payment ID to Capture Authorized Payments. Currently, capturing only the full amount is supported.
- To void the payment, pass the order ID and payment ID to Void Authorized Payments.
To fully refund an entire order, follow these steps:
- Pass the selected order's ID to Get Order Refundability to retrieve the refundable items and amounts.
- Retrieve the refundable payments from the response.
- Pass the order ID and payment IDs to Refund Payments. Use the response from Get Order Refundability to provide the amount and items related to the refund.
Sometimes you may want to refund only a certain item. To partially refund an order, follow these steps:
- Pass the selected order's ID to Get Order Refundability to retrieve the refundable items and amounts.
- Retrieve the refundable payments from the response.
- Pass the order ID and line item ID to Calculate Refund to compute the refund amount for the required item, including associated taxes and discounts.
- Pass the received amount and the line item ID to Refund Payments to execute the partial refund for the selected item.
In cases where the payment provider is not supported by Wix or the refund was processed outside of Wix, you can still record the refund using the Order Billing API.
To do this, follow these steps:
- Call Refund Payments.
- Pass the order ID, payment ID, and refund amount.
- Set
externalRefund
to true
.