# Getnet Plugin Configuration and Usage

This guide details the integration and configuration process for the Getnet payment method on the Magento platform.

## Prerequisites

Before starting, ensure you have:

* Magento version between 2.3.5 and 2.4.5 (inclusive)
* FTP access to your server
* Getnet credentials (Client ID and Client Secret)
* The Getnet Magento plugin (download from [GitHub](https://github.com/getnetArgentina/Magento) and save as ZIP)

---

## Step 1: Module Installation

### 1.1 Copy Module to Magento

1. Access the root directory of your Magento installation and navigate to the `app/code` folder (create it if it doesn't exist).
2. Inside `app/code`, create the following directory structure:
   ```
   GetnetArg/Payments
   ```
3. Copy all contents from the downloaded repository into the `Payments` folder.

The final structure should look like:
```
app/code/GetnetArg/Payments/
├── Block
├── Controller
├── Cron
├── etc
├── Model
├── Observer
├── Plugin
└── registration.php
```

### 1.2 Execute Installation Commands

Access the server via terminal, navigate to the Magento root directory, and execute the following commands in order:

```
php bin/magento cache:disable
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:enable
```

<Callout type="warning">

If the `setup:di:compile` command does not complete at 100%, increase the PHP memory limit. Recommended value: `memory_limit = 1024M`

</Callout>

---

## Step 2: Verify Module Configuration

1. Access the Magento Admin panel.
2. In the side menu, navigate to **Stores > Configuration**.
3. In the left sidebar, select **Sales > Payment Methods** and locate the new payment method named **Getnet Argentina**.
5. Click on **Getnet Argentina** and configure the following fields:

| Field | Value |
| :---- | :---- |
| **Activate** | Yes (makes the payment module visible at checkout as **Getnet by Santander**) |
| **Client ID** | Client ID received from Getnet |
| **Secret ID** | Client Secret received from Getnet |
| **User Webhook** | Username configured in Getnet Portal |
| **Pass Webhook** | Password configured in Getnet Portal |
| **Test Environment** | Yes for testing; No for production. Use the appropriate Client ID and Client Secret for each environment. |

Click **Save Config** to save the configuration.

---

## Step 3: Getnet Portal Configuration

Access the Getnet Portal at: `https://www.globalgetnet.com/` and navigate to **Checkout configuration**.

### 5.1 Success and Error URLs

1. In the **Choose the screen after a transaction** section, configure the redirect URLs.
2. Apply the following suffixes to your store base URL:

| URL type | Suffix |
| :------- | :----- |
| **Success URL** | `<your-store-url>/response/success` |
| **Error URL** | `<your-store-url>/response/fail` |

Example: if your store is `https://getnettest.com`, use:
- **Success URL**: `https://getnettest.com/response/success`
- **Error URL**: `https://getnettest.com/response/fail`

### 3.2 Webhook Configuration

1. In the **Configure your notifications** section, set the webhook URL:
   ```
   <your-store-url>/webhook/response
   ```
   Example: `https://getnettest.com/webhook/response`

2. Define a webhook username and password in the Portal.
3. Add the same credentials to Magento in **User Webhook** and **Pass Webhook**.

<Callout type="warning">

Webhook credentials must match exactly between the Getnet Portal and Magento.

</Callout>

---

## Step 4: Checkout Visualization

With correct configuration:

1. The payment method will appear in checkout as **Getnet by Santander**.
2. It will be displayed in the **Review & Payments** step.
3. When selected, customers will see the Getnet payment form.
4. Customers can choose between credit or debit cards.
5. Installment options will be displayed according to configuration.