Alipay, China's leading third-party online payment solutionAlipay, China's leading third-party online payment solution

modifyCustomer

POST /ams/api/v1/customers/modifyCustomer

Use this API to change a user's mobile phone number or email address.

Note:

  • Before calling this API to modify the customer's information, make sure that the merchant calls this API and makes a modification consult first.

Structure

A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see:

Note: Set the data type of each field (except array) as String. This means that you must use double quotation marks (" ") to enclose the field value. Examples:

  • If the data type of a field is Integer and its value is 20, set it as "20".
  • If the data type of a field is Boolean and its value is true, set it as "true".

Request parameters

Field

Data type

Required

Description

Examples

requestId

String

Yes

The unique ID that is assigned by a merchant to identify a customer information modification request. DWS uses this field for idempotence control.

More information about this field:

  • Maximum length: 64 characters

"22103231051900770000001621402005857"

authenticationId

String

No

The authentication ID throughout the process. Returned when the verification is initialized.

More information about this field:

  • length: 64 characters

"20220105190077000000162140200586657"

customer

Customer

Yes

Details of customer information. See Customer for details.

{

"customerId": "2188000000000000000",

"user": {

"mobileNoInfo": {

"countryCode":"65",

"phoneNo":"85555555"

},

"email":"example@example.com"

}

}

businessSceneCode

String

No

The modified type. This field needs to be filled in the consult modify period and depends on the user's modify status.

Valid values are:

  • MOBILE_AVAILABLE: Modifying phone numbers and phone numbers are available (default).
  • MOBILE_UNAVAILABLE: Modifying phone numbers and phone numbers are unavailable.
  • MODIFY_EMAIL: Modifying email.

"MOBILE_AVAILABLE"

env

Env

No

The environment information, and data collection for transaction risk. See Env for details.

{

"appVersion": "6.84.2",

"clientIp": "175.***.**.***",

"deviceModel": "TECNO LD7",

"deviceTokenId": "wiQ5Hlwx3QLMkRS3R3OMtOAnznRWKJ6lFPgs7GDgihiuimC9fQEAAA==",

"language": "en-PH",

"operateEntrance": "DWS",

"osType": "Android",

"osVersion": "10",

"sessionId": "1e32d8b642590af5c3cba8ad5d111c2c",

"terminalType": "APP",

"umidTokenId": "DYQAEhpLPO4XcQN9vXk/RHl6C7oLX+41"

}

Response parameters

Field

Data type

Required

Description

Examples

result

Result

Yes

The result contains information such as status and error codes.

{

"resultCode":"SUCCESS",

"resultMessage":"success.",

"resultStatus":"S"

}

customerId

String

Yes

Customer ID in DWS.

More information about this field:

  • Maximum length: 64 characters

"2188000000000000000"

actionForm

Map<String, Object>

No

Further action, when the processing result is not in the final state, provides a reference for what the next action needs to do. According to challengeType, you can determine the factor to be verified in the next step.

When need to do OTP verification:

{

"challengeRenderValue": "+6222***508",

"challengeType": "sms"

}

When need to do PIN verification

{

"challengeRenderValue": "",

"challengeType": "PAYMENT_PASSWORD"

}

authenticationId

String

No

The authentication ID throughout the process. The value of this field is used as the value of challengeId when calling the triggerChallenge API.

More information about this field:

  • length: 64 characters

"20220105190077000000162140200586657"

Result processing logic

In the response, the result.resultStatus field indicates the result of the modifyCustomer request. The following table describes each result status:

Result status

Description

S

The modifyCustomer request is accepted successfully.

The corresponding result.resultCode is SUCCESS, and result.resultMessage is SUCCESS.

U

The status of the modifyCustomer request is unknown.

The corresponding result.resultCode is UNKNOWN_EXCEPTION, and result.resultMessage is An API call failed, which is caused by unknown reasons. For details, see the Common error codes section.

F

