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

ActiveLibrary[Payment Processing](/categories/payments)

paytrail/paytrail-php-sdk
=========================

PHP Software Development Kit for Paytrail payment service

2.8.1(2d ago)11485.5k↓37.4%15[2 PRs](https://github.com/paytrail/paytrail-php-sdk/pulls)3MITPHPPHP &gt;=7.3CI passing

Since Oct 8Pushed 4mo ago6 watchersCompare

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

READMEChangelog (10)Dependencies (21)Versions (35)Used By (3)

Paytrail PHP-SDK
================

[](#paytrail-php-sdk)

PHP Software Development Kit for [Paytrail](https://www.paytrail.com) payment service

Paytrail Payment Service
------------------------

[](#paytrail-payment-service)

Paytrail is a payment gateway that offers 20+ payment methods for Finnish customers.

The payment gateway provides all the popular payment methods with one simple integration. The provided payment methods include, but are not limited to, credit cards, online banking and mobile payments.

To use the payment service, you need to sign up for a Paytrail account. Transaction fees will be charged for every transaction. Transaction cost may vary from merchant to merchant, based on what is agreed upon with Paytrail when negotiating your contract. For more information and registration, please visit our [website](https://www.paytrail.com) or contact  directly.

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

[](#requirements)

### General requirements

[](#general-requirements)

- PHP version &gt;= 7.3
- ext-curl PHP cURL extension
- ext-json PHP JSON extension

### Development requirements

[](#development-requirements)

- [PHPUnit](https://github.com/sebastianbergmann/phpunit) - A programmer-oriented testing framework for running unit tests in PHP.
- [Guzzle](https://github.com/guzzle/guzzle) 7 or 6 - PHP HTTP client for performing HTTP request.

### Guzzle

[](#guzzle)

PHP-SDK will use Guzzle 6 or 7, if in present application, otherwise it will fall back to cURL. Guzzle is still used as dev dependency to make testing easier.

Using Guzzle is recommended on applications using PHP-SDK.

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

[](#installation)

Install with Composer:

```
composer require paytrail/paytrail-php-sdk

```

The package uses PSR-4 autoloader. Activate autoloading by requiring the Composer autoloader:

```
require 'vendor/autoload.php';

```

*Note the path to the vendor directory is relative to your project.*

Folder contents &amp; descriptions
----------------------------------

[](#folder-contents--descriptions)

Folder/FileContent/DescriptionexamplesExamplessrc/ExceptionException classes and functionssrc/InterfacesInterface classes and functions for all the related classes to implementsrc/ModelModel classes and functionssrc/RequestRequest classes and functionssrc/ResponseResponse classes and functionssrc/UtilUtility/trait classes and functionssrc/Client.phpClient class and functionstests/unitPHP unit testsBasic functionalities
---------------------

[](#basic-functionalities)

The Paytrail PHP-SDK supports most of the functionalities of the [Paytrail Payment API](https://paytrail.github.io/api-documentation/#/).

Some of the key features are:

### Payments and refunds

[](#payments-and-refunds)

- [Creating payment request](https://paytrail.github.io/api-documentation/#/?id=create)
- [Creating payment status request](https://paytrail.github.io/api-documentation/#/?id=get)
- [Creating refund request](https://paytrail.github.io/api-documentation/#/?id=refund)

### Tokenized credit cards and payments

[](#tokenized-credit-cards-and-payments)

- [Creating Add card form request](https://paytrail.github.io/api-documentation/#/?id=adding-tokenizing-cards)
- [Creating Get token request](https://paytrail.github.io/api-documentation/#/?id=get-token)
- [Creating Customer Initiated Transactions (CIT) or Merchant Initiated Transactions (MIT)](https://checkoutfinland.github.io/psp-api/#/?id=charging-a-token)

### Shop-in-Shop

[](#shop-in-shop)

- Creating Shop-in-Shop payment request

### Settlements

[](#settlements)

- [Requesting merchant settlements](https://docs.paytrail.com/#/?id=settlements)

### Reports

[](#reports)

- [Request payment report](https://docs.paytrail.com/#/?id=payment-report-request)

Methods
-------

[](#methods)

List of `Client::class` methods

MethodDescriptiongetPaymentProviders()Get a list of payment providersgetGroupedPaymentProviders()Returns an array of grouped payment providers fieldscreatePayment()Create paymentcreateShopInShopPayment()Create SiS paymentgetPaymentStatus()Request payment statusrefund()Create refundemailRefund()Create email refundcreateAddCardFormRequest()Save card detailscreateGetTokenRequest()Request card tokencreateCitPaymentCharge()Create CiT paymentcreateCitPaymentAuthorizationHold()Create CiT authorization holdcreateCitPaymentCommit()Commit CiT authorization holdcreateMitPaymentCharge()Create MiT paymentcreateMitPaymentAuthorizationHold()Create MiT authorization holdcreateMitPaymentCommit()Commit MiT authorization holdrevertPaymentAuthorizationHold()Revert existing Mit or CiT authorization holdactivateInvoice()Activate pending invoice (Walley / Klarna)cancelInvoice()Cancel pending invoice (Currently only Klarna)getSettlements() \[Deprecated\]Deprecated Request settlementsrequestSettlements()Request settlementsrequestPaymentReport()Request payment reportrequestPaymentReportBySettlement()Request payment report by settlement IDcreatePaymentAndAddCard()Create payment and save card details---

***Disclaimer:*** *This open source project is made available to assist coders in getting started with our API. However, we do not provide any warranty or guarantee that the code will work as intended and offer limited support for it. Use at your own risk.*

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance87

Actively maintained with recent releases

Popularity47

Moderate usage in the ecosystem

Community33

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~72 days

Recently: every ~128 days

Total

25

Last Release

2d ago

Major Versions

1.1.0 → 2.0.02022-05-20

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/92095698?v=4)[Juho-Pekka Vuorela](/maintainers/VuorelaJ-P)[@VuorelaJ-P](https://github.com/VuorelaJ-P)

![](https://www.gravatar.com/avatar/4cf08522f5fee9430e0286956ae8252c185fe8f8c5d66a42f622dca111df9657?d=identicon)[loueranta-paytrail](/maintainers/loueranta-paytrail)

---

Top Contributors

[![loueranta-paytrail](https://avatars.githubusercontent.com/u/93136005?v=4)](https://github.com/loueranta-paytrail "loueranta-paytrail (129 commits)")[![VuorelaJ-P](https://avatars.githubusercontent.com/u/92095698?v=4)](https://github.com/VuorelaJ-P "VuorelaJ-P (77 commits)")[![mpesari](https://avatars.githubusercontent.com/u/11061725?v=4)](https://github.com/mpesari "mpesari (27 commits)")[![kotivuori](https://avatars.githubusercontent.com/u/111269748?v=4)](https://github.com/kotivuori "kotivuori (16 commits)")[![bartoszkaluzny-solteq](https://avatars.githubusercontent.com/u/85225665?v=4)](https://github.com/bartoszkaluzny-solteq "bartoszkaluzny-solteq (15 commits)")[![Saggre](https://avatars.githubusercontent.com/u/13721842?v=4)](https://github.com/Saggre "Saggre (14 commits)")[![PanuKar](https://avatars.githubusercontent.com/u/114216464?v=4)](https://github.com/PanuKar "PanuKar (7 commits)")[![konrad-konieczny](https://avatars.githubusercontent.com/u/51909244?v=4)](https://github.com/konrad-konieczny "konrad-konieczny (6 commits)")[![joel-maizonnier](https://avatars.githubusercontent.com/u/97093492?v=4)](https://github.com/joel-maizonnier "joel-maizonnier (6 commits)")[![paytrail-max](https://avatars.githubusercontent.com/u/210703070?v=4)](https://github.com/paytrail-max "paytrail-max (3 commits)")[![MarkusPoutanen](https://avatars.githubusercontent.com/u/25428918?v=4)](https://github.com/MarkusPoutanen "MarkusPoutanen (1 commits)")[![eerohakio](https://avatars.githubusercontent.com/u/31061105?v=4)](https://github.com/eerohakio "eerohakio (1 commits)")[![Kimitri](https://avatars.githubusercontent.com/u/445639?v=4)](https://github.com/Kimitri "Kimitri (1 commits)")[![asiksami](https://avatars.githubusercontent.com/u/105490492?v=4)](https://github.com/asiksami "asiksami (1 commits)")[![OttiaDevsPT](https://avatars.githubusercontent.com/u/112936539?v=4)](https://github.com/OttiaDevsPT "OttiaDevsPT (1 commits)")[![Taiteilija](https://avatars.githubusercontent.com/u/5556102?v=4)](https://github.com/Taiteilija "Taiteilija (1 commits)")[![tommi-martin](https://avatars.githubusercontent.com/u/5362449?v=4)](https://github.com/tommi-martin "tommi-martin (1 commits)")

---

Tags

paytrailphpsdkpayment service providerpaytrail

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[msilabs/bkash

bKash Payment Gateway API for Laravel Framework.

181.2k](/packages/msilabs-bkash)

PHPackages © 2026

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