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 | Yes | Indicates the member's identity. | |
bizScene | String | Yes | Indicates the business scenario where the verification code is used. Valid values are:
|
extendInfo | String | No | Indicates any extended information that the Mini Program Platform passes to the merchant.
|
Response parameters
Field | Data type | Required | Description |
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.
|
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 |
U | The status of the request to send a verification code is unknown. The corresponding value of result.resultCode is |
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:
The above diagram consists of the following steps:
- The Mini Program Platform calls this API to request the merchant to send a verification code.
- The merchant server processes the request and sends a verification code to the user.
- The merchant returns the sending result to the Mini Program Platform.
Request
{
"loginIdentity": {
"identityNo": "example@example.com",
"identityType": "EMAIL"
},
"appId": "xxxxxx",
"bizScene": "REGISTRATION"
}
Response
{
"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.