PHPackages                             lee-ratinan/emv-qr - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. lee-ratinan/emv-qr

ActiveLibrary[Payment Processing](/categories/payments)

lee-ratinan/emv-qr
==================

This PHP class is for reading and generating EMV QR codes, which is the QR code for making payments via mobile payment platforms.

V0.9.1(4y ago)435[1 issues](https://github.com/lee-ratinan/emv-qr/issues)MITPHP

Since Oct 25Pushed 4y ago1 watchersCompare

[ Source](https://github.com/lee-ratinan/emv-qr)[ Packagist](https://packagist.org/packages/lee-ratinan/emv-qr)[ Docs](https://lee.rongq.in)[ RSS](/packages/lee-ratinan-emv-qr/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (2)DependenciesVersions (9)Used By (0)

emv-qr
======

[](#emv-qr)

[![GitHub last commit](https://camo.githubusercontent.com/1df96a91122dec3d01333ca3bff4c0e91b148163c301a62f144d2435cd49930b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f6c65652d726174696e616e2f656d762d7172)](https://github.com/lee-ratinan/emv-qr/commits/main)[![GitHub](https://camo.githubusercontent.com/9343add0b6e074287f394ab54385adafe39ef82dc895d5c93f973a8bfb1914a3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6c65652d726174696e616e2f656d762d7172)](https://github.com/lee-ratinan/emv-qr/blob/main/LICENSE)[![GitHub all releases](https://camo.githubusercontent.com/a129d0a9950b3b587c7d698c45234a78f664c4a82fdf6d703bf78c2da04184fd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f6c65652d726174696e616e2f656d762d71722f746f74616c)](https://github.com/lee-ratinan/emv-qr/releases)[![GitHub issues](https://camo.githubusercontent.com/6625f9f72c57f217877719fb2b65c792f5ad0ee20fa33da2c874753982ba42fa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6c65652d726174696e616e2f656d762d7172)](https://github.com/lee-ratinan/emv-qr/issues)

This repo is for reading and generating EMV QR Code for various countries, currently supports:

- Singapore
- Thailand

Possible expansion: Indonesia, Malaysia, Hong Kong, India.

EMVCo QR Code Specification for Merchant-Presented QR Code
----------------------------------------------------------

[](#emvco-qr-code-specification-for-merchant-presented-qr-code)

The specification for EMVCo QR Code defined as the blocks of string: \[ID, Length, Value\]. The ID and length consist of 2-digit number ranging from '00' to '99', and the value is the value of the item identified by the ID. For example, '000201' is the block of string for ID '00' (payload format indicator) with the value's length of '02' (2-character long), hence the value is '01', which is the 2-character behind the length. The tables below describe the IDs, lengths, and their descriptions.

Notes:

- Formats:
    - N = numeric
    - ANS = alphanumeric and special character string (ASCII 32-126)
    - S = string of any unicode characters
- Presence
    - M = mandatory
    - O = optional
    - C = conditional

Table 1: Data Objects Under the Root of a QR Code

IDLengthFormatDescriptionPresenceNotes0002NPayload format indicatorMA fixed value of '01' (or '00', as used by Singapore SGQR)0102NPoint of initiationO'11' for static QR code or '12' for dynamic QR code02-51&lt;=99ANSMerchant account informationMAt least 1 account for the payment to be made to, refer to Table 2 below for the allocation of the IDs, and Table 5 for the data objects under each account5204NMerchant category codeMISO 18245 code for retail financial services, use '0000' if unknown or not required5303NTransaction currencyMISO 4217 numeric currency code54&lt;=13ANSTransaction amountCThe amount to be transferred, required if the QR type is dynamic (the customers do not enter the amount themselves)5502NTip or Convenience IndicatorO56&lt;=13ANSValue of Convenience Fee FixedC57&lt;=5ANSValue of Convenience Fee PercentageC5802ANSCountry codeMISO 3166-1 alpha-2 country code59&lt;=25ANSMerchant nameM60&lt;=15ANSMerchant cityM61&lt;=10ANSMerchant postal codeO62&lt;=99SAdditional data field templateORefer to Table 3 below64&lt;=99SMerchant information template languageORefer to Table 4 below / \* Not supported by this library65-79&lt;=99SReserved for future useO\* Not supported by this library80-99&lt;=99SUnreserved templatesO\* Not supported by this library6304ANSCRCMSecurity codeThe IDs 02-51 are for merchant account information, where the IDs 26-51 are open for private use. The length for each of the account is up to 99.

Table 2: Allocation of Merchant Account Information (ID 26-51)

IDLengthFormatDescriptionPresence02-03&lt;=99ANSReserved for VisaO04-05&lt;=99ANSReserved for MasterCardO06-08&lt;=99ANSReserved by EMVCoO09-10&lt;=99ANSReserved for DiscoverO11-12&lt;=99ANSReserved for AMEXO13-14&lt;=99ANSReserved for JCBO15-16&lt;=99ANSReserved for UnionPayO17-25&lt;=99ANSReserved by EMVCoO26-51&lt;=99ANSOpen for private useO26&lt;=99ANSHK: Reserved for Faster Payment System for use in HK.O26&lt;=99ANSSG: Preferred ID for PayNowO29&lt;=99ANSTH: Generally found PromptPay account information under this IDO51&lt;=99ANSSG: Reserved for SGQR merchant informationOTable 3: Data Objects for Additional Data Field Template (ID 62)

IDLengthFormatDescriptionPresence01&lt;=25ANSBill numberO02&lt;=25ANSMobile numberO03&lt;=25ANSStore labelO04&lt;=25ANSLoyalty numberO05&lt;=25ANSReference labelO06&lt;=25ANSCustomer labelO07&lt;=25ANSTerminal labelO08&lt;=25ANSPurpose of transactionO09&lt;=3ANSAdditional customer data requestO10&lt;=20ANSMerchant tax IDO113ANSMerchant channelO12-49anySReserved for future use (Not supported by this library)O50-99anySPayment system specific templates (Not supported by this library)OTable 4: Data Objects for Merchant Information in Other Language (ID 64) (Not supported by this library)

IDLengthFormatDescriptionPresence002ANSLanguage Preference (2-char alphabetic code as defined in ISO 639)M01&lt;=25SMerchant NameM02&lt;=15SMerchant CityO03-99anySReserved for future useOTable 5: Data Objects for Each Merchant Account

IDLengthFormatDescriptionPresence00&lt;=32ANSGlobally Unique Identifier \*M01-99anySPayment network specificO- A globally unique identifier can be an application identifier (AID), a UUID without hyphen separators, or a reversed domain name.

How to use
----------

[](#how-to-use)

### 1 `EmvMerchant`

[](#1-emvmerchant)

#### 1.1 Class Public Properties

[](#11-class-public-properties)

Table 6: Class Public Properties

\#PropertyTypeNotes1modestringAlways 'DECODE' or 'GENERATE'2qr\_stringstring3payload\_format\_indicatorstringA fixed value of '01'4point\_of\_initiationstringAlways '11' or '12'5accountsarray6merchant\_category\_codestringISO 18245, 4-character in length7transaction\_currencystringISO 4217 alphabetic code (3-character)8transaction\_amountfloatoptional9tip\_or\_convenience\_fee\_indicatorstringoptional10convenience\_fee\_fixedfloatoptional11convenience\_fee\_percentagefloatoptional12country\_codestringISO 3166-1 alpha-2 code13merchant\_namestring14merchant\_citystring15merchant\_postal\_codestring16additional\_fieldsarray17crcstringA CRC string, 4-character in length18errorsarray19warningsarray### 2 `EmvMerchantDecoder`

[](#2-emvmerchantdecoder)

#### 2.1 Description

[](#21-description)

Receive the string read from the QR code and structure it in the object format as seen in Table 6.

#### 2.2 How to Use

[](#22-how-to-use)

- Create an object of class `EmvMerchantDecoder` with a parameter `$string` which is the string read from the QR code (optional).
- If the `$string` is not passed into the constructor in the previous step, call the `decode($string)` function to pass the parameter instead.
- The public properties of class `EmvMerchantDecoder` will be filled with the data read from the QR code. If there are any problems in the `$string` input, the arrays `errors` and/or `warnings` will be filled.

#### 2.3 Example

[](#23-example)

```
$string = '00020101021126490009SG.PAYNOW010120210202012345X0301104082021123151820007SG.SGQR0113202012345X123020701.000103068286710402010503123060400000708201912315204000053037025802SG5911RATINAN LEE6009SINGAPORE610682876162140110987654321X630429FD';
$emv    = new \EMVQR\EmvMerchantDecoder($string);
$json   = json_encode($emv, JSON_PRETTY_PRINT);
```

Result:

```
{
    "mode": "DECODE",
    "qr_string": "00020101021126490009SG.PAYNOW010120210202012345X0301104082021123151820007SG.SGQR0113202012345X123020701.000103068286710402010503123060400000708201912315204000053037025802SG5911RATINAN LEE6009SINGAPORE610682876162140110987654321X630429FD",
    "payload_format_indicator": "01",
    "point_of_initiation": "STATIC",
    "accounts": {
        "SG.PAYNOW": {
            "original_id": 26,
            "reverse_domain": "SG.PAYNOW",
            "proxy_type": "UEN",
            "proxy_value": "202012345X",
            "amount_editable": true
        },
        "SG.SGQR": {
            "original_id": 51,
            "reverse_domain": "SG.SGQR",
            "sgqr_id_number": "202012345X123",
            "version": "01.0001",
            "postal_code": "828671",
            "level": "01",
            "unit_number": "123",
            "miscellaneous": "0000",
            "new_version_date": "20191231"
        }
    },
    "merchant_category_code": {
        "code": "0000",
        "value": "Generic"
    },
    "transaction_currency": "SGD",
    "transaction_amount": null,
    "tip_or_convenience_fee_indicator": null,
    "convenience_fee_fixed": null,
    "convenience_fee_percentage": null,
    "country_code": "SG",
    "merchant_name": "RATINAN LEE",
    "merchant_city": "SINGAPORE",
    "merchant_postal_code": "828761",
    "additional_fields": {
        "bill_number": "987654321X"
    },
    "crc": "29FD",
    "errors": [],
    "warnings": []
}
```

### 3 `EmvMerchantGenerator`

[](#3-emvmerchantgenerator)

#### 3.1 Description

[](#31-description)

Under construction.

#### 3.2 Functions and Parameters

[](#32-functions-and-parameters)

Under construction.

#### 3.3 Return Values

[](#33-return-values)

Under construction.

#### 3.4 Example

[](#34-example)

Under construction.

### 4 Account Templates

[](#4-account-templates)

#### 4.1 Singapore

[](#41-singapore)

##### PayNow

[](#paynow)

```
{
    "SG.PAYNOW": {
        "original_id": 26,
        "reverse_domain": "SG.PAYNOW",
        "proxy_type": "UEN",
        "proxy_value": "202012345X",
        "amount_editable": true,
        "expiry_date": "2099-12-31"
    }
}
```

##### FavePay

[](#favepay)

```
{
    "FavePay": {
        "original_id": 27,
        "channel": "FavePay",
        "reverse_domain": "COM.MYFAVE",
        "url": "https://myfave.com/qr/xxxxxx"
    }
}
```

##### SGQR

[](#sgqr)

```
{
    "SG.SGQR": {
        "original_id": 51,
        "reverse_domain": "SG.SGQR",
        "sgqr_id_number": "202012345X123",
        "version": "01.0001",
        "postal_code": "828671",
        "level": "01",
        "unit_number": "123",
        "miscellaneous": "0000",
        "new_version_date": "20191231"
    }
}
```

#### 4.2 Thailand

[](#42-thailand)

##### PromptPay

[](#promptpay)

```
{
    "TH.PROMPTPAY": {
        "original_id": 29,
        "channel_name": "TH.PROMPTPAY",
        "guid": "A000000677010111",
        "proxy_type": "MOBILE",
        "proxy_value": "0066899999999",
        "mobile_number": "+66899999999"
    }
}
```

#### 4.3 Indonesia

[](#43-indonesia)

##### QRIS

[](#qris)

```
{
    "ID.CO.QRIS.WWW": {
        "original_id": 51,
        "reverse_domain": "ID.CO.QRIS.WWW",
        "nmid": "ID1234567890123",
        "03": "UMI"
    }
}
```

#### 4.4 Malaysia

[](#44-malaysia)

The QR Code for Malaysia, DuitNow, has not yet been implemented.

#### 4.5 Hong Kong

[](#45-hong-kong)

The QR Code for Hong Kong has not yet been implemented.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1660d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d573004dd25fe32bfb2dd2500d2c9038af9e80d905eddf7c30f30a48b7c491be?d=identicon)[lee-ratinan](/maintainers/lee-ratinan)

---

Top Contributors

[![lee-ratinan](https://avatars.githubusercontent.com/u/29251314?v=4)](https://github.com/lee-ratinan "lee-ratinan (79 commits)")

---

Tags

qr codeqrpayment gatewayEMVCo

### Embed Badge

![Health badge](/badges/lee-ratinan-emv-qr/health.svg)

```
[![Health](https://phpackages.com/badges/lee-ratinan-emv-qr/health.svg)](https://phpackages.com/packages/lee-ratinan-emv-qr)
```

###  Alternatives

[shetabit/payment

Laravel Payment Gateway Integration Package

944330.1k5](/packages/shetabit-payment)[shetabit/multipay

PHP Payment Gateway Integration Package

291348.2k3](/packages/shetabit-multipay)[cybersource/rest-client-php

Client SDK for CyberSource REST APIs

39881.3k6](/packages/cybersource-rest-client-php)[rikudou/skqrpayment

QR payment library for Slovak accounts

35796.2k1](/packages/rikudou-skqrpayment)[dfridrich/qr-platba

Generování QR Plateb a QR Faktur v PHP.

47270.8k1](/packages/dfridrich-qr-platba)[rikudou/czqrpayment

QR payment library for Czech accounts

29404.4k6](/packages/rikudou-czqrpayment)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
