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

registerCustomerWithProduct

POST /ams/api/v1/customers/registerCustomerWithProduct

Use this API to register an account for the user after the user passes the challenge verification successfully.

Note:

  • Before calling this interface, make sure that the user's phone number is authenticated. Otherwise, an exception error will be returned.

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

applyRequestId

String

Yes

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

More information about this field:

  • Maximum length: 64 characters

Note: This field is an API idempotency field. Merchant uses the authenticationRequestId field for idempotency control. For initialization registration requests that are initiated with the same value of authenticationRequestId and reach a final status (S or F), the same result is to be returned for the request. For details about API idempotency, see the Idempotency chapter.

"c2c25606-9f1e-4697-853d-da2517bf67be"

customer

Customer

Yes

Details of Customer information.

{

"customerType":"USER",

"accounts": [

{

"currency":"SGD",

"accountType":"BALANCE_ACCOUNT"

}

],

"user": {

"address": {

"zipCode":"3100000",

"address2":"XihuDistrict",

"city":"Hangzhou",

"address1":"ShentonWay1",

"state":"Zhejiang"

},

"occupation":"Student",

"gender":"MALE",

"nationality":"TH",

"mobileNoInfo": {

"countryCode":"65",

"verified":true,

"phoneNo":"85555555"

},

"userName": {

"firstName":"John",

"lastName":"Doe",

"nickName":"word",

"companyName":"word",

"fullName":"JohnDoe",

"middleName":"Jerry"

},

"email":"example@example.com"

},

"referenceCustomerId":"231341413144"

}

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: 32 characters

"2159210002165804"

referenceCustomerId

String

No

Customer ID in merchant's system.

More information about this field:

  • Maximum length: 64 characters

"164613912586279033763"

applyRequestId

String

No

The unique ID that is assigned by a merchant to identify a customer registration request.

More information about this field:

  • Maximum length: 64 characters

"2162878776333"

Result processing logic

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

Resultstatus

Description

S

The registerCustomerWithProduct request is accepted successfully.

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

  • If result.resultStatus is S and customerId is not null, it shows the request to register customer is successful.

U

The status of the registerCustomerWithProduct 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 registerCustomerWithProduct request is 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 call is failed, which is caused by unknown reasons.

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

RISK_REJECT

F

Risk reject

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

USER_REGISTER_ERROR

F

User register error

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

REPEATED_SUBMIT

F

Repeated request.

Repeated request.

USER_LOGIN_INFO_EXIST

F

User already register

User already registered, the user can try to set a payment password.

INVALID_PHONE_NUMBER

F

Invalid phone number

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

USER_STATUS_ABNORMAL

F

User status abnormal

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

INVALID_BALANCE_ACCOUNT_CURRENCY

F

Invalid balance account currency.

Check and verify whether the user's balance account currency is valid.

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 request sending 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.

copy
  {
    "applyRequestId":"c2c25606-9f1e-4697-853d-da2517bf67be",
    "env": {
        "language":"ko_KR",
        "osVersion":"8.1.0",
        "osType":"ios8929",
        "pastedCard":false,
        "clientUmid":"sdjoi02082",
        "sessionId":"1e32d8b642590af5c3cba8ad5d111c2c",
        "terminalType":"APP",
        "clientIp":"123.136.111.19",
        "hideProcessPayment":false
    },
    "customer": {
        "customerType":"USER",
        "accounts": [
             {
                "currency":"SGD",
                "accountType":"BALANCE_ACCOUNT"
            }
        ],
        "user": {
            "address": {
                "zipCode":"3100000",
                "address2":"XihuDistrict",
                "city":"Hangzhou",
                "address1":"ShentonWay1",
                "state":"Zhejiang"
            },
            "occupation":"Student",
            "gender":"MALE",
            "nationality":"TH",
            "mobileNoInfo": {
                "countryCode":"65",
                "verified":true,
                "phoneNo":"85555555"
            },
            "userName": {
                "firstName":"John",
                "lastName":"Doe",
                "nickName":"word",
                "companyName":"word",
                "fullName":"JohnDoe",
                "middleName":"Jerry"
            },
            "email":"example@example.com"
        },
        "referenceCustomerId":"231341413144"
    }
}

Response

DWS returns the request result.

copy
 {
        "customerId":"2188210123456789",
        "applyRequestId":"c2c25606-9f1e-4697-853d-da2517bf67be",
        "referenceCustomerId":"231341413144",
        "resultInfo": {
                "resultCodeId":"IPAY_RS_100000200",
                "resultMsg":"success",
                "resultStatus":"S"
        },
}