PHPackages                             pckg/payment - 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. pckg/payment

ActiveLibrary[Payment Processing](/categories/payments)

pckg/payment
============

Full implementation of payment libraries like braintree, paypal, ideal and others

23.3k[2 PRs](https://github.com/pckg/payment/pulls)PHPCI failing

Since Apr 22Pushed 1y ago2 watchersCompare

[ Source](https://github.com/pckg/payment)[ Packagist](https://packagist.org/packages/pckg/payment)[ RSS](/packages/pckg-payment/feed)WikiDiscussions next-8.0 Synced 2mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

About project
=============

[](#about-project)

[![Codacy Badge](https://camo.githubusercontent.com/cd32dd7c8a3657e283194ac9ba9b95ac36296546e692b183bf4cc7bfd9879dfe/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3862356332376134613333633466616461333131356139656337623137383732)](https://www.codacy.com/app/schtr4jh/payment?utm_source=github.com&utm_medium=referral&utm_content=pckg/payment&utm_campaign=badger)

[![Build status](https://github.com/pckg/payment/workflows/Pckg%20Payment%20CI/badge.svg)](https://github.com/pckg/payment/workflows/Pckg%20Payment%20CI/badge.svg)

Project provides abstract implementation for payment providers:

- paypal (classic API, REST API)
- paymill (credit cards, sepa, paypal)
- icepay (credit cards, bancontact, eps, giropay, ideal, sofort)
- braintree
- axcess
- valu
- proforma / upn

Currently waiting for implementation:

- paywiser
- activa
- megapos

Instalation
===========

[](#instalation)

You can install package via composer.

```
$ composer require schtr4jh/payment
```

Paymill
-------

[](#paymill)

### Credit cards

[](#credit-cards)

```
'enabled'     => true,
'private_key' => env('PAYMILL_PRIVATE_KEY'),
'public_key'  => env('PAYMILL_PUBLIC_KEY'),
```

### Paypal

[](#paypal)

```
'enabled'     => true,
'private_key' => env('PAYMILL_PRIVATE_KEY'),
'public_key'  => env('PAYMILL_PUBLIC_KEY'),
'url_return'  => 'payment.success',
'url_cancel'  => 'payment.error',
```

### Sepa

[](#sepa)

```
'enabled'     => true,
'private_key' => env('PAYMILL_PRIVATE_KEY'),
'public_key'  => env('PAYMILL_PUBLIC_KEY'),
```

Paypal
------

[](#paypal-1)

### Classic API

[](#classic-api)

```
'enabled'    => true,
'username'   => 'schtr4jh-facilitator_api1.schtr4jh.net',
'password'   => '1390585136',
'signature'  => 'AOZR6pqlRlwo0Ex9.oQbP2uvOalsAHQdlhdfczB0.B699lqJXv8pigFj',
'url'        => 'https://api-3t.sandbox.paypal.com/nvp',
'url_token'  => 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=[token]',
'url_return' => 'payment.success',
'url_cancel' => 'payment.error',
```

### REST API

[](#rest-api)

```
'enabled'    => false,
'id'         => 'AYlzupNqmg7177ZI57MfI26mgkzN-n8QQewuicaHmi7OOEf5LNy5FIi7ooFIbwo-t9_LQR9NOqtLslF_',
'secret'     => 'ECQLZ6zyH8b6JgG3hGN8Qg1u6ezDiT0HpfCK7MnKcQyyQoYtghnAndYJLu5p1g0UJmLMj7_IV1Qdbsv3',
'mode'       => 'sandbox',
'url_return' => 'payment.success',
'url_cancel' => 'payment.error',
'log'        => [
    'enabled' => true,
    'level'   => 'DEBUG', // 'FINE' for production
],
```

Proforma
--------

[](#proforma)

### Config

[](#config)

```
'enabled'     => false,
'url_waiting' => 'payment.waiting',
```

Implementation
==============

[](#implementation)

Each project needs to have implemented \\Pckg\\Payment\\Adapter\\Order|Product|Customer|Log|Environment (called ProjectOrder, ProjectProduct, ProjectCustomer and ProductLog) which provides proper mappers. For usage in Laravel project you can simply use Pckg\\Payment\\Service\\LaravelPayment trait which creates payment service with Laravel environment for handling request, responses, url generation and redirects. For usage in other project simply implement Payment\\Adapter\\Environment.

Routes
------

[](#routes)

```
// list payments
'payment'          => route('PaymentController@payment', 'payment/{listing}', 'GET'),

// apply promo code
'payment.promo'    => route('PaymentController@promo', 'payment/{handler}/{listing}/promo', 'POST'),

// validate payment request
'payment.validate' => route('PaymentController@validate', 'payment/{handler}/{listing}/validate', 'POST'),

// start payment process
'payment.start'    => route('PaymentController@start', 'payment/{handler}/{listing}/start', 'POST|GET'),

// payment valid
'payment.success'  => route('PaymentController@success', 'payment/{handler}/{listing}/success', 'GET'),

// payment invalid
'payment.error'    => route('PaymentController@error', 'payment/{handler}/{listing}/error', 'GET'),

// payment not processed yet
'payment.waiting'  => route('PaymentController@waiting', 'payment/{handler}/{listing}/waiting', 'GET'),
```

Controller
----------

[](#controller)

Example of full Laravel implementation

```
