Alipay+ DocsAlipay+ Docs

Code Format

The format of a Merchant-Presented Code is composed of domain name, standard identifier, version and general payload.

A code format is defined as follows:

copy
HTTPS://<DOMAIN_NAME>/<STANDARD_IDENTIFIER>/<VERSION>/<GENERAL_PAYLOAD>

In the format, you can find the following elements, which are explained in detail:

  • Domain name
  • Standard identifier
  • Version
  • General payload

Domain name

Domain name, also known as network domain, is the name of a computer or group of computers on the Internet. Domain name is presented as a string of dot-separated names. It can be used to identify internet resources, such as computers, networks, and services.

This parameter is a string type with a variable length, and the value is defined by the code issuer.

Example:

Below is an example of domain name:

copy
QR.SAMPLEDOMAIN.COM

Standard identifier

String type. The value of this parameter is defined as MPM, which means the code complies with the format defined in this standard.

Version

Numeric type. This parameter represents the version of a code format.

The value of this parameter is defined as 3, which means the code complies with the version format defined in this standard.

General payload

Payload structure

The Payload is made up of three fields as depicted in Figure 2.3. The first field is the payload identifier which is defined as GPLD in this standard. The second field is a length field which is a 3-digit numeric value. The value in the length field indicates the total number of characters included in the value field. The data in the value field is a combination of different data objects.

MPMcodeformat.png

Figure 2.3 Payload data structure

Each data object is made up of three fields, where:

  • The first field is a 4-character identifier assigned to identify the data object. The identifiers are defined indata object.
  • The second field is a length field which is a 3-digital numeric type. It indicates the number of characters included in the value field of this data object.
  • The third field is the value field, which has a minimum length of one character.

A data object may be a primitive data object or a complex data object. For primitive data objects, for example, the payload version PLVS, there's no subdata object. For complex data objects, there are subdata objects. For example, below is a data structure of the sub data objects of CDSD in the Code Directory Service Data:

收款码标准配图.jpg

Figure 2.4 CDSD subdata structure in a payload

The subdata object (value field) of the CDSD data object is made up of three fields:

    • The first field is a 2-digital number with a value ranging from 01 to 99 which is assigned to identify the subdata object.
    • The second field is a length field which is a 2-digital numeric type, and it indicates the number of characters included in the value field of this data object.
    • The third field is the value field, which has a minimum length of one character and maximum length of 99 characters.

Data representation requirements

The data representation requirements in a payload are described as below:

a)     The value of a data object encoded in the payload is represented by a numeric type, an alphanumeric type and a string type.

b)     For conversion of a character to its binary representation, this standard uses UTF-8 encoding as defined by the Unicode Standard.

c)     The length of the payload should not exceed 512 alphanumeric characters.

d)     The General Payload shall be converted to base64, and the URL special characters of forward slash(/),plus sign(+) and equal sign(=) shall be URL-encoded as "%2F","%2B" and "%3D" respectively.

Data objects

The data objects in this standard are listed in table 2.1.1 below:

Table 2.1.1 Defined data objects

Data object ID

Type

Meaning

Presence

PLVS

Primitive data object

Payload Version

Current value: 01

Mandatory

CDSD

Complex data object

Code Directory Service Data

Conditional

At least one of CDSD and CIRD data object shall be present

CIRD

Complex data object

Code Issuer Reference Data  

TSVD

Complex data object

Transaction Value Data

Optional

AMAD

Complex data object

Additional Merchant Account Data

Optional

OADD

Complex data object

Other Additional Data

Optional

 

Code Directory Service Data

The data object ID CDSD indicates the code directory service data which can be used by multiple digital wallets to obtain the acquiring information of a merchant from a CDS platform. It includes subdata objects, as defined in Table 2.1.2.

A merchant can be registered on a CDS platform and assigned with a merchant index number by the platform which indicates a merchant record storing the merchant-supported acquiring information on the platform. If the data object exists in the General Payload, the CDS platform identifier and the merchant index number shall be included in this data object. For more information, see the table below:

Table 2.1.2 Code directory service data structure

Data object ID

Length

Format

Meaning

Presence

CDSD

Var.

Code Directory Service Data

 

                                                                    

01

Var. Up to 16

AN

CDS platform Identifier

Mandatory

02

Var. Up to 32

AN

Merchant Index Number on the CDS platform

The value is assigned by CDS platform

Mandatory

03

Var. Up to 32

S

Code Directory Service Platform URL

Optional

04

Var. Up to 32

AN

Key Derivation Parameter for Merchant Acquiring Information Privacy Protection Key

Optional

05

02

N

Key Derivation Function Algorithm Identifier

Current Value

01NIST SP 800-108

02SM3

Conditional,

Shall be presence when subdata object 04 exists

06

02

N

Merchant Acquiring Information Encryption Algorithm Identifier

Current Value:

01: AES-256

02: SM4

07-89

Reserved for future use

 

90-99

Reserved for CDS platform private use

 

