PHP code example of muhanz / shoapi

1. Go to this page and download the library: Download muhanz/shoapi library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

muhanz / shoapi example snippets

bash
php artisan vendor:publish --provider="Muhanz\Shoapi\ShoapiServiceProvider" --tag="shoapi.config"
bash
return Shoapi::call('shop')->access('cancel_auth_partner')->redirect();
bash
// After authorization, the front-end page will redirect to the redirect URL in your authorization link:
// https://open.shopee.com/?code=xxxxxxxxxx&shop_id=xxxxxx

$params =  [
	'code'  =>  "54494572544875766********", 
	'shop_id'  =>  (int)  000000,
];

$response = Shoapi::call('auth')
		->access('get_access_token')
		->shop(000000)
		->request($params)
		->response();
				
dd($response);
bash
$params =  [
	'refresh_token'  =>  "527a424f54494572544875766*******",
	'shop_id'  =>  (int)  000000,
];

$response =  Shoapi::call('auth')
		->access('refresh_access_token')
		->shop(000000)
		->request($params)
		->response();

dd($response);
bash
// Add this facades on top controller
use Muhanz\Shoapi\Facades\Shoapi;

public  function  get_category()
{

	$params =  [
		'language'  =>  'id'  // en
	];

	$response = Shoapi::call('product')
			->access('get_category',  <YOUR_ACCESS_TOKEN>)
			->shop(<YOUR_SHOP_ID>)
			->request($params)
			->response();
	dd($response);
}