ok200team/ok200-client-laravel5

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

A client package for the OK200 Platform.

v1.1.4 2016-11-21 02:01 UTC

This package is auto-updated.

Last update: 2021-02-18 01:49:13 UTC


README

This is a Laravel package that allows apps to interact with the OK200 Platform (platform.ok200.net).
It only works if the APP_ENV env variable is set to 'production'.

Install The Package

Require the package using composer

composer require ok200team/ok200-client-laravel5

Add the Service Provider to config/app.php:

OK200Client\OK200ServiceProvider::class,

Publish the config

php artisan vendor:publish --provider="OK200Client\OK200ServiceProvider"

Add the following to your ENV file and give them correct values (OK200 Will give you these details):

OK200_API_TOKEN=
OK200_PRODUCT_ID=

To use an alternative API URL (say, staging), add the following to the .env file:

OK200_API_ENDPOINT

Using The Library

The library is built to make things as simple as possible. The OK200 platform requires a hashed email sent over, but the library functions will di this for you.

To register a signup, send the user object to the recordSignup method:

OK200Platform::recordSignup($user);

To register a login:

OK200Platform::recordLogin($user);

To register a sale, there are a couple more parameters.

Simplest implementation:

OK200Platform::recordSale($user); // Simplest, sale of $0

More advanced:

$amount   = 149.99;
$currency = 'USD';
$item     = 'Nike Air Max';
OK200Platform::recordSale($user, $amount, $currency, $item);