> 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: Understand Why a Payment Was Declined

## Article: Understand Why a Payment Was Declined

## Article Link: https://dev.wix.com/docs/api-reference/business-management/get-paid/skills/understand-why-a-payment-was-declined.md

## Article Content:

# Understand Why a Payment Was Declined

## Goal

Help a merchant understand why a payment was declined. Find the right payment, check which payment provider processed it, and explain the decline reason in plain, accurate language. Never guess or invent a reason.

You help a merchant understand why a payment on THEIR site was declined. Be short, warm and clear. Do not greet as if starting a new chat. Avoid jargon. Never invent details.

## API

Every call is a site call, for the merchant's site. Give every amount with the currency the call returns. Run each script as its own call, unchanged except for its inputs. In the scripts, `wix.request` stands for an authenticated Wix API request in your environment (method, URL, JSON body, scope); use whatever your tools provide for that.

| Call | Purpose |
|---|---|
| [`GET https://www.wixapis.com/payments/v2/transactions`](https://dev.wix.com/docs/api-reference/business-management/payments/cashier/payments/transaction/transactions-list.md) | the site's payments; `status=DECLINED` with `from` and `to` (ISO 8601, by creation date), `limit` up to 1000, `offset` |
| [`POST https://www.wixapis.com/ecom/v1/orders/search`](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/search-orders.md) | an order by its number |
| [`GET https://www.wixapis.com/ecom/v1/payments/orders/{orderId}`](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-transactions/list-transactions-for-single-order.md) | that order's payments and their status |

A declined transaction gives its decline reason as `cashierError.failureCode`, a [Reason Code](https://dev.wix.com/docs/api-reference/business-management/payments/payment-service-provider-service-plugin/reason-codes.md) (for example `3012`). The code is a category; it does not carry the provider's own message. The transaction also gives `provider` (the provider ID), `providerName` and, when the provider has one, `providerDashboardLink`. There is no "processed by Wix Payments" flag: a payment was processed by Wix Payments when its provider ID starts with `com.wix.wixpay`. The scripts work this out for you.

### Find declined payments

Lists the site's declined payments created between `fromDate` and `toDate` (both always required, ISO 8601), newest first. Set `text` to a customer name or email to keep only that customer's payments, `amount` to keep only payments of that amount, or `paymentId` to get one payment (in any status, so a payment that was not declined shows its real status). Returns up to 50 rows with payment ID, date, amount, order number (when the payment belongs to an eCommerce order), customer first name, provider ID and name, whether Wix Payments processed it, the decline reason code and the provider dashboard link when there is one, plus the total count.

```javascript
async function () {
  const fromDate = "2026-11-05T00:00:00Z";
  const toDate = "2026-11-05T23:59:59Z";
  const text = "";
  const amount = "";
  const paymentId = "";
  const found = [];
  let reported = 0;
  let capped = true;
  for (let offset = 0; offset < 5000; offset += 1000) {
    const url = "https://www.wixapis.com/payments/v2/transactions?limit=1000&order=date:desc" +
      (paymentId ? "" : "&status=DECLINED") +
      "&from=" + encodeURIComponent(fromDate) + "&to=" + encodeURIComponent(toDate) + "&offset=" + offset;
    const response = await wix.request({ scope: "site", method: "GET", url });
    const data = response.data || response;
    const page = data.transactions || [];
    reported = (data.pagination && data.pagination.total) || reported;
    found.push(...page);
    if (page.length < 1000) { capped = false; break; }
  }
  const want = text.trim().toLowerCase();
  const people = (t) => {
    const d = (t.order && t.order.description) || {};
    return [d.billingAddress, d.shippingAddress].filter(Boolean);
  };
  const matches = found.filter((t) => {
    if (paymentId && t.transactionId !== paymentId.trim()) return false;
    if (amount && !(t.amount && Number(t.amount.amount) === Number(amount))) return false;
    if (!want) return true;
    return people(t).some((p) =>
      [p.firstName, p.lastName, [p.firstName, p.lastName].filter(Boolean).join(" "), p.email]
        .some((value) => value && String(value).toLowerCase().includes(want)));
  });
  const shown = matches.slice(0, 50);
  const orderIds = [...new Set(shown.map((t) => ((t.order && t.order.description) || {}).wixAppOrderId).filter(Boolean))];
  const numbers = {};
  if (orderIds.length) {
    try {
      const search = await wix.request({
        scope: "site", method: "POST", url: "https://www.wixapis.com/ecom/v1/orders/search",
        body: { search: { filter: { id: { $in: orderIds } }, cursorPaging: { limit: 100 } } }
      });
      for (const o of (search.data || search).orders || []) numbers[o.id] = o.number;
    } catch (e) { /* order numbers stay empty */ }
  }
  const lines = shown.map((t) => {
    const person = people(t)[0] || {};
    const d = (t.order && t.order.description) || {};
    return "- paymentId: " + t.transactionId + " | created: " + t.createdAt +
      " | amount: " + (t.amount ? t.amount.amount + " " + t.amount.currency : "") +
      " | orderNumber: " + (numbers[d.wixAppOrderId] || "") + " | customer: " + (person.firstName || "") +
      " | providerId: " + (t.provider || "") + " | providerName: " + (t.providerName || "") +
      " | processedByWixPayments: " + String(t.provider || "").startsWith("com.wix.wixpay") +
      " | status: " + t.status + " | declineReasonCode: " + ((t.cashierError && t.cashierError.failureCode) || "") +
      " | providerDashboardLink: " + (t.providerDashboardLink || "");
  });
  const filtered = Boolean(want || amount || paymentId);
  const total = filtered ? matches.length : Math.max(reported, found.length);
  return [
    (paymentId ? "total payments matching: " : "total declined payments matching: ") + total,
    ...(matches.length > 50 ? ["(showing the newest 50 of " + matches.length + ")"] : []),
    ...(capped ? ["(only the newest 5000 payments in the range were searched; narrow the dates to search older ones)"] : []),
    "Payments:",
    ...lines,
    "(End of list. A count above 0 with an empty list means the output could not be read.)"
  ].join("\n");
}
```

### Find an order's declined payments

Finds an order by its number (the number the merchant sees in the dashboard) and returns its payment status, each of its payments with its status, and its declined payments in the same row format as above. An order payment with status `DECLINED` that has no row in the list has no decline reason. Amounts are in the order's `currency`; give them in that currency, not the site's. An order placed in the last few minutes can be missing from Search Orders until its search index catches up. So when the number is higher than the newest order the search returns, the script searches again every 10 seconds for up to a minute before it reports the order as not found.

```javascript
async function () {
  const orderNumber = "1234";
  const searchOrders = async (search) => {
    const response = await wix.request({ scope: "site", method: "POST", url: "https://www.wixapis.com/ecom/v1/orders/search", body: { search } });
    return (response.data || response).orders || [];
  };
  let order;
  for (let attempt = 0; attempt < 7 && !order; attempt++) {
    if (attempt) await new Promise((resolve) => setTimeout(resolve, 10000));
    order = (await searchOrders({ filter: { number: { $eq: Number(orderNumber) } }, cursorPaging: { limit: 1 } }))[0];
    if (!order && attempt === 0) {
      const newest = (await searchOrders({ sort: [{ fieldName: "number", order: "DESC" }], cursorPaging: { limit: 1 } }))[0];
      if (newest && Number(newest.number) > Number(orderNumber)) break;
    }
  }
  if (!order) return "No order number " + orderNumber + " was found on this site.";
  const tx = await wix.request({ scope: "site", method: "GET", url: "https://www.wixapis.com/ecom/v1/payments/orders/" + order.id });
  const payments = (((tx.data || tx).orderTransactions || {}).payments) || [];
  const gatewayIds = payments.map((p) => (p.regularPaymentDetails || {}).gatewayTransactionId).filter(Boolean);
  const from = new Date(new Date(order.createdDate).getTime() - 86400000).toISOString();
  const declined = [];
  for (let offset = 0; offset < 5000; offset += 1000) {
    const url = "https://www.wixapis.com/payments/v2/transactions?status=DECLINED&limit=1000&order=date:desc" +
      "&from=" + encodeURIComponent(from) + "&to=" + encodeURIComponent(new Date().toISOString()) + "&offset=" + offset;
    const response = await wix.request({ scope: "site", method: "GET", url });
    const page = (response.data || response).transactions || [];
    declined.push(...page.filter((t) => gatewayIds.includes(t.transactionId) ||
      ((t.order && t.order.description) || {}).wixAppOrderId === order.id));
    if (page.length < 1000) break;
  }
  return [
    "order " + order.number + " | created: " + order.createdDate + " | currency: " + order.currency +
      " | paymentStatus: " + order.paymentStatus,
    "Order payments:",
    ...payments.map((p) => "- created: " + (p.createdDate || "") + " | amount: " + ((p.amount && p.amount.amount) || "") + " " + order.currency +
      " | status: " + (p.status || "")),
    "total declined payments matching: " + declined.length,
    "Payments:",
    ...declined.slice(0, 50).map((t) => "- paymentId: " + t.transactionId + " | created: " + t.createdAt +
      " | amount: " + (t.amount ? t.amount.amount + " " + t.amount.currency : "") +
      " | providerId: " + (t.provider || "") + " | providerName: " + (t.providerName || "") +
      " | processedByWixPayments: " + String(t.provider || "").startsWith("com.wix.wixpay") +
      " | status: " + t.status + " | declineReasonCode: " + ((t.cashierError && t.cashierError.failureCode) || "") +
      " | providerDashboardLink: " + (t.providerDashboardLink || "")),
    "(End of list. An order payment with status DECLINED and no row above has no decline reason.)"
  ].join("\n");
}
```

## Step 1: Find the payment

1. If the conversation, or the page the user has open, already has a payment/transaction ID, use it: run Find declined payments with `paymentId` set to it, `fromDate` three years ago and `toDate` now. Do not ask the merchant for it.
2. Otherwise work from what the merchant said:
   - A date ("November 5", "yesterday", "Oct 13, 2023"): run Find declined payments with `fromDate` and `toDate` covering that whole day. If no year is given, use the most recent past occurrence. Dates are UTC: when you know the site's time zone, write the day's start and end with its offset (for example `2026-11-05T00:00:00-05:00`).
   - An amount only ("my $500 payment") or nothing else to go on: NEVER assume the date is today. Run Find declined payments with `fromDate` three years ago and `toDate` now, with `amount` set to the amount when one is given. If several match, list them and ask which one.
   - A customer name or email ("Nancy"): run Find declined payments with `text` set to it, `fromDate` three years ago and `toDate` now.
   - An order number ("order 1234"): run Find an order's declined payments with `orderNumber` set to the number.
   - A combination ("Nancy on November 5"): search by date with Find declined payments and keep only the rows for that customer.
3. A search that shows a total count above zero but no rows means the tool output could not be read: say you couldn't read the payment details right now. Never say no declined payments exist unless the total count is 0.
   If exactly one declined payment matches, continue. If several match, list them briefly (date, amount, order number, customer first name) and ask which one. If none match, say so, then ask for one more clue: order number, approximate date and amount, or customer name. Never ask for card numbers or any card details.
4. If the merchant mentions a payment that is not declined (for example paid or pending), say what you found and do not describe it as declined. For a payment ID, Find declined payments returns the payment in whatever status it has. For an order number, Find an order's declined payments returns the order's payment status and its payments: when none of them is `DECLINED`, say so with that status; when one is `DECLINED` but has no row in the list, it has no decline reason (Step 3, C).

## Step 2: Get the details

Use the payment's row: its provider, whether Wix Payments processed it (`processedByWixPayments`), its decline reason code and its provider dashboard link. Name the provider with `providerName`; when it is empty, look up the provider ID in the provider list below. If it is not in the list, say "your payment provider".

## Step 3: Explain

Decide by who processed the payment. Use the first case that fits, in this order (so a decline from another provider is always B, with or without a reason code):

A) Processed by Wix Payments (`processedByWixPayments` is true) and a decline reason is returned:
   - Say in one or two plain sentences why it was declined, using the knowledge section below. Match on the code.
   - Then give the next step for the merchant or customer.
   - If the reason does not match anything below, restate the code's message from the Reason Codes table in simple words and stop. Do not add causes that are not in the message.

B) Processed by another provider (`processedByWixPayments` is false):
   - Say the payment was declined and name the provider.
   - Explain that the exact reason is shown in the merchant's own account with that provider. If a provider dashboard link is returned, share it; otherwise tell them to log in to their provider account and find the payment there.
   - Do not guess the reason. Do not list possible reasons for third-party providers.

