> For the complete documentation index, see [llms.txt](https://docs.morpara.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.morpara.com/tr/en/api-documentation/gelistiriciaraclari/open-source-plugins/magento-2.md).

# Magento 2

**MorPOS Payment Gateway for Magento 2**, to Magento 2 based stores **Morpara MorPOS** is a secure, flexible and easy payment gateway that integrates the payment system.

***

#### 📥 Download Plugin <a href="#eklenti-indir" id="eklenti-indir"></a>

**You can download the MorPOS Magento 2 plugin from the link below:**

[**Download the Plugin**](https://github.com/morpara/morpos-magento2/archive/refs/heads/main.zip) ✅

### 🧠 General Features

The module includes the following features:

* Magento **2.2 and above** compatible with
* Hosted Payment Page&#x20;
* Seamless payment with embedded payment form
* Multiple currencies: **TRY, USD, EUR**
* Sandbox (test) mode
* Easy configuration from the admin panel
* Multi-store support
* Payments for guest & registered users
* CSP (Content Security Policy) compatible
* API signing and security features

***

### 📌 Requirements

**Server side:**

* Magento: **2.2+**
* PHP: **7.2+** (8.1+ recommended)
* TLS 1.2 or higher
* PHP extensions: `cURL`, `json`, `hash`, `openssl`

***

### ⚙️ Installation

#### 1) With Composer (recommended)

```bash
composer require morpara/morpos-magento2
php bin/magento module:enable MorPOS_PaymentGateway
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento cache:flush
```

#### 2) Manual

1. Download the ZIP file from the GitHub Releases page
2. Extract the module folder to **app/code/MorPOS/PaymentGateway/** below
3. Run the activation and deployment commands\
   → the same steps match the installation done with Composer

#### 3) Via FTP

Upload the module files via FTP to the `app/code/MorPOS/PaymentGateway/` directory and then run the Magento installation commands in the terminal.

***

### 🔧 Configuration (Admin Panel)

For configuration:

> **Stores → Configuration → Sales → Payment Methods → MorPOS Payment Gateway**

Required fields:

| Setting                  | Description                           |
| ------------------------ | ------------------------------------- |
| Merchant ID              | MorPOS merchant identifier            |
| Client ID                | OAuth Client ID                       |
| Client Secret            | OAuth Client Secret                   |
| API Key                  | MorPOS API key                        |
| Test Mode                | Sandbox / Prod setting                |
| Form Type                | HPP or Embedded form                  |
| Order Status             | Order status after successful payment |
| Minimum / Maximum Amount | Optional limits                       |
| Countries                | Countries allowed for payment         |
|                          |                                       |

👉 **Where do you get the information?**\
You can obtain it from the MorPOS panel or through the Morpara support team.

***

### 🛒 Payment Flow

1. Customer adds a product to the cart
2. MorPOS method is selected at the payment step
3. Magento initiates the payment session with the MorPOS API
4. Customer is redirected to the payment page or the payment form opens in a modal
5. When the payment is completed MorPOS sends a callback to the store
6. The order is automatically updated
7. Customer sees the result screen

***

### 🔐 Security Features

The module includes the following security practices:

* SHA-256 signed API calls (MorPOS Docs requirement)
* Client Secret & API Key are stored encrypted in the database
* CSP whitelist configuration
* HTTPS requirement
* Sensitive data is not logged

***

### 🧪 Test Cards & Sandbox

The module includes sandbox support. For test card numbers and sample scenarios, see the MorPOS documentation.

***

### 🚑 Troubleshooting

**Payment method not visible?**

* Is the module active?
* Is there a supported currency?
* Is there a country / order amount restriction?

**Payment cannot be initiated?**

* Are the credentials correct?
* Is the TLS version adequate?
* Is cURL installed?

**Order not updated after callback?**

* Is the callback URL accessible?
* Is there a firewall / DNS block?

***

### 🌍 Internationalization (i18n)

The module includes Turkish and English translation files. Adding new languages is also possible.

***

### 🧩 Module Structure (Important Directories)

```
MorPOS/PaymentGateway/
├── Api/
├── Block/
├── Controller/
├── Gateway/
├── Helper/
├── Model/
├── Plugin/
├── etc/
├── i18n/
└── view/
```

***

### 📍 API Endpoints

| Endpoint                 | Method | Usage                 |
| ------------------------ | ------ | --------------------- |
| /morpos/payment/start    | POST   | Start payment session |
| /morpos/payment/callback | POST   | MorPOS callback       |
| /morpos/payment/success  | GET    | Success redirect      |
| /morpos/payment/cancel   | GET    | Cancel redirect       |
|                          |        |                       |
