PHP code example of combindma / yotpo-api

1. Go to this page and download the library: Download combindma/yotpo-api 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/ */

    

combindma / yotpo-api example snippets


return [
    /*
    * Enable or disable Yotpo api. Useful for local development when runing tests.
    */
    'api_enabled' => env('YOTPO_API_ENABLED', false),

    /*
   * Enable or disable Yotpo Loyalty. Useful for local development when runing tests.
   */
    'loyalty_enabled' => env('YOTPO_LOYALTY_ENABLED', false),

    /*
    * Core API V3 Credentials
    */
    'app_key' => env('YOTPO_APP_KEY'),
    'secret_key' => env('YOTPO_SECRET_KEY'),

    /*
    * Loyalty & Referrals API Credentials
    */
    'loyalty_api_key' => env('LOYALTY_API_KEY'),
    'loyalty_guid_key' => env('LOYALTY_GUID_KEY'),

    /*
     * CDNs
     * */
    'loyalty_js_sdk_url' => env('LOYALTY_JS_SDK_URL'),
    'loyalty_modules_loader_url' => env('LOYALTY_MODULES_LOADER_URL'),

    /*
     * Refer link used by Loyalty Program
     * */
    'refer_link' => 'http://rwrd.io',

    /*
     * Default currency code you want to use. Make sure to have the same in your Yotpo Loyalty admin: https://loyalty.yotpo.com/general-settings
     * */
    'currency' => env('YOTPO_DEFAULT_CURRENCY', 'MAD'),

    /*
    * Default country code you want to use. This is important for API requests when submitting the phone number
    * */
    'country' => env('YOTPO_DEFAULT_COUNTRY', 'MA')
];

use Combindma\YotpoApi\Facades\YotpoApi;

//yotpoApiData is implemented in Combindma\YotpoApi\Traits\YotpoCustomer. You can create yours.
YotpoApi::createOrUpdateLoyaltyCustomer($user->yotpoApiData());
bash
php artisan vendor:publish --provider="Combindma\YotpoApi\YotpoApiServiceProvider" --tag="yotpo-config"