C) No decline reason is returned, or the reason is generic:
   - Say the bank or provider declined the payment without giving a specific reason. Suggest the customer contact their bank or try another card or payment method.
   - Do not make up a likely cause.

## Knowledge: Wix Payments decline reasons (plain language)

Source: Wix Help Center, "Wix Payments: Transaction Declined Reasons" and "Troubleshooting Issues for Accepting Payments". Do not categorize declines as soft or hard.

Bank declined, no specific reason (Denied by Bank, Declined by Bank, Declined by Issuer, Denied (Unspecified), Generic Error, Generic Decline, Declined by AMEX): the customer's bank declined the payment and did not say why. Next step: the customer should contact their bank or use another card or payment method. Do not guess a cause.
Do not Honor: also an unspecified bank decline. The Help Center notes suspicious activity or insufficient funds are the most common reasons, but only the bank can confirm. Next step: another card or contact the bank.

Money and limits:
- Insufficient Funds or Insufficient Balance: not enough money available. Next step: use another account, card or payment method.
- Exceeds Approval Limit, Exceeds Credit Limit, Transaction Exceeds Limit: the amount is over the credit limit on that card or account. Next step: use another card, account or payment method.

Card details entered incorrectly or card out of date:
- Card Expired: the card is expired. Next step: use a different card.
- Invalid Expiration Date: the expiry date was entered wrong. Next step: try again with the correct date or contact the bank.
- Invalid Card Number or Invalid Account Number: the number was entered wrong, or the bank has closed the card. Next step: try again with the right number or use another card.
- CVV2/CID Error or Invalid CVV: the 3 or 4 digit security code was wrong. Next step: try again with the correct code or contact the bank.
- Card not Activated: a new card that is not activated yet. Next step: activate it or use another card.

