Coder Social home page Coder Social logo

laravel-adyen's Introduction

Laravel Adyen

Description

A Laravel 5.4+ package/wrapper for Adyen API Library. Adyen is a leading payment processor supporting multiple channels of payment on a single platform.

Reference

This package is a wrapper for Adyen PHP API Library. For detailed usage and API reference, please read base library's documentation.

Installation

Install using composer:

composer require ranium/laravel-adyen

Configuration

After installation, publish the adyen config file:

php artisan vendor:publish --provider="Ranium\LaravelAdyen\AdyenServiceProvider"

The above command will create LARAVEL_ROOT/config/adyen.php configuration file.

NOTE: This package supports configuring multiple adyen merchant accounts. You can even define company wide settings which are then merged with merchant account specific settings when the package is instantiated. This is very useful for those companies which have some settings (like web service username and password) common across all their merchant accounts. They will only need to define such settings once which will be merged with merchant account settings. The config/adyen.php file is very well documented and please refer the same for the usage/configuration.

Basic Usage

This package is primarily used to instantiate the \Adyen\Client class. The Adyen client is then passed on to various services like Payments, Recurring, Refunds etc.

$request = [
    'additionalData' => [
        // Client side encrypted card data. See adyen documentation for more info.
        'card.encrypted.json' => 'adyenjs_0_1_19$tfnNpk+3IbAAFJ...',
    ],
    'amount' => [
        'value' => 1050,
        'currency' => 'GBP',
    ],
    // Unique reference. This will be your order number or something similar
    'reference' => 'test-' . time(),
    // Merchant account to use
    'merchantAccount' => config('adyen.accounts.default.merchantAccount'),
    'shopperEmail' => '[email protected]',
    'shopperIP' => '123.123.10.10',
];

// Make the adyen client
$client = App::make(\Adyen\Client::class);

// Instantiate the Payment service
$service = new \Adyen\Service\Payment($client);

try {
    $response = $service->authorise($request);
} catch (\Adyen\AdyenException $e) {
    // Handle the error message
    dd($e->getMessage());
}

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.