PHPackages                             x-laravel/payline-hoppa-driver - 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. x-laravel/payline-hoppa-driver

ActiveLibrary[Payment Processing](/categories/payments)

x-laravel/payline-hoppa-driver
==============================

Hoppa payment gateway driver for x-laravel/payline

v1.0.0(today)00MITPHPPHP ^8.3CI passing

Since Jun 19Pushed todayCompare

[ Source](https://github.com/x-laravel/payline-hoppa-driver)[ Packagist](https://packagist.org/packages/x-laravel/payline-hoppa-driver)[ RSS](/packages/x-laravel-payline-hoppa-driver/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (2)Used By (0)

payline-hoppa-driver
====================

[](#payline-hoppa-driver)

[![Tests](https://github.com/x-laravel/payline-hoppa-driver/actions/workflows/tests.yml/badge.svg)](https://github.com/x-laravel/payline-hoppa-driver/actions/workflows/tests.yml)[![PHP](https://camo.githubusercontent.com/c8d8dad6beb757a2b8acba331d16140813699543b88a37af0a81f20bd35f61de/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d626c7565)](https://www.php.net)[![Laravel](https://camo.githubusercontent.com/42e62a9adb05b6cb16993782fd4b04b64a76be3ff5704d170001885eb70c8448/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d313225323025374325323031332d726564)](https://laravel.com)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE.md)

Hoppa payment gateway driver for [x-laravel/payline](https://github.com/x-laravel/payline).

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

[](#requirements)

- PHP ^8.3
- Laravel ^12.0 | ^13.0
- x-laravel/payline ^1.0

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

[](#installation)

```
composer require x-laravel/payline-hoppa-driver
```

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

[](#configuration)

Add the `hoppa` block to `config/payline.php` under `gateways`:

```
'gateways' => [
    'hoppa' => [
        'api_url'      => env('HOPPA_API_URL', 'https://api.hoppa.com'),
        'merchant_id'  => env('HOPPA_MERCHANT_ID'),
        'merchant_key' => env('HOPPA_MERCHANT_KEY'),
    ],
],
```

Set the corresponding environment variables in `.env`:

```
PAYLINE_DRIVER=hoppa

HOPPA_API_URL=https://api.hoppa.com
HOPPA_MERCHANT_ID=your-merchant-id
HOPPA_MERCHANT_KEY=your-merchant-key
```

Usage
-----

[](#usage)

### Charging a payment

[](#charging-a-payment)

```
use XLaravel\Payline\DTOs\Card;
use XLaravel\Payline\DTOs\PaymentRequest;

$data = PaymentRequest::fromPayable(
    payable: $order,
    card: new Card(
        holderName: 'John Doe',
        number: '4111111111111111',
        expiryMonth: '12',
        expiryYear: '2030',
        cvv: '123',
    ),
    installments: 1,
    customerIp: $request->ip(),
);

$response = $order->pay('hoppa')->charge($data);
```

Hoppa uses a **3DS redirect** flow. On success, `pay()` returns a `PaymentResponse` with `status = Pending` and a `redirectUrl` pointing to Hoppa's 3DS page:

```
if ($response->requiresRedirect()) {
    return redirect($response->redirectUrl);
}
```

### Handling the callback

[](#handling-the-callback)

Payline handles the callback automatically via its built-in route (`/payline/callbacks/hoppa`). After 3DS completes, Hoppa POSTs to this URL and the user is redirected to `payline.callback_success_url` or `payline.callback_failure_url`.

You can listen to the dispatched events for any post-payment logic:

```
use XLaravel\Payline\Events\PaymentSucceeded;
use XLaravel\Payline\Events\PaymentFailed;

class HandlePaymentSucceeded
{
    public function handle(PaymentSucceeded $event): void
    {
        $event->payment;     // Payment model
        $event->transaction; // Transaction model
        $event->response;    // PaymentResponse DTO
    }
}
```

### Refund

[](#refund)

```
use XLaravel\Payline\DTOs\RefundData;
use XLaravel\Payline\Facades\Payline;

Payline::via('hoppa')->refund(
    new RefundData(
        gatewayTransactionId: $transaction->gateway_transaction_id,
        amount: 5000, // kuruş
        currency: 'TRY',
    ),
    $payment,
    $transaction,
);
```

### Void (Cancel)

[](#void-cancel)

Hoppa's cancel endpoint requires the original payment amount. Pass it via `metadata`:

```
use XLaravel\Payline\DTOs\VoidData;

Payline::via('hoppa')->void(
    new VoidData(
        gatewayTransactionId: $transaction->gateway_transaction_id,
        metadata: ['amount' => $transaction->amount],
    ),
    $payment,
    $transaction,
);
```

BIN Lookup
----------

[](#bin-lookup)

Hoppa provides a BIN lookup service that resolves card family and type from the first 8 digits of a card number. Enable it by setting `payline.bin_lookup.default` to `hoppa`:

```
// config/payline.php
'bin_lookup' => [
    'default' => env('PAYLINE_BIN_LOOKUP_DRIVER', 'hoppa'),
    'drivers' => [],
],
```

The BIN lookup driver automatically uses the same `api_url` configured under `payline.gateways.hoppa`. Usage:

```
use XLaravel\Payline\DTOs\Card;
use XLaravel\Payline\BinLookupManager;

$card = (new Card(
    holderName: 'John Doe',
    number: '4111111111111111',
    expiryMonth: '12',
    expiryYear: '2030',
    cvv: '123',
))->resolveProfile(app(BinLookupManager::class));

// $card->profile->family → 'Maximum'
// $card->profile->type   → CardType::Credit
```

When used with `PaymentRequest`, the resolved `CardProfile` enables automatic gateway routing via `GatewayRouter`:

```
$data = PaymentRequest::fromPayable(
    payable: $order,
    card: $card, // profile already resolved
    installments: 3,
);

$order->pay()->charge($data); // cheapest gateway selected automatically
```

Hoppa `Card_Type`Payline `CardType`CREDIT`CardType::Credit`DEBIT`CardType::Debit`Supported Operations
--------------------

[](#supported-operations)

OperationSupportedNotesPay (3DS)✓Redirects to Hoppa's 3DS pageAuthorize✗Not supported by HoppaCapture✗Not supported by HoppaRefund✓Partial or full via `/api/services/OrderReturn`Void/Cancel✓Requires `metadata["amount"]`Webhooks✗Hoppa uses callback-only flowTesting
-------

[](#testing)

```
# Build first (once per PHP version)
DOCKER_BUILDKIT=0 docker compose --profile php83 build

# Run tests
docker compose --profile php83 up
docker compose --profile php84 up
docker compose --profile php85 up
```

Or directly:

```
composer test
```

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](https://opensource.org/license/MIT).

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2bdb64c6c087c331b8bd5906bb1aa7eb06bc83af3654a48ba8ab9da365976651?d=identicon)[X-Adam](/maintainers/X-Adam)

---

Top Contributors

[![x-adam](https://avatars.githubusercontent.com/u/60411758?v=4)](https://github.com/x-adam "x-adam (2 commits)")

---

Tags

laravelpaymentvposhoppa

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/x-laravel-payline-hoppa-driver/health.svg)

```
[![Health](https://phpackages.com/badges/x-laravel-payline-hoppa-driver/health.svg)](https://phpackages.com/packages/x-laravel-payline-hoppa-driver)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)

PHPackages © 2026

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