SDK return codes
During the integration of the Antom SDK, this part will introduce you the event codes, card payment information, and risk control details that may be returned via callback functions or other methods.
onEventCallback callback function event codes
Event codes are returned through different callback functions at different times, mainly including the following three types:
- Status codes
- Error codes
- Payment result codes
Status codes
Returned through the
onEventCallback
method during the component's runtime lifecycle, and subsequent processing can be done based on the specific event.- SDK_START_OF_LOADING: The loading animation starts to be shown when the component is created. When configured to hide loading and use a custom animation, the custom animation can be rendered at this time.
- SDK_END_OF_LOADING: The loading animation ends when the component is created. When configured to hide loading and use custom animation, the animation can be hidden at this time.
- SDK_PAYMENT_CANCEL: Indicates that the user canceled the payment (the user exited the payment page without submitting the order). You can re-invoke the SDK using the paymentSessionData within its validity period. If it has expired, you need to initiate a new createPaymentSession request.
- SDK_CALL_URL_ERROR: This event code represents one of the following situations in the event information:
- Failed to redirect to merchant page.
- Failed to redirect to the payment method app or page.
- The paymentRedirectUrl parameter is not specified or is not correctly specified when calling the createPaymentSession request.
In the Web or WAP scenario, redirecting links is usually not abnormal. If an exception does occur, it is recommended that you verify the redirected link. In the app scenario, if the exception frequently occurs, contact Antom Technical Support to troubleshoot redirection or calling issues.
- SDK_CALL_URL_SUCCESS: Successfully redirected to the payment method/merchant page.
- SDK_DUPLICATE_SUBMISSION_BEHAVIOR: The form is submitted repeatedly. The merchant can prompt the user through a toast without the need to click submit repeatedly.
- SDK_FORM_VERIFICATION_FAILED: The form verification failed after submitting the form. The SDK will display the form error code on the element collection page, allowing users to resubmit payments.
- SDK_PAYMENT_AUTHORIZATION_SUCCESSFUL: The payment process is completed. If the method of not redirecting after payment is configured, it is recommended to continue listening for the corresponding payment event code to handle the subsequent process. This event code, otherwise, can be ignored and redirected to your payment results page.
- SDK_PAYMENT_CHALLENGE: Triggering a 3D challenge, and the issuing bank needs further interaction with shoppers before payment can be verified. No need to process, the SDK will redirect to the challenge page.
Error codes
Returned through the
onEventCallback
or onError
method during the component initialization phase, and subsequent processing can be done based on the specific event.- SDK_INTERNAL_ERROR: SDK internal error. Contact Antom Technical Support.
- SDK_CREATEPAYMENT_PARAMETER_ERROR:createComponentmethod specified parameter abnormally. Check if the parameters are correct and reinitialize the component.
- SDK_INIT_PARAMETER_ERROR:AMSCashierPaymentmethod specified parameter abnormally. Check if the parameters are correct and re-instantiate the SDK.
- SDK_CREATECOMPONENT_ERROR: Component initialization exception. Contact Antom Technical Support.
- SDK_SUBMIT_NETWORK_ERROR: API call failed due to network reasons. It may occur insubmitmethod submission. Try to submit it again.
Payment result codes
Returned through the
onEventCallback
method at the end of the payment process and subsequent processing can be done based on the specific event.- SDK_PAYMENT_SUCCESSFUL: Payment is successful. The buyer needs to cancel the SDK for the first-time payment, and the SDK will close in the card token payment mode. Suggest redirecting to the payment result page.
- SDK_PAYMENT_FAIL: Payment failed. We suggest that you follow the paymentResultCode error code prompt and guide the user to pay again.
- SDK_PAYMENT_PROCESSING: Payment is being processed. It is recommended to check the payment status on your server or wait for the payment result notification.
- SDK_PAYMENT_ERROR: The payment status is abnormal. It is recommended to check the payment status on your server or wait for the payment result notification.
- SDK_PAYMENT_RETRY: Retry after payment failure. When you enable the option to retry after payment failure, guide the buyer to modify the information and pay again.
Description of payment failure or abnormal payment status
The following table provides payment result code and corresponding handling suggestions for payment failure or abnormal payment status. You can take further action based on the received payment result code.
Card payment information
In the case of card payment, once the payment processing reaches a final state of success or failure, you will receive the cardPaymentResultInfo parameter in the response after invoking the
onEventCallback
function. See the table below to explore child parameters of cardPaymentResultInfo:Note: If the payment flow completes and the user is redirected to the redirection URL, you will not receive the cardPaymentResultInfo parameter.
The sample code of returned card information:
Risk control
In the case of card payment, once the payment processing reaches a final state of success or failure and you have signed the risk control service with Antom, you will receive the popRiskDecisionResultInfo parameter in the response after invoking the
onEventCallback
function. See the table below to explore child parameters of popRiskDecisionResultInfo:Note: If the payment flow completes and the user is redirected to the redirection URL, you will not receive the popRiskDecisionResultInfo parameter.
The sample code of returned risk control information: