culturekings/laravel5-afterpay

This package is abandoned and no longer maintained. No replacement package was suggested.

Afterpay API integration exposed via Laravel5 services'

v2.1.1 2017-05-12 05:09 UTC

This package is not auto-updated.

Last update: 2023-01-07 09:40:04 UTC


README

This packages exposes services from CultureKings/Afterpay in Laravel5.

Coverage Status CircleCI Scrutinizer SensioLabsInsight

Version Compatibility

Laravel Laravel5 Afterpay
5.3.x @dev

Installation

The recommended way to install is via Composer.

composer require culturekings/laravel5-afterpay

Find the providers key in your config/app.php and register the Afterpay Service Provider

'providers' => array(
    // ...
    CultureKings\LaravelAfterpay\Provider\AfterpayProvider::class,
)

Configuration

Merchant API Configuration

By default, the package uses the following environment variables to auto-configure the plugin without modification:

AFTERPAY_API_URL (defaults to sandbox url)
AFTERPAY_MERCHANT_ID
AWS_AFTERPAY_SECRET_KEY

InStore API Configuration

AFTERPAY_INSTORE_API_URL (defaults to sandbox url)

To customize the configuration file, publish the package configuration using Artisan.

php artisan vendor:publish

Update your settings in the generated app/config/afterpay.php configuration file.

Usage

Merchant API Facades

This package exposes multiple facades for you to use.

Using the facades allows you not to worry about the Authorisation object that is required for calls.

Configuration

$api = \App::make('afterpay_merchant_configuration');
$api::get();

Payments

$api = \App::make('afterpay_merchant_payments');
$payments = $api::listPayments();

Orders

$api = \App::make('afterpay_merchant_orders');
$order = $api::get(ORDER_TOKEN);

InStore API Facades

This package exposes multiple facades for you to use.

Authentication is more manual with this API and it is required for you to manually set the details on \CultureKings\Afterpay\Model\InStore\Authorization.

Customer

$api = \App::make('afterpay_instore_customer');
$api::invite();

Device

$api = \App::make('afterpay_instore_device');
$api::activate();

Order

$api = \App::make('afterpay_instore_order');
$order = $api::create();

PreApproval

$api = \App::make('afterpay_instore_preapproval');
$order = $api::enquiry();

Refund

$api = \App::make('afterpay_instore_refund');
$order = $api::create();

Raw

read the documentation

Raw does away with the Facade and hits the services directly, giving you more flexibility. The trade off is that your now responsible for creating your own Authentication object and injecting it into the services. You can still ask Laravel to create you an Authentication object with your credentials loaded from config.

$auth = \App::make(CultureKings\Afterpay\Model\Merchant\Authorization::class);