Download the PHP package gizemsever/laravel-paytr without Composer

On this page you can find all versions of the php package gizemsever/laravel-paytr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-paytr

Laravel Paytr

This package has been developed only for the Paytr Iframe API service.

How to install?

composer require gizemsever/laravel-paytr

Publish provider

php artisan vendor:publish --provider="Gizemsever\LaravelPaytr\PaytrServiceProvider"

Setup your environment

PAYTR_MERCHANT_ID=''  
PAYTR_MERCHANT_SALT=''  
PAYTR_MERCHANT_KEY=''  
PAYTR_SUCCESS_URL='https://your-domain/success-payment'  
PAYTR_FAIL_URL='https://your-domain/fail-payment'  
PAYTR_TEST_MODE=true

NOTE: PAYTR_SUCCESS_URL and PAYTR_FAIL_URL are the frontend URLs that will be redirected after the payment screen. They are not addresses where payment will be verified.

Create your product basket

<?php 

$products = [
    [
        'Product Name',
        14.5, // Product Price
        5 // Quantity
    ]
];
$basket = \Paytr::basket()->addProducts($products);

Create Payment Request

<?php 
    use Gizemsever\LaravelPaytr\Payment\Currency;

    $payment = \Paytr::payment()  
        ->setCurrency(Currency::TRY)  
        ->setUserPhone($phone)  
        ->setUserAddress($address)  
        ->setNoInstallment(1)  
        ->setMaxInstallment(1)  
        ->setEmail($email)  
        ->setMerchantOid($oid) // Payment id generated by you 
        ->setUserIp($ipAddress)  
        ->setPaymentAmount($paymentAmount)  // Total payment amount
        ->setUserName($name)  
        ->setBasket($basket);  

    $paymentRequest = \Paytr::createPayment($payment);
    if($paymentRequest->isSuccess()) {
        $token = $paymentRequest->getToken();
        // If the payment request has been successfully created, 
        // you can view the iframe using the token.
        // Iframe URL: 'https://www.paytr.com/odeme/guvenli/'. $token
    }

Verify Payment

You must set the Callback Url, where the result of the payment transaction will be notified to you, on the Paytr Panel. 

You should add this endpoint as route

Route::post('paytr/payment-check', [PaytrController::class, 'checkPayment']);

And check payment

<?php 
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class PaytrController extends Controller  
{  
    public function checkPayment(Request $request)  
    {
        $verification = \Paytr::paymentVerification($request);  
        if (!$verification->verifyRequest()) {  
            // Throw unauthorized  
        }

        $oid = $verification->getMerchantOid(); // Payment id generated by you 
        $isSuccess = $verification->isSuccess(); // Is the payment status successful?
        // ... 
    }
}

All versions of laravel-paytr with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0|^8.1
guzzlehttp/guzzle Version ^7.0.1
illuminate/collections Version ^8|^9|^10
illuminate/support Version ^8.0|^9.0|^10.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package gizemsever/laravel-paytr contains the following files

Loading the files please wait ....