7. Update AlipayHK Membership card

1、API Path

/api/open/alipay/v1/ipass/pass/manage/updatePass

Sample:https://open.alipay.hk/api/open/alipay/v1/ipass/pass/manage/updatePass

1.1、Request

1.1.1、request header

Field

Type

Requred

Length

Description

Sample

client-id

String

M

8

Client ID

2110200000000044

signature

String

M

128

Signature contains key-value pairs that are separated by comma (,). Each key-value pair is an equation, which is a key joined with its value with an equal sign (=).

algorithm=sha256withrsa,keyVersion=2,signature=xxxxxxxxxxxyyyyyyyyyyyyyyzzzzzzzzz==

encrypt

String

O

32

Encrypt contains key-value pairs that are separated by comma (,). Each key-value pair is an equation, which is a key joined with its value with an equal sign (=).

algorithm=rsa, keyVersion=2

Content-type

String

M

/

Content-Type indicates the media type of the body of the request, as defined by RFC2616. In which, charset is used for generating/validating signature and encrypting/decrypting content.

application/json; charset=UTF-8

request-time

String

M

Request time

2023-12-18T02:33:31Z

1.1.2、body

字段

类型

长度

必填

说明

示例

merchantId

string

32

M

Indicates the unique ID assigned to identify a merchant.

Maximum length: 64 characters

2312314123123123

userId

string

32

C

Unique Id to identify an Alipay User,

At least send one ID. userId or openId

2188200000000000

openId

string

32

C

Unique Id to identify an Alipay User

At least send one ID. userId or openId

fj398457jd8iue98d8w7w93j

templateCode

string

32

O

Member card templateId

an unique id that represent merchant's membership template

Provided by AlipayHK

passId

String

32

M

Member card id

an unique id that represent user's membership card

status

String

32

M

Membership card status:

  1. CLOSED - terminate card
  2. UPDATE - update card content

UPDATE

updateDetailType

String

32

C

When staus = UPDATE, the allowed updateDetailType is (fixed value):

UPDATE_MEMBER_CARD

UPDATE_MEMBER_CARD

endDate

String

128

O

Membership card expired date in

millisecond timestamp

1640970061000

dataInfo

JSONObject

O

Data needs to be updated, json object format

{

"$points_zh_HK$": 19999,

"$points_en_US$": 19999,

"$level_zh_HK$":"钻石卡",

"$level_en_US$":"Diamond Card"

"billNo": "220230343242343442422333222",

"lastChangedPoints": "1",

"pointsProvider": "ALIPAYHK"

}

billNo,lastChangePoints,pointsProvider

For non-Alipay transaction the above field can be null

codeInfo

JSONObject

O

Code information that needs to be updated.

Pass a new JSON object info, if the member card code needs to be updated.

Warn: To update code infomation needs to confirm with SA team

"codeInfo": {

   "$codemsg$": "81399940",

   "$codevalue$": "81399940"

}

2.2、response

2.2.1 header

Fields

Type

Required

Length

Description

Sample

client-id

String

M

8

Client ID

2110200000000044

signature

String

M

128

Signature

algorithm=sha256withrsa,keyVersion=2,signature=xxxxxxxxxxxyyyyyyyyyyyyyyzzzzzzzzz==

encrypt

String

O

32

Encrption

algorithm=rsa, keyVersion=2

Content-type

String

M

/

Http content type

application/json; charset=UTF-8

response-time

String

M

response time

2023-12-18T02:33:31Z

2.2.2 Body

Field

Type

Length

Description

Sample

ResultInfo

Object

/

Result

ResultInfo

Field

Type

Length

Description

Sample

resultCode

String

result code

resultStatus

String

result status

F - failed S- success

resultMessage

String

result description

SUCCESS

3.3、Sample

3.3.1、Request Sample

copy
// case1: Update both points & level & code value
{
  "merchantId": "2160120036095023",
  "userId": "2160220037090534",
  "templateCode": "temlate111001",
  "bizSerialId": "1111128828",
  "bizSerialType": "OUT_PLAT_FORM",
  "startDate": 1640970061000,
  "endDate": 1640970061000,
  "bizCreate": 1640970061000,
  "type": "CARD",
  "product": "MEMBER_CARD",
  "codeInfo": {
    "$codemsg$": "81399940",
    "$codevalue$": "81399940"
  },
  "dataInfo": {
    "$points_zh_HK$": 19999,
    "$points_en_US$": 19999,
    "$level_zh_HK$": "鑽石卡",
    "$level_en_US$": "Diamond Card"
  }
}

// case2: Update points only
{
  "merchantId": "2160120036095023",
  "userId": "2160220037090534",
  "templateCode": "temlate111001",
  "bizSerialId": "1111128828",
  "bizSerialType": "OUT_PLAT_FORM",
  "startDate": 1640970061000,
  "endDate": 1640970061000,
  "bizCreate": 1640970061000,
  "type": "CARD",
  "product": "MEMBER_CARD",
  "dataInfo": {
    "$points_zh_HK$": 19999,
    "$points_en_US$": 19999
  }
}

// case3: Update level only
{
  "merchantId": "2160120036095023",
  "userId": "2160220037090534",
  "templateCode": "temlate111001",
  "bizSerialId": "1111128828",
  "bizSerialType": "OUT_PLAT_FORM",
  "startDate": 1640970061000,
  "endDate": 1640970061000,
  "bizCreate": 1640970061000,
  "type": "CARD",
  "product": "MEMBER_CARD",
  "dataInfo": {
    "$level_zh_HK$": "鑽石卡",
    "$level_en_US$": "Diamond Card"
  }
}

// case4: Update status
{
  "merchantId":"6228480402564890018",
  "userId":"2160400000000135",
  "templateCode":"5228480402564890018",
  "passId":"2995228480402564890018",
  "status":"CLOSED",  // Terminate member card, user can check this card from Used/expired tab
}

4.3.2、Response Sample

copy
{
    "resultInfo":{
        "resultCode": "SUCCESS"
        "resultMessage":"success",
        "resultStatus": "S"
    }
}