PHP code example of ranium / laravel-adyen

1. Go to this page and download the library: Download ranium/laravel-adyen library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ranium / laravel-adyen example snippets


$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());
}
sh
php artisan vendor:publish --provider="Ranium\LaravelAdyen\AdyenServiceProvider"