Skip to content

Latest commit

 

History

History
398 lines (275 loc) · 12.4 KB

CouponApi.md

File metadata and controls

398 lines (275 loc) · 12.4 KB

Reepay\CouponApi

All URIs are relative to https://api.reepay.com

Method HTTP request Description
createCoupon POST /v1/coupon Create coupon
deleteCoupon DELETE /v1/coupon/{handle} Delete coupon
expireCoupon POST /v1/coupon/{handle}/expire Expire coupon
getCoupon GET /v1/coupon/{handle} Get coupon
getCoupons GET /v1/coupon Get list of coupons
updateCoupon PUT /v1/coupon/{handle} Update coupon
validateCode GET /v1/coupon/code/validate Validate coupon

createCoupon

\Reepay\Model\Coupon createCoupon($body)

Create coupon

Example

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

// Configure API key authorization: apiKey
Reepay\Configuration::getDefaultConfiguration()->setApiKey('X-Auth-Token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Reepay\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Auth-Token', 'Bearer');
// Configure HTTP basic authorization: basicAuth
Reepay\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
Reepay\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');

$apiInstance = new Reepay\Api\CouponApi();
$body = new \Reepay\Model\CreateCoupon(); // \Reepay\Model\CreateCoupon |

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

Parameters

Name Type Description Notes
body \Reepay\Model\CreateCoupon [optional]

Return type

\Reepay\Model\Coupon

Authorization

apiKey, basicAuth

HTTP request headers

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

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

deleteCoupon

\Reepay\Model\Coupon deleteCoupon($handle)

Delete coupon

Example

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

// Configure API key authorization: apiKey
Reepay\Configuration::getDefaultConfiguration()->setApiKey('X-Auth-Token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Reepay\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Auth-Token', 'Bearer');
// Configure HTTP basic authorization: basicAuth
Reepay\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
Reepay\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');

$apiInstance = new Reepay\Api\CouponApi();
$handle = "handle_example"; // string | Coupon handle

try {
    $result = $apiInstance->deleteCoupon($handle);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CouponApi->deleteCoupon: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
handle string Coupon handle

Return type

\Reepay\Model\Coupon

Authorization

apiKey, basicAuth

HTTP request headers

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

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

expireCoupon

\Reepay\Model\Coupon expireCoupon($handle)

Expire coupon

Example

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

// Configure API key authorization: apiKey
Reepay\Configuration::getDefaultConfiguration()->setApiKey('X-Auth-Token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Reepay\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Auth-Token', 'Bearer');
// Configure HTTP basic authorization: basicAuth
Reepay\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
Reepay\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');

$apiInstance = new Reepay\Api\CouponApi();
$handle = "handle_example"; // string | Coupon handle

try {
    $result = $apiInstance->expireCoupon($handle);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CouponApi->expireCoupon: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
handle string Coupon handle

Return type

\Reepay\Model\Coupon

Authorization

apiKey, basicAuth

HTTP request headers

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

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

getCoupon

\Reepay\Model\Coupon getCoupon($handle)

Get coupon

Example

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

// Configure API key authorization: apiKey
Reepay\Configuration::getDefaultConfiguration()->setApiKey('X-Auth-Token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Reepay\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Auth-Token', 'Bearer');
// Configure HTTP basic authorization: basicAuth
Reepay\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
Reepay\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');

$apiInstance = new Reepay\Api\CouponApi();
$handle = "handle_example"; // string | Coupon handle

try {
    $result = $apiInstance->getCoupon($handle);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CouponApi->getCoupon: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
handle string Coupon handle

Return type

\Reepay\Model\Coupon

Authorization

apiKey, basicAuth

HTTP request headers

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

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

getCoupons

\Reepay\Model\CouponSearch getCoupons($page, $size, $search, $sort)

Get list of coupons

Example

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

// Configure API key authorization: apiKey
Reepay\Configuration::getDefaultConfiguration()->setApiKey('X-Auth-Token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Reepay\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Auth-Token', 'Bearer');
// Configure HTTP basic authorization: basicAuth
Reepay\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
Reepay\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');

$apiInstance = new Reepay\Api\CouponApi();
$page = 1; // int | Page number to get
$size = 20; // int | Page size to use
$search = "search_example"; // string | Optional search expression
$sort = "sort_example"; // string | Optional sorting expression

try {
    $result = $apiInstance->getCoupons($page, $size, $search, $sort);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CouponApi->getCoupons: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
page int Page number to get [default to 1]
size int Page size to use [default to 20]
search string Optional search expression
sort string Optional sorting expression

Return type

\Reepay\Model\CouponSearch

Authorization

apiKey, basicAuth

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

\Reepay\Model\Coupon updateCoupon($handle, $body)

Update coupon

Example

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

// Configure API key authorization: apiKey
Reepay\Configuration::getDefaultConfiguration()->setApiKey('X-Auth-Token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Reepay\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Auth-Token', 'Bearer');
// Configure HTTP basic authorization: basicAuth
Reepay\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
Reepay\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');

$apiInstance = new Reepay\Api\CouponApi();
$handle = "handle_example"; // string | Coupon handle
$body = new \Reepay\Model\UpdateCoupon(); // \Reepay\Model\UpdateCoupon |

try {
    $result = $apiInstance->updateCoupon($handle, $body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CouponApi->updateCoupon: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
handle string Coupon handle
body \Reepay\Model\UpdateCoupon [optional]

Return type

\Reepay\Model\Coupon

Authorization

apiKey, basicAuth

HTTP request headers

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

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

validateCode

\Reepay\Model\Coupon validateCode($code, $plan, $customer)

Validate coupon

Example

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

// Configure API key authorization: apiKey
Reepay\Configuration::getDefaultConfiguration()->setApiKey('X-Auth-Token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Reepay\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Auth-Token', 'Bearer');
// Configure HTTP basic authorization: basicAuth
Reepay\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
Reepay\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');

$apiInstance = new Reepay\Api\CouponApi();
$code = "code_example"; // string | Coupon code
$plan = "plan_example"; // string | Optional plan to validate against
$customer = "customer_example"; // string | Optional customer to validate against

try {
    $result = $apiInstance->validateCode($code, $plan, $customer);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CouponApi->validateCode: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
code string Coupon code
plan string Optional plan to validate against [optional]
customer string Optional customer to validate against [optional]

Return type

\Reepay\Model\Coupon

Authorization

apiKey, basicAuth

HTTP request headers

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

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