> For the complete documentation index, see [llms.txt](https://resources.atriptech.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://resources.atriptech.com/api-document/support-and-reference/troubleshooting-and-support/errors-handing/401-vs-402-vs-404.md).

# 401 vs 402 vs 404

{% hint style="info" %}
💬 **Need help?** If you're stuck, ask Eva in the Help Center for instant diagnostics.

<a href="https://www.atriptech.com/" class="button primary" data-icon="comments">Ask Eva</a>
{% endhint %}

Use this page when `pay.do` fails and you need to know whether the order expired, changed state, or was already paid.

### Short answer

`401` means payment was attempted after the payment deadline.

`402` means the current order state does not support payment.

`404` means the order is already paid.

Only `401` points to order regeneration or a new booking flow.

### FAQ

#### What does `401` usually mean?

It means payment started too late.

The current order is no longer payable.

#### What does `402` usually mean?

It means the order is not in a payable state.

It may already be ticketing or ticketed.

#### What does `404` usually mean?

It means a prior payment already succeeded.

Do not send another payment request.

### Core difference

#### `401` — payment timeout

**What it usually means**

The payment deadline passed before `pay.do` completed.

**Next action**

Regenerate the order or create a new booking.

Do not keep retrying the same expired payment path.

#### `402` — order state does not support payment

**What it usually means**

The order is not payable now.

The order may already be paid, ticketing, or ticketed.

**Next action**

Query the order first.

Use current order state as the source of truth.

#### `404` — order already paid

**What it usually means**

Payment already succeeded.

**Next action**

Stop retrying `pay.do`.

Continue with order follow-up instead.

### Quick decision rule

Use this rule in production:

* `401` — regenerate or rebuild the booking flow
* `402` — query the order before any payment action
* `404` — do not retry payment

### What to check next

After these codes, check:

* whether payment deadline already passed
* current `orderStatus`
* current `ticketStatus`
* whether payment already succeeded

### Common mistakes

#### Treating `401` like a transient payment failure

Do not do this.

It usually means the current order can no longer be paid.

#### Treating `402` like a simple unpaid state

Do not do this.

The order may already be moving forward.

#### Retrying `404`

Do not do this.

It creates duplicate-payment risk.

### Best practice

If payment state is unclear, switch to order query before any further payment action.

If payment deadline already passed, stop trying to pay the old order.

### Related pages

* [402 vs 404 vs 406 vs 615](/api-document/support-and-reference/troubleshooting-and-support/errors-handing/402-vs-404-vs-406-vs-615.md)
* [Payment Errors](/api-document/support-and-reference/troubleshooting-and-support/errors-handing/payment-errors.md)
* [Payment & Ticketing](/api-document/product-guides/booking/booking-step-guides/payment-and-ticketing.md)
* [Query Order](/api-document/product-guides/booking/booking-step-guides/query-order.md)
* [Hybrid Payment Guide](/api-document/product-guides/booking/booking-step-guides/payment-and-ticketing/hybrid-payment-guide.md)
* [Error Codes](/api-document/support-and-reference/troubleshooting-and-support/errors-handing.md)
