@natade-coco/jpqr
v0.1.1
Published
JPQR library that uses go.mercari.io/go-emv-code by WebAssembly.
Downloads
1
Readme
JPQR
JPQR library that uses go.mercari.io/go-emv-code by WebAssembly.
Installation
npm install @natade-coco/jpqr
Usage
import JPQR from '@natade-coco/jpqr';
const code = JPQR.mpmEncode({
payloadFormatIndicator: '01',
pointOfInitiationMethod: 'dynamic',
merchantAccountInformation: [{
tag: '26',
length: '68',
value: '0019jp.or.paymentsjapan011300000000000010204000103060000010406000001'
}],
merchantCategoryCode: '5812',
transactionCurrency: '392',
transactionAmount: '498',
countryCode: 'JP',
merchantName: 'xxx',
merchantCity: 'xxx',
postalCode: '5300005',
merchantInformation: {
languagePreference: 'JA',
name: 'ナタデココ カフェ'
}
});
console.log(code); // 00020101021226680019jp.or.paymentsjapan01130000000000001020400010306000001040600000152045812530339254034985802JP5903xxx6003xxx6107530000564190002JA0109ナタデココ カフェ63045BA0
showQRCode(code);
API
mpmEncode(mpmInformation: MPMInformation): string
Get JPQR MPM code for showing QR Code. For details, please refer to JPQR MPM guideline 1.1.
Example
const code = JPQR.mpmEncode({
payloadFormatIndicator: '01', // '01' 固定
pointOfInitiationMethod: 'dynamic', // 静的 'static' または 動的 'dynamic'
merchantAccountInformation: [{
tag: '26',
length: '68',
value: '0019jp.or.paymentsjapan011300000000000010204000103060000010406000001'
}],
merchantCategoryCode: '5812',
transactionCurrency: '392', // 円 '392' 固定
transactionAmount: '498', // 静的の場合は任意、動的の場合は必須
countryCode: 'JP', // 日本 'JP' 固定
merchantName: 'xxx',
merchantCity: 'xxx',
postalCode: '5300005',
merchantInformation: {
languagePreference: 'JA', // 日本語 'JA' 固定
name: 'ナタデココ カフェ'
}
});