> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Sample Flows

## Article: Sample Flows

## Article Link: https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/sample-flows.md

## Article Content:

# Order Billing: Sample Use Cases and Flows

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.

## Authorize and capture with a saved payment method

To authorize a payment for an order with a saved payment method, follow these steps:

1. Ensure the order has a saved payment method. To do this, pass the order ID to the [List Transactions For Single Order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-transactions/list-transactions-for-single-order.md) method.
2. 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.
3. Pass the order ID and the other required fields to [Authorize Charge With Saved Payment Method](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/authorize-charge-with-saved-payment-method.md). Use the `delayedCaptureSettings` field to define whether to automatically capture or void the authorized charge.
4. To capture the payment manually, pass the order ID and payment ID to [Capture Authorized Payments](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/capture-authorized-payments.md). Currently, capturing only the full amount is supported.
5. To void the payment, pass the order ID and payment ID to [Void Authorized Payments](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/void-authorized-payments.md).

## Process the refund of an entire order

To fully refund an entire order, follow these steps:

1. Pass the selected order's ID to [Get Order Refundability](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/get-order-refundability.md) to retrieve the refundable items and amounts.
2. Retrieve the refundable payments from the response.
3. Pass the order ID and payment IDs to [Refund Payments](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/refund-payments.md). Use the response from Get Order Refundability to provide the amount and items related to the refund.

## Process the partial refund of an order

Sometimes you may want to refund only a certain item. To partially refund an order, follow these steps:

1. Pass the selected order's ID to [Get Order Refundability](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/get-order-refundability.md) to retrieve the refundable items and amounts.
2. Retrieve the refundable payments from the response.
3. Pass the order ID and line item ID to [Calculate Refund](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/calculate-refund.md) to compute the refund amount for the required item, including associated taxes and discounts.
4. Pass the received amount and the line item ID to [Refund Payments](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/refund-payments.md) to execute the partial refund for the selected item.

## Record a refund made on an external system

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:

1. Call [Refund Payments](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/refund-payments.md).
2. Pass the order ID, payment ID, and refund amount.
3. Set `externalRefund` to `true`.