sendVerificationCode

POST /v2/pds/memberships/sendVerificationCode

With this API call, the Mini Program Platform can request the merchant to send a verification code to a user.

The message structure of this API is defined by us. Follow the specifications below when the merchant develops this API.

Structure

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

Request parameters

Field

Data type

Required

Description

loginIdentity

LoginIdentity

Yes

Indicates the member's identity.

bizScene

String

Yes

Indicates the business scenario where the verification code is used. Valid values are:

  • REGISTRATION: indicates the verification code is used for the membership registration.
  • LOGIN_ID_UPDATE: indicates the verification code is used for the login ID update.

extendInfo

String

No

Indicates any extended information that the Mini Program Platform passes to the merchant.

  • Maximum length: 2048 characters
  • Characters not allowed: special characters such as @, #, and ?

Response parameters

Field

Data type

Required

Description

result

Result

Yes

Indicates the request result, such as status and error codes.

extendInfo

String

No

Indicates any extended information that the merchant passes to the Mini Program Platform.

  • Maximum length: 2048 characters
  • Characters not allowed: special characters such as @, #, and ?

Result processing logic

In the response, the result.resultStatus parameter indicates the result of processing a request. The following table describes each result status:

resultStatus

Description 

S

The request to send a verification code is successful.

The corresponding value of result.resultCode is SUCCESS and the value of result.resultMessage is Success.

U

The status of the request to send a verification code is unknown.

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

F

The request to send a verification code failed.

The corresponding values of result.resultCode and result.resultMessage can vary based on different situations. For details, see the following Error codes section.

Error codes

Error codes are usually classified into the following categories:

  • Common error codes are common for all mini program OpenAPIs in V2.
  • API-specific error codes:

Error code

Result status

Error message

VERIFICATION_CODE_SEND_TIMES_EXCEED_LIMIT

F

The requests to send a verification code are too frequent.

Sample

The data flow of sending a request to send a verification code is illustrated as follows:

image

The above diagram consists of the following steps:

  1. The Mini Program Platform calls this API to request the merchant to send a verification code.
  2. The merchant server processes the request and sends a verification code to the user.
  3. The merchant returns the sending result to the Mini Program Platform.

Request

copy
{
  "loginIdentity": {  
    "identityNo": "example@example.com",
    "identityType": "EMAIL"
  },
  "appId": "xxxxxx",
  "bizScene": "REGISTRATION"
}

Response

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

In the response sample above, the value of result.resultStatus is S, which means the request to send a verification code is successful.