# Retail Payment Integration Guide

One of the payment methods offered by Faspay is Retail Payment. By using this payment method, customers will have the option to make a payment via retail payment and Faspay will send real time notifications when the customer completes the payment.

At this moment, Faspay has integrated the following retail payment methods:

1. Payment Point Indomaret
2. Alfagroup

Basic integration process of retail payment will be explained below.

## **Integration Step**

1. Post Data Transaction to Faspay
2. Display Payment Code
3. Payment Notification

## 1. Post Data Transaction

Post data transaction 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)

{% hint style="info" %}
Every Retail Payment channel will use the same API request, the difference is only on `payment_channel`value for each retail payment channel.
{% endhint %}

This is an example of post data transaction for the Retail Payment channel

{% tabs %}
{% tab title="Payment Point Indomaret" %}

```json
{
   "request": "Post Data Transaction",
   "merchant_id": "99999",
   "merchant": "Sophia Store",
   "bill_no": "20201222113632",
   "bill_reff": "20200324_02-2286704_336",
   "bill_date": "2020-12-19 06:04:29",
   "bill_expired": "2020-12-19 07:04:29",
   "bill_desc": "Payment Online Via Faspay",
   "bill_currency": "IDR",
   "bill_gross": "100000",
   "bill_miscfee": "100000",
   "bill_total": "200000",
   "cust_no": "01",
   "cust_name": "John Doe",
   "payment_channel": "706",
   "pay_type": "01",
   "msisdn": "8562927907",
   "email": "john@gmail.com",
   "terminal": "10",
   "billing_address": "Jl Sabang 37",
   "billing_address_city": "Jakarta",
   "billing_address_region": "DKI Jakarta",
   "billing_address_state": "Indonesia",
   "billing_address_poscode": "10170",
   "billing_address_country_code": "ID",
   "receiver_name_for_shipping": "John Doe",
   "shipping_address": "Jl. Sabang 37",
   "shipping_address_city": "Jakarta",
   "shipping_address_region": "DKI Jakarta",
   "shipping_address_state": "Indonesia",
   "shipping_address_poscode": "10170",
   "item": {
      "id": "A001",
      "product": "Invoice #2286704",
      "qty": "1",
      "amount": "100000",
      "payment_plan": "01",
      "merchant_id":"99999",
      "tenor": "00"
   },
   "reserve1": "",
   "reserve2": "",
   "signature": "b8e8b132d1fba3b958fd427b22b88349b7b4c16d"
}
```

{% endtab %}

{% tab title="Alfagroup" %}

```json
{
   "request": "Post Data Transaction",
   "merchant_id": "99999",
   "merchant": "Sophia Store",
   "bill_no": "20201222113850",
   "bill_reff": "20200324_02-2286704_336",
   "bill_date": "2020-12-19 06:04:29",
   "bill_expired": "2020-12-19 07:04:29",
   "bill_desc": "Payment Online Via Faspay",
   "bill_currency": "IDR",
   "bill_gross": "100000",
   "bill_miscfee": "100000",
   "bill_total": "200000",
   "cust_no": "01",
   "cust_name": "John Doe",
   "payment_channel": "707",
   "pay_type": "01",
   "msisdn": "8562927907",
   "email": "john@gmail.com",
   "terminal": "10",
   "billing_address": "Jl Sabang 37",
   "billing_address_city": "Jakarta",
   "billing_address_region": "DKI Jakarta",
   "billing_address_state": "Indonesia",
   "billing_address_poscode": "10170",
   "billing_address_country_code": "ID",
   "receiver_name_for_shipping": "John Doe",
   "shipping_address": "Jl. Sabang 37",
   "shipping_address_city": "Jakarta",
   "shipping_address_region": "DKI Jakarta",
   "shipping_address_state": "Indonesia",
   "shipping_address_poscode": "10170",
   "item": {
      "id": "A001",
      "product": "Invoice #2286704",
      "qty": "1",
      "amount": "100000",
      "payment_plan": "01",
      "merchant_id":"99999",
      "tenor": "00"
   },
   "reserve1": "",
   "reserve2": "",
   "signature": "5fefe2c250f029d18db15396c430a7c4aec9e5aa"
}
```

{% endtab %}
{% endtabs %}

You will get the post data response like the following

{% tabs %}
{% tab title="Payment Point Indomaret" %}

```json
{
   "response": "Transmission of Purchase Detail Info",
   "trx_id": "9999970000081018",
   "merchant_id": "99999",
   "merchant": "Sophia Store",
   "bill_no": "20201222113632",
   "bill_items": {
      "id": "A001",
      "product": "Invoice #2286704",
      "qty": "1",
      "amount": "100000",
      "payment_plan": "01",
      "merchant_id": "99999",
      "tenor": "00"
   },
   "response_code": "00",
   "response_desc": "Success",
   "redirect_url" : "https://dev.faspay.co.id/pws/100003/0830000010100000/b8e8b132d1fba3b958fd427b22b88349b7b4c16d?trx_id=9999970000081018&merchant_id=99999&bill_no=20201222113632"
}
```

{% endtab %}

{% tab title="Alfagroup" %}

```json
{
   "response": "Transmission of Purchase Detail Info",
   "trx_id": "3245070700122879",
   "merchant_id": "99999",
   "merchant": "Sophia Store",
   "bill_no": "20201222113850",
   "bill_items": {
      "id": "A001",
      "product": "Invoice #2286704",
      "qty": "1",
      "amount": "100000",
      "payment_plan": "01",
      "merchant_id": "99999",
      "tenor": "00"
   },
   "response_code": "00",
   "response_desc": "Success",
   "redirect_url" : "https://dev.faspay.co.id/pws/100003/0830000010100000/5fefe2c250f029d18db15396c430a7c4aec9e5aa?trx_id=3245070700122879&merchant_id=99999&bill_no=20201222113850"
}
```

{% endtab %}
{% endtabs %}

## 2. Displaying Payment Code

There are display the payment code there are two options:

1. Displaying payment code on merchant's web page
2. Redirect to Faspay's page to display the payment code, expired time, and how to pay instructions. Read the detailed API reference [here](https://docs.faspay.co.id/merchant-integration/api-reference-1/debit-transaction/redirect-process) or just simply use `redirect_url` that retrieved from Post Data Transaction Response (for JSON Format).

{% hint style="info" %}
To display the payment code on the merchant's webpage use the `trx_id` response from Post Data Transaction as Payment Code

Don't forget to display the expiration time and how to pay instructions too.
{% endhint %}

#### 3. 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 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;
