Dynamic QRCode
Dynamic QR codes enable single-use or recurring payments by generating unique urls that can be used to process the payment.
Create a dynamic QRCode
For generating a dynamic QRCode, you can use the createDynamic
function:
Parameters
Prop | Type | Default |
---|---|---|
merchantAccountInfo | { gui?: string | undefined; url: string; merchantAdditionalInfo?: string | undefined; fss?: string | undefined; } | - |
pointOfInitiationMethod | PointOfInitiationMethod | - |
value | number | - |
merchantCategoryCode | string | 0000 |
transactionCurrency | string | 986 |
countryCode | string | BR |
merchantName | string | - |
merchantCity | string | - |
additionalData | { txId?: string | undefined; } | - |
postalCode | string | - |
unreservedTemplate | { gui?: string | undefined; url?: string | undefined; } | - |
Dynamic QRCode methods
Prop | Type | Default |
---|---|---|
toBase64 | () => Promise<string> | - |
toDataUrl | () => Promise<string> | - |
type | PixQrCodeType | - |
brcode | string | - |
getPayload | () => Promise<{ payload: InstantPayload | ScheduledPayload; header: Record<string, unknown>; }> | - |
Parse PIX QRCode data from a string
To parse a PIX QRCode from a string, you can use the parseFromString
function:
You can also parse and create a dynamic QRCode object from a string:
Create a QRCode image
To create a QRCode image, you can use the toDataUrl
method:
Verify wheather a string is a dynamic QRCode
Use the isDynamicPix
function to verify whether a string is a dynamic QRCode: