devability/laravel-cafebazaar

Cafebazaar development api package

v1.0.1 2021-02-17 20:31 UTC

This package is auto-updated.

Last update: 2024-10-18 04:15:27 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 ~ 8.+

Installation

You can install the package via composer:

composer require devability/laravel-cafebazaar

You have to publish the configuration

php artisan vendor:publish
# select [10] Provider: Devability\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) {
    return \Devability\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 Devability\LaravelCafebazaar\LaravelCafebazaar;

...

class MyController extends Controller {
    function check() {
        $cafebazaar = new LaravelCafebazaar();
        $purchase = $cafebazaar->verifyPurchase('ir.devability.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.