PHPackages                             makstech/montonio-php-sdk - 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. makstech/montonio-php-sdk

ActiveLibrary[Payment Processing](/categories/payments)

makstech/montonio-php-sdk
=========================

Montonio PHP Library

v2.0.0(2mo ago)211.1k↓79.4%[6 PRs](https://github.com/makstech/montonio-php-sdk/pulls)MITPHPPHP ^8.2CI passing

Since Apr 2Pushed 6d ago1 watchersCompare

[ Source](https://github.com/makstech/montonio-php-sdk)[ Packagist](https://packagist.org/packages/makstech/montonio-php-sdk)[ Docs](https://github.com/makstech/montonio-php-sdk)[ RSS](/packages/makstech-montonio-php-sdk/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (8)Dependencies (8)Versions (17)Used By (0)

Montonio PHP SDK
================

[](#montonio-php-sdk)

[![Latest Version](https://camo.githubusercontent.com/0715bb1168319c55cca4dfb5e2d2a3e027a505eec58248d9cc55451fc1ac2213/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6d616b73746563682f6d6f6e746f6e696f2d7068702d73646b2e7376673f7374796c653d666c61742d737175617265)](https://github.com/makstech/montonio-php-sdk/releases)[![Total Downloads](https://camo.githubusercontent.com/8f01621158a42e05491369c0feafe6e488127e0cdd675b7dc0b86d8e0f75d25a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d616b73746563682f6d6f6e746f6e696f2d7068702d73646b3f7374796c653d666c61742d737175617265266c6162656c3d646f776e6c6f616473)](https://packagist.org/packages/makstech/montonio-php-sdk)[![Codecov](https://camo.githubusercontent.com/51326550699f5d112aaa47d756f7f93125615bc58d7e02c6edfdbced751308b3/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6d616b73746563682f6d6f6e746f6e696f2d7068702d73646b3f7374796c653d666c61742d737175617265)](https://app.codecov.io/gh/makstech/montonio-php-sdk)

PHP SDK for the [Montonio Stargate API](https://docs.montonio.com/api/stargate/) and [Shipping V2 API](https://docs.montonio.com/api/shipping-v2/reference). Wraps both APIs with fluent struct builders and JWT-authenticated requests.

Features
--------

[](#features)

- **Full API coverage** — Payments (Stargate) and Shipping V2 APIs
- **PSR-18 support** — bring your own HTTP client (Guzzle, Symfony, etc.) or use the built-in cURL transport
- **Fluent struct builders** — build request payloads with chained setters, array hydration, or `static create()` with named parameters
- **Typed enums** — `Environment`, `PaymentMethod`, `PaymentStatus` backed enums with full IDE support
- **Granular exceptions** — `AuthenticationException`, `ValidationException`, `NotFoundException`, `RateLimitException`, `ServerException`
- **JWT authentication** — token generation, webhook signature verification

### API Coverage

[](#api-coverage)

ClientMethodsAPI Docs**Orders**`createOrder`, `getOrder`[Orders guide](https://docs.montonio.com/api/stargate/guides/orders)**Payment Links**`createPaymentLink`, `getPaymentLink`[Payment links guide](https://docs.montonio.com/api/stargate/guides/payment-links)**Payment Intents**`createDraft`[Embedded cards guide](https://docs.montonio.com/api/stargate/guides/embedded-cards)**Refunds**`createRefund`[Refunds guide](https://docs.montonio.com/api/stargate/guides/refunds)**Sessions**`createSession`[Embedded cards guide](https://docs.montonio.com/api/stargate/guides/embedded-cards)**Payouts**`getPayouts`, `exportPayout`, `getBalances`[Payouts guide](https://docs.montonio.com/api/stargate/guides/payouts)**Stores**`getPaymentMethods`[Payment methods guide](https://docs.montonio.com/api/stargate/guides/payment-methods)**Shipping / Carriers**`getCarriers`[Shipping API reference](https://docs.montonio.com/api/shipping-v2/reference)**Shipping / Methods**`getShippingMethods`, `getPickupPoints`, `getCourierServices`, `filterByParcels`, `getRates`[Shipping methods guide](https://docs.montonio.com/api/shipping-v2/guides/shipping-methods)**Shipping / Shipments**`createShipment`, `updateShipment`, `getShipment`[Shipments guide](https://docs.montonio.com/api/shipping-v2/guides/shipments)**Shipping / Labels**`createLabelFile`, `getLabelFile`[Labels guide](https://docs.montonio.com/api/shipping-v2/guides/labels)**Shipping / Webhooks**`createWebhook`, `listWebhooks`, `deleteWebhook`[Webhooks guide](https://docs.montonio.com/api/shipping-v2/guides/webhooks)Supported payment methods: bank payments, card payments (Apple Pay, Google Pay), BLIK, Buy Now Pay Later, and Hire Purchase.

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

[](#requirements)

- PHP 8.2 or later
- cURL extension (or a PSR-18 HTTP client)

> **Using PHP 8.0 or 8.1?** [v1 (1.x branch)](https://github.com/makstech/montonio-php-sdk/tree/1.x) is actively maintained with full API coverage (Payments + Shipping):
>
> ```
> composer require makstech/montonio-php-sdk:^1.0
> ```

> **Upgrading from v1?** See the [upgrade guide](UPGRADE.md) — most users need no code changes.

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

[](#installation)

```
composer require makstech/montonio-php-sdk
```

Getting Started
---------------

[](#getting-started)

Get your API keys from the Montonio [Partner System](https://partnerv2.montonio.com/stores) (Stores → your store → API keys).

```
use Montonio\MontonioClient;

$client = new MontonioClient(
    $accessKey,
    $secretKey,
    MontonioClient::ENVIRONMENT_SANDBOX, // or ENVIRONMENT_LIVE
);
```

All sub-clients are accessed via factory methods on the main client (e.g. `$client->orders()`, `$client->refunds()`).

Custom HTTP Client (PSR-18)
---------------------------

[](#custom-http-client-psr-18)

By default, the SDK uses cURL for HTTP requests. You can optionally provide your own PSR-18 HTTP client:

```
use Montonio\MontonioClient;

$httpFactory = new \Nyholm\Psr7\Factory\Psr17Factory();

$client = new MontonioClient(
    $accessKey,
    $secretKey,
    MontonioClient::ENVIRONMENT_SANDBOX,
    httpClient: new \GuzzleHttp\Client(),
    requestFactory: $httpFactory,
    streamFactory: $httpFactory,
);
```

This is useful for testing (inject a mock client) or when your framework already provides an HTTP client.

Orders
------

[](#orders)

Create a payment order and redirect the customer to the payment URL.

Structs can be built fluently or from arrays — both approaches can be mixed:

```
$orderData = (new \Montonio\Structs\OrderData())
    ->setMerchantReference('ORDER-123')
    ->setReturnUrl('https://myshop.com/return')
    ->setNotificationUrl('https://myshop.com/webhook')
    ->setGrandTotal(29.99)
    ->setCurrency('EUR')
    ->setLocale('en')
    ->setPayment(
        (new \Montonio\Structs\Payment())
            ->setMethod(\Montonio\Structs\Payment::METHOD_PAYMENT_INITIATION)
            ->setAmount(29.99)
            ->setCurrency('EUR')
    )
    ->setLineItems([
        [
            'name' => 'T-Shirt',
            'quantity' => 1,
            'finalPrice' => 19.99,
        ],
    ])
    ->addLineItem(
        (new \Montonio\Structs\LineItem())
            ->setName('Socks')
            ->setQuantity(2)
            ->setFinalPrice(5.00)
    )
    ->setBillingAddress(new \Montonio\Structs\Address([
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john@example.com',
        'addressLine1' => 'Main St 1',
        'locality' => 'Tallinn',
        'country' => 'EE',
    ]));

$order = $client->orders()->createOrder($orderData);

// Redirect customer to payment
header('Location: ' . $order['paymentUrl']);
```

Retrieve an order:

```
$order = $client->orders()->getOrder($orderUuid);
echo $order['paymentStatus']; // 'PAID', 'PENDING', etc.
```

See the [orders guide](https://docs.montonio.com/api/stargate/guides/orders) for all available fields and response details.

Payment Methods
---------------

[](#payment-methods)

Fetch available payment methods for your store:

```
$methods = $client->stores()->getPaymentMethods();
```

Payment Links
-------------

[](#payment-links)

Create shareable payment links without building a full checkout:

```
$link = $client->paymentLinks()->createPaymentLink(
    (new \Montonio\Structs\CreatePaymentLinkData())
        ->setDescription('Invoice #456')
        ->setCurrency('EUR')
        ->setAmount(50.00)
        ->setLocale('en')
        ->setAskAdditionalInfo(true)
        ->setExpiresAt(date('c', strtotime('+7 days')))
        ->setType('one_time')
        ->setNotificationUrl('https://myshop.com/webhook')
);

echo $link['url']; // https://pay.montonio.com/...
```

Retrieve a payment link:

```
$link = $client->paymentLinks()->getPaymentLink($linkUuid);
```

Refunds
-------

[](#refunds)

Issue a full or partial refund for a paid order:

```
$refund = $client->refunds()->createRefund(
    (new \Montonio\Structs\CreateRefundData())
        ->setOrderUuid($orderUuid)
        ->setAmount(10.00)
        ->setIdempotencyKey($uniqueKey) // V4 UUID recommended
);

echo $refund['status']; // 'PENDING'
```

Webhooks
--------

[](#webhooks)

Montonio sends webhook notifications to your `notificationUrl` when order or refund statuses change. Use `decodeToken()` to verify the JWT signature and decode the payload:

```
// Order webhook: {"orderToken": ""}
$decoded = $client->decodeToken($requestBody['orderToken']);
echo $decoded->paymentStatus; // 'PAID', 'PENDING', 'ABANDONED', etc.
echo $decoded->merchantReference;

// Refund webhook: {"refundToken": ""}
$decoded = $client->decodeToken($requestBody['refundToken']);
echo $decoded->refundStatus; // 'SUCCESSFUL', 'PENDING', 'REJECTED', etc.
```

See the [webhooks guide](https://docs.montonio.com/api/stargate/guides/webhooks) for full payload details and retry policy.

Embedded Payments
-----------------

[](#embedded-payments)

### Embedded Card Payments

[](#embedded-card-payments)

For embedding card payment fields directly in your checkout, create a session and pass it to the [MontonioCheckout JS SDK](https://docs.montonio.com/api/stargate/guides/embedded-cards/):

```
$session = $client->sessions()->createSession();
$sessionUuid = $session['uuid']; // Pass to frontend JS SDK
```

### Embedded BLIK

[](#embedded-blik)

For embedded BLIK payments, pass the customer's 6-digit BLIK code when creating an order:

```
$orderData = (new \Montonio\Structs\OrderData())
    ->setPayment(
        (new \Montonio\Structs\Payment())
            ->setMethod(\Montonio\Structs\Payment::METHOD_BLIK)
            ->setAmount(100.00)
            ->setCurrency('PLN')
            ->setMethodOptions(
                (new \Montonio\Structs\PaymentMethodOptions())
                    ->setBlikCode('777123')
            )
    )
    // ... other order fields
;
```

See the [embedded BLIK guide](https://docs.montonio.com/api/stargate/guides/embedded-blik/) for the full flow.

Payouts
-------

[](#payouts)

Retrieve payout reports and balances:

```
// Get store balances
$balances = $client->payouts()->getBalances();

// List payouts for a store
$payouts = $client->payouts()->getPayouts($storeUuid, limit: 50, offset: 0, order: 'DESC');

// Export a payout report (excel or xml)
$export = $client->payouts()->exportPayout($storeUuid, $payoutUuid, 'excel');
$downloadUrl = $export['url'];
```

Shipping
--------

[](#shipping)

All shipping sub-clients are accessed via `$client->shipping()`:

### Carriers

[](#carriers)

```
$carriers = $client->shipping()->carriers()->getCarriers();
```

### Shipping Methods

[](#shipping-methods)

```
// All shipping methods
$methods = $client->shipping()->shippingMethods()->getShippingMethods();

// Pickup points for a carrier
$pickupPoints = $client->shipping()->shippingMethods()
    ->getPickupPoints('omniva', 'EE');

// Courier services for a carrier
$courierServices = $client->shipping()->shippingMethods()
    ->getCourierServices('dpd', 'EE');

// Filter methods by parcel dimensions
$filtered = $client->shipping()->shippingMethods()->filterByParcels(
    (new \Montonio\Structs\Shipping\FilterByParcelsData())
        ->setParcels([
            (new \Montonio\Structs\Shipping\ShipmentParcel())->setWeight(1.5),
        ]),
    'EE' // destination
);

// Calculate shipping rates
$rates = $client->shipping()->shippingMethods()->getRates(
    (new \Montonio\Structs\Shipping\ShippingRatesData())
        ->setDestination('EE')
        ->setParcels([
            (new \Montonio\Structs\Shipping\RatesParcel())->setItems([
                (new \Montonio\Structs\Shipping\RatesItem())
                    ->setLength(20.0)
                    ->setWidth(15.0)
                    ->setHeight(10.0)
                    ->setWeight(0.5),
            ]),
        ])
);
```

### Shipments

[](#shipments)

```
$shipment = $client->shipping()->shipments()->createShipment(
    (new \Montonio\Structs\Shipping\CreateShipmentData())
        ->setShippingMethod(
            (new \Montonio\Structs\Shipping\ShipmentShippingMethod())
                ->setType('pickupPoint')
                ->setId($pickupPointId) // UUID from getPickupPoints()
        )
        ->setReceiver(
            (new \Montonio\Structs\Shipping\ShippingContact())
                ->setName('John Doe')
                ->setPhoneCountryCode('372')
                ->setPhoneNumber('53334770')
                ->setEmail('john@example.com')
        )
        ->setParcels([
            (new \Montonio\Structs\Shipping\ShipmentParcel())->setWeight(1.0),
        ])
        ->setMerchantReference('ORDER-123')
);

echo $shipment['id'];
echo $shipment['status']; // 'pending', 'registered', etc.

// Get shipment details
$shipment = $client->shipping()->shipments()->getShipment($shipmentId);

// Update a shipment
$updated = $client->shipping()->shipments()->updateShipment($shipmentId,
    (new \Montonio\Structs\Shipping\UpdateShipmentData())
        ->setReceiver(
            (new \Montonio\Structs\Shipping\ShippingContact())
                ->setName('Jane Doe')
                ->setPhoneCountryCode('372')
                ->setPhoneNumber('55512345')
        )
);
```

### Label Files

[](#label-files)

```
$labelFile = $client->shipping()->labels()->createLabelFile(
    (new \Montonio\Structs\Shipping\CreateLabelFileData())
        ->setShipmentIds([$shipmentId])
        ->setPageSize('A4')
        ->setSynchronous(true)
);

echo $labelFile['labelFileUrl']; // PDF download URL (expires in 5 minutes)

// Get label file status
$labelFile = $client->shipping()->labels()->getLabelFile($labelFileId);
echo $labelFile['status']; // 'pending', 'ready', 'failed'
```

### Shipping Webhooks

[](#shipping-webhooks)

```
$webhook = $client->shipping()->webhooks()->createWebhook(
    (new \Montonio\Structs\Shipping\CreateShippingWebhookData())
        ->setUrl('https://myshop.com/shipping-webhook')
        ->setEnabledEvents([
            'shipment.registered',
            'shipment.statusUpdated',
            'labelFile.ready',
        ])
);

// List all webhooks
$webhooks = $client->shipping()->webhooks()->listWebhooks();

// Delete a webhook
$client->shipping()->webhooks()->deleteWebhook($webhookId);
```

See the [Shipping API reference](https://docs.montonio.com/api/shipping-v2/reference) for all available fields and response details.

License
-------

[](#license)

This library is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance92

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 87.2% 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 ~92 days

Recently: every ~0 days

Total

9

Last Release

81d ago

Major Versions

1.x-dev → v2.0.02026-04-13

PHP version history (2 changes)v1.0.0PHP ^8.0

v2.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/29b9792125b1fe697ab7de77b65ba4ffb79f9f1e9cb0d86433baf9f9d686ec47?d=identicon)[makstech](/maintainers/makstech)

---

Top Contributors

[![makstech](https://avatars.githubusercontent.com/u/25028046?v=4)](https://github.com/makstech "makstech (34 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

paymentpaymentsmontonio

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/makstech-montonio-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/makstech-montonio-php-sdk/health.svg)](https://phpackages.com/packages/makstech-montonio-php-sdk)
```

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.1B4.0k](/packages/guzzlehttp-psr7)[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

60216.0M85](/packages/mollie-mollie-api-php)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)

PHPackages © 2026

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