# Payment Service

This API allows you to retrieve a list of payment services by payment channel. This enables extra controls of what payment services that you want to display on your application.&#x20;

## Authentication

LeanX uses **Auth Token** to authenticate in each request's header.

{% hint style="info" %}
**Auth Token** can be retrieved in your portal dashboard under **API** page.
{% endhint %}

**Request Header**

{% code overflow="wrap" %}

```json
{
    "auth-token": "LP-0D7C06DE-MM|7394e58e-edee-4c42-9ca5-bcbc449f1b9f|2141df4a3cb633d5ce8683bb0c55067e5caebfbe07390dde277dc455bcc95c91723a81b5e565c7c02d68fb84e396722563016bf99e576a4b8cdbe4423fbf226P 
}
```

{% endcode %}

## Getting Payment Service List

{% hint style="info" %}
Note that for **B2C** payment please use **`payment_model_reference_id`** = 1\
while **B2B** is **`payment_model_reference_id`** = 2
{% endhint %}

{% hint style="warning" %}
B2B payment service list are only available for payment type **`WEB_PAYMENT.`** Jump to **Getting B2B Payment Service** List [**here**](/api-docs/cloud-payment/payment-service.md#getting-payment-service-list-fpx-b2b)
{% endhint %}

HTTP Method: <mark style="color:yellow;">POST</mark>

```
https://api.leanx.dev/api/v1/merchant/list-payment-services
```

#### Request Body

```json
{
  "payment_type": "WEB_PAYMENT",
  "payment_status": "active",
  "payment_model_reference_id": 1
}
```

#### Attributes

<table><thead><tr><th width="281.3333333333333">Property</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td>payment_type<mark style="color:red;">*</mark></td><td>String</td><td><p>Payment service type <br><br><code>WEB_PAYMENT</code> = Web Payment (FPX)<br><code>CI_VISA_MASTERCARD</code> = Card</p><p><code>GLOBAL_CARD_PAYMENT</code> = Card<br><code>DIGITAL_PAYMENT</code> = E-Wallet<br><code>BUY_NOW_PAY_LATER</code> = Buy Now Pay Later<br><code>SWITCH_PAYPAL</code> = PayPal<br><code>GLOBAL_CARD_PAYMENT_STRIPE</code> = Stripe<br><code>DUITNOW_ONLINE_BANKING</code> = DuitNow<br><code>QR_PAYMENT</code> = DuitNow QR</p></td></tr><tr><td>payment_model_reference_id<mark style="color:red;">*</mark></td><td>String</td><td>The web payment (FPX) channel <br><code>1</code> = B2C<br><code>2</code> = B2B<br><br>If using other payment type than <code>WEB_PAYMENT</code> , please use <br><code>1</code> = Default</td></tr><tr><td>payment_status<mark style="color:red;">*</mark></td><td>String</td><td>Payment service channel status<br><br><code>active</code> or <code>inactive</code></td></tr></tbody></table>

#### Response

```json
{
  "response_code": 2000,
  "description": "SUCCESS",
  "app_version": "/api/v1",
  "talk_to_server_before": "2023-11-28T19:22:13.243431",
  "data": {
    "list": {
      "draw": 25,
      "record_total": 25,
      "record_filtered": 25,
      "data": [
        {
          "WEB_PAYMENT": [
            {
              "payment_service_id": 16,
              "payment_model_reference_id": 1,
              "payment_model_reference": "B2C",
              "unique_reference": "AFFIN_BANK_WEBPAY",
              "payment_service": "WEB_PAYMENT",
              "name": "Affin Bank",
              "record_status_id": 1,
              "record_status": "ACTIVE"
            },
            ...........
            {
              "payment_service_id": 85,
              "payment_model_reference_id": 1,
              "payment_model_reference": "B2C",
              "unique_reference": "UOB_TESTID_WEBPAY",
              "payment_service": "WEB_PAYMENT",
              "name": "United Overseas Bank - B2C Test",
              "record_status_id": 1,
              "record_status": "ACTIVE"
            }
          ]
        }
      ],
      "next_page_start": null,
      "next_page_length": null,
      "previous_page_start": null,
      "previous_page_length": null
    }
  },
  "breakdown_errors": null,
  "token": ""
}
```

## Getting Payment Service List (FPX B2B)

HTTP Method: <mark style="color:yellow;">POST</mark>

```
https://api.leanx.dev/api/v1/merchant/list-payment-services
```

#### Request Body

```json
{
  "payment_type": "WEB_PAYMENT",
  "payment_status": "active",
  "payment_model_reference_id": 2
}
```

#### Attributes

<table><thead><tr><th width="281.3333333333333">Property</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td>payment_type<mark style="color:red;">*</mark></td><td>String</td><td>Payment service type <br><code>WEB_PAYMENT</code> = Web Payment (FPX)</td></tr><tr><td>payment_model_reference_id<mark style="color:red;">*</mark></td><td>String</td><td>The web payment (FPX) channel <br><code>2</code> = B2B</td></tr><tr><td>payment_status<mark style="color:red;">*</mark></td><td>String</td><td>Payment service channel status<br><br><code>active</code> or <code>inactive</code></td></tr></tbody></table>

#### Response

```json
{
  "response_code": 2000,
  "description": "SUCCESS",
  "app_version": "/api/v1",
  "talk_to_server_before": "2023-12-05T14:38:08.409962",
  "data": {
    "list": {
      "draw": 24,
      "record_total": 24,
      "record_filtered": 24,
      "data": [
        {
          "WEB_PAYMENT": [
            {
              "payment_service_id": 60,
              "payment_model_reference_id": 2,
              "payment_model_reference": "B2B1",
              "unique_reference": "AFFIN_BANK_B2B1_WEBPAY",
              "payment_service": "WEB_PAYMENT",
              "name": "Affin Bank Staging",
              "record_status_id": 1,
              "record_status": "ACTIVE"
            },
            ........
            {
              "payment_service_id": 86,
              "payment_model_reference_id": 2,
              "payment_model_reference": "B2B1",
              "unique_reference": "AFFIN_BANK_AFFINMAX_B2B1_WEBPAY",
              "payment_service": "WEB_PAYMENT",
              "name": "AFFINMAX",
              "record_status_id": 1,
              "record_status": "ACTIVE"
            }
          ]
        }
      ],
      "next_page_start": null,
      "next_page_length": null,
      "previous_page_start": null,
      "previous_page_length": null
    }
  },
  "breakdown_errors": null,
  "token": ""
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.leanx.io/api-docs/cloud-payment/payment-service.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
