PHP code example of smlnordic / kupongsupport-api

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

    

smlnordic / kupongsupport-api example snippets


return [
    'token' => env('KS_API_TOKEN'),
    'base_url' => env('KS_BASE_URL', 'https://kupongsupport.se'),

    'templates' => [
        'print' => env('KS_PRINT_TEMPLATE_ID'),
        'mobile' => env('KS_MOBILE_TEMPLATE_ID'),
    ],
];

$options = [
    'template' => XXXX, // Template ID in Kupongsupport
    'type' => 'mobile', // "print" or "mobile
    'delivery_type' => 'sms', // "sms", "email" or "api"
    'amount' => 10,
    'valid_days' => 90,
];
$kupongsupport = new SMLNordic\KSApi();
$coupon = $kupongsupport->createCoupon($options);
bash
php artisan ks-api-init
bash
php artisan vendor:publish --provider="SMLNordic\KSApi\KSApiServiceProvider" --tag="kupongsupport-api-config"