updateCardDetail

POST /v2/pds/memberships/updateCardDetail

With this API call, Mini Program Platform can request the merchant to update membership card details for a specific user.

The message structure of this API is defined by Mini Program Platform. 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

Example

cardNo

String 

Yes

Indicates the unique card number of the specific user who changes their membership card details.

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

"011164508621375700010170***"

requestTime

Datetime

Yes

Indicates the time when the request is sent.

The value follows the ISO 8601 standard format.

"2019-06-12T14:07:05+08:00"

cardFields

Array<CardField>

Yes

Indicates the details of the membership card, for example, the username or user's phone number.

Maximum size: 10 elements

Note: Only elements that need to be updated are passed.

Refer to the CardField object in data dictionary.

extendInfo

String

No

Indicates the extended information about the request. This parameter is specified by Mini Program Platform to pass other related information that is not included in the above parameters.

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

N/A

Response parameters

Field

Data type

Required

Description

result

Result

Yes

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

extendInfo

String

No

Indicates the extended information about the response. You can specify this parameter to pass other related information that is not included in the result parameter.

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

Result processing logic

In the response, the result.resultStatus field indicates the result of updating a user's membership card details. The following table describes each result status:

resultStatus

Description 

S

The user's membership card details are updated successfully.

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

U

The result of the request to update a user's membership card details is unknown.

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

F

The request to update a user's membership card details failed.

The corresponding 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

EXPIRED_CRM_BIND_TOKEN

F

The CRM authentication token of the user is expired.

Samples

The following diagram shows the data flow of sending a request to update card details:

image

The above diagram consists of the following steps:

  1. Mini Program Platform calls this API to send a request to the merchant to update membership card details for a specific user.
  2. The merchant server processes the request and updates the user's card details in the database.
  3. The merchant returns the result to Mini Program Platform.

Request

copy
{
  "cardNo": "011164508621375700010170***",
  "requestTime": "2022-02-03T08:00Z",
  "cardFields": [
    {
      "fieldCode": "FIRST_NAME",
      "fieldValue": "John"
    },
    {
      "fieldCode": "LAST_NAME",
      "fieldValue": "Doe"
    },
    {
      "fieldCode": "GENDER",
      "fieldValue": "M"
    },
    {
      "fieldCode": "BIRTH_DATE",
      "fieldValue": "2002-07-25"
    },
    {
      "fieldCode": "MOBILE_PHONE",
      "fieldValue": "+658812****"
    },
    {
      "fieldCode": "EMAIL",
      "fieldValue": "email@example.com"
    }
  ]
}

Response

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

In this response, the result.resultStatus is S, which means the request to update card details is successful.