Revoke authorization

Once the buyer completes the authorization process, you are required to grant your buyer the ability to revoke authorization for the following reasons:

  • To empower the buyer with full control over their authorized agreements, enabling them to terminate the authorization relationship at any time based on their account security strategy or service usage requirements.
  • The same Antom business account is only allowed to maintain one valid token in a single merchant dimension.

If the buyer cancels authorization, you need to call the revoke API to invalidate the payment token of the payment method.

The payment token (accessToken) corresponding to the withholding service is passed in the API request, and the payment token (accessToken) can be invalidated after the API call is successful. The code below shows a sample of calling the revoke API:

copy
public static void Cancel() {
    AlipayAuthRevokeTokenRequest alipayAuthRevokeTokenRequest = new AlipayAuthRevokeTokenRequest();

    // replace with your accessToken
    alipayAuthRevokeTokenRequest.setAccessToken("281010033AB2F588D14B43238637264FCA5Axxxx");

    AlipayAuthRevokeTokenResponse alipayAuthRevokeTokenResponse = null;
    try {
        alipayAuthRevokeTokenResponse = CLIENT.execute(alipayAuthRevokeTokenRequest);
    } catch (AlipayApiException e) {
        String errorMsg = e.getMessage();
        // handle error condition
    }
}

The following code shows a sample of the request message:

copy
{
  "accessToken": "281010033AB2F588D14B43238637264FCA5Axxxx"
}

The following code shows an example of a response:

copy
{
  "result": {
    "resultCode": "SUCCESS",
    "resultMessage": "Success",
    "resultStatus": "S"
  }
}

The table below shows the possible values of result.resultStatus in the response message. Handle the result according to the guidance provided.

result.resultStatus

Message

Further action

S

Revocation is successful.

No further action is needed.

U

Unknown revocation status.

Use the same accessToken and call the API again or wait for the asynchronous notification. If the issue persists, contact Antom Technical Support.

F

Revocation failed.

Check and verify whether the current API required request fields (including header fields and body fields) are correctly passed and valid.

Notes:

  • If no response is received, it may indicate a network timeout. Use the same accessToken and call the API again. If the issue persists, contact Antom Technical Support.
  • Currently, buyers are not supported to cancel authorization on the Antom Business Account side.