The modifyCustomer request failed. The corresponding result.resultCode and result.resultMessage may vary based on different situations. For details, see the following Error codes section.

Error codes

Result code

Result status

Result message

Further action

SUCCESS

S

Success

/

REPEAT_REQ_INCONSISTENT

F

Repeated requests are inconsistent.

Ensure the fields in the requests are the same.

PARAM_ILLEGAL

F

Illegal parameters exist. For example, a non-numeric input, or an invalid date.

Check and verify whether the request fields, including the header fields and body fields, are correct and valid.

For details on the fields of each API, see the specific API Structure section.

PROCESS_FAIL

F

A general business failure occurred. Don't retry.

Human intervention is usually needed. It is recommended that you contact the technical support team to troubleshoot the issue.

UNKNOWN_EXCEPTION

U

An API cal failed, which is caused by unknown reasons.

Call the interface again to resolve the issue. If the issue persists, contact Alipay Technical Support.

INVALID_PHONE_NUMBER

F

invalid phone number

Check and verify whether the user's phone number has the correct format and is valid.

TIMES_EXCEED_LIMIT

F

Wait a while, please try again later

Too many requests in a short time, wait for a while then request again.

INVALID_API

F

API is invalid (or not active).

Check whether the API name, HTTP method, or request format is correct when sending the request.

INVALID_CLIENT

F

Invalid client.

Check whether the client ID is correct, or contact Alipay Technical Support for detailed reasons.

INVALID_SIGNATURE

F

Signature is invalid.

Check whether the private key used to sign a request matches the public key of Alipay Developer Center.

REQUEST_TRAFFIC_EXCEED_LIMIT

U

Request traffic exceeds the limit.

Call the interface again to resolve the issue. If the issue persists, contact Alipay Technical Support.

ACCESS_DENIED

F

Access denied.

Contact Alipay Technical Support for detailed reasons.

SEND_TIMES_EXCEED_LIMIT

F

The send times exceed the limit.

Contact Alipay technical support to know the specific limitation.

METHOD_NOT_SUPPORTED

F

The server does not implement the requested HTTP method.

Ensure the HTTP method is POST.

Samples

Request

The merchant sends a request to Alipay to consult the customer information modification.

copy
{
    "requestId": "12314356786543545324",
    "customerInfo": {
      "customerId": "2188000000000000000",
    },
    "businessSceneCode": "MOBILE_AVAILABLE",
}

The merchant sends a request to Alipay to do the email modification.

copy
{
    "authenticationId": "20220105190077000000162140200586657",
    "customerInfo": {
      "customerId": "2188000000000000000",
      "user": {
            "email":"example@example.com"
        }
    }
}

The merchant sends a request to Alipay to modify the phone number.

copy
{
    "authenticationId": "20220105190077000000162140200586657",
    "customerInfo": {
      "customerId": "2188000000000000000",
      "user": {
         "mobileNoInfo": {
             "countryCode":"65",
             "phoneNo":"85555555"
         }
      }
    }
}

Response

DWS returns the request result of consulting modification.

copy
{
  "actionForm":{
    "challengeRenderValue":"+60******6353",
    "challengeType":"sms"
  },
  "customerId": "2188000000000000000",
  "authenticationId":"20220105190077000000162140200586657",
  "result":{
    "resultCode":"SUCCESS",
    "resultMessage":"success.",
    "resultStatus":"S"
  }
}

DWS returns the request result of the phone number modification with risk.

copy
{
  "actionForm":{
    "challengeRenderValue":"+60******6353",
    "challengeType":"sms"
  },
  "customerId": "2188000000000000000",
  "authenticationId":"20220105190077000000162140200586657",
  "result":{
    "resultCode":"SUCCESS",
    "resultMessage":"success.",
    "resultStatus":"S"
  }
}

DWS returns the successful result of the email modification.

copy
{
  "customerId": "2188000000000000000",
  "result":{
    "resultCode":"SUCCESS",
    "resultMessage":"success.",
    "resultStatus":"S"
  }
}