6. Create AlipayHK Membership card

API Path

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

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

API Request

Request

Header

Fields

Type

Required

Length

Description

Sample

client-id

String

M

32

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

Body

Fields

Description

Type

Length

Required

Remarks

Sample

merchantId

MerchantID

String

64

M

Indicates the unique ID assigned to identify a merchant.

Maximum length: 64 characters

2160120041113167

userId

AlipayHK userId

String

32

O

Unique Id to identify an Alipay User

2160120037098191

openId

The id that authorized by the AlipayHK user and sent to merchant

String

32

O

At least send one ID. userId or openId

fj398457jd8iue98d8w7w93j

templateCode

Member card template id


String


32

M

2020091119027102160530200000039

bizSerialId

Card business serial number

String


128

M

Unique ID that merchant backend system uses to record the merbership card creation record

2023121819050111540150000000000108370001091127

bizSerialType

Card business serial type

String


32

M

Enumerate:
OUT_PLAT_FORM

OUT_PLAT_FORM

startDate

Card effective time

Date


/

M

Card start date time

in millisecond timestamp format

1640970061000

endDate

Card expiration time

Date


/

M

Card end date time

in millisecond timestamp format

1640970061000

bizCreate

The time when the card was created

Date


/

M

The time when the card was created,

in millisecond timestamp format

1640970061000

type

Card type

String

32

M

PassType

enumerate:

CARD

CARD

product

Product type

String

32

M

PassProductType

enumerate:

MEMBER_CARD

MEMBER_CARD

codeInfo

Card code value information, in JSON format

string

512

M

codemsg is merchant member card ID, codemsg and codevalue should be the same value

{

"$codemsg$": "9123912839123712893",

"$codevalue$": "9123912839123712893"

}

dataInfo

Card details


String

8192

M

Specific fields are assigned according to template variables

When points and/or levels were defined in member card template, the corresponding points and/or levels information should be assigned in this field.

{

"points_zh_HK": 19999,

"points_en_US": 19999,

"level_zh_HK":"鑽石卡",

"level_en_US":"Diamond Card"

}

extInfo

jsonString

M

Pass extendInfo field from Create Merchant’s Membership Card API
Sample:
{"createCardRecordId":"111","uid":"222","mid":"333"}

Response

Headers

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

Body

Fields

Description

Type

Length

Required

Remarks

result

Result info

Object

/

M

passId

System-generated unique identifier

String

32

M

ResultInfo

Fields

Description

Type

Length

Required

Remarks

resultCode

Result code

String

64

M

SUCCESS

resultStatus

Result status

String

2

M

F - failed S- success

resultMessage

Result message

String

256

O

success

Request Sample

Request

copy
{
  "merchantId": "2160120036095023",
  "userId": "2160220037090534",
  "templateCode": "temlate111001",
  "bizSerialId": "1111128828",
  "bizSerialType": "OUT_PLAT_FORM",
  "startDate": 1640970061000,
  "endDate": 1640970061000,
  "type": "CARD",
  "product": "MEMBER_CARD",
  "codeInfo": {
    "$codemsg$": "9123912839123712893",  /** Membercard ID,displayed under qrcode/barcode **/
    "$codevalue$": "9123912839123712893" /** Membercard ID,qrcode/barcode scanning content **/
  },
  "bizCreate": 1640970061000,
  "dataInfo": {"$points_zh_HK$":19999,"$points_en_US$":19999,"$level_zh_HK$":"鑽石卡","$level_en_US$":"Diamond Card"}
}

/***  dataInfo sample  ***/

// case1、template defined points & level
{
  "$points_zh_HK$": 19999,
  "$points_en_US$": 19999, 
  "$level_zh_HK$":"鑽石卡",
  "$level_en_US$":"Diamond Card"
}

// case2、template defined points, not define level
{
  "$points_zh_HK$": 19999,
  "$points_en_US$": 19999
}

// case3、template defined level, not define points
{
  "$level_zh_HK$":"鑽石卡",
  "$level_en_US$":"Diamond Card"
}

Response

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