# LinkAja Integration Guide

The basic integration process of LinkAja channel will be explained below.

### Integration Step:

1. Post Data Transaction to Faspay
2. Redirect to LinkAja website
3. Callback/Return URL
4. Payment Notification
5. Refund Full Transaction

### 1. Post data Transaction

Post data transactions should be done from 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 post data transaction for LinkAja channel:

**A. Post Data Request**

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

```xml
<faspay>
	<request>Post Data Transaction</request>
	<merchant_id>99999</merchant_id>
	<merchant>STORE</merchant>
	<bill_no>647998170894149</bill_no>
	<bill_reff>647998170894149</bill_reff>
	<bill_date>2017/7/19 11:25:53 AM</bill_date>
	<bill_expired>2017/7/19 3:25:53 PM</bill_expired>
	<bill_desc>MIYAKO Stand Water Dispenser - Red Black (Merchant)</bill_desc>
	<bill_currency>IDR</bill_currency>
	<bill_gross>000</bill_gross>
	<bill_tax>000</bill_tax>
	<bill_miscfee>000</bill_miscfee>
	<bill_total>75600000</bill_total>
	<cust_no>USR170709275</cust_no>
	<cust_name>nur auliya</cust_name>
	<payment_channel>302</payment_channel>
	<pay_type>1</pay_type>
	<bank_userid>bot31160</bank_userid>
	<msisdn>089682712285</msisdn>
	<email>example@gmail.com</email>
	<terminal>10</terminal>
	<billing_address>Kawasan industri sentul.jl.olympic raya kav.b8 sentul bogor</billing_address>
	<billing_address_city>Bogor</billing_address_city>
	<billing_address_region>Bogor</billing_address_region>
	<billing_address_state>Jawa Barat</billing_address_state>
	<billing_address_poscode>16810</billing_address_poscode>
	<billing_address_country_code>ID</billing_address_country_code>
	<receiver_name_for_shipping>nur auliya</receiver_name_for_shipping>
	<shipping_address>Kawasan industri sentul.jl.olympic raya kav.b8 sentul bogor</shipping_address>
	<shipping_address_city>Bogor</shipping_address_city>
	<shipping_address_region>Bogor</shipping_address_region>
	<shipping_address_state>Jawa Barat</shipping_address_state>
	<shipping_address_poscode>16810</shipping_address_poscode>
	<shipping_address_country_code>ID</shipping_address_country_code>
	<item>
		<product>MIYAKO Stand Water D</product>
		<amount>54900000</amount>
		<qty>1</qty>
		<payment_plan>1</payment_plan>
		<tenor>00</tenor>
		<merchant_id />
	</item>
	<item>
		<product>Shipping Cost</product>
		<amount>20700000</amount>
		<qty>1</qty>
		<payment_plan>1</payment_plan>
		<tenor>00</tenor>
		<merchant_id />
	</item>
	<reserve1 />
	<reserve2 />
	<signature>be8791ac5f10bb042834896598bfc6bb9aadcbf9</signature>
</faspay>

```

{% endtab %}

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

```json
{
    "request": "Post Data Transaksi",
    "merchant_id": "99999",
    "merchant": "STORE",
    "bill_no": "647998170894149",
    "bill_reff": "647998170894149",
    "bill_date": "2017/7/19 11:25:53 AM",
    "bill_expired": "2017/7/19 3:25:53 PM",
    "bill_desc": "MIYAKO Stand Water Dispenser - Red Black (Merchant)",
    "bill_currency": "IDR",
    "bill_gross": "0",
    "bill_tax": "0",
    "bill_miscfee": "0",
    "bill_total": "75600000",
    "cust_no": "USR170709275",
    "cust_name": "Nur Auliya",
    "payment_channel": "302",
    "pay_type": "1",
    "bank_userid": "bot31160",
    "msisdn": "89682712285",
    "email": "auliyanur@gmail.com",
    "terminal": "10",
    "billing_address": "Kawasan industri sentul.jl.olympic raya kav.b8 sentul bogor",
    "billing_address_city": "Bogor",
    "billing_address_region": "Bogor",
    "billing_address_state": "Jawa Barat",
    "billing_address_poscode": 16810,
    "billing_address_country_code": "ID",
    "receiver_name_for_shipping": "nur auliya",
    "shipping_address": "Kawasan industri sentul.jl.olympic raya kav.b8 sentul bogor",
    "shipping_address_city": "Bogor",
    "shipping_address_region": "Bogor",
    "shipping_address_state": "Jawa Barat",
    "shipping_address_poscode": "16810",
    "shipping_address_country_code": "ID",
    "item": [
      {
        "product": "MIYAKO Stand Water D",
        "amount": "54900000",
        "qty": "1",
        "payment_plan": "1",
        "tenor": 0,
        "merchant_id": ""
      },
      {
        "product": "Shipping Cost",
        "amount": 20700000,
        "qty": 1,
        "payment_plan": 1,
        "tenor": "0",
        "merchant_id": ""
      }
    ],
    "reserve1": "",
    "reserve2": "",
    "signature": "be8791ac5f10bb042834896598bfc6bb9aadcbf9"
  }
}
```

{% endtab %}
{% endtabs %}

**B. Post Data Transaction Response**

You will get the post data response like the following

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

```xml
<?xml version="1.0" encoding="UTF-8"?>
<faspay>
	<response>Transmisi Info Detil Pembelian</response>
	<trx_id>9999971100000638</trx_id>
	<merchant_id>99999</merchant_id>
	<merchant>STORE</merchant>
	<bill_no>647998170894149</bill_no>
	<bill_items>
		<product>MIYAKO Stand Water D</product>
		<qty>1</qty>
		<amount>54900000</amount>
		<payment_plan>01</payment_plan>
		<merchant_id />
		<tenor>00</tenor>
	</bill_items>
	<bill_items>
	        <product>Shipping Cost</product>
		<qty>1</qty>
		<amount>20700000</amount>
		<payment_plan>01</payment_plan>
		<merchant_id />
		<tenor>00</tenor>
	</bill_items>
	<response_code>00</response_code>
	<response_desc>Success</response_desc>
</faspay>

```

{% endtab %}

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

```json
{
    "response": "Transmission detail of purchase",
    "trx_id": "9999971100000638",
    "merchant_id": "99999",
    "merchant": "STORE",
    "bill_no": "647998170894149",
    "bill_items": [
      {
        "product": "MIYAKO Stand Water D",
        "qty": 1,
        "amount": "54900000",
        "payment_plan": "1",
        "merchant_id": "",
        "tenor": "0"
      },
      {
        "product": "Shipping Cost",
        "qty": "1",
        "amount": "20700000",
        "payment_plan": "1",
        "merchant_id": "",
        "tenor": "0"
      }
    ],
    "response_code": "0",
    "response_desc": "Success"
  }
}
```

{% endtab %}
{% endtabs %}

### 2. Redirect

To redirect customers to LinkAja's Website, use `redirect_url` retrieved from Post Data Transaction response (JSON Format) or follow the detailed API reference [Here](https://docs.faspay.co.id/merchant-integration/api-reference-1/debit-transaction/redirect-process)

### 3. Callback/Return URL

After the customer completes the payment via LinkAja's website, the 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 the detailed reference can be found [Here](https://docs.faspay.co.id/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](https://docs.faspay.co.id/merchant-integration/api-reference-1/debit-transaction/payment-notification)&#x20;
