PHP SDK for working with basic Sage Payment Bankcard methods.
For more information visit Sage Payments
$ composer require midwesterninteractive/laravel-sagepayments
$ php artisan vendor:publish --tag=config
You may modify the config file that is published config/sagepayments.php
and provide the default options or add the following to your .env
file:
# Merchant/Client
SAGE_MERCH_ID=[sage-client-id]
SAGE_MERCH_KEY=[sage-client-key]
# Sage App
SAGE_APP_ID=[sage-app-id]
SAGE_APP_KEY=[sage-app-key]
You'll need to get the Sage Merch creds from your client or login to your Sage Portal. You may also request that Sage set up a test client for development.
For your Sage App creds you'll need to login to your developer account and grab them from your exisiting application or create a new one.
If you're on laravel 5.5 the service provider will be automatially loaded, if not, add to your config/app.php
providers
'providers' => [
// ...
MidwesternInteractive\Laravel\SagePaymentsServiceProvider::class,
],
Use in class
use MidwesternInteractive\Laravel\SagePayments;
Utilizes post_charges
for more information on available parameters visit the documentation
$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);
Utilizes get_charges
for more information on available parameters visit the documentation
$data = [
'pageSize' => '20'
];
$response = SagePayments::charges($data);
Utilizes get_charges_detail
for more information on available parameters visit the documentation
// Charge ID
$reference = '[charge-reference-id]';
$response = SagePayments::details($reference);