PHPackages                             marekvikartovsky/trustpay-php - 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. [API Development](/categories/api)
4. /
5. marekvikartovsky/trustpay-php

ActiveLibrary[API Development](/categories/api)

marekvikartovsky/trustpay-php
=============================

TrustPay - online card payments gate.

v1.1.4(8mo ago)012MITPHPPHP &gt;=8.1

Since Jun 22Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/MarekVikartovsky/trustpay-php)[ Packagist](https://packagist.org/packages/marekvikartovsky/trustpay-php)[ Docs](https://github.com/MarekVikartovsky/trustpay-php)[ RSS](/packages/marekvikartovsky-trustpay-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

TrustPay API PHP library
========================

[](#trustpay-api-php-library)

This library provides communication between client and TrustPay online cards payment gate.

Currently supported payment methods
===================================

[](#currently-supported-payment-methods)

- Card payment
- EPS
- Sofort
- Giropay
- SepaCreditTransfer

Requirements
============

[](#requirements)

- &gt;= PHP 8.1

Installation
============

[](#installation)

`composer require marekvikartovsky/trustpay-php`

Usage
=====

[](#usage)

### To create payment url you need to follow these steps.

[](#to-create-payment-url-you-need-to-follow-these-steps)

As first as you need to instantiate `\MarekVikartovsky\TrustPay\TrustPay` class and provide information such as `project id`, `private key`, `notification url`, `return urls` and `locale`.
`Cancel return URL`, `Error return URL` and `locale` do not need to be specified, they have predefined values.

```
$trustpay = new \MarekVikartovsky\TrustPay\TrustPay(
'PROJET_ID',
'PRIVATE_KEY',
'NOTIFICATION_URL'
'SUCCESS_RETURN_URL',
'CANCEL_RETURN_URL',
'ERROR_RETURN_URL',
'en'
);
```

After that, you need to call a `payment` method, which creates payment object for specific payment method. The payment method is set by `payment` function parameter.
Available payment methods:
`\MarekVikartovsky\TrustPay\PaymentMethods\CardPayment::PAYMENT_METHOD_NAME``\MarekVikartovsky\TrustPay\PaymentMethods\Eps::PAYMENT_METHOD_NAME``\MarekVikartovsky\TrustPay\PaymentMethods\Giropay::PAYMENT_METHOD_NAME``\MarekVikartovsky\TrustPay\PaymentMethods\Sofort::PAYMENT_METHOD_NAME``\MarekVikartovsky\TrustPay\PaymentMethods\SepaCreditTransfer::PAYMENT_METHOD_NAME`

If you want to use `\MarekVikartovsky\TrustPay\PaymentMethods\CardPayment` method type, you have to call `setPaymentType` method with `Purchase` value.

```
return $trustpay->payment(\MarekVikartovsky\TrustPay\PaymentMethods\CardPayment::PAYMENT_METHOD_NAME)
->setAmount((float) 10)
->setCurrency(\MarekVikartovsky\TrustPay\Enums\CurrencyEnum::EUR)
->setReference('MERCHANT_REFERENCE')
->setPaymentType('Purchase')
->getPaymentUrl();
```

If the payment gateway is not loaded inside an iframe. You have to call `allowRedirect` method on payment object.

```
return $trustpay->payment(\MarekVikartovsky\TrustPay\PaymentMethods\CardPayment::PAYMENT_METHOD_NAME)
->allowRedirect()
->getPaymentUrl();
```

### Notification handler

[](#notification-handler)

As first as you need to instantiate `\MarekVikartovsky\TrustPay\CallbackHandlers\NotificationHandler` class and pass into its constructor `private key` and `\Illuminate\Http\Request()` instance.

```
$notification = new \MarekVikartovsky\TrustPay\CallbackHandlers\NotificationHandler('XXXXX-PRIVATE-KEY-XXXXX', new \Illuminate\Http\Request())
```

After that you should check if signature is valid. You can do this by calling method `hasValidSignature()`. This method return boolean value.

```
if($notification->hasValidSignature()){
    // do something
}
```

Than you can check for specific payment status. There are few methods which can be used: `isPaid()`, `isRejected()`, `isChargeBacked()`, `isRapidDisputeResolution()` or if you want to get value from status attribute, you can use `getStatus()` method. These methods return boolean values.

```
if($notification->isPaid()){
    // do something
}
```

Documentation
=============

[](#documentation)

License
=======

[](#license)

The TrustPay API PHP library is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance58

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Every ~107 days

Total

5

Last Release

265d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/da07a34b5aa51105e00a6d3b40960a7d3561afd17b7f991c0326dcb6300fe5d8?d=identicon)[MarekVikartovsky](/maintainers/MarekVikartovsky)

---

Top Contributors

[![MarekVikartovsky](https://avatars.githubusercontent.com/u/62723172?v=4)](https://github.com/MarekVikartovsky "MarekVikartovsky (1 commits)")

---

Tags

phpapipaymentsonline paymentstrustpay

### Embed Badge

![Health badge](/badges/marekvikartovsky-trustpay-php/health.svg)

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

###  Alternatives

[resend/resend-laravel

Resend for Laravel

1191.4M6](/packages/resend-resend-laravel)[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.1M28](/packages/mollie-laravel-mollie)[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[dragon-code/laravel-json-response

Automatically always return a response in JSON format

1118.6k1](/packages/dragon-code-laravel-json-response)

PHPackages © 2026

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