# Payment status description

> Learn about the payment status values and the logic for querying, canceling, and refunding payments through API calls.

You can confirm the status of a payment by calling the [**inquiryPayment**](https://docs.antom.com/ac/ams/paymentri_online.md) API. If the payment does not exist, the error code `ORDER_NOT_EXIST` is returned by the API. If the payment exists, the parameter _paymentStatus_ indicates the payment status.

The value of _paymentStatus_ can be `SUCCESS`, `FAIL`, `PROCESSING`, `CANCELLED`, or `PENDING` (which is triggered by few payment methods). The following flow chart illustrates the processing logic of the payment status:

![image](https://idocs-assets.marmot-cloud.com/storage/idocs87c36dc8dac653c1/1671695879544-c1fb036e-eb71-4dae-bf37-f1f0096d3682.png)

When you initiate a payment by calling the [**pay**](https://docs.antom.com/ac/ams/payment_cashier.md) API and the API call succeeds, regardless of whether a cashier page is invoked, the payment status changes to `PROCESSING`. If the payment is successful, the payment status changes to `SUCCESS`. If the payment is timed out, the payment is automatically closed 14 minutes after the API is called, and the payment status changes to `FAIL`.

If an buyer chooses Sofort to pay, when the payment is completed, the payment status changes to `PENDING`. After Sofort confirms the payment result (which usually takes 1-3 days, 7 days maximum), the payment status changes to `SUCCESS` if a successful payment is confirmed, and the payment status changes to `FAIL` if a failed payment is confirmed.

Regardless of whether a payment is completed, a buyer can use the [**cancel**](https://docs.antom.com/ac/ams/paymentc_online.md) API to cancel the payment on T day before T+1 00:15. After the payment is canceled, the payment status changes to `CANCELLED`. If the payment is completed before or after the payment is canceled, a full refund is issued to the buyer.

> **Notes**:
>
> -   A payment that has been refunded cannot be canceled, and the error code `PROCESS_FAIL` is returned in this case.
> -   A payment whose payment status is `FAIL` can be canceled. In this case, the status code `SUCCESS` is returned while the payment status remains `FAIL` instead of changing to `CANCELLED`.

If a payment is successful, you can issue a refund by calling the [**refund**](https://docs.antom.com/ac/ams/refund_online.md) API within a year. The refund amount cannot exceed the total payment amount. Partial refunds are allowed, and the amount of each refund must be no less than the minimum refund amount. After multiple partial refunds or a full refund, the payment status remains `SUCCESS`.