Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

PHP Laravel Service Provider for the Afterpay.com.au API - Unmaintained as of April 2021

License

Notifications You must be signed in to change notification settings

culturekings/laravel5-afterpay

Repository files navigation

Afterpay for Laravel 5

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);

About

PHP Laravel Service Provider for the Afterpay.com.au API - Unmaintained as of April 2021

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages