# Code Format Specification

## Payment code (for UPM)

### Code format

An Alipay+ Payment Code is a string composed of a Prefix Block and a User Identification Number (UIN), as follows:

| **Prefix Block** | **User Identification Number (UIN)** |
| --- | --- |

**Figure 1 – General Format of Alipay+ Payment Code**

An Alipay+ Payment Code has the following constraints:

-   All the characters are numeric.
-   The length of the code varies from 17 to 32 digits.
-   Codes with a length range from 20 to 23 and 25 to 32 are reserved for future use.

The mainstream Alipay+ Payment Code format currently in use is a 24-digit numeric string, composed of a 6-digit [Code Issuer Identifier (CII)](#YSvaQ), a 2-digit [Business Type Identifier (BTI)](#MC7Y0), and a 16-digit UIN.

| **Code Issuer Identifier (CII)** | **Business Type Identifier (BTI)** | **User Identification Number (UIN)** |
| --- | --- | --- |

**Figure 2 - Format of Mainstream Alipay+ Payment Code**

The CII and BTI are assigned or defined by Alipay+, and the UIN is defined by the code issuer itself to identify a particular User in its own account system.

For security reasons, the UIN should not contain any private information of the corresponding User, for example, bank card numbers, or national ID numbers.

Legacy Payment Codes that fulfill the following rules are also used in Alipay+:

| **NO.** | **Length of Payment Code** | **Regular Expression** |
| --- | --- | --- |
| 1 | 17 | 28\[0-9\]{15} |
| 2 | 18 | 28\[0-9\]{16} |
| 3 | 19 | 28\[0-8\]\[0-9\]{16} |
| 4 | 19 | 289\[0-9\]{10}\[0-57-9\]\[0-9\]{5} |
| 5 | 19 | 289\[0-9\]{10}6\[0-9\]{5} |

**Table 1 –Alipay+ Legacy Payment Code**

### Code example

Here is an example Alipay+ Payment Code.

The code value is:

**2510 0102 0123 4567 8901 2345**

The length of the Payment Code is 24 digits, the first 6 digits **251001** are the CII, the 7th to 8th digit **02** is the BTI (indicating this is a Payment Code used in UPM scenarios), and the last 16 digits **0123456789012345** are the UIN.

If this code value is symbolized into a barcode (1-dimension), the code image is like this:

![image](https://idocs-assets.marmot-cloud.com/storage/idocs87c36dc8dac653c1/1672036861342-31dc1034-f8df-44c5-b870-70765ab9798e.png)

Note: refer to

ISO/IEC 15417: 2007, _Information technology — Automatic identification and data capture techniques — Code 128 bar code symbology specification_

If this code value is symbolized into a QR code (2-dimension), the code image is like this:

![image](https://idocs-assets.marmot-cloud.com/storage/idocs87c36dc8dac653c1/1672036881912-9253a1b5-0dba-4e32-9fa2-4a8dc7a7034a.png)

Note: refer to

ISO/IEC 18004: 2015, _Information technology -- Automatic identification and data capture techniques - QR-code bar code symbology specification_

## Collection code (for MPM)

### Code format

An Alipay+ Collection Code is a string in the form of a URL, as follows:

| **https://** | **Domain Name/** | **Code Issuer Identifier (CII)** | **Business Type Identifier (BTI)** | **Object Identification Number (OIN)** |
| --- | --- | --- | --- | --- |

**Figure 3 – General Format of Alipay+ Collection Code**

where:

-   **https://**: is the default prefix to indicate the recommended network protocol. This field is case-insensitive.
-   **Domain Name**: also known as network domain, is the name of a computer or group of computers on the Internet. The 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 field is a string type with a variable length. It is defined by the code issuer itself and registered to Alipay+. This field is case-insensitive.
-   [Code Issuer Identifier (CII)](#YSvaQ): a 6-digit numeric string assigned by Alipay+ to identify a code issuer.
-   [Business Type Identifier (BTI)](#MC7Y0): a 2-digit numeric string defined by Alipay+ to indicate the intended business type.
-   **Object Identification Number (OIN)**: a 16-character or longer alphanumeric string defined by the code issuer or Alipay+ to identify a merchant, a store, a purchase order, etc., depending on the intended business type.

When a Collection Code is symbolized into a QR code image, the longer the code string is, the denser the code image appears. An extra dense QR code image should be avoided because it is difficult to resolve, therefore user experience may deteriorate. Although the capacity of a QR code is larger than a 1-dimension barcode, the length of a Collection Code should still be limited in practice, see [Use a shorter code string](../code_scanning_payment_standards_acq/user_experience_design#E9w5U) for more details.

### Code example

Here is an example Alipay+ Collection Code.

The code value is:

**https://qr.yourdomian.com/28100105****123456789ABCDEFG1234**

where:

-   **Domain Name**: qr.yourdomain.com
-   [Code Issuer Identifier (CII)](#YSvaQ): 281001
-   [Business Type Identifier (BTI)](#MC7Y0): 05 (indicating this is a **Collection Code –** Entry Code)
-   **Object Identification Number (OIN)**: 123456789ABCDEFG1234

When this code value is symbolized into a QR code (2-dimension), the code image is like this:

![image.png](https://idocs-assets.marmot-cloud.com/storage/idocs87c36dc8dac653c1/yuque/idocs/2024/png/1136479b-4af2-40a7-80f4-85b364b4c96a.png)

Note: refer to

ISO/IEC 18004: 2015, _Information technology -- Automatic identification and data capture techniques - QR-code bar code symbology specification_

## Common identifiers

### Code Issuer Identifier (CII)

A Code Issuer Identifier (CII) is a 6-digit numeric string assigned by Alipay+ to identify a code issuer, which in Alipay+ is either an MPP or an ACQP. Each code issuer can apply for one or more CII(s).

The following CIIs have been allocated:

Last updated on _**September 6, 2022**_

| **CII** | **Name of Code Issuer\*** | **Remarks** |
| --- | --- | --- |
| 281001 | Code issuer 1 |  |
| 281002 | **Reserved** | For MPM only |
| 281003 | Code issuer 2 |  |
| 281004 | Code issuer 3 |  |
| 281005 | Code issuer 4 |  |
| 281006 | Code issuer 5 |  |
| 281007 | Code issuer 6 |  |
| 281008 | Code issuer 7 | For MPM only |
| 281009 | Code issuer 8 |  |
| 281010 | Code issuer 9 |  |
| 281011 | Code issuer 10 |  |
| 281012 | Code issuer 11 |  |
| 281013 | Code issuer 12 |  |
| 281014 | Code issuer 13 |  |
| 281015 | Code issuer 14 | For MPM only |
| 281016 | Code issuer 15 | For MPM only |
| 281017 | Code issuer 16 | For MPM only |
| 281018 | Code issuer 17 |  |
| 281019 | Code issuer 18 |  |
| 281020 | Code issuer 19 |  |
| 281021 | Code issuer 20 |  |
| 281022 | Code issuer 21 |  |
| 281023 | Code issuer 22 |  |
| 281024 | Code issuer 23 |  |
| 281025 | Code issuer 24 |  |
| 281026 | Code issuer 25 |  |
| 281027 | Code issuer 26 |  |
| 281028 | Code issuer 27 |  |
| 281029 | Code issuer 28 |  |
| 281030 | Code issuer 29 |  |
| 281031 | Code issuer 30 |  |
| 281032 | Code issuer 31 |  |
| 281033 | Code issuer 32 |  |
| 281034 | Code issuer 33 |  |
| 281035 | Code issuer 34 |  |
| 281039 | **Reserved** |  |
| 281666 | Code issuer 35 |  |
| 281801 | Code issuer 36 |  |
| 281802 | Code issuer 37 |  |
| 281803 | Code issuer 38 | For MPM only |
| 281804 | Code issuer 39 | For MPM only |
| 301039 | Code issuer 40 |  |

**Table 2 – Alipay+ CIIs**

**\* The names of the code issuers are de-identified in this table.**

Contact us to get the latest formal version of the CII table.

Contact the Alipay+ Solution Architect to apply for a CII.

### Business Type Identifier (BTI)

Alipay+ recognizes the following Business Type Identifiers (BTI) as part of the Alipay+ Payment Codes (for UPM) and Collection Codes (for MPM):

Last updated on _**September 6, 2022**_

| **Numeric Value** | **Description** | **Remark** |
| --- | --- | --- |
| 02 | **Payment Code** | A code to identify a User who is trying to make a payment. It is a code used in **UPM** (User Presented Mode) where the User uses a mobile application (for example, a digital wallet provided by an MPP) to present a code image to the Merchant, and the Merchant scans the code image to initiate a Payment. |
| 04 | **Collection Code -** Order Code (acquiring scenario) | A code to identify a purchase order in an acquiring scenario. It is a code used in **MPM** (Merchant Presented Mode) where the Merchant presents a code image to the User, the User uses a mobile application (for example, a digital wallet provided by an MPP) to scan the code image and initiate a Payment. |
| 05 | **Collection Code -** Entry Code | A code to identify a store or a merchant. It is a code used in **MPM** (Merchant Presented Mode) where the Merchant presents a code image to the User, the User uses a mobile application (for example, a digital wallet provided by an MPP) to scan the code image and initiate a Payment. |

**Table 3 – Alipay+ BTIs assigned for code-scanning payment**

Alipay+ also recognizes the following Business Type Identifiers (BTI) which are related to but may not be part of the Alipay+ Payment Codes (for UPM) and Collection Codes (for MPM):

Last updated on _**September 6, 2022**_

| **Numeric V****alue** | **Description** | **Remark** |
| --- | --- | --- |
| 03 | Access Token Code | A code used as an access token in Auto-debit or User-authorization scenarios. |
| 13 | Authorization Code | A code used by a client to exchange for an access token. |
| 10 | Agreement Code | A code used for guiding users to the agreement page to complete the sign-up process. |

**Table 4 – Alipay+ BTIs related to code-scanning payment**