The subdata objects 04~06 are used for privacy protection of acquiring information on a CDS platform.

Code Issuer Reference Data

The data object ID CIRD indicates the reference data used by the coder issuer, including subdata objects defined in Table 2.1.3:

Table 2.1.3 Code issuer reference data structure

Data object ID

Length

Format

Meaning

Presence

CIRD

Var.

Code Issuer Reference Data

 

 

01

Var. Up to 16

S

Code Issuer Identifier

This identifier represents a Code Issuer.

See Code Issuer List for details.

Mandatory

02

Var. Up to 16

N

Business Type

The specific value is defined in Table 5-4

Optional

03

Var. Up to 32

S

Code Issuer Business Object

The subdata object represents a business object which can be processed by the code issuer for proprietary use. It helps to identify a merchant, a store, a terminal or an order. The attribute of the business object can be described by Business Type if presence.

The value is defined by code issuer.

Mandatory

04-89

Reserved for future use

90-99

Reserved for code issuer private use

 

The value of business type is defined in Table 2.1.4 below:

Table 2.1.4 Enumeration definitions of Business Type Identifier

Numeric Value (Range)

Description

Remark

00

 

Reserved for future use

01

Transfer

A code for a fund transfer scenario.

02 - 03

 

Reserved for future use

04

Order Code (acquiring scenario)

A code used for order payment in an acquiring scenario.

05

Store Code

A code to identify a store or a merchant. A payment can be initiated using this code in an in-store payment scenario.

06

Group Code

A code used for joining a group in a social network scenario.

07

Friend Code

A code used for adding a friend / contact in a social network scenario.

08

Red Envelope Code

A code used for a red envelope scenario.

09

Order Code (transfer scenario)

A code used for order payment in a fund transfer scenario.

10

Agreement Code

A code used for guiding user to the agreement page to complete the sign-up process.

11

Top-up Code

A code used for top-up balance to a user's account.

12

Mini Program

After scanning the code, the user evokes a Mini Program in the user app.

13

Marketing

Marketing code for marketing campaigns.

14

Game

A code used for gaming scenarios.

15

To B Transfer

A code presented by a business account (B-account) owner to collect funds from another user.

16 - 99

RFU

Reserved for future use

 

Transaction Value Data

The data object ID TSVD indicates the transaction value information for a transaction, including subdata objects defined in Table 2.1.5:

Table 2.1.5 Transaction value data

Data object ID

Length

Format

Meaning

Presence

TSVD

Var.

Transaction Value Data

 

 

01

Var., up to16

S

Transaction amount

The value represents the transaction amount in a currency unit defined by subdata object 02. For example, if the currency code in subdata object 02 represents US dollar, the value 100.05 in this field signifies that the transaction amount is 100.05 US dollars.

Mandatory

02

03

AN

Transaction Currency Code

Alphabetic code or numeric code defined in ISO 4217 -2008.

Mandatory

03

Var., up to 16

S

Discount Amount

The value represents the discount amount in a currency unit defined by subdata object 02. For example, if the currency code in subdata object 02 represents US dollar, the value 3.05” in this field signifies that the discount amount for this transaction is 3.05 US dollars.

Optional

04-99

Reserved for future use

 

Additional Merchant Account Data

The data object ID AMAD indicates other identification information of the merchant which can be used by the partners of code issuers to identify the merchant directly. The value of each subdata object represents a partner representation of the merchant, and the format of each representation is defined by the code issuer or the partner for private use.

Table 2.1.6 AMAD data

Data object ID

Length

Format

Meaning

Presence

AMAD

Var.

Additional Merchant Account Data

 

 

01-99

Var., up to 99

S

Other representation of the merchant account information which can be used by the partner of code issuers .

The value of each subdata object complies with the template defined in Table 2.1.7.

At least one subdata object shall be presence if this data object exists

 

Table 2.1.7 AMAD subdata object template

AMAD SubData Object ID

Length

Format

Meaning

Presence

01~99

Var., up to 99

 

 

 

01

2-digital numeric type

Var., up to 16

S

Code Issuer Partner Identifier

This identifier represents a Code Issuer Partner and the identifier values are allocated and managed in the Code Issuer List.

Mandatory

 

02

2-digital numeric type

Var.

S

The identification information of the merchant which can be used by the code issuer partner to identify the merchant directly.

Mandatory

 

For example, if the code issuer agrees to put identification information of the merchant, such as a merchant identifier into the code, it can use one subdata object of AMAD for a record.

Other Additional Data

The data object ID OADD indicates additional data which cannot be included in other data objects, including subdata objects defined in Table 2.1.8.

Table 2.1.8 Other additional data

Data object ID

Length

Format

Meaning

Presence

OADD

Var.

Other Additional Data

 

 

99

04

S

CRC

Checksum calculated over all the data objects included in the General Payload.

Optional

 

01-98

Reserved for future use

More information

For more information, see the following topics:

Merchant-Presented Mode

Code Issuer List

Code Sample

Interaction Process

Terminology

Contact Us