# PrompPay
## Code: (Fieldcode,Fieldlength,Field)...
* fieldcode: numchar[2]
* fieldlength: numchar[2]
* field: char[length]: (subfieldcode,subcodefieldlength,subfield)...
### Fields
Fields are unordered (also Subfields=templates), except Fields start with 00 and end with 63.
* !00[2] Payload Format Indicator: 01=version
* ~01[2] Point of Initiation Method: 11=static(no amount), 12=dynamic(has amount)
* 02..51[1..99] Merchant Account Information 02..25 reserved for CC providers
* 02..03 VISA
* 04..05 Mastercard
* 06..08 EMVCo
* 09..10 Discover
* 11..12 Amex
* 13..14 JCB
* 15..16 UnionPay
* 17..25 EMVCo
* 26..51[] Merchant Account Information
- 00[1..32] Globally Unique ID: AID(RID+PIX(ISO7816-4)):D840000000|UUID(hyphenless)|RDN
- ~01..99: Context-specific Data (Merchant ID)
* 31[1.99] Payment Innovation
- 00[16] AID: A000000677012004=Std.API, A000000677010113
- 01[3] API ID: 001 Trans.Verif.API | Acquirer ID
- 03[25] Trans.Ref.
- 02..99[1.99] Acquirer Specific
* 52[4] Merchant Category Code
* 53[3] Currency(ISO4217): 764=THB
* ~54[1..13] Transaction Amount (number of decimals must correspond to the exponent in ISO4217)
* ~55[2] Tip or Convenience Indicator: 01=Prompted to tip, 02=56, 03=57
* ~56[1..13] Value of Convenience Fee Fixed
* ~57[1..5] Value of Convenience Fee Percentage (00.01..99.99)
* 58[2] Country(ISO3166-1a2): TH=Thailand
* 59[1..25] Merchant Name
* 60[1..15] Merchant City
* ~61[1..10] Postal Code
* ~62[1..99] Additional Data Field Template
- ~01[1..25] Bill Number
- ~02 Mobile Number
- ~03 Store Label
- ~04[1..25] Loyalty Number
- ~05 Reference Label
- ~06[1..25] Customer Label: ***-Prompted
- ~07 Terminal Label
- ~08 Purpose of Transaction
- ~09[1..3] Additional Consumer Data Request (A:Address, M:Mobile number, E:Email address of Consumer)
- ~10 Merchant Tax ID
- ~11[3] Merchant Channel (POS, sticker, app, site, invoice, poster; (un)attended)
* 000: attended sticker
* 001: unattended sticker
* 002: semi-attended sticker
* 010: attended sticker not-at-merchant
* 111: invoice
* 211: poster
* 400: attended screen
* 401: unattended screen
* 402: semi-attended screen
* 521: unattended website
* 610: attended screen not-at-merchant
- ~12..49 Reserved for EMVCo
- ~50..99 Payment System Specific templates
* ~64[1..99] Merchant Information - Language Template
- 00[2] Language Preference(ISO639-1)
- 01[1..25] Alternate Language Merchant Name
- ~02[1..15] Alternate Language Merchant City
- ~03..99[?] Reserved for EMVCo
* ~65..=79[1..99] Reserved fo EMVCo
* ~80[1..50] VAT TQRC
- 00[4] Seller Tax Branch ID
- ~01[1..5] VAT Rate
- 02[1..13[ VAT Amount
* ~80..=99[1..99] Unreserved templates
* 63[4] CRC (ISO13239 polyn.0x1021 init.0xffff) - CRC over 0002010102...6304 (includes final 6304!)
Algorithm is called CRC-16/IBM-3740 (width=16 poly=0x1021 init=0xffff refin=false refout=false xorout=0x0000
check=0x29b1[of 123456789] residue=0x0000 name="CRC-16/IBM-3740", alias: CRC-16/AUTOSAR, CRC-16/CCITT-FALSE
#### Merchant
'0002010102111531267607642676076400000220303464030810016A00000067701011201150107536000374030215000002203034640031943003465002111328415204000053037645802TH5925CHIANGRAI INTERNATIONAL C6009CHIANGRAI610557100621207084300346563042771'
`00[2]01[2]15[31]30[81](00[16]01[15]02[15]03[19])[65+4x4]53[3]58[2]59[25]60[9]61[5]62[12]`
* 15[31] Project code: 2676076426760764000002203034640
* 30[81] PrompPay Bill Payment
- 00[16] Application ID: A000000677010112=Domestic Merchant, A000000677012006=Cross-border Merchant
- 01[15] Biller ID: 010753600037403
- 02[15..20] Ref1: 000002203034640
- 03[19..20] Ref2: 430034650021110000
* 53[3] Currency(ISO4217): 764=THB
* 59[25] Merchant Name: 'CHIANGRAI INTERNATIONAL C'
* ~60[9] Merchant City: CHIANGRAI
* ~61[5] Postcode: 57100
* ~62[12] Additional Data Field template
- ~07[8] Terminal Label: 43003465
* 63[4] CRC 2771
#### Consumer
'00020101021230480016A00000067701011201150105523009350080205001295802TH62200716SCOSM800129099915303764540510.0063044003'
`00[2]01[2]30[48](00[16],01[15],02[5])36+3x4]58[2]62[20](07[16])53[3]54[5]63[4]`
* 30[48] Merchant account information
- 00[16] Application ID: A000000677010112=PromptPayPayment
- 01[15] Biller ID
- 02[5] Ticket Number
* 58[2] Country: TH=Thailand
* ~62[20]
- 07[16] Ref03
* 53[3] Currency: 764=THB
* ~54[5] Amount: 10.00
* 63[3] CRC
00020101021229370016A0000006770101110113006689999999953037645802TH6304DE56
`00[2]01[2]29[37](00[16],01[13])[29+2x4]53[3]58[2]63[4]`
00020101021229370016A00000067701011101130066890000000530376454031005802TH63045021
`00[2]01[2]29[37](00[16],01[13])[29+2x4]53[3]54[3]58[2]63[4]`
00020101021129390016A00000067701011103150049990002885055802TH530376463041521
`00[2]01[2]29[39](00[16],03[15])[31+2x4]58[2]53[3]63[4]`
00020101021229370016A000000677010111021312345678901235802TH53037645406420.006304BF7B
00020101021129370016A000000677010111011300660000000005802TH530376463048956
`00[2]01[2]29[37](00[16],01|02|0x[13])[29+2x4]58[2]53[3]63[4]`
* 29[37|39] Merchant account information
- 00[16] Application ID: A000000677010111=PromptPayMerchantPresented, A000000677010114=CustomerPresented
- | 01[13] Phone number: 0066956865094
- | 02[13] CitizenID | Tax ID(starts with 0)
- | 03[15] eWalletID
- | 04[15..43] K+ ShopID/Bank Account
- | 05[10] OTA (mandatory for A000000677010114=CustomerPresented)
* 58[2] Country: TH=Thailand
* 53[3] Currency: 764=THB
* 63[3] CRC