Mollie API Client for PHP

The official PHP client for the Mollie payments API, covering payments, refunds, subscriptions, and webhooks.

SDK
Composer
vv4.0.0-beta.1
604stars
BSD-2-Clause

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
81/100Excellent
Development Activity76
Maintenance80
Community88
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
82/100Excellent
Architecture86
Code Quality88
Innovation80
Learning Curve72

The Mollie API client for PHP is the official SDK for integrating Mollie’s payment platform into PHP applications. It lets you accept a wide range of European and global payment methods, including iDEAL, credit card, PayPal, Apple Pay, Bancontact, Klarna, and SEPA transfers, without dealing with the raw HTTP API directly.

The library exposes a fluent MollieApiClient with resource repositories for payments, refunds, customers, subscriptions, mandates, orders, and more. It handles authentication via API keys or OAuth access tokens, request idempotency, and webhook signature handling, so you can focus on your checkout and billing flows rather than transport details.

What You Get

  • A MollieApiClient with repositories for payments, refunds, customers, subscriptions, mandates, and orders
  • Support for API-key and OAuth access-token authentication with automatic detection
  • Typed resource objects with helper methods (isPaid, canBeRefunded, getCheckoutUrl, and more)
  • Idempotency-key support to safely retry create requests without duplicate charges
  • Webhook and payment-status handling for reconciling asynchronous payment updates

Common Use Cases

  • Creating a payment and redirecting the customer to Mollie’s hosted checkout
  • Handling webhook callbacks to update order status when a payment is completed
  • Managing recurring subscriptions and SEPA direct-debit mandates for customers
  • Issuing full or partial refunds against existing payments

Under The Hood

Architecture - The library centers on MollieApiClient (src/), which composes EndpointCollection repositories and Resources that map one-to-one to Mollie REST resources. An Http layer abstracts the transport (cURL by default) behind contracts, Factories build request payloads, and an Idempotency module injects keys so retried creates are safe. Webhooks and Traits provide reconciliation and shared behavior, keeping resource classes thin.

Tech Stack - Targets PHP 7.4+ and is distributed as mollie/mollie-api-php. It uses cURL and an up-to-date OpenSSL/TLS stack for transport, with the code organized under PSR-4 autoloading. Development tooling includes PHPUnit for tests and PHPStan (with a baseline) for static analysis.

Code Quality - The codebase is well-structured with clear separation between Repositories, Resources, Http, Factories, and Types, and it carries a substantial test suite (270+ test files) plus a Fake test double for offline testing. PHPStan static analysis and an enforced code style keep the surface consistent and maintainable.

API Design - The public API is ergonomic and discoverable: instantiate MollieApiClient, call setToken(), then use fluent repositories like payments->create() that return typed resource objects with helper methods (isPaid, getCheckoutUrl). Credential handling auto-detects API keys versus OAuth tokens, minimizing setup boilerplate for common integrations.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search