# LinkAja QRIS Integration Guide

## Integration Step

1. Post Data Transaction to Faspay
2. Display QR Code
3. Callback/Return URL
4. Payment Notification

### 1. Post Data Transaction

Post-data transactions should be done from the merchant backend, the detailed API reference can be found [Here](https://docs.faspay.co.id/merchant-integration/api-reference-1/debit-transaction/post-data-transaction)

This is an example of a post-data transaction sample code for the LinkAja QRIS channel:

**A. Post Data Transaction Request**

{% tabs %}
{% tab title="XML Sample Code" %}

```xml
<faspay>
	<request>Purchased Details Transmission</request>
	<merchant_id>99999</merchant_id>
	<merchant>FASPAY STORE</merchant>
	<bill_no>849389422312</bill_no>
	<bill_reff>Payment</bill_reff>
	<bill_date>2023-10-10 09:19:00</bill_date>
	<bill_expired>2023-10-11 12:10:10</bill_expired>
	<bill_desc>Payment #12345678</bill_desc>
	<bill_currency>IDR</bill_currency>
	<bill_gross>0</bill_gross>
	<bill_tax>0</bill_tax>
	<bill_miscfee>0</bill_miscfee>
	<bill_total>10000</bill_total>
	<cust_no>1</cust_no>
	<cust_name>Faspay Agus Priyono</cust_name>
	<cust_lastname></cust_lastname>
	<payment_channel>715</payment_channel>
	<pay_type>1</pay_type>
	<bank_userid></bank_userid>
	<msisdn>081234567891</msisdn>
	<email>sanjayaegasanto@gmail.com</email>
	<terminal>10</terminal>
	<billing_name>payment item faspay</billing_name>
	<billing_lastname>0</billing_lastname>
	<billing_address>jalan pintu air raya</billing_address>
	<billing_address_city>Jakarta Pusat</billing_address_city>
	<billing_address_region>DKI Jakarta</billing_address_region>
	<billing_address_state>Indonesia</billing_address_state>
	<billing_address_poscode>10710</billing_address_poscode>
	<billing_msisdn></billing_msisdn>
	<billing_address_country_code>ID</billing_address_country_code>
	<receiver_name_for_shipping>Faspay Agus</receiver_name_for_shipping>
	<shipping_lastname></shipping_lastname>
	<shipping_address>jalan pintu air raya</shipping_address>
	<shipping_address_city>Jakarta Pusat</shipping_address_city>
	<shipping_address_region>DKI Jakarta</shipping_address_region>
	<shipping_address_state>Indonesia</shipping_address_state>
	<shipping_address_poscode>10710</shipping_address_poscode>
	<shipping_msisdn>08766688686</shipping_msisdn>
	<shipping_address_country_code>ID</shipping_address_country_code>
	<item>
		<id>123</id>
		<product>Glass Plastic</product>
		<qty>1</qty>
		<amount>10000</amount>
		<payment_plan>01</payment_plan>
		<merchant_id>99999</merchant_id>
		<tenor>00</tenor>
		<type>Furniture</type>
		<url>http://localhost:8088/index</url>
		<image_url>https://cdn.mos.cms.futurecdn.net/Mffc35PH77Dq7USrHb4qNm-1200-80.jpg</image_url>
	</item>
	<item>
		<id>234</id>
		<product>Plastic Bucket</product>
		<qty>1</qty>
		<amount>10000</amount>
		<payment_plan>01</payment_plan>
		<merchant_id>99999</merchant_id>
		<tenor>00</tenor>
		<type>Furniture</type>
		<url>http://localhost:8088/kredivo</url>
		<image_url>https://cdn.mos.cms.futurecdn.net/Mffc35PH77Dq7USrHb4qNm-1200-80.jpg</image_url>
	</item>
	<reserve1>0</reserve1>
	<reserve2></reserve2>
	<signature>0d8a326853f3090251fb81b1a56f5c4d5b5f2639</signature>
</faspay>
```

{% endtab %}

{% tab title="JSON Sample Code" %}

```json
{
    "request": "Purchased Details Transmission",
    "merchant_id": 99999,
    "merchant": "FASPAY STORE",
    "bill_no": 849389422312,
    "bill_reff": "Payment",
    "bill_date": "2023-10-10 09:19:00",
    "bill_expired": "2023-10-11 12:10:10",
    "bill_desc": "Payment #12345678",
    "bill_currency": "IDR",
    "bill_gross": 0,
    "bill_tax": 0,
    "bill_miscfee": 0,
    "bill_total": 10000,
    "cust_no": 1,
    "cust_name": "Faspay Agus Priyono",
    "cust_lastname": "",
    "payment_channel": 715,
    "pay_type": 1,
    "bank_userid": "",
    "msisdn": 81234567891,
    "email": "sanjayaegasanto@gmail.com",
    "terminal": 10,
    "billing_name": "payment item faspay",
    "billing_lastname": 0,
    "billing_address": "jalan pintu air raya",
    "billing_address_city": "Jakarta Pusat",
    "billing_address_region": "DKI Jakarta",
    "billing_address_state": "Indonesia",
    "billing_address_poscode": 10710,
    "billing_msisdn": "",
    "billing_address_country_code": "ID",
    "receiver_name_for_shipping": "Faspay Agus",
    "shipping_lastname": "",
    "shipping_address": "jalan pintu air raya",
    "shipping_address_city": "Jakarta Pusat",
    "shipping_address_region": "DKI Jakarta",
    "shipping_address_state": "Indonesia",
    "shipping_address_poscode": 10710,
    "shipping_msisdn": 8766688686,
    "shipping_address_country_code": "ID",
    "item": [
      {
        "id": 123,
        "product": "Glass Plastic",
        "qty": 1,
        "amount": 10000,
        "payment_plan": 1,
        "merchant_id": 99999,
        "tenor": 0,
        "type": "Furniture",
        "url": "http://localhost:8088/index",
        "image_url": "https://cdn.mos.cms.futurecdn.net/Mffc35PH77Dq7USrHb4qNm-1200-80.jpg"
      },
      {
        "id": 234,
        "product": "Plastic Bucket",
        "qty": 1,
        "amount": 10000,
        "payment_plan": 1,
        "merchant_id": 99999,
        "tenor": 0,
        "type": "Furniture",
        "url": "http://localhost:8088/kredivo",
        "image_url": "https://cdn.mos.cms.futurecdn.net/Mffc35PH77Dq7USrHb4qNm-1200-80.jpg"
      }
    ],
    "reserve1": 0,
    "reserve2": "",
    "signature": "0d8a326853f3090251fb81b1a56f5c4d5b5f2639"
  }
```

{% endtab %}
{% endtabs %}

**B. Post Data Transaction Response**

Response parameters are the parameters sent by the Faspay system in response to requests made by the merchant system. If any of these parameters do not match or contain incorrect values, the transaction will be rejected by Faspay's system.

For the LinkAja QRIS payment method, there are 2 types of transaction models:

* Direct Type
* Redirect Type

Here below are 2 different responses based on the transaction type model.

<table><thead><tr><th width="159">Parameter</th><th width="165">Data Type</th><th width="125">M/O/C</th><th>Description</th></tr></thead><tbody><tr><td>response</td><td>Alphanumeric (50)</td><td>Mandatory</td><td>Response Name</td></tr><tr><td>trx_id</td><td>Numeric (16)</td><td>Mandatory</td><td>Transaction ID (Issued/generated by Faspay (Media Indonusa)) Notes: Unique Transaction ID for 1 day or as long as it hasn't been paid and hasn't expired</td></tr><tr><td>merchant_id</td><td>Numeric (5)</td><td>Mandatory</td><td>Merchant Code</td></tr><tr><td>merchant</td><td>Alphanumeric (32)</td><td>Mandatory</td><td>Merchant Name</td></tr><tr><td>bill_no</td><td>Alphanumeric (32)</td><td>Mandatory</td><td>Order Number</td></tr><tr><td>bill_items</td><td>Array</td><td> </td><td> </td></tr><tr><td>id</td><td>Numeric</td><td>Optional</td><td>ID product</td></tr><tr><td>product</td><td>Alphanumeric</td><td>Optional</td><td>Product name</td></tr><tr><td>amount</td><td>Numeric</td><td>Optional</td><td>Nominal product price</td></tr><tr><td>merchant_id</td><td>Numeric (5)</td><td>Mandatory</td><td>Merchant Code</td></tr><tr><td>qty</td><td>Numeric</td><td>Optional</td><td>Quantity of item</td></tr><tr><td>payment_plan</td><td>Numeric</td><td>Optional</td><td>Payment code<br>1: Full Settlement<br>2: Installement</td></tr><tr><td>tenor</td><td>Numeric</td><td>Optional</td><td>Installment Tenor<br>00: Full Payment<br>03: 3 months<br>06: 6 months<br>12: 12 months</td></tr><tr><td>type</td><td>Alphanumeric</td><td>Optional</td><td>Item type</td></tr><tr><td>url</td><td>Alphanumeric</td><td>Optional</td><td>Item Link</td></tr><tr><td>image_url</td><td>Alfaumeric</td><td>Optional</td><td>Image item Link</td></tr><tr><td>response_code</td><td>Numeric (2)</td><td>Mandatory</td><td>Response Code<br>00 Success</td></tr><tr><td>response_desc</td><td>Alphanumeric (32)</td><td>Mandatory</td><td>Response Code Description</td></tr><tr><td>web_url</td><td>Alphanumeric</td><td>Conditional</td><td>Used if the transaction model uses direct type, displaying only QR code in the browser.</td></tr><tr><td>qr_content</td><td>Alphanumeric</td><td>Conditional</td><td><p>Data will be encoded in a QR code generated or processed. </p><p></p><p>Notes: Use this if the transaction is direct type.</p></td></tr><tr><td>redirect_url</td><td>Alphanumeric</td><td>Mandatory</td><td>Link to Faspay landing page containing QR image</td></tr></tbody></table>

**Sample Code for Direct Type**

{% tabs %}
{% tab title="Response Post Data (XML Code)" %}

```xml
<?xml version="1.0" encoding="UTF-8"?>
<faspay>
	<response>Purchase Details Transmission</response>
	<trx_id>9999971571609433</trx_id>
	<merchant_id>99999</merchant_id>
	<merchant>FASPAY DEMO</merchant>
	<bill_no>849389422312</bill_no>
	<bill_items>
		<id>123</id>
		<product>Glass Plastic</product>
		<qty>1</qty>
		<amount>10000</amount>
		<payment_plan>01</payment_plan>
		<merchant_id>99999</merchant_id>
		<tenor>00</tenor>
		<type>Furniture</type>
		<url>http://localhost:8088/index</url>
		<image_url>https://cdn.mos.cms.futurecdn.net/Mffc35PH77Dq7USrHb4qNm-1200-80.jpg</image_url>
	</bill_items>
	<bill_items>
		<id>234</id>
		<product>Plastic Bucket</product>
		<qty>1</qty>
		<amount>10000</amount>
		<payment_plan>01</payment_plan>
		<merchant_id>99999</merchant_id>
		<tenor>00</tenor>
		<type>Furniture</type>
		<url>http://localhost:8088/kredivo</url>
		<image_url>https://cdn.mos.cms.futurecdn.net/Mffc35PH77Dq7USrHb4qNm-1200-80.jpg</image_url>
	</bill_items>
	<response_code>00</response_code>
	<response_desc>Success</response_desc>
	<web_url>https://debit-urgent-staging.faspay.co.id/__assets/qr/linkaja/99999-9999971571609433.png</web_url>
	<qr_content>00020101021226660014ID.LINKAJA.WWW011893600911002140400102152106140914040010303UME51450015ID.OR.GPNQR.WWW02150000000000000000303UME520454995802ID5906Faspay6007Jakarta61051071062200116999997156141292153033605403100630497F4</qr_content>
</faspay>

```

{% endtab %}

{% tab title="Response Post Data (JSON Code)" %}

```json
{
    "response": "Purchase Details Transmission",
    "trx_id": 9999971571609432,
    "merchant_id": 99999,
    "merchant": "FASPAY DEMO",
    "bill_no": 849389422312,
    "bill_items": [
      {
        "id": 123,
        "product": "glass plastic",
        "qty": 1,
        "amount": 10000,
        "payment_plan": 1,
        "merchant_id": 99999,
        "tenor": 0,
        "type": "Furniture",
        "url": "http://localhost:8088/index",
        "image_url": "https://cdn.mos.cms.futurecdn.net/Mffc35PH77Dq7USrHb4qNm-1200-80.jpg"
      },
      {
        "id": 234,
        "product": "plastic bucket",
        "qty": 1,	
        "amount": 10000,
        "payment_plan": 1,
        "merchant_id": 99999,
        "tenor": 0,
        "type": "Furniture",
        "url": "http://localhost:8088/kredivo",
        "image_url": "https://cdn.mos.cms.futurecdn.net/Mffc35PH77Dq7USrHb4qNm-1200-80.jpg"
      }
    ],
    "response_code": 0,
    "response_desc": "Success",
    "web_url": "https://debit-urgent-staging.faspay.co.id/__assets/qr/linkaja/99999-9999971571609433.png",
    "qr_content": "00020101021226660014ID.LINKAJA.WWW011893600911002140400102152106140914040010303UME51450015ID.OR.GPNQR.WWW02150000000000000000303UME520454995802ID5906Faspay6007Jakarta61051071062200116999997156141292153033605403100630497F4"
  }

```

{% endtab %}
{% endtabs %}

**Sample Code Response Post Data (Redirect Type)**

{% tabs %}
{% tab title="Response Post Data (XML)" %}

```xml
<?xml version="1.0" encoding="UTF-8" ?>
<faspay>
        <response> Purchase Details Transmission</response>
        <trx_id>9999971150758059</trx_id>
        <merchant_id>99999</merchant_id>
        <merchant>FASPAY DEMO</merchant>
        <bill_no>163b4ef032520a7.07128111</bill_no>
        <bill_items>
	        <id>01</id>
	        <product>Glass Plastic Prem</product>
	        <qty>1</qty>
	        <amount>1000000</amount>
	        <payment_plan>01</payment_plan>
	        <merchant_id>99999</merchant_id>
	        <tenor>00</tenor>
	        <type>Furniture</type>
	        <url>http://localhost</url>
	        <image_url>https://cdn.mos.cms.futurecdn.net/Mffc35PH77Dq7USrHb4qNm-1200-80.jpg</image_url>
         </bill_items>
         <response_code>00</response_code>
         <response_desc>Success</response_desc>
         <redirect_url>https://web.faspay.co.id/pws/100003/2830000010100000/92fb23821115e920a979b3c28ea969d98ac76497?trx_id=9999971150758059&merchant_id=99999&bill_no=163b4ef032520a7.07128111</redirect_url>
</faspay>
```

{% endtab %}

{% tab title="Response Post Data (JSON)" %}

```json
{
    "response": " Purchase Details Transmission",
    "trx_id": "9999971150758059",
    "merchant_id": "99999",
    "merchant": "FASPAY DEMO",
    "bill_no": "163b4ef032520a7.07128111",
    "bill_items": [
        {
            "id": "01",
            "product": "Glass Plastic Prem",
            "qty": "1",
            "amount": "1000000",
            "payment_plan": "01",
            "merchant_id": "99999",
            "tenor": "00",
            "type": "Furniture",
            "url": "http://localhost",
            "image_url": "https://cdn.mos.cms.futurecdn.net/Mffc35PH77Dq7USrHb4qNm-1200-80.jpg"
        }
    ],
    "response_code": "00",
    "response_desc": "Success",
    "redirect_url": "https://web.faspay.co.id/pws/100003/2830000010100000/92fb23821115e920a979b3c28ea969d98ac76497?trx_id=9999971150758059&merchant_id=99999&bill_no=163b4ef032520a7.07128111"
}
```

{% endtab %}
{% endtabs %}

### 2   Display QR Code

Here are two ways to display the QR Code:

* **Redirect Type**: To display the QR Code on Faspay's page, redirect using the `redirect_url` obtained from the Post Data Transaction Response (in JSON format), or refer to the detailed API reference for more information [Here](file:///merchant-integration/api-reference-1/debit-transaction/redirect-process)
* **Direct Type:** To display the QR Code on the merchant's page, if the frontend is HTML, you can use the `web_url` retrieved from the post-data transaction within an image tag like this: `<img src="[web_url]">`. Alternatively, you can display it on a similar component without downloading. However, if the front end does not support this scenario, you should download and display the QR code image from that URL on the front end.

### 3   Callback/Return URL

After the customer completes the payment via LinkAja's website, the LinkAja website automatically redirects the customer to the Callback/Return URL. Please provide the URL and make sure it's already registered on the Faspay system. For details, reference can be found [Here](file:///merchant-integration/api-reference-1/debit-transaction/url-callback-return-url)

### 4   Payment Notification

Payment notification from Faspay to the Merchant backend will also be triggered in the event of transaction status getting updated, to ensure the merchant is securely informed. Please provide the URL and make sure it's already registered on the Faspay system

The detailed API reference can be found [here](file:///merchant-integration/api-reference-1/debit-transaction/payment-notification) &#x20;
