Implement error handling

Idempotence

The AlipayHK API supports idempotency, allowing one to retry a request multiple times while only performing the action once.

To add a pass: AlipayHK checks the idempotence by using MerchantID, TemplateID, and BizSerialID. If an existing record is found, errors will be returned.

To redeem/close a pass: AlipayHK checks the idempotence by using OpenID, PassID, and status. If a pass record is found with the status of Used or Closed, errors will be returned.

image

Timeout or system error

Because HTTPS requests depend on network stabilities, timeout might occur. At the same time, AlipayHK might return SYSTEM_ERROR for internal system problems. In both cases, partners can retry to get aligned with the final pass status.

Returned Result

Description

PARAM_ILLEGAL

Illegal parameters

USER_NOT_EXSITS

The user does not exist.

PASS_HAS_EXIT

Pass exists

PASS_TEMPLATE_HAS_NOT_EXIT

Pass template does not exist.

PASS_TYPE_NOT_MATCH

Pass type does not match the template.

PASS_PRODUCT_TYPE_NOT_MATCH

Pass product type does not match the template.

PASS_IS_NULL

Pass is null.

PASS_HAS_NOT_EXIST

Pass does not exist.

PASS_USED_OCCUPIED

Pass has been redeemed.

PASS_UPDATE_FAIL

Fail to update pass status, only pass with active status can be updated.