This package is abandoned and no longer maintained. No replacement package was suggested.

Simplified Payments of many Providers

1.4 2020-11-14 06:37 UTC

This package is auto-updated.

Last update: 2023-01-14 11:23:06 UTC


README

Latest Version on Packagist Quality Score Total Downloads

Installation

You can install the package via composer:

composer require rene-roscher/paymix

Usage

php artisan vendor:publish --provider="RServices\PayMix\PaymixServiceProvider"
// Create Payment
use

$repo = \RServices\PayMix\PayMix::create('PAYPAL')->getRepository();
or
$repo = \paymix('PAYPAL');

/** @return PaymentRepositoryInterface */
$repo->createTransaction(\RServices\PayMix\Objects\TransactionData::make(14.99, 'Movie XY', \Illuminate\Support\Str::random(6)));
// redirect user to payment provider
$repo->getPaymentUri();
// Callback
/** @return string|PaymentResponseType */
$state = \RServices\PayMix\PayMix::create()->getRepository()->handleRequest(\request());

if ($state == \RServices\PayMix\Objects\PaymentResponseType::SUCCESSFULLY_PAID)
    return 'successfully paid the movie xy';

Configuration

[
    'paypal' => [
        'live' => [
            'client_id' => env('PAYMIX_PAYPAL_CLIENT_ID'),
            'client_secret' => env('PAYMIX_PAYPAL_CLIENT_SECRET'),
        ],
        'sandbox' => [
            'client_id' => env('PAYMIX_SANDBOX_PAYPAL_CLIENT_ID'),
            'client_secret' => env('PAYMIX_SANDBOX_PAYPAL_CLIENT_SECRET'),
        ],
        'config' => [
            'mode' => 'sandbox',
            'log.LogEnabled' => TRUE,
            'log.FileName' => storage_path('paypal.log'),
            'log.LogLevel' => 'FINE',
            'validation.level' => 'log',
            'cache.enabled' => TRUE,
            'cache.FileName' => storage_path('paypal-cache.log'),
        ],
        'redirect_urls' => [
			// Named-Route
            'return_url' => 'payment.paid.successfully',
            'cancel_url' => 'payment.paid.failured',
        ]
    ],
];

License

The MIT License (MIT). Please see License File for more information.