# generatePaynowQR

## Description

Generates a Paynow QR code.

## Input / Parameter

| Name                    | Description                                     | Input Type  | Default | Options | Required |
| ----------------------- | ----------------------------------------------- | ----------- | ------- | ------- | -------- |
| formatIndicator         | The format indicator for the QR code.           | String/Text | -       | -       | Yes      |
| initiationMethod        | The initiation method.                          | Array/List  | -       | -       | Yes      |
| accountIdentifier       | The account id.                                 | String/Text | -       | -       | Yes      |
| accountProxyType        | The proxy type of the account.                  | String/Text | -       | -       | Yes      |
| accountProxyValue       | The proxy value of the account.                 | String/Text | -       | -       | Yes      |
| editableAmountIndicator | The editable amount indicator.                  | String/Text | -       | -       | Yes      |
| qrExpiryDate            | The expiry date of the QR code.                 | String/Text | -       | -       | Yes      |
| merchantCategoryCode    | The category code of the merchant.              | String/Text | -       | -       | Yes      |
| transactionCurrency     | The currency of the transaction.                | String/Text | -       | -       | Yes      |
| transactionAmount       | The transaction amount.                         | String/Text | -       | -       | Yes      |
| countryCode             | The country code of the merchant.               | String/Text | -       | -       | Yes      |
| merchantName            | The name of the merchant.                       | String/Text | -       | -       | Yes      |
| merchantCity            | The city of the merchant.                       | String/Text | -       | -       | Yes      |
| billNumber              | The bill number for the transaction.            | String/Text | -       | -       | Yes      |
| logo                    | The logo of the QR code.                        | String/Text | -       | -       | No       |
| extra                   | Extra parameters stored and passed to callback. | Any         | -       | -       | No       |

## Output

N/A

## Callback?

### callback

The function to be executed if the Paynow QR code is generated successfully.

### errorCallback

The function to be executed if the Paynow QR code is not generated successfully.

## Video

Coming Soon.

## Example

### Steps

1. First we add 2 components to the page:

   1. A button to generate the QR code
   2. `imgQR`, an image placeholder for the QR code once generated.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-e4647262230abc70d3272634471bffe1b0d1c3ac%2FgeneratePaynowQR-step-1.png?alt=media)
2. Select the "Generate QR Local" button and add these 2 functions to the event flow:

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-b93e62733344f6561458558aea874acae90e3d04%2FgeneratePaynowQR-step-2.png?alt=media)
3. Specify the parameters for the QR code.
4. For the `setComponentFunction`, we set the "component" value to "imgQR", the image placeholder created in step 1.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-e3ec2ee916c5971c2a46c58425845eeadd15f2da%2FgeneratePaynowQR-step-4.png?alt=media)

   For 'value', we add a subflow with the function "objectAttr" like so:

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-b49b369d63e5039e50465415629c29b05c6a8acc%2FgeneratePaynowQR-step-5.png?alt=media)

### Result

![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-af177353b05e4bb11f29401f7fc1b088f156d787%2FgeneratePaynowQR-result-1.gif?alt=media)

## Links
