Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Latest commit

 

History

History
444 lines (301 loc) · 12.1 KB

CouponsApi.md

File metadata and controls

444 lines (301 loc) · 12.1 KB

OpenAPI\Client\CouponsApi

All URIs are relative to https://api.getlago.com/api/v1, except if the operation defines another base path.

Method HTTP request Description
applyCoupon() POST /applied_coupons Apply a coupon to a customer
createCoupon() POST /coupons Create a new coupon
destroyCoupon() DELETE /coupons/{code} Delete a coupon
findAllAppliedCoupons() GET /applied_coupons Find Applied Coupons
findAllCoupons() GET /coupons Find Coupons
findCoupon() GET /coupons/{code} Find coupon by code
updateCoupon() PUT /coupons/{code} Update an existing coupon

applyCoupon()

applyCoupon($applied_coupon_input): \OpenAPI\Client\Model\AppliedCoupon

Apply a coupon to a customer

Apply a coupon to a customer

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new OpenAPI\Client\Api\CouponsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$applied_coupon_input = new \OpenAPI\Client\Model\AppliedCouponInput(); // \OpenAPI\Client\Model\AppliedCouponInput | Apply coupon payload

try {
    $result = $apiInstance->applyCoupon($applied_coupon_input);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CouponsApi->applyCoupon: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
applied_coupon_input \OpenAPI\Client\Model\AppliedCouponInput Apply coupon payload

Return type

\OpenAPI\Client\Model\AppliedCoupon

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

createCoupon()

createCoupon($coupon_input): \OpenAPI\Client\Model\Coupon

Create a new coupon

Create a new coupon

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new OpenAPI\Client\Api\CouponsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$coupon_input = new \OpenAPI\Client\Model\CouponInput(); // \OpenAPI\Client\Model\CouponInput | Coupon payload

try {
    $result = $apiInstance->createCoupon($coupon_input);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CouponsApi->createCoupon: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
coupon_input \OpenAPI\Client\Model\CouponInput Coupon payload

Return type

\OpenAPI\Client\Model\Coupon

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

destroyCoupon()

destroyCoupon($code): \OpenAPI\Client\Model\Coupon

Delete a coupon

Delete a coupon

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new OpenAPI\Client\Api\CouponsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$code = example_code; // string | Code of the existing coupon

try {
    $result = $apiInstance->destroyCoupon($code);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CouponsApi->destroyCoupon: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
code string Code of the existing coupon

Return type

\OpenAPI\Client\Model\Coupon

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

findAllAppliedCoupons()

findAllAppliedCoupons($page, $per_page, $status, $external_customer_id): \OpenAPI\Client\Model\AppliedCouponsPaginated

Find Applied Coupons

Find all applied coupons

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new OpenAPI\Client\Api\CouponsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$page = 2; // int | Number of page
$per_page = 20; // int | Number of records per page
$status = 'status_example'; // string | Applied coupon status
$external_customer_id = 12345; // string | External customer ID

try {
    $result = $apiInstance->findAllAppliedCoupons($page, $per_page, $status, $external_customer_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CouponsApi->findAllAppliedCoupons: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
page int Number of page [optional]
per_page int Number of records per page [optional]
status string Applied coupon status [optional]
external_customer_id string External customer ID [optional]

Return type

\OpenAPI\Client\Model\AppliedCouponsPaginated

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

findAllCoupons()

findAllCoupons($page, $per_page): \OpenAPI\Client\Model\CouponsPaginated

Find Coupons

Find all coupons in certain organisation

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new OpenAPI\Client\Api\CouponsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$page = 2; // int | Number of page
$per_page = 20; // int | Number of records per page

try {
    $result = $apiInstance->findAllCoupons($page, $per_page);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CouponsApi->findAllCoupons: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
page int Number of page [optional]
per_page int Number of records per page [optional]

Return type

\OpenAPI\Client\Model\CouponsPaginated

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

findCoupon()

findCoupon($code): \OpenAPI\Client\Model\Coupon

Find coupon by code

Return a single coupon

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new OpenAPI\Client\Api\CouponsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$code = example_code; // string | Code of the existing coupon

try {
    $result = $apiInstance->findCoupon($code);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CouponsApi->findCoupon: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
code string Code of the existing coupon

Return type

\OpenAPI\Client\Model\Coupon

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

updateCoupon()

updateCoupon($code, $coupon_input): \OpenAPI\Client\Model\Coupon

Update an existing coupon

Update an existing coupon by code

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new OpenAPI\Client\Api\CouponsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$code = example_code; // string | Code of the existing coupon
$coupon_input = new \OpenAPI\Client\Model\CouponInput(); // \OpenAPI\Client\Model\CouponInput | Update an existing coupon

try {
    $result = $apiInstance->updateCoupon($code, $coupon_input);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CouponsApi->updateCoupon: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
code string Code of the existing coupon
coupon_input \OpenAPI\Client\Model\CouponInput Update an existing coupon

Return type

\OpenAPI\Client\Model\Coupon

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]