PHPackages                             tapbuy/adyen - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. tapbuy/adyen

ActiveMagento2-module[Payment Processing](/categories/payments)

tapbuy/adyen
============

Tapbuy Adyen Payment for Magento 2 GraphQL

1.4.1(2mo ago)0447↓33.3%OSL-3.0PHPPHP ^7.4 || ^8.1CI passing

Since Aug 14Pushed 1mo agoCompare

[ Source](https://github.com/tapbuy/magento-adyen)[ Packagist](https://packagist.org/packages/tapbuy/adyen)[ RSS](/packages/tapbuy-adyen/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelogDependencies (6)Versions (10)Used By (0)

Tapbuy Adyen Module
===================

[](#tapbuy-adyen-module)

A Magento 2 module that extends the Adyen Payment functionality to modify origin data for Tapbuy's GraphQL payment processing system.

Overview
--------

[](#overview)

This module provides a plugin that intercepts and modifies the origin data for Adyen payments, specifically to handle custom origin URLs when requests are made through Tapbuy's system.

Features
--------

[](#features)

- **Origin URL Extraction**: Automatically extracts origin data from Tapbuy GraphQL requests and applies it to Adyen payment requests
- **Request Header Validation**: Validates Tapbuy requests using the `X-Tapbuy-Call` header for enhanced security
- **GraphQL Integration**: Designed to work seamlessly with Magento 2 GraphQL API
- **State Data Parsing**: Extracts origin information from nested JSON state data in GraphQL variables
- **URL Normalization**: Validates and normalizes origin URLs to ensure proper format
- **Error Handling**: Graceful handling of malformed JSON or missing data without interrupting payment flow

Requirements
------------

[](#requirements)

- Magento 2.x
- PHP 7.4+ or 8.x
- Adyen Payment module
- Magento GraphQL module

Installation
------------

[](#installation)

### Composer Installation (Recommended)

[](#composer-installation-recommended)

1. Add the module to your Magento project:

```
composer require tapbuy/adyen
```

2. Enable the module:

```
php bin/magento module:enable Tapbuy_Adyen
```

3. Run setup upgrade:

```
php bin/magento setup:upgrade
```

4. Compile if needed:

```
php bin/magento setup:di:compile
```

5. Clear cache:

```
php bin/magento cache:clean
```

### Manual Installation

[](#manual-installation)

1. Create the directory structure:

```
app/code/Tapbuy/Adyen/

```

2. Copy all module files to the directory
3. Follow steps 2-5 from the Composer installation

How It Works
------------

[](#how-it-works)

### Plugin Architecture

[](#plugin-architecture)

The module uses Magento's plugin system to intercept the `Adyen\Payment\Gateway\Request\OriginDataBuilder::build()` method using an `afterBuild` plugin.

### Origin Data Modification

[](#origin-data-modification)

When a payment is processed, the plugin:

1. **Validates Request Headers**: Checks for the `X-Tapbuy-Call` header to ensure the request originates from Tapbuy
2. **Extracts GraphQL Request Data**: Parses the request body to extract GraphQL variables
3. **Navigates Nested JSON**: Follows the path `variables.paymentMethod.adyen_additional_data_cc.stateData` to find state data
4. **Parses State Data**: Deserializes the nested JSON state data to extract origin information
5. **Validates Origin URL**: Ensures the origin URL has proper scheme and host components
6. **Normalizes URL**: Constructs a normalized origin URL (scheme://host:port format)
7. **Updates Payment Data**: Modifies the Adyen payment request with the extracted origin URL

### Data Flow

[](#data-flow)

The plugin expects GraphQL requests with the following structure:

```
{
  "variables": {
    "paymentMethod": {
      "adyen_additional_data_cc": {
        "stateData": "{\"origin\":\"https://example.com:3000\",\"...\":\"...\"}"
      }
    }
  }
}
```

### Error Handling

[](#error-handling)

The plugin includes robust error handling:

- Validates request headers to ensure legitimate Tapbuy requests
- Gracefully handles malformed JSON in request body or state data
- Validates URL structure and components before applying changes
- Maintains original payment flow if extraction fails or data is missing
- Prevents payment process interruption through comprehensive exception handling

Configuration
-------------

[](#configuration)

### Request Headers

[](#request-headers)

The module validates requests using the `X-Tapbuy-Call` header. This header must be present for the plugin to process Tapbuy payment modifications:

```
X-Tapbuy-Call: 1
```

### GraphQL Request Format

[](#graphql-request-format)

The module expects Tapbuy GraphQL requests to include state data in the following format:

```
{
  "variables": {
    "paymentMethod": {
      "adyen_additional_data_cc": {
        "stateData": "{\"origin\":\"https://your-domain.com:3000\"}"
      }
    }
  }
}
```

The `stateData` field should contain a JSON string with an `origin` property that specifies the origin URL for the Adyen payment.

### Origin Data Modification

[](#origin-data-modification-1)

When a Tapbuy request is detected, the plugin:

- Extracts the origin URL from the nested JSON state data
- Validates the URL format (must include scheme and host)
- Normalizes the URL to `scheme://host:port` format
- Applies the normalized origin to the Adyen payment request

File Structure
--------------

[](#file-structure)

```
Tapbuy/Adyen/
├── Plugin/
│   └── OriginDataBuilderPlugin.php        # Main plugin class
├── etc/
│   ├── di.xml                             # Dependency injection configuration
│   └── module.xml                         # Module declaration
├── composer.json                          # Composer configuration
├── registration.php                       # Module registration
└── README.md                              # This file

```

Dependencies
------------

[](#dependencies)

### Module Dependencies

[](#module-dependencies)

- `Magento_GraphQl`: Required for GraphQL functionality

### Plugin Target

[](#plugin-target)

- `Adyen\Payment\Gateway\Request\OriginDataBuilder`: The Adyen module's origin data builder

Development
-----------

[](#development)

### Plugin Configuration

[](#plugin-configuration)

The plugin is configured in `etc/di.xml`:

```

```

### Key Classes

[](#key-classes)

#### OriginDataBuilderPlugin

[](#origindatabuilderplugin)

- **Namespace**: `Tapbuy\Adyen\Plugin`
- **Purpose**: Extracts origin data from Tapbuy GraphQL requests and applies it to Adyen payments
- **Method**: `afterBuild()` - Plugin method that runs after the original build method
- **Dependencies**:
    - `RequestInterface` - For accessing HTTP request headers and body content
    - `Json` - For parsing JSON data from GraphQL requests and state data
- **Key Methods**:
    - `extractOriginFromTapbuyRequest()` - Extracts and validates origin from GraphQL request
    - `getNestedValue()` - Safely navigates nested array structures

Troubleshooting
---------------

[](#troubleshooting)

### Common Issues

[](#common-issues)

1. **Module Not Loading**

    - Verify module is enabled: `php bin/magento module:status Tapbuy_Adyen`
    - Check registration.php path is correct
2. **Plugin Not Working**

    - Ensure DI compilation is up to date: `php bin/magento setup:di:compile`
    - Verify Adyen module is installed and enabled
    - Check that the `X-Tapbuy-Call` header is being sent with requests
3. **Origin Data Issues**

    - Verify that the GraphQL request includes the correct state data structure
    - Check that the origin URL in state data has valid scheme and host
    - Ensure the `stateData` field contains valid JSON with an `origin` property
4. **JSON Parsing Errors**

    - Validate that the GraphQL request body is properly formatted JSON
    - Check that the nested `stateData` field contains valid JSON
    - Verify the origin URL format in the state data
5. **Headers Not Detected**

    - Ensure the `X-Tapbuy-Call` header is included in HTTP requests
    - Verify server configuration allows custom headers
    - Check that headers are not being stripped by proxies or load balancers

Development
-----------

[](#development-1)

### Running Tests

[](#running-tests)

Tests run inside a Docker container that replicates the CI environment (PHP 8.3, Magento 2.4.7-p5). Docker must be running.

**Prerequisites:** clone the following sibling repository next to this one:

```
# From the parent directory
git clone git@github.com:tapbuy/magento-redirect-plugin.git redirect-tracking
```

`Adyen/adyen-magento2` is cloned automatically to `~/.tapbuy-ci-cache/` on first run.

**First-time setup:**

```
cp auth.json.dist auth.json
# Fill in your repo.magento.com public/private keys in auth.json
```

**Run all unit tests:**

```
make test
```

On the first run, the Docker image is built and Magento is installed into a named volume (`tapbuy-magento-2.4.7-p5-php83`). Subsequent runs reuse the cached volume and are fast.

> Do not use `composer test` — it runs PHPUnit without the Magento bootstrap and will fail or produce misleading results.

### Linting

[](#linting)

Linting runs PHPMD and PHPCS (Magento2 standard) inside the same Docker container as tests. Docker must be running.

**Run both linters:**

```
make lint
```

**Run individually:**

```
make phpmd   # PHP Mess Detector
make phpcs   # PHP CodeSniffer (Magento2 standard)
```

Both linters always run when using `make lint`; if either fails, the command exits with a non-zero code.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance88

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~29 days

Recently: every ~8 days

Total

8

Last Release

68d ago

Major Versions

0.1.0 → 1.0.02025-08-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/f193163becacc7142aebf5cdcddf3c47d3c66c9476e2cbcc53e38ffb46b3561f?d=identicon)[valentin\_tapbuy](/maintainers/valentin_tapbuy)

---

Top Contributors

[![ValentinCreative](https://avatars.githubusercontent.com/u/1830588?v=4)](https://github.com/ValentinCreative "ValentinCreative (79 commits)")

### Embed Badge

![Health badge](/badges/tapbuy-adyen/health.svg)

```
[![Health](https://phpackages.com/badges/tapbuy-adyen/health.svg)](https://phpackages.com/packages/tapbuy-adyen)
```

###  Alternatives

[adyen/module-payment

Official Magento2 Plugin to connect to Payment Service Provider Adyen.

1663.0M10](/packages/adyen-module-payment)[checkoutcom/magento2

Checkout.com Payment Gateway for Magento 2

34263.8k1](/packages/checkoutcom-magento2)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
