dolibarr/htdocs/includes/stripe/stripe-php/lib/SubscriptionItem.php

60 lines
1.6 KiB
PHP
Raw Normal View History

2017-04-18 05:44:08 +02:00
<?php
namespace Stripe;
/**
* Class SubscriptionItem
*
2018-03-06 13:52:56 +01:00
* @property string $id
* @property string $object
2019-05-03 02:22:27 +02:00
* @property mixed $billing_thresholds
2018-03-06 13:52:56 +01:00
* @property int $created
* @property StripeObject $metadata
* @property Plan $plan
* @property int $quantity
* @property string $subscription
2019-05-03 02:22:27 +02:00
* @property array $tax_rates
2018-03-06 13:52:56 +01:00
*
2017-04-18 05:44:08 +02:00
* @package Stripe
*/
class SubscriptionItem extends ApiResource
{
2019-05-03 02:22:27 +02:00
const OBJECT_NAME = "subscription_item";
2020-03-13 03:07:28 +01:00
const PATH_USAGE_RECORDS = '/usage_records';
2018-03-06 13:52:56 +01:00
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Delete;
2020-03-13 03:07:28 +01:00
use ApiOperations\NestedResource;
2018-03-06 13:52:56 +01:00
use ApiOperations\Retrieve;
use ApiOperations\Update;
2020-03-13 03:07:28 +01:00
/**
* @param string|null $id The ID of the subscription item on which to create the usage record.
* @param array|null $params
* @param array|string|null $opts
*
* @return ApiResource
*/
public static function createUsageRecord($id, $params = null, $opts = null)
{
return self::_createNestedResource($id, static::PATH_USAGE_RECORDS, $params, $opts);
}
2017-04-18 05:44:08 +02:00
/**
2019-05-03 02:22:27 +02:00
* @param array|null $params
* @param array|string|null $options
2017-04-18 05:44:08 +02:00
*
2020-03-13 03:07:28 +01:00
* @return Collection The list of usage record summaries.
2017-04-18 05:44:08 +02:00
*/
2019-05-03 02:22:27 +02:00
public function usageRecordSummaries($params = null, $options = null)
2017-04-18 05:44:08 +02:00
{
2019-05-03 02:22:27 +02:00
$url = $this->instanceUrl() . '/usage_record_summaries';
list($response, $opts) = $this->_request('get', $url, $params, $options);
$obj = Util\Util::convertToStripeObject($response, $opts);
$obj->setLastResponse($response);
return $obj;
2017-04-18 05:44:08 +02:00
}
}