PHP SDK for the Montonio Stargate API. Wraps the API with fluent struct builders and JWT-authenticated requests.
| Client | Methods | API Docs |
|---|---|---|
| Orders | createOrder, getOrder |
Orders guide |
| Payment Links | createPaymentLink, getPaymentLink |
Payment links guide |
| Payment Intents | createDraft |
Embedded cards guide |
| Refunds | createRefund |
Refunds guide |
| Sessions | createSession |
Embedded cards guide |
| Payouts | getPayouts, exportPayout, getBalances |
Payouts guide |
| Stores | getPaymentMethods |
Payment methods guide |
Supported payment methods: bank payments, card payments (Apple Pay, Google Pay), BLIK, Buy Now Pay Later, and Hire Purchase.
- PHP 8.0 or later
- cURL extension
composer require makstech/montonio-php-sdkGet your API keys from the Montonio Partner System (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()).
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 for all available fields and response details.
Fetch available payment methods for your store:
$methods = $client->stores()->getPaymentMethods();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);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'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": "<jwt>"}
$decoded = $client->decodeToken($requestBody['orderToken']);
echo $decoded->paymentStatus; // 'PAID', 'PENDING', 'ABANDONED', etc.
echo $decoded->merchantReference;
// Refund webhook: {"refundToken": "<jwt>"}
$decoded = $client->decodeToken($requestBody['refundToken']);
echo $decoded->refundStatus; // 'SUCCESSFUL', 'PENDING', 'REJECTED', etc.See the webhooks guide for full payload details and retry policy.
For embedding card payment fields directly in your checkout, create a session and pass it to the MontonioCheckout JS SDK:
$session = $client->sessions()->createSession();
$sessionUuid = $session['uuid']; // Pass to frontend JS SDKFor 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 for the full flow.
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'];This library is made available under the MIT License (MIT). Please see License File for more information.