smlnordic/kupongsupport-api

Integration with Kupongsupport API


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads Website

Installation

You can install the package via composer:

composer require smlnordic/kupongsupport-api

Init .env variables:

php artisan ks-api-init

You can publish the config file with:

php artisan vendor:publish --provider="SMLNordic\KSApi\KSApiServiceProvider" --tag="kupongsupport-api-config"

This is the contents of the published config file:

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'),
    ],
];

Usage

Create and send a coupon via SMS:

$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);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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