# Best practices

> This document presents actionable strategies to improve user experience and payment performance, driving your business growth.

This document presents actionable strategies to improve user experience and payment performance, driving your business growth.

-   [Intelligent risk control service](#coyZI)
-   [Security expansion package](#l2mYC)
-   [Order query after redirecting to the merchant result page](#FAh1d)
-   [Merchant-initiated transaction cancellation](#LpdHK)
-   [Payment failure retry](#PFmIt)

## **Intelligent** risk control service

EasySafePay's built-in intelligent risk control capabilities requires precise risk control field inputs during payment session creation (annotated for risk control purposes). The accuracy and completeness of these data points directly determine the system's fraud detection effectiveness.

The following parameters are essential for effective risk control. Please transmit them accurately. For detailed field specifications, refer to [**createPaymentSession (EasySafePay)**](https://docs.antom.com/ac/ams/createpaymentsession_easypay.md).

| **Parameter type** | **Parameter name** | **Description** |
| --- | --- | --- |
| Equipment & Environment fields | _env.clientIp_ | The client device's IP address. |
| Order Fields | _order.goods:_ - _referenceGoodsId_ - _goodsName_ - _goodsCategory_ - _goodsUnitAmount_ - _goodsQuantitygoodsUrl_ - _deliveryMethodType_ | Product details including product ID, name, category, unit price, quantity, URL, and delivery method. |
| Order Fields | _order.shipping:_ - _shippingName_ - _shippingAddress_ - _shippingPhoneNo_ - _shipToEmail_ - _shippingCarrier_ | Shipping information including recipient details and logistics carrier name. For digital goods, provide _shipToEmail_ for the recipient email address. |
| Order Fields | _order.buyer:_ - _referenceBuyerId_ - _buyerPhoneNo_ - _buyerEmail_ - _buyerRegistrationTime_ | Buyer information including buyer ID, phone number, email address, and registration time. At least one of the following must be provided: ID, phone number, or email address. |

## Security expansion package

When integrating the SDK resource package, please follow the specifications to add the security extension package. For iOS, refer to [SDK security package](https://docs.antom.com/ac/sdks/ios.md#2eqMK); for Android, refer to [Integrate the security package](https://docs.antom.com/ac/sdks/android.md#lIujm).

This component collects terminal device information for risk identification, enhancing payment security and service reliability.

## Order query after redirecting to the merchant result page

Call the [**inquiryPayment**](https://docs.antom.com/ac/ams/paymentri_online.md) API and dynamically display content on the results page according to different payment states.

-   **Payment succes****s**: Display shipping-related information.
-   **Payment failure**: Display payment retry instructions.
-   **Payment** **in** **process**:

-   Display loading status for 3-5 seconds, then automatically initiate a secondary query.
-   When the system continuously returns a processing status, display “Your order is being processed. Please check the results later in the Order Management Portal.”

> **Notes**:
>
> -   Avoid non-deterministic descriptions like "network latency".
> -   All status prompts must strictly match the API response.

## Merchant-initiated transaction cancellation

If the merchant's order timeout closure occurs earlier than Antom's payment order timeout, a "payment successful" notification may still be received after order closure. In such cases, invoke the [**cancel**](https://docs.antom.com/ac/ams/paymentc_online.md) API to initiate a buyer refund.

## Payment failure retry

When an order payment fails and retries are permitted for the same order, follow this workflow:

1.  Set _referenceOrderId_ as the order ID and _paymentRequestId_ as the payment order ID in the payment request.
2.  Before retrying payment, check the order status:

-   If already successful, display "Payment completed".
-   If still processing or failed, call the [**createPaymentSession (EasySafePay)**](https://docs.antom.com/ac/ams/createpaymentsession_easypay.md) API again to obtain new _paymentSessionData._

3.  Ensure each order is only associated with one successful payment. If duplicate successful payments are detected, call the [**cancel**](https://docs.antom.com/ac/ams/paymentc_online.md) API to initiate a refund.