GithubHelp home page GithubHelp logo

shockwavemk / laravel-paymill Goto Github PK

View Code? Open in Web Editor NEW

This project forked from threesquared/laravel-paymill

0.0 2.0 0.0 24 KB

Laravel wrapper for the Paymill API

License: MIT License

PHP 100.00%

laravel-paymill's Introduction

Laravel Paymill

Build Status Latest Stable Version Packagist Packagist

Laravel Paymill is a Laravel 5 specific wrapper for the Paymill PHP library.

Please use the 1.0.0 release for Laravel 4

Install

Simply add the following line to your composer.json and run install/update:

"threesquared/laravel-paymill": "~1.3"

Configuration

Publish the package config files to configure your api keys:

php artisan vendor:publish

You will also need to add the service provider and the facade alias to your config/app.php:

'providers' => array(
  Threesquared\LaravelPaymill\LaravelPaymillServiceProvider::class
)

'aliases' => array(
  'Paymill'   => Threesquared\LaravelPaymill\Facades\Paymill::class
),

By default the package will use your test keys. In order to use the live Paymill keys you need to set the PAYMILL_ENV enviroment variable.

PAYMILL_ENV=live

Usage

Please see the Paymill API for full documentation on all available entities, actions and methods.

First start with instantiating the Paymill entity you want to work with.

$transaction = Paymill::Transaction();

Available entities are:

Then add in any additional information the request requires with setter methods.

$transaction->setAmount(4200)
    ->setCurrency('EUR')
    ->setPayment('pay_2f82a672574647cd911d')
    ->setDescription('Test Transaction');

Finally chose which action you want to perform.

$transaction->create();

Available actions are:

  • create()
  • details()
  • update()
  • all()
  • delete()

So an example to create a transaction would be:

try {

    Paymill::Transaction()
        ->setAmount(4200)
        ->setCurrency('EUR')
        ->setPayment('pay_2f82a672574647cd911d')
        ->setDescription('Test Transaction')
        ->create();

} catch(PaymillException $e) {

    $e->getResponseCode();
    $e->getStatusCode();
    $e->getErrorMessage();

}

You can set the ID of an entity by passing it as an argument.

Paymill::Client('client_8127a65bf3c84676c918')->details();

Payment create can also take the token as an argument.

Paymill::Payment()->create('098f6bcd4621d373cade4e832627b4f6');

You can also use the $paymill_public_key variable across all blade views.

<script type="text/javascript">
  var PAYMILL_PUBLIC_KEY = '{{ $paymill_public_key }}';
</script>

laravel-paymill's People

Contributors

christianheidorn avatar threesquared avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.