nikandlv/laravel-cafebazaar

Cafebazaar development api package

1.0 2019-10-08 22:16 UTC

This package is auto-updated.

Last update: 2024-11-10 12:22:48 UTC


README

Latest Version on Packagist Build Status Quality Score Total Downloads

Cafebazaar uses a non standard implementation of OAuth2.0, with this package you can use cafebazaar api without all of the headache that it brings.

Also Official Documents are not clear and not complete at all.

Requirements

  • Laravel 5.5 ~ 6.+

Installation

You can install the package via composer:

composer require nikandlv/laravel-cafebazaar

You have to publish the configuration

php artisan vendor:publish
# select [10] Provider: Nikandlv\LaravelCafebazaar\LaravelCafebazaarServiceProvider

Usage

Add a redirect route

<?php
// add a redirect route for example routes/api.php
Route::get('/iap/redirect', function(Illuminate\Http\Request $request) {
    Nikandlv\LaravelCafebazaar\LaravelCafebazaar::handleRedirect($request);
});

Open up Cafebazaar developer panel and create a new client with redirect url you specified

Configure config/laravel-cafebazaar.php

Then run

php artisan Cafebazaar code

Open up the link and authorize the application

<?php

namespace App\Http\Controllers;

use Nikandlv\LaravelCafebazaar\LaravelCafebazaar;

...

class MyController extends Controller {
    function check() {
        $cafebazaar = new LaravelCafebazaar();
        $purchase = $cafebazaar->verifyPurchase('ir.nikandlv.package_id', 'product_id', 'purchase_token');
        if($purchase->isValid()) {
            echo 'yay!';
        }
    }
}

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email nikandalvand@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.