PHPackages                             turown/laravel-paytr - 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. turown/laravel-paytr

ActiveLibrary[Payment Processing](/categories/payments)

turown/laravel-paytr
====================

PayTR integration for Laravel.

v1(3y ago)21791MITPHPPHP ^8.1.0

Since Apr 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/alirizaoztetik/paytr-laravel)[ Packagist](https://packagist.org/packages/turown/laravel-paytr)[ RSS](/packages/turown-laravel-paytr/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Licence
-------

[](#licence)

[![MIT License](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](https://choosealicense.com/licenses/mit/)

Description
-----------

[](#description)

PayTR integration for Laravel.
This package is under development, first version only supports iFame payment screen.

Thanks in advance for your contribution.

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

[](#installation)

`composer require turown/laravel-paytr`

Publish configuration and assets

`php artisan vendor:publish --tag="paytr"`

Usage
-----

[](#usage)

To run this project you will need to add the following environment variables to your .env file

```
PAYTR_MERCANT_ID
PAYTR_MERCANT_KEY
PAYTR_MERCANT_SALT
PAYTR_API_URL
PAYTR_OK_URL
PAYTR_FAIL_URL

```

#### Configs

[](#configs)

You can change or get the necessary settings in the [config](https://github.com/alirizaoztetik/paytr-laravel/blob/v1/config/paytr.php) file. This file is important

`use PayTR\Config;`

You can easily access it with the help of it, you can perform operations as in the example.

The example below is the config that needs to be set for simple api triggering.

```
$config = new Config();
$config->setMerchantId(00000)
       ->setMerchantKey("XXXXX")
       ->setMerchantSalt("XXXX")
       ->setApiType(2) // iFrame Type
       ->setApiUrl(ENV('PAYTR_API_URL') . 'odeme/api/get-token');
```

Next, we define the required array variable to generate the HASH DATA.

```
 $hash_data = [
        "merchant_id"       => $config->getMerchantId(),
        "user_ip"           => request()->ip(),
        "merchant_oid"      => 1002945, //must be unique
        "email"             => "ali.riza.oztetik@gmail.com",
        "payment_amount"    => 999, //9.99 TL|EUR|USD vs. for 999;
        "user_basket"       => json_encode([
            ["Test Product", "9.99", 1] //(Product Name - Unit Price - Quantity)
        ]),
        "no_installment"    => $config->getNoInstallment(),
        "max_installment"   => $config->getMaxInstallment(),
        "currency"          => $config->getCurrency(),
        "test_mode"         => $config->getTestMode()
    ];
```

And we set the post data array and trigger the necessary

```
 $post_data = [
        'user_name'         => "Ali Rıza Öztetik",
        'user_address'      => "test",
        'user_phone'        => "901111111111", //Need [+][country code][area code][phone number]
        'paytr_token'       => $paytr->setHashStr($hash_data)->getToken()->token,
        'debug_on'          => $config->getDebugOn(),
        'merchant_ok_url'   => $config->getMerchantOkUrl(),
        'merchant_fail_url' => $config->getMerchantFailUrl(),
        'timeout_limit'     => $config->getTimeoutLimit()
    ];

 $post_data = array_merge($post_data, $hash_data); //Absolutely 2 array data must be combined.
```

Then you can activate the PayTR class and operate with the call method.

`use PayTR\Paytr;`

```
$trigger = $paytr->call($post_data, $config->getApiUrl());
```

Using iFrame will return you success and a token after the transaction. In addition, I have included the necessary javascript codes for you.

```
{
  +"status": "success"
  +"token": "090aab565210f757db0d9948ed4f58c8723a9f1de3beac1f651a90cdf9b2f678-324703229"
  +"javascript_file_url": "https://www.paytr.com/js/iframeResizer.min.js"
  +"iframe_code": ""
  +"script": "iFrameResize({},'#paytriframe');"
}
```

By including the script with the **"javascript\_file\_url"** in the return, you can print the **"iframe\_code"** code wherever you want. Don't forget to include the **"script"** variable as well.

It's actually that simple!

A payment screen will then appear on your screen. After the transaction made on this screen, the API will return to you, all your successful or unsuccessful returns are specified in the settings;

`'merchant_ok_url' => $config->getMerchantOkUrl()`
`'merchant_fail_url' => $config->getMerchantFailUrl()`

This is why these settings are very important.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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

Unknown

Total

1

Last Release

1120d ago

### Community

Maintainers

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

---

Top Contributors

[![alirizaoztetik](https://avatars.githubusercontent.com/u/49926866?v=4)](https://github.com/alirizaoztetik "alirizaoztetik (6 commits)")[![bulentsakarya](https://avatars.githubusercontent.com/u/1279934?v=4)](https://github.com/bulentsakarya "bulentsakarya (1 commits)")

---

Tags

laravelpaytr

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/turown-laravel-paytr/health.svg)

```
[![Health](https://phpackages.com/badges/turown-laravel-paytr/health.svg)](https://phpackages.com/packages/turown-laravel-paytr)
```

###  Alternatives

[laravel/ui

Laravel UI utilities and presets.

2.7k134.9M601](/packages/laravel-ui)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

71510.9M66](/packages/laravel-mcp)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)[amsgames/laravel-shop

Package set to provide shop or e-commerce functionality (such as CART, ORDERS, TRANSACTIONS and ITEMS) to Laravel for customizable builds.

4845.9k](/packages/amsgames-laravel-shop)[lanos/laravel-cashier-stripe-connect

Adds Stripe Connect functionality to Laravel's main billing package, Cashier.

84138.9k](/packages/lanos-laravel-cashier-stripe-connect)[021/laravel-wallet

Reliable and flexible wallet system for Laravel

2785.2k](/packages/021-laravel-wallet)

PHPackages © 2026

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