PHP code example of midwesterninteractive / laravel-sagepayments

1. Go to this page and download the library: Download midwesterninteractive/laravel-sagepayments 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/ */

    

midwesterninteractive / laravel-sagepayments example snippets


'providers' => [
    // ...
    MidwesternInteractive\Laravel\SagePaymentsServiceProvider::class,
],

use MidwesternInteractive\Laravel\SagePayments;

$data = [
    'retail' => [
        'amounts' => [
            'total' => 100
        ],
        'billing' => [
            'name' => 'John Smith',
            'address' => '123 Address Ave',
            'city' => 'City',
            'state' => 'ST',
            'postalCode' => '12345',
            'country' => 'US'
        ],
        'cardData' => [
            'number' => '5454545454545454',
            'expiration' => '0920',
            'cvv' => '987'
        ]
    ]
];
$type = 'Sale';

$response = SagePayments::create($data, $type);

$data = [
    'pageSize' => '20'
];

$response = SagePayments::charges($data);

// Charge ID
$reference = '[charge-reference-id]';

$response = SagePayments::details($reference);