---
agentTools:
  projectIndex: https://herepay.readme.io/llms.txt
---

# Get Payment Channels

Gets the list of banks your customer can pay with, and your charges.

**When to use:** before payment, to show the customer a list of banks to choose from.

**What you get back**

- `payment_method`: `Online Banking` (personal account) or `Corporate Banking` (company account).
- `charges`: the fee for each payment, as a fixed amount (RM) and/or a percentage.
- `channels`: the banks. Each bank has:
  - `prefix`: the bank code. You need it for *Initiate Payment*.
  - `name` and `img_url`: bank name and logo to show the customer.
  - `active`: `Active` means the bank is working. Hide banks that show `Inactive`.

**Tip:** a bank can go offline at any time, so get a fresh list each time you show it.

# OpenAPI definition

````json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Herepay Payment API",
    "description": "Use the Herepay Payment API to accept **FPX online banking** payments on your website or app, and to check if a payment went through.\n\n## How it works\n\n1. **Show the banks:** call *Get Payment Channels* to get the list of banks.\n2. **Customer picks a bank:** your system sends the order to *Initiate Payment*.\n3. **Customer pays:** Herepay takes the customer to their bank's page.\n4. **You get the result:** Herepay sends the result to your system (*Callback*) and brings the customer back to your website.\n5. **Check anytime:** call *Get Transaction by Payment Code* to see the latest status of an order.\n\n## Before you start\n\nGet these 3 keys from your Herepay dashboard (**Settings → API**):\n\n| Key | What it's for |\n|---|---|\n| Secret Key | Sent with every request |\n| API Key | Sent with every request |\n| Private Key | Used to make and check the **checksum**. Keep it secret. Never send it or put it on your website. |\n\nTest on **UAT** first, then switch to **Production**:\n\n| | Address |\n|---|---|\n| UAT (testing) | `https://uat.herepay.org` |\n| Production (live) | `https://app.herepay.org` |\n\n## Payment status\n\n| Code | Status | Meaning |\n|---|---|---|\n| `00` | Success | Paid |\n| `29` | Pending | Not finished yet |\n| `30` | Failed | Not paid, cancelled, or wrong details |\n| `41` | Unauthorized | Wrong keys or wrong checksum |\n\n## What is a checksum?\n\nA checksum is a **security code**. It proves the message really came from you (or from Herepay) and nobody changed it along the way.\n\nHow to make it:\n\n1. Put all the fields in **A to Z order by field name**. Leave out `checksum` itself.\n2. Join their **values** with a comma.\n3. Lock that text with your **Private Key** using HMAC-SHA256.\n\nExample: for a payment of RM10.00, the joined text looks like this:\n\n```\n10.00,ABB0233,Order #1001,ali@example.com,Ali bin Abu,ORDER-1001,Online Banking,0123456789\n```\n\nThat text, locked with your Private Key, is the checksum.\n\n**In Postman you don't have to do this yourself.** *Initiate Payment* makes the checksum for you. Just fill in `private_key` in the collection variables.\n\n## Collection variables\n\nFill these in before you send a request: `base_url`, `secret_key`, `api_key`, `private_key`, `payment_code`.\n\n## For developers\n\n```php\nfunction herepayChecksum(array $fields, string $privateKey): string\n{\n    unset($fields['checksum']);\n    ksort($fields);\n    return hash_hmac('sha256', implode(',', $fields), $privateKey);\n}\n```\n\nSend `amount` as text (`\"10.00\"`), so the value you sign is exactly the value Herepay receives.\n",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://uat.herepay.org"
    },
    {
      "url": "https://yourshop.com"
    }
  ],
  "paths": {
    "/api/v1/herepay/payment/channels": {
      "get": {
        "tags": [
          "default"
        ],
        "summary": "Get Payment Channels",
        "description": "Gets the list of banks your customer can pay with, and your charges.\n\n**When to use:** before payment, to show the customer a list of banks to choose from.\n\n**What you get back**\n\n- `payment_method`: `Online Banking` (personal account) or `Corporate Banking` (company account).\n- `charges`: the fee for each payment, as a fixed amount (RM) and/or a percentage.\n- `channels`: the banks. Each bank has:\n  - `prefix`: the bank code. You need it for *Initiate Payment*.\n  - `name` and `img_url`: bank name and logo to show the customer.\n  - `active`: `Active` means the bank is working. Hide banks that show `Inactive`.\n\n**Tip:** a bank can go offline at any time, so get a fresh list each time you show it.",
        "parameters": [
          {
            "name": "SecretKey",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Your team's Secret Key (Herepay dashboard → Settings → API).",
            "example": "{{secret_key}}"
          },
          {
            "name": "XApiKey",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Your team's API Key (Herepay dashboard → Settings → API).",
            "example": "{{api_key}}"
          },
          {
            "name": "Accept",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "example": "application/json"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string",
                  "example": "application/json"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "payment_method": "Online Banking",
                      "charges": {
                        "currency": "MYR",
                        "fixed": "1.00",
                        "percentage": 0
                      },
                      "channels": [
                        {
                          "prefix": "ABB0233",
                          "active": "Active",
                          "name": "Affin Bank",
                          "img_url": "https://app.herepay.org/storage/payment_method/affin-bank.png"
                        },
                        {
                          "prefix": "MB2U0227",
                          "active": "Active",
                          "name": "Maybank2u",
                          "img_url": "https://app.herepay.org/storage/payment_method/maybank2u.png"
                        },
                        {
                          "prefix": "BCBB0235",
                          "active": "Inactive",
                          "name": "CIMB Clicks",
                          "img_url": "https://app.herepay.org/storage/payment_method/cimb-clicks.png"
                        }
                      ]
                    },
                    {
                      "payment_method": "Corporate Banking",
                      "charges": {
                        "currency": "MYR",
                        "fixed": "2.00",
                        "percentage": 0
                      },
                      "channels": [
                        {
                          "prefix": "ABB0232",
                          "active": "Active",
                          "name": "Affin Bank",
                          "img_url": "https://app.herepay.org/storage/payment_method/affin-bank.png"
                        }
                      ]
                    }
                  ],
                  "message": "Payment channels and methods retrieved successfully."
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string",
                  "example": "application/json"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "status": "Unauthorized",
                  "status_code": "41",
                  "error": "Not authorized. Invalid API Key."
                }
              }
            }
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 106,
      "1": 225,
      "2": 121,
      "3": 235,
      "4": 26,
      "5": 235,
      "6": 96,
      "7": 24,
      "8": 42,
      "9": 153,
      "10": 39,
      "11": 174
    }
  }
}
````