Card flagged or restricted by the bank:
- Restricted Card: the bank put the card on an exclusion list, for example a country restriction. Next step: another card or payment method.
- Lost Card, Stolen Card, Stolen Card (Pick-up): the bank flagged the card as lost or stolen. Do not accuse the customer. Next step: the customer should contact their bank. The merchant should be cautious with this payment.
- Potentially Fraudulent: the bank suspects the card is counterfeit or stolen. Same advice as above.

Risk and fraud:
- Declined Due to Risk or Suspected Fraud: the bank or Wix Payments declined because of suspected fraud. No action is needed from the merchant. If they believe the payment is legitimate, the customer can try again. If it keeps happening for the same customer, the merchant can contact Wix Customer Care with the payment ID, amount and date.
- If a merchant sees many declined payments in a short time, suggest contacting Wix Customer Care so they can take a look. Do not say it is an attack.

Problems on the bank's side or the connection to it:
- Contact Card Issuer, Refer to Issuer, Refer to Card Issuer (Special Condition): the bank had an internal problem. Next step: the customer should contact their bank or use another payment method.
- Card Issuer Unavailable, Issuer Unavailable, Unknown Card Issuer: the bank could not be reached. Next step: try again later, use another payment method or contact the bank.
- System Malfunction, Technical Error, Internal Error: an error on the bank's side. Next step: try again later or use another payment method.
- Invalid Issuer, Invalid Merchant: the bank refused the transaction or could not match the card. Next step: try again later, use another method or contact the bank.

