> 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: Introduction

## Article: Introduction

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

## Article Content:

# About the Order Billing API

The Order Billing API allows you to manage payments and refunds for Wix eCommerce orders.
The API centralizes all payment-related capabilities for eCommerce orders, supporting a wide range of business use cases, including charging unpaid orders with saved payment methods, capturing and voiding authorized payments, and processing refunds.

With the Order Billing API, you can:
+ [Authorize payments for orders with saved payment methods](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/authorize-charge-with-saved-payment-method.md).
+ [Capture](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/capture-authorized-payments.md) or [void](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/void-authorized-payments.md) authorized payments.
+ [Retrieve the refundability status of an order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/get-order-refundability.md) and check the amounts available for refund.
+ [Calculate the refundable amount](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/calculate-refund.md) for specific items, shipping, or additional fees, including taxes and discounts.
+ [Issue refunds](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/refund-payments.md) for supported payment providers, and mark refunds performed on systems other than Wix as externally refunded.
+ [Redeem a gift card](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/redeem-gift-card.md) as payment for an order.
+ [Generate digital receipts](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/generate-receipts.md) for an order's completed payments.

After capturing a payment or issuing a refund with the Order Billing API, you can manage the records of these payments and refunds with the [Order Transactions API](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-transactions/introduction.md).

## Before you begin

It’s important to note the following before starting to code:

+ Payments are supported from payment service providers and gift cards (using [Redeem Gift Card](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/redeem-gift-card.md)). Paying with a membership is not yet supported.
+ Charging payments with this API is limited to saved payment methods and authorized payments only.
+ Authorizing payments (delayed capture) is only available for Wix Payments.
+ Capturing or voiding authorized payments is only supported for the full authorized amount. Partial captures or voids are not currently available.
+ Most payment providers can be automatically refunded using the [Refund Payments](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/refund-payments.md) method. For unsupported payment providers, use the API to manually mark the payments as externally refunded. This ensures alignment between Wix and external systems.

## Use cases

+ [Authorization and capture with a saved payment method](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/sample-flows.md)
+ [Process the refund of an entire order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/sample-flows.md)
+ [Process the partial refund of an order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/sample-flows.md)
+ [Record a refund made on an external system](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-billing/sample-flows.md)

## Terminology

+ **Regular payment:** A standard payment processed via supported payment providers. This represents only monetary transactions, not gift cards or memberships.
+ **Offline payment:** A payment not processed by Wix, but still recorded by Wix.
+ **Saved payment method:** Card tokenization replaces sensitive card details with a secure, unique token to protect data during transactions and enable safer digital payments. You can specify that an item requires a saved payment method at checkout with the [Catalog Service Plugin](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/catalogs/catalog-service-plugin/introduction.md).
+ **Payment authorization:** Authorization is the process of reserving funds on a customer's payment method to ensure the payment can be completed, without immediately charging the amount.
+ **Delayed capture:** Allows businesses to charge the authorized amount at a later date. This is typically used for security deposits or order verification.
+ **Capture:** The process of transferring the reserved funds from the customer to the business.
+ **Void:** Cancels an authorized payment, and releases the reserved funds back to the customer's payment method.


+ **Refundability:** Whether an order/payment is refundable. Possible reasons why an order/payment is not refundable include pending/rejected orders, payment provider issues, and more.
+ **Shipping refund:** Refunding the amount charged for shipping fees.
+ **Additional fee refund:** Refunding the amount charged for extra fees. This may include handling fees, gift wrapping fees, or other supplementary charges.
+ **Refund statuses:**
  * `SCHEDULED` - Refund request acknowledged, and will be performed soon.
  * `STARTED` - Refund initiated on the payment provider side.
  * `PENDING` - Refund initiated on the payment provider side. This status is assigned by the payment provider.
  * `SUCCEEDED` - Refund transaction succeeded.
  * `FAILED` - Refund transaction failed.

## SDK Setup
  `@wix/ecom`

To use the API, install the `@wix/ecom` package.

#### Install the package

Follow the installation instructions for your development environment.

| Development environment | Installation method |
|--|--|
| Wix sites (editor or IDE) | Use the [package manager](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/packages/work-with-npm-packages-in-the-editor.md). |
| Wix sites (local IDE) | Run `wix install @wix/ecom` using the [Wix CLI](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/packages/work-with-npm-packages-with-the-wix-cli.md).|
| Blocks apps | Use the same installation method as Wix sites. |
| CLI and self-hosted apps | Run `npm install @wix/ecom` or `yarn add @wix/ecom`. |
| Headless sites and apps | Run `npm install @wix/ecom` or `yarn add @wix/ecom`. |

#### Import the package

To import the package in your code:

```js
import { orderBilling } from '@wix/ecom'
```

#### Import types

Types for this API are accessed through the `orderBilling` namespace you already imported above, as `orderBilling.<TypeName>`, using any type name shown in these docs.
  