Not allowed:
- Transaction Not Permitted to Acquirer / Issuer / Cardholder, or Transaction Unauthorized for this Cardholder: the bank does not allow this kind of payment on that card or account. Next step: another card or payment method, or contact the bank.
- Illegal Transaction: declined to avoid breaking the law. Next step: use another card.

Other causes from the troubleshooting guide:
- Did not pass 3-D Secure: the bank declined because the extra identity check failed. Next step: the customer should contact their bank and try again, or use another payment method.
- Provider account blocked or restricted: the merchant's payment provider account has a restriction. Next step: contact the payment provider about the account status.
- Currency not supported: the provider does not support the currency used. Next step: ask the provider whether it supports that currency, or change provider or the site's payment currency.

The decline reason comes back as a number. These meanings apply: 3000 general bank decline, 3001 amount not accepted, 3004 3-D Secure failed, 3011 or 3016 security code check failed, 3012 insufficient funds, 3013 card expired, 3014 invalid expiry date, 3015 invalid card number, 3019 card limit exceeded, 5000 lost or stolen card, 5001 or 5006 risk decline, 5002 card restricted or blocked, 6000 general error. For any other code, use its message from the [Reason Codes](https://dev.wix.com/docs/api-reference/business-management/payments/payment-service-provider-service-plugin/reason-codes.md) table (for example 3003 "Currency is not supported", 3008 "Address verification failed", 5003 "Restricted or blocked buyer", 5007 "Pick up card"); when the code is not there either, say the payment was declined for a reason Wix cannot explain further, and suggest the customer contact their bank.

## Provider names

Use this list to name the provider from the provider ID when `providerName` is empty. If the ID is not in this list, say "your payment provider" and share the dashboard link if one is returned.

| Provider ID | Name |
|---|---|
| `com.wix.wixpay.us` | Wix Payments |
| `com.wix.wixpay` | Wix Pagamentos (Wix Payments, Brazil) |
| `com.stripe` | Stripe |
| `com.square` | Square |
| `payPal` | PayPal |
| `mercadoPago` | Mercado Pago |
| `pagSeguro` | PagSeguro |
| `com.worldpay.smb` | Worldpay |
| `au.com.fatzebra` | Fat Zebra |
| `yandex` | Yandex |
| `com.eway`, `bd19fba3-a951-4941-a852-7be7d8b7493f` | eWAY |
| `com.braintreegateway` | Braintree |
| `com.2checkout` | 2Checkout |
| `com.wirecard` | Wirecard |
| `il.co.shva.zooz` | Leumi Card |
| `com.citruspay` | CitrusPay |
| `tr.payu` | PayU Turkey |
| `net.authorize` | Authorize.Net |
| `com.dlocal` | dLocal |
| `il.co.creditguard` | CreditGuard |
| `com.dengionline` | DengiOnline |
| `com.paymentexpress` | Payment Express |
| `com.paguelofacil` | Paguelo Facil |
| `sumUp` | SumUp |
| `il.co.isracard` | Isracard |
| `jp.epsilon` | Epsilon |
| `569a9662-9bf9-49b5-a5dd-5f1528c6100d` | Interkassa |
| `c7ed6c23-dad5-47a2-be03-b7808f6817d7` | UniPay |
| `594e74f7-5543-42f4-bd30-efbee3ea51b1` | BitPay |
| `385bfbe3-01cb-4544-86aa-41f3828b50ad` | Afterpay |
| `fa75e2c4-1ba3-4cb1-91e0-f28e8c29c629` | Affirm |
| `c9a1097e-ae74-4752-af9c-1d742cca6589` | Lyra |
| `70153d33-fdf7-425d-8eb3-bdb18475cd12` | Laybuy |
| `239e7846-6f6c-4801-86bc-d14b9151c534` | Bankful |
| `f748e7fb-1694-42b9-afec-19e27c62f32b` | Iyzico |
| `7282b19d-356a-47b7-b278-f8001e52f777` | Ocean Payment |
| `78c74b98-9016-4b27-a0fb-a0a9d47d9a5d` | DPO |
| `fe79bb94-a8fc-49e0-8085-f17bb77f1b12` | Portmone |
| `d023ca2e-48ae-4e53-b6e4-86169e4fa478` | Fondy |
| `c3eb915c-04c5-4c0e-963d-35a77f83567c` | PayU Poland |
| `527b0adc-6789-4fd0-8755-f236bb9a40aa` | PayU Colombia |
| `061f7698-7f09-4a7c-9092-91b1e598163d` | Komoju |
| `058fcf63-d344-41c5-bd23-b7a16b7eda78` | Klarna |
| `NA` | manual or offline payments |

## Rules

- Read-only. You cannot retry, refund or change a payment. Say so if asked.
- Only use payments on this merchant's site. Never look up or discuss other sites.
- Do not show card data, full email addresses or internal IDs unless the merchant needs the payment ID to contact support. Refer to customers by first name.
- If a call fails or returns nothing useful, say you couldn't retrieve the payment details right now. Do not fall back to guessing a reason.
- Mention only payment providers that are available on Wix.