diff --git a/CHANGELOG.md b/CHANGELOG.md index f33dd4a..55d3646 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 3.0.0 + +* ZfrStripe now uses Guzzle v5 (instead of v3). Usage of ZfrStripe does not change, except that Guzzle 5 is +substantially faster. This change has introduced a few breaking changes (those are documented in UPGRADING document) + # 2.8.1 * Add the new `tax_percent` property to subscriptions. diff --git a/README.md b/README.md index a7ce079..dfbacf2 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,14 @@ ZfrStripe is a modern PHP library based on Guzzle for [Stripe payment system](ht ## Dependencies * PHP 5.4+ -* [Guzzle](http://www.guzzlephp.org): >= 3.6 +* [Guzzle](http://www.guzzlephp.org): >= 5.0 ## Installation Installation of ZfrStripe is only officially supported using Composer: ```sh -php composer.phar require zfr/zfr-stripe:2.* +php composer.phar require zfr/zfr-stripe:3.* ``` ## Tutorial @@ -30,11 +30,11 @@ $client = new StripeClient('my-api-key'); > You can change the API key for the client using the `setApiKey` method. This is useful if you are using Stripe Connect and make both your own API calls and API calls on behalf of your users. -The currently latest supported version of the API is **2014-12-22**. You can (and should) also explicitly specify the version +The currently latest supported version of the API is **2015-04-07**. You can (and should) also explicitly specify the version of the client using the second parameter: ```php -$client = new StripeClient('my-api-key', '2014-12-22'); +$client = new StripeClient('my-api-key', '2015-04-07'); ``` ### Versioning @@ -49,7 +49,8 @@ However, each new minor version (2.1.0 to 2.2.0 for instance) will update the St Currently, the following Stripe API versions are accepted by ZfrStripe: `2014-03-28`, `2014-05-19`, `2014-06-13`, `2014-06-17`, `2014-07-22`, `2014-07-26`, `2014-08-04`, `2014-08-20`, `2014-09-08`, `2014-10-07`, `2014-11-05`, -`2014-11-20`, `2014-12-08`, `2014-12-17`, `2014-12-22`. I will try to update the library as soon as new version are released. +`2014-11-20`, `2014-12-08`, `2014-12-17`, `2014-12-22`, `2015-01-11`, `2015-01-26`, `2015-02-10`, `2015-02-18`, +`2015-03-24`, `2015-04-07`. I will try to update the library as soon as new version are released. > If you need support for older versions, please use branch v1 of ZfrStripe. @@ -130,18 +131,17 @@ foreach ($iterator as $user) { } ``` -By default, ZfrStripe retrieves 100 elements per API call (which is the maximum allowed by Stripe API). You may want -to lower this limit by using the `setPageSize` method. You can also set a upper bound of how many results you want -to retrieve by using the `setLimit` method. +By default, ZfrStripe will implicitly add the limit parameter to 100 (the maximum page size allowed by Stripe API). You +may want to lower this limit by explicitly passing the `limit` parameter. You can limit the maximum number of elements +you want to retrive (in total) by calling the `setMaxResults` method on the iterator. -Finally, you can still use API parameters when using an iterator. For instance, this will retrieve all the events +With iterators, you can still use any API parameters. For instance, this will retrieve all the events that have the event `customer.subscription.updated`, doing a new API call each 50 elements (this means that only up to 50 elements are stored in memory), setting a limit of maximum 500 elements to retrieve: ```php $iterator = $client->getEventsIterator(array('type' => 'customer.subscription.updated')); -$iterator->setPageSize(50); -$iterator->setLimit(500); +$iterator->MaxResults(500); foreach ($iterator as $event) { // Do something @@ -159,7 +159,7 @@ foreach ($iterator as $invoices) { ``` ZfrStripe takes care of fetching the last item in the batch, extracting the id, and continuing doing requests -until no more data is available! +until no more data is available (or more results than "maxResults" have been fetched)! #### Undocumented features diff --git a/UPGRADING.md b/UPGRADING.md new file mode 100644 index 0000000..2191afe --- /dev/null +++ b/UPGRADING.md @@ -0,0 +1,40 @@ +# From 2.x to 3.x + +ZfrStripe 3 upgraded Guzzle from v3 to v5. In this version, iterators have been removed and must be now implemented +in user-land. ZfrStripe therefore implements a lightweight iterator that replaces previous Guzzle iterator. As a +consequence, a few things have changed. + +The `setPageSize` method has been removed, in favour of explicitly using the standard `limit` parameter from Stripe. +This makes the client more coherent. + +Before: + +```php +$iterator = $stripeClient->getCustomersIterator(); +$iterator->setPageSize(50); +``` + +After: + +```php +$iterator = $stripeClient->getCustomersIterator(['limit' => 50]); +``` + +The `setLimit` (that was used to limit the **total** number of results) was confusing because it had the same name +as Stripe `limit` parameter. This method has been removed in favour of a new `setMaxResults` method. For instance, +to create an iterator that fetch a maximum number of 200 elements, with a limit of 50 elements per API call. + +Before: + +```php +$iterator = $stripeClient->getCustomersIterator(); +$iterator->setPageSize(50); +$iterator->setLimit(200); +``` + +After: + +```php +$iterator = $stripeClient->getCustomersIterator(['limit' => 50]); +$iterator->setMaxResults(200); +``` \ No newline at end of file diff --git a/composer.json b/composer.json index 35361d8..a66087b 100644 --- a/composer.json +++ b/composer.json @@ -17,10 +17,10 @@ ], "require": { "php": ">=5.4", - "guzzle/guzzle": ">=3.6,<=3.9" + "guzzlehttp/guzzle-services": "0.5.*" }, "require-dev": { - "phpunit/phpunit": "~3.7" + "phpunit/phpunit": "~4.1" }, "autoload": { "psr-4": { diff --git a/src/Client/Iterator/StripeCommandsCursorIterator.php b/src/Client/Iterator/StripeCommandsCursorIterator.php index 80d4dd4..412d93a 100644 --- a/src/Client/Iterator/StripeCommandsCursorIterator.php +++ b/src/Client/Iterator/StripeCommandsCursorIterator.php @@ -18,8 +18,9 @@ namespace ZfrStripe\Client\Iterator; -use Guzzle\Service\Command\CommandInterface; -use Guzzle\Service\Resource\ResourceIterator; +use GuzzleHttp\Command\CommandInterface; +use GuzzleHttp\Command\ServiceClientInterface; +use Iterator; /** * Basic iterator that is used to iterate over all Stripe commands @@ -29,37 +30,165 @@ * @author Michaël Gallego * @licence MIT */ -class StripeCommandsCursorIterator extends ResourceIterator +class StripeCommandsCursorIterator implements Iterator { /** - * @param CommandInterface $command - * @param array $data + * @var ServiceClientInterface */ - public function __construct(CommandInterface $command, array $data = []) + private $client; + + /** + * @var CommandInterface + */ + private $command; + + /** + * @var int + */ + private $requestCount = 0; + + /** + * @var string|null + */ + private $nextToken; + + /** + * @var array + */ + private $result = []; + + /** + * @var int|null + */ + private $maxResults = null; + + /** + * @var int + */ + private $iterationCount = 0; + + /** + * @param ServiceClientInterface $client + * @param CommandInterface $command + */ + public function __construct(ServiceClientInterface $client, CommandInterface $command) + { + $this->client = $client; + $this->command = $command; + + // If there is no explicit limit set, we use the maximum allowed by Stripe (100) + if (!isset($command['limit'])) { + $command['limit'] = 100; + } + } + + /** + * @param int $maxResults + */ + public function setMaxResults($maxResults) + { + $this->maxResults = (int) $maxResults; + } + + /** + * @return int + */ + public function getMaxResults() + { + return $this->maxResults; + } + + /** + * @return array + */ + public function toArray() { - parent::__construct($command, $data); + return iterator_to_array($this, false); + } + + /** + * @return array + */ + public function getNext() + { + $this->result = []; + $countLoaded = $this->requestCount * $this->command['limit']; + + if ((!$this->requestCount || $this->nextToken) + && ($this->maxResults === null || $countLoaded < $this->maxResults) + ) { + $this->loadNextResult(); + } + + return $this->result; + } + + /** + * {@inheritDoc} + */ + public function current() + { + return current($this->result); + } + + /** + * {@inheritDoc} + */ + public function next() + { + next($this->result); + $this->iterationCount++; + } - $this->pageSize = 100; // This is the maximum allowed by Stripe + /** + * {@inheritDoc} + */ + public function key() + { + return key($this->result); } /** * {@inheritDoc} */ - protected function sendRequest() + public function valid() { - $this->command['limit'] = $this->pageSize; + if (null !== key($this->result)) { + return null !== $this->maxResults ? ($this->iterationCount < $this->maxResults) : true; + } + return !empty($this->getNext()); + } + + /** + * {@inheritDoc} + */ + public function rewind() + { + $this->requestCount = 0; + $this->iterationCount = 0; + $this->result = []; + $this->nextToken = null; + } + + /** + * @return void + */ + private function loadNextResult() + { if ($this->nextToken) { $this->command['starting_after'] = $this->nextToken; + } else { + unset($this->command['starting_after']); } - $result = $this->command->execute(); - $data = $result['data']; - $lastItem = end($data); + $response = $this->client->execute($this->command); - // This avoid to do any additional request - $this->nextToken = $result['has_more'] ? $lastItem['id'] : false; + $this->result = $response['data']; + $this->requestCount++; - return $data; + if ($response['has_more']) { + $this->nextToken = end($response['data'])['id']; + } } } diff --git a/src/Client/ServiceDescription/Stripe-v1.0.php b/src/Client/ServiceDescription/Stripe-v1.0.php index 5eb51cc..6f9b5d9 100644 --- a/src/Client/ServiceDescription/Stripe-v1.0.php +++ b/src/Client/ServiceDescription/Stripe-v1.0.php @@ -64,11 +64,12 @@ * -------------------------------------------------------------------------------- */ - 'CaptureCharge' => [ + 'captureCharge' => [ 'httpMethod' => 'POST', 'uri' => '/v1/charges/{id}/capture', 'summary' => 'Capture an existing charge', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the charge', @@ -103,11 +104,12 @@ ] ], - 'CreateCharge' => [ + 'createCharge' => [ 'httpMethod' => 'POST', 'uri' => '/v1/charges', 'summary' => 'Create a new charge (either card or customer is needed)', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'amount' => [ 'description' => 'Amount (in cents)', @@ -164,6 +166,12 @@ 'type' => 'string', 'required' => false ], + 'destination' => [ + 'description' => 'An account to make the charge on behalf of', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], 'application_fee' => [ 'description' => 'A fee in cents that will be applied to the charge and transferred to the application owner\'s Stripe account', 'location' => 'query', @@ -181,15 +189,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'GetCharge' => [ + 'getCharge' => [ 'httpMethod' => 'GET', 'uri' => '/v1/charges/{id}', 'summary' => 'Get an existing charge', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the charge', @@ -206,11 +222,12 @@ ] ], - 'GetCharges' => [ + 'getCharges' => [ 'httpMethod' => 'GET', 'uri' => '/v1/charges', 'summary' => 'Get existing charges', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many charges are retrieved', @@ -266,11 +283,12 @@ ] ], - 'RefundCharge' => [ + 'refundCharge' => [ 'httpMethod' => 'POST', 'uri' => '/v1/charges/{id}/refunds', 'summary' => 'Refund an existing charge', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the charge', @@ -309,15 +327,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'UpdateCharge' => [ + 'updateCharge' => [ 'httpMethod' => 'POST', 'uri' => '/v1/charges/{id}', 'summary' => 'Update an existing charge', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the charge to update', @@ -342,6 +368,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -354,11 +387,12 @@ * -------------------------------------------------------------------------------- */ - 'CreateCustomer' => [ + 'createCustomer' => [ 'httpMethod' => 'POST', 'uri' => '/v1/customers', 'summary' => 'Create a new customer (either card or customer is needed)', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'account_balance' => [ 'description' => 'An integer amount in cents that is the starting account balance for your customer', @@ -419,15 +453,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'DeleteCustomer' => [ + 'deleteCustomer' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/customers/{id}', 'summary' => 'Delete an existing customer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the customer', @@ -444,11 +486,12 @@ ] ], - 'GetCustomer' => [ + 'getCustomer' => [ 'httpMethod' => 'GET', 'uri' => '/v1/customers/{id}', 'summary' => 'Get an existing customer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the customer', @@ -465,11 +508,12 @@ ] ], - 'GetCustomers' => [ + 'getCustomers' => [ 'httpMethod' => 'GET', 'uri' => '/v1/customers', 'summary' => 'Get existing customers', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many customers are retrieved', @@ -519,11 +563,12 @@ ] ], - 'UpdateCustomer' => [ + 'updateCustomer' => [ 'httpMethod' => 'POST', 'uri' => '/v1/customers/{id}', 'summary' => 'Update an existing customer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the customer to update', @@ -543,12 +588,6 @@ 'type' => ['string', 'array'], 'required' => false ], - 'default_card' => [ - 'description' => 'Default card identifier', - 'location' => 'query', - 'type' => 'string', - 'required' => false - ], 'coupon' => [ 'description' => 'Optional coupon identifier that applies a discount on all recurring charges', 'location' => 'query', @@ -578,6 +617,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -590,11 +636,12 @@ * -------------------------------------------------------------------------------- */ - 'CreateCard' => [ + 'createCard' => [ 'httpMethod' => 'POST', 'uri' => '/v1/customers/{customer}/cards', 'summary' => 'Create a new card for a customer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Unique identifier of the customer', @@ -613,15 +660,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'DeleteCard' => [ + 'deleteCard' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/customers/{customer}/cards/{id}', 'summary' => 'Delete an existing customer\'s card', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the card to delete', @@ -644,11 +699,12 @@ ] ], - 'GetCard' => [ + 'getCard' => [ 'httpMethod' => 'GET', 'uri' => '/v1/customers/{customer}/cards/{id}', 'summary' => 'Get an existing customer\'s card', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the card to get', @@ -671,11 +727,12 @@ ] ], - 'GetCards' => [ + 'getCards' => [ 'httpMethod' => 'GET', 'uri' => '/v1/customers/{customer}/cards', 'summary' => 'Get existing customers\'s cards', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Unique identifier of the customer to get the cards from', @@ -718,11 +775,12 @@ ] ], - 'UpdateCard' => [ + 'updateCard' => [ 'httpMethod' => 'POST', 'uri' => '/v1/customers/{customer}/cards/{id}', 'summary' => 'Update an existing customer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the card to update', @@ -786,6 +844,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -798,11 +863,12 @@ * -------------------------------------------------------------------------------- */ - 'CreateRecipientCard' => [ + 'createRecipientCard' => [ 'httpMethod' => 'POST', 'uri' => '/v1/recipients/{recipient}/cards', 'summary' => 'Create a new card for a recipient', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'recipient' => [ 'description' => 'Unique identifier of the recipient', @@ -821,15 +887,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'DeleteRecipientCard' => [ + 'deleteRecipientCard' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/recipients/{recipient}/cards/{id}', 'summary' => 'Delete an existing recipients\'s card', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the card to delete', @@ -852,11 +926,12 @@ ] ], - 'GetRecipientCard' => [ + 'getRecipientCard' => [ 'httpMethod' => 'GET', 'uri' => '/v1/recipients/{recipient}/cards/{id}', 'summary' => 'Get an existing recipient\'s card', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the card to get', @@ -879,11 +954,12 @@ ] ], - 'GetRecipientCards' => [ + 'getRecipientCards' => [ 'httpMethod' => 'GET', 'uri' => '/v1/recipients/{recipient}/cards', 'summary' => 'Get existing recipients\'s cards', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'recipient' => [ 'description' => 'Unique identifier of the recipient to get the cards from', @@ -926,11 +1002,12 @@ ] ], - 'UpdateRecipientCard' => [ + 'updateRecipientCard' => [ 'httpMethod' => 'POST', 'uri' => '/v1/recipients/{recipient}/cards/{id}', 'summary' => 'Update an existing recipient\'s card', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the card to update', @@ -994,6 +1071,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -1006,11 +1090,12 @@ * -------------------------------------------------------------------------------- */ - 'CancelSubscription' => [ + 'cancelSubscription' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/customers/{customer}/subscriptions/{id}', 'summary' => 'Delete an existing customer\'s subscription', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the subscription to cancel', @@ -1040,11 +1125,12 @@ ] ], - 'CreateSubscription' => [ + 'createSubscription' => [ 'httpMethod' => 'POST', 'uri' => '/v1/customers/{customer}/subscriptions', 'summary' => 'Create a customer\'s new subscription', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Unique identifier of the customer', @@ -1097,7 +1183,7 @@ 'tax_percent' => [ 'description' => 'A positive decimal (with at most two decimal places) between 1 and 100 that represents the percentage of the subscription invoice subtotal that will be calculated and added as tax to the final amount each billing period', 'location' => 'query', - 'type' => 'string', + 'type' => 'number', 'required' => false ], 'metadata' => [ @@ -1111,15 +1197,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'GetSubscription' => [ + 'getSubscription' => [ 'httpMethod' => 'GET', 'uri' => '/v1/customers/{customer}/subscriptions/{id}', 'summary' => 'Get an existing customer\'s active subscription', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the active subscription to get', @@ -1142,11 +1236,12 @@ ] ], - 'GetSubscriptions' => [ + 'getSubscriptions' => [ 'httpMethod' => 'GET', 'uri' => '/v1/customers/{customer}/subscriptions', 'summary' => 'Get existing customers\'s active subscriptions', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Unique identifier of the customer to get the subscriptions from', @@ -1189,11 +1284,12 @@ ] ], - 'UpdateSubscription' => [ + 'updateSubscription' => [ 'httpMethod' => 'POST', 'uri' => '/v1/customers/{customer}/subscriptions/{id}', 'summary' => 'Update a customer\'s subscription', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the subscription to update', @@ -1211,7 +1307,7 @@ 'description' => 'Unique plan identifier', 'location' => 'query', 'type' => 'string', - 'required' => true + 'required' => false ], 'quantity' => [ 'description' => 'Quantity you\'d like to apply to the subscription you\'re creating', @@ -1259,7 +1355,7 @@ 'tax_percent' => [ 'description' => 'A positive decimal (with at most two decimal places) between 1 and 100 that represents the percentage of the subscription invoice subtotal that will be calculated and added as tax to the final amount each billing period', 'location' => 'query', - 'type' => 'string', + 'type' => 'number', 'required' => false ], 'metadata' => [ @@ -1273,6 +1369,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -1285,11 +1388,12 @@ * -------------------------------------------------------------------------------- */ - 'CreatePlan' => [ + 'createPlan' => [ 'httpMethod' => 'POST', 'uri' => '/v1/plans', 'summary' => 'Create a new plan', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique string to identify the plan', @@ -1351,15 +1455,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'DeletePlan' => [ + 'deletePlan' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/plans/{id}', 'summary' => 'Delete an existing plan', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the plan', @@ -1376,11 +1488,12 @@ ] ], - 'GetPlan' => [ + 'getPlan' => [ 'httpMethod' => 'GET', 'uri' => '/v1/plans/{id}', 'summary' => 'Get an existing plan', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the plan', @@ -1397,11 +1510,12 @@ ] ], - 'GetPlans' => [ + 'getPlans' => [ 'httpMethod' => 'GET', 'uri' => '/v1/plans', 'summary' => 'Get existing plans', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many plans are retrieved', @@ -1438,11 +1552,12 @@ ] ], - 'UpdatePlan' => [ + 'updatePlan' => [ 'httpMethod' => 'POST', 'uri' => '/v1/plans/{id}', 'summary' => 'Update an existing plan', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the plan to update', @@ -1473,6 +1588,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -1485,11 +1607,12 @@ * -------------------------------------------------------------------------------- */ - 'CreateCoupon' => [ + 'createCoupon' => [ 'httpMethod' => 'POST', 'uri' => '/v1/coupons', 'summary' => 'Create a new coupon', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique string to identify the coupon (you can specify none and it will be auto-generated)', @@ -1545,15 +1668,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'DeleteCoupon' => [ + 'deleteCoupon' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/coupons/{id}', 'summary' => 'Delete an existing coupon', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the coupon', @@ -1570,11 +1701,12 @@ ] ], - 'GetCoupon' => [ + 'getCoupon' => [ 'httpMethod' => 'GET', 'uri' => '/v1/coupons/{id}', 'summary' => 'Get an existing coupon', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the plan', @@ -1591,11 +1723,12 @@ ] ], - 'GetCoupons' => [ + 'getCoupons' => [ 'httpMethod' => 'GET', 'uri' => '/v1/coupons/{id}', 'summary' => 'Get existing plans', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many coupons are retrieved', @@ -1632,11 +1765,12 @@ ] ], - 'UpdateCoupon' => [ + 'updateCoupon' => [ 'httpMethod' => 'POST', 'uri' => '/v1/coupons/{id}', 'summary' => 'Update an existing coupon', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the coupon to update', @@ -1655,6 +1789,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -1667,11 +1808,12 @@ * -------------------------------------------------------------------------------- */ - 'DeleteCustomerDiscount' => [ + 'deleteCustomerDiscount' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/customers/{customer}/discount', 'summary' => 'Delete a customer wide discount', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Unique identifier of the customer to delete the discount from', @@ -1688,11 +1830,12 @@ ] ], - 'DeleteSubscriptionDiscount' => [ + 'deleteSubscriptionDiscount' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/customers/{customer}/subscriptions/{subscription}/discount', 'summary' => 'Delete a discount applied on a subscription', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Unique identifier of the customer to delete the discount from', @@ -1723,11 +1866,12 @@ * -------------------------------------------------------------------------------- */ - 'CreateInvoice' => [ + 'createInvoice' => [ 'httpMethod' => 'POST', 'uri' => '/v1/invoices', 'summary' => 'Create a new invoice', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Unique string to identify the plan', @@ -1764,15 +1908,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'GetInvoice' => [ + 'getInvoice' => [ 'httpMethod' => 'GET', 'uri' => '/v1/invoices/{id}', 'summary' => 'Get an existing invoice', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the invoice', @@ -1789,11 +1941,12 @@ ] ], - 'GetInvoiceLineItems' => [ + 'getInvoiceLineItems' => [ 'httpMethod' => 'GET', 'uri' => '/v1/invoices/{invoice}/lines', 'summary' => 'Get an existing invoice line items', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'invoice' => [ 'description' => 'Unique identifier of the invoice to retrieve invoice items from', @@ -1842,11 +1995,12 @@ ] ], - 'GetInvoices' => [ + 'getInvoices' => [ 'httpMethod' => 'GET', 'uri' => '/v1/invoices', 'summary' => 'Get existing invoices', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many invoices are retrieved', @@ -1895,11 +2049,12 @@ ] ], - 'GetUpcomingInvoice' => [ + 'getUpcomingInvoice' => [ 'httpMethod' => 'GET', 'uri' => '/v1/invoices/upcoming', 'summary' => 'Get upcoming invoices', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Only return upcoming invoices for a specific customer', @@ -1922,11 +2077,12 @@ ] ], - 'GetUpcomingInvoiceLineItems' => [ + 'getUpcomingInvoiceLineItems' => [ 'httpMethod' => 'GET', 'uri' => '/v1/invoices/upcoming/lines', 'summary' => 'Get an existing invoice line items', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Only return invoice line items for a specific customer', @@ -1969,11 +2125,12 @@ ] ], - 'PayInvoice' => [ + 'payInvoice' => [ 'httpMethod' => 'POST', 'uri' => '/v1/invoices/{id}/pay', 'summary' => 'Pay an existing invoice', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the invoice to pay', @@ -1986,15 +2143,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'UpdateInvoice' => [ + 'updateInvoice' => [ 'httpMethod' => 'POST', 'uri' => '/v1/invoices/{id}', 'summary' => 'Update an existing invoice', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the invoice to update', @@ -2039,6 +2204,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -2051,11 +2223,12 @@ * -------------------------------------------------------------------------------- */ - 'CreateInvoiceItem' => [ + 'createInvoiceItem' => [ 'httpMethod' => 'POST', 'uri' => '/v1/invoiceitems', 'summary' => 'Create a new invoice item', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'ID of the customer who will be billed when this invoice item is billed', @@ -2093,6 +2266,13 @@ 'type' => 'string', 'required' => false ], + 'discountable' => [ + 'description' => 'Controls whether discounts apply to this invoice item', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], 'metadata' => [ 'description' => 'Optional metadata', 'location' => 'query', @@ -2104,15 +2284,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'DeleteInvoiceItem' => [ + 'deleteInvoiceItem' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/invoiceitems/{id}', 'summary' => 'Delete an existing invoice item', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the invoice item', @@ -2129,11 +2317,12 @@ ] ], - 'GetInvoiceItem' => [ + 'getInvoiceItem' => [ 'httpMethod' => 'GET', 'uri' => '/v1/invoiceitems/{id}', 'summary' => 'Get an existing invoice item', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the invoice item', @@ -2150,11 +2339,12 @@ ] ], - 'GetInvoiceItems' => [ + 'getInvoiceItems' => [ 'httpMethod' => 'GET', 'uri' => '/v1/invoiceitems', 'summary' => 'Get existing invoice items', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many invoice items are retrieved', @@ -2209,11 +2399,12 @@ ] ], - 'UpdateInvoiceItem' => [ + 'updateInvoiceItem' => [ 'httpMethod' => 'POST', 'uri' => '/v1/invoiceitems/{id}', 'summary' => 'Update an existing invoice item', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the invoice item to update', @@ -2227,6 +2418,13 @@ 'type' => 'string', 'required' => false ], + 'discountable' => [ + 'description' => 'Controls whether discounts apply to this invoice item', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], 'metadata' => [ 'description' => 'Optional metadata', 'location' => 'query', @@ -2238,6 +2436,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -2250,11 +2455,12 @@ * -------------------------------------------------------------------------------- */ - 'CloseDispute' => [ + 'closeDispute' => [ 'httpMethod' => 'POST', 'uri' => '/v1/charges/{charge}/dispute/close', 'summary' => 'Close a dispute', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'charge' => [ 'description' => 'ID of the charge to close the dispute', @@ -2267,15 +2473,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'UpdateDispute' => [ - 'httpMethod' => 'DELETE', + 'updateDispute' => [ + 'httpMethod' => 'POST', 'uri' => '/v1/charges/{charge}/dispute', 'summary' => 'Update a dispute', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'charge' => [ 'description' => 'ID of the charge to update the dispute', @@ -2285,7 +2499,7 @@ ], 'evidence' => [ 'description' => 'Evidence text', - 'location' => 'uri', + 'location' => 'query', 'type' => 'string', 'required' => false ], @@ -2300,6 +2514,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -2312,11 +2533,12 @@ * -------------------------------------------------------------------------------- */ - 'CancelTransfer' => [ + 'cancelTransfer' => [ 'httpMethod' => 'POST', 'uri' => '/v1/transfers/{id}/cancel', 'summary' => 'Cancel an existing transfer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the transfer', @@ -2329,15 +2551,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'CreateTransfer' => [ + 'createTransfer' => [ 'httpMethod' => 'POST', 'uri' => '/v1/transfers', 'summary' => 'Create a new transfer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'amount' => [ 'description' => 'Amount (in cents)', @@ -2380,15 +2610,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'GetTransfer' => [ + 'getTransfer' => [ 'httpMethod' => 'GET', 'uri' => '/v1/transfers/{id}', 'summary' => 'Get an existing transfer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the transfer', @@ -2405,11 +2643,12 @@ ] ], - 'GetTransfers' => [ + 'getTransfers' => [ 'httpMethod' => 'GET', 'uri' => '/v1/transfers', 'summary' => 'Get existing transfers', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many transfers are retrieved', @@ -2464,11 +2703,12 @@ ] ], - 'UpdateTransfer' => [ + 'updateTransfer' => [ 'httpMethod' => 'POST', 'uri' => '/v1/transfers/{id}', 'summary' => 'Update an existing transfer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the transfer to update', @@ -2493,6 +2733,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -2505,11 +2752,12 @@ * -------------------------------------------------------------------------------- */ - 'CreateRecipient' => [ + 'createRecipient' => [ 'httpMethod' => 'POST', 'uri' => '/v1/recipients', 'summary' => 'Create a new recipient', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'name' => [ 'description' => 'The recipient\'s full, legal name', @@ -2559,15 +2807,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'DeleteRecipient' => [ + 'deleteRecipient' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/recipients/{id}', 'summary' => 'Delete an existing recipient', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the recipient', @@ -2584,11 +2840,12 @@ ] ], - 'GetRecipient' => [ + 'getRecipient' => [ 'httpMethod' => 'GET', 'uri' => '/v1/recipients/{id}', 'summary' => 'Get an existing recipient', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the recipient', @@ -2605,11 +2862,12 @@ ] ], - 'GetRecipients' => [ + 'getRecipients' => [ 'httpMethod' => 'GET', 'uri' => '/v1/recipients', 'summary' => 'Get existing recipients', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many recipients are retrieved', @@ -2647,11 +2905,12 @@ ] ], - 'UpdateRecipient' => [ + 'updateRecipient' => [ 'httpMethod' => 'POST', 'uri' => '/v1/recipients/{id}', 'summary' => 'Update an existing recipient', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the recipient to update', @@ -2700,6 +2959,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -2712,11 +2978,12 @@ * -------------------------------------------------------------------------------- */ - 'GetRefund' => [ + 'getRefund' => [ 'httpMethod' => 'GET', 'uri' => '/v1/charges/{charge}/refunds/{id}', 'summary' => 'Get an existing refund', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the refund', @@ -2739,11 +3006,12 @@ ] ], - 'GetRefunds' => [ + 'getRefunds' => [ 'httpMethod' => 'GET', 'uri' => '/v1/charges/{charge}/refunds', 'summary' => 'Get existing refunds for a given charge', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'charge' => [ 'description' => 'Charge to get the refunds from', @@ -2786,11 +3054,12 @@ ] ], - 'UpdateRefund' => [ + 'updateRefund' => [ 'httpMethod' => 'POST', 'uri' => '/v1/charges/{charge}/refunds/{id}', 'summary' => 'Update an existing charge', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the refund to update', @@ -2815,6 +3084,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -2827,11 +3103,12 @@ * -------------------------------------------------------------------------------- */ - 'GetApplicationFee' => [ + 'getApplicationFee' => [ 'httpMethod' => 'GET', 'uri' => '/v1/application_fees/{id}', 'summary' => 'Get details about an application fee that your account has collected', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the application fee', @@ -2848,11 +3125,12 @@ ] ], - 'GetApplicationFees' => [ + 'getApplicationFees' => [ 'httpMethod' => 'GET', 'uri' => '/v1/application_fees', 'summary' => 'Get details about all application fees that your account has collected', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many application fees are retrieved', @@ -2901,11 +3179,12 @@ ] ], - 'RefundApplicationFee' => [ + 'refundApplicationFee' => [ 'httpMethod' => 'POST', 'uri' => '/v1/application_fees/{id}/refunds', 'summary' => 'Refund an application fee that has previously been collected but not yet refunded', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of application fee to be refunded', @@ -2924,6 +3203,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -2936,11 +3222,12 @@ * -------------------------------------------------------------------------------- */ - 'GetApplicationFeeRefund' => [ + 'getApplicationFeeRefund' => [ 'httpMethod' => 'GET', 'uri' => '/v1/application_fees/{fee}/refunds/{id}', 'summary' => 'Get details about an application fee refund', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the application fee refund', @@ -2963,11 +3250,12 @@ ] ], - 'GetApplicationFeeRefunds' => [ + 'getApplicationFeeRefunds' => [ 'httpMethod' => 'GET', 'uri' => '/v1/application_fees/{fee}/refunds', 'summary' => 'Get details about all application fee refunds', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'fee' => [ 'description' => 'Unique identifier of the application fee we want refunds', @@ -3010,11 +3298,12 @@ ] ], - 'UpdateApplicationFeeRefund' => [ + 'updateApplicationFeeRefund' => [ 'httpMethod' => 'POST', 'uri' => '/v1/application_fees/{fee}/refunds/{id}', 'summary' => 'Update an application fee refund', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of application fee refund', @@ -3039,6 +3328,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -3051,11 +3347,12 @@ * -------------------------------------------------------------------------------- */ - 'GetAccountBalance' => [ + 'getAccountBalance' => [ 'httpMethod' => 'GET', 'uri' => '/v1/balance', 'summary' => 'Get the current account balance', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'expand' => [ 'description' => 'Allow to expand some properties', @@ -3066,11 +3363,12 @@ ] ], - 'GetBalanceTransaction' => [ + 'getBalanceTransaction' => [ 'httpMethod' => 'GET', 'uri' => '/v1/balance/history/{id}', 'summary' => 'Get an existing balance transaction by its id', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the balance transaction to get', @@ -3087,11 +3385,12 @@ ] ], - 'GetBalanceTransactions' => [ + 'getBalanceTransactions' => [ 'httpMethod' => 'GET', 'uri' => '/v1/balance/history', 'summary' => 'Get all the balance transactions', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many application fees are retrieved', @@ -3175,11 +3474,12 @@ * -------------------------------------------------------------------------------- */ - 'CreateCardToken' => [ + 'createCardToken' => [ 'httpMethod' => 'POST', 'uri' => '/v1/tokens', 'summary' => 'Create a new card token (note you must either specify card OR customer but not both)', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'card' => [ 'description' => 'Unique card identifier (can either be an ID or a hash)', @@ -3198,15 +3498,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'CreateBankAccountToken' => [ + 'createBankAccountToken' => [ 'httpMethod' => 'POST', 'uri' => '/v1/tokens', 'summary' => 'Create a bank account token', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'bank_account' => [ 'description' => 'A bank account to attach to the recipient', @@ -3219,15 +3527,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'GetToken' => [ + 'getToken' => [ 'httpMethod' => 'GET', 'uri' => '/v1/tokens/{id}', 'summary' => 'Get details about an existing token', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the token', @@ -3252,11 +3568,12 @@ * -------------------------------------------------------------------------------- */ - 'GetEvent' => [ + 'getEvent' => [ 'httpMethod' => 'GET', 'uri' => '/v1/events/{id}', 'summary' => 'Get details about an event', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the event', @@ -3273,11 +3590,12 @@ ] ], - 'GetEvents' => [ + 'getEvents' => [ 'httpMethod' => 'GET', 'uri' => '/v1/events', 'summary' => 'Get details about all events (up to 30 days)', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many events are retrieved', @@ -3340,11 +3658,20 @@ * -------------------------------------------------------------------------------- */ - 'GetAccount' => [ + 'getAccount' => [ 'httpMethod' => 'GET', 'uri' => '/v1/account', 'summary' => 'Get details about the account', 'errorResponses' => $errors, + 'responseModel' => 'getResponse' + ] + ], + 'models' => [ + 'getResponse' => [ + 'type' => 'object', + 'additionalProperties' => [ + 'location' => 'json' + ] ] ] ]; diff --git a/src/Client/ServiceDescription/Stripe-v1.1.php b/src/Client/ServiceDescription/Stripe-v1.1.php index 76519df..d84e84e 100644 --- a/src/Client/ServiceDescription/Stripe-v1.1.php +++ b/src/Client/ServiceDescription/Stripe-v1.1.php @@ -64,11 +64,12 @@ * -------------------------------------------------------------------------------- */ - 'CaptureCharge' => [ + 'captureCharge' => [ 'httpMethod' => 'POST', 'uri' => '/v1/charges/{id}/capture', 'summary' => 'Capture an existing charge', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the charge', @@ -99,15 +100,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'CreateCharge' => [ + 'createCharge' => [ 'httpMethod' => 'POST', 'uri' => '/v1/charges', 'summary' => 'Create a new charge (either card or customer is needed)', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'amount' => [ 'description' => 'Amount (in cents)', @@ -152,7 +161,7 @@ 'type' => 'array', 'required' => false ], - 'statement_descriptor' => [ + 'statement_description' => [ 'description' => 'An arbitrary string to be displayed alongside your customer\'s credit card statement', 'location' => 'query', 'type' => 'string', @@ -164,6 +173,12 @@ 'type' => 'string', 'required' => false ], + 'destination' => [ + 'description' => 'An account to make the charge on behalf of', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], 'application_fee' => [ 'description' => 'A fee in cents that will be applied to the charge and transferred to the application owner\'s Stripe account', 'location' => 'query', @@ -181,15 +196,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'GetCharge' => [ + 'getCharge' => [ 'httpMethod' => 'GET', 'uri' => '/v1/charges/{id}', 'summary' => 'Get an existing charge', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the charge', @@ -206,11 +229,12 @@ ] ], - 'GetCharges' => [ + 'getCharges' => [ 'httpMethod' => 'GET', 'uri' => '/v1/charges', 'summary' => 'Get existing charges', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many charges are retrieved', @@ -266,11 +290,12 @@ ] ], - 'RefundCharge' => [ + 'refundCharge' => [ 'httpMethod' => 'POST', 'uri' => '/v1/charges/{id}/refunds', 'summary' => 'Refund an existing charge', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the charge', @@ -309,15 +334,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'UpdateCharge' => [ + 'updateCharge' => [ 'httpMethod' => 'POST', 'uri' => '/v1/charges/{id}', 'summary' => 'Update an existing charge', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the charge to update', @@ -342,6 +375,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -354,11 +394,12 @@ * -------------------------------------------------------------------------------- */ - 'CreateCustomer' => [ + 'createCustomer' => [ 'httpMethod' => 'POST', 'uri' => '/v1/customers', 'summary' => 'Create a new customer (either card or customer is needed)', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'account_balance' => [ 'description' => 'An integer amount in cents that is the starting account balance for your customer', @@ -419,15 +460,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'DeleteCustomer' => [ + 'deleteCustomer' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/customers/{id}', 'summary' => 'Delete an existing customer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the customer', @@ -444,11 +493,12 @@ ] ], - 'GetCustomer' => [ + 'getCustomer' => [ 'httpMethod' => 'GET', 'uri' => '/v1/customers/{id}', 'summary' => 'Get an existing customer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the customer', @@ -465,11 +515,12 @@ ] ], - 'GetCustomers' => [ + 'getCustomers' => [ 'httpMethod' => 'GET', 'uri' => '/v1/customers', 'summary' => 'Get existing customers', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many customers are retrieved', @@ -519,11 +570,12 @@ ] ], - 'UpdateCustomer' => [ + 'updateCustomer' => [ 'httpMethod' => 'POST', 'uri' => '/v1/customers/{id}', 'summary' => 'Update an existing customer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the customer to update', @@ -543,12 +595,6 @@ 'type' => ['string', 'array'], 'required' => false ], - 'default_card' => [ - 'description' => 'Default card identifier', - 'location' => 'query', - 'type' => 'string', - 'required' => false - ], 'coupon' => [ 'description' => 'Optional coupon identifier that applies a discount on all recurring charges', 'location' => 'query', @@ -578,6 +624,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -590,11 +643,12 @@ * -------------------------------------------------------------------------------- */ - 'CreateCard' => [ + 'createCard' => [ 'httpMethod' => 'POST', 'uri' => '/v1/customers/{customer}/cards', 'summary' => 'Create a new card for a customer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Unique identifier of the customer', @@ -613,15 +667,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'DeleteCard' => [ + 'deleteCard' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/customers/{customer}/cards/{id}', 'summary' => 'Delete an existing customer\'s card', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the card to delete', @@ -644,11 +706,12 @@ ] ], - 'GetCard' => [ + 'getCard' => [ 'httpMethod' => 'GET', 'uri' => '/v1/customers/{customer}/cards/{id}', 'summary' => 'Get an existing customer\'s card', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the card to get', @@ -671,11 +734,12 @@ ] ], - 'GetCards' => [ + 'getCards' => [ 'httpMethod' => 'GET', 'uri' => '/v1/customers/{customer}/cards', 'summary' => 'Get existing customers\'s cards', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Unique identifier of the customer to get the cards from', @@ -718,11 +782,12 @@ ] ], - 'UpdateCard' => [ + 'updateCard' => [ 'httpMethod' => 'POST', 'uri' => '/v1/customers/{customer}/cards/{id}', 'summary' => 'Update an existing customer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the card to update', @@ -786,6 +851,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -798,11 +870,12 @@ * -------------------------------------------------------------------------------- */ - 'CreateRecipientCard' => [ + 'createRecipientCard' => [ 'httpMethod' => 'POST', 'uri' => '/v1/recipients/{recipient}/cards', 'summary' => 'Create a new card for a recipient', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'recipient' => [ 'description' => 'Unique identifier of the recipient', @@ -821,15 +894,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'DeleteRecipientCard' => [ + 'deleteRecipientCard' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/recipients/{recipient}/cards/{id}', 'summary' => 'Delete an existing recipients\'s card', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the card to delete', @@ -852,11 +933,12 @@ ] ], - 'GetRecipientCard' => [ + 'getRecipientCard' => [ 'httpMethod' => 'GET', 'uri' => '/v1/recipients/{recipient}/cards/{id}', 'summary' => 'Get an existing recipient\'s card', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the card to get', @@ -879,11 +961,12 @@ ] ], - 'GetRecipientCards' => [ + 'getRecipientCards' => [ 'httpMethod' => 'GET', 'uri' => '/v1/recipients/{recipient}/cards', 'summary' => 'Get existing recipients\'s cards', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'recipient' => [ 'description' => 'Unique identifier of the recipient to get the cards from', @@ -926,11 +1009,12 @@ ] ], - 'UpdateRecipientCard' => [ + 'updateRecipientCard' => [ 'httpMethod' => 'POST', 'uri' => '/v1/recipients/{recipient}/cards/{id}', 'summary' => 'Update an existing recipient\'s card', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the card to update', @@ -994,6 +1078,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -1006,11 +1097,12 @@ * -------------------------------------------------------------------------------- */ - 'CancelSubscription' => [ + 'cancelSubscription' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/customers/{customer}/subscriptions/{id}', 'summary' => 'Delete an existing customer\'s subscription', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the subscription to cancel', @@ -1040,11 +1132,12 @@ ] ], - 'CreateSubscription' => [ + 'createSubscription' => [ 'httpMethod' => 'POST', 'uri' => '/v1/customers/{customer}/subscriptions', 'summary' => 'Create a customer\'s new subscription', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Unique identifier of the customer', @@ -1097,7 +1190,7 @@ 'tax_percent' => [ 'description' => 'A positive decimal (with at most two decimal places) between 1 and 100 that represents the percentage of the subscription invoice subtotal that will be calculated and added as tax to the final amount each billing period', 'location' => 'query', - 'type' => 'string', + 'type' => 'number', 'required' => false ], 'metadata' => [ @@ -1111,15 +1204,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'GetSubscription' => [ + 'getSubscription' => [ 'httpMethod' => 'GET', 'uri' => '/v1/customers/{customer}/subscriptions/{id}', 'summary' => 'Get an existing customer\'s active subscription', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the active subscription to get', @@ -1142,11 +1243,12 @@ ] ], - 'GetSubscriptions' => [ + 'getSubscriptions' => [ 'httpMethod' => 'GET', 'uri' => '/v1/customers/{customer}/subscriptions', 'summary' => 'Get existing customers\'s active subscriptions', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Unique identifier of the customer to get the subscriptions from', @@ -1189,11 +1291,12 @@ ] ], - 'UpdateSubscription' => [ + 'updateSubscription' => [ 'httpMethod' => 'POST', 'uri' => '/v1/customers/{customer}/subscriptions/{id}', 'summary' => 'Update a customer\'s subscription', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the subscription to update', @@ -1211,7 +1314,7 @@ 'description' => 'Unique plan identifier', 'location' => 'query', 'type' => 'string', - 'required' => true + 'required' => false ], 'quantity' => [ 'description' => 'Quantity you\'d like to apply to the subscription you\'re creating', @@ -1259,7 +1362,7 @@ 'tax_percent' => [ 'description' => 'A positive decimal (with at most two decimal places) between 1 and 100 that represents the percentage of the subscription invoice subtotal that will be calculated and added as tax to the final amount each billing period', 'location' => 'query', - 'type' => 'string', + 'type' => 'number', 'required' => false ], 'metadata' => [ @@ -1273,6 +1376,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -1285,11 +1395,12 @@ * -------------------------------------------------------------------------------- */ - 'CreatePlan' => [ + 'createPlan' => [ 'httpMethod' => 'POST', 'uri' => '/v1/plans', 'summary' => 'Create a new plan', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique string to identify the plan', @@ -1340,7 +1451,7 @@ 'type' => 'array', 'required' => false ], - 'statement_descriptor' => [ + 'statement_description' => [ 'description' => 'An arbitrary string to be displayed alongside your customer\'s credit card statement', 'location' => 'query', 'type' => 'string', @@ -1351,15 +1462,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'DeletePlan' => [ + 'deletePlan' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/plans/{id}', 'summary' => 'Delete an existing plan', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the plan', @@ -1376,11 +1495,12 @@ ] ], - 'GetPlan' => [ + 'getPlan' => [ 'httpMethod' => 'GET', 'uri' => '/v1/plans/{id}', 'summary' => 'Get an existing plan', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the plan', @@ -1397,11 +1517,12 @@ ] ], - 'GetPlans' => [ + 'getPlans' => [ 'httpMethod' => 'GET', 'uri' => '/v1/plans', 'summary' => 'Get existing plans', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many plans are retrieved', @@ -1438,11 +1559,12 @@ ] ], - 'UpdatePlan' => [ + 'updatePlan' => [ 'httpMethod' => 'POST', 'uri' => '/v1/plans/{id}', 'summary' => 'Update an existing plan', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the plan to update', @@ -1462,7 +1584,7 @@ 'type' => 'array', 'required' => false ], - 'statement_descriptor' => [ + 'statement_description' => [ 'description' => 'An arbitrary string to be displayed alongside your customer\'s credit card statement', 'location' => 'query', 'type' => 'string', @@ -1473,6 +1595,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -1485,11 +1614,12 @@ * -------------------------------------------------------------------------------- */ - 'CreateCoupon' => [ + 'createCoupon' => [ 'httpMethod' => 'POST', 'uri' => '/v1/coupons', 'summary' => 'Create a new coupon', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique string to identify the coupon (you can specify none and it will be auto-generated)', @@ -1545,15 +1675,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'DeleteCoupon' => [ + 'deleteCoupon' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/coupons/{id}', 'summary' => 'Delete an existing coupon', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the coupon', @@ -1570,11 +1708,12 @@ ] ], - 'GetCoupon' => [ + 'getCoupon' => [ 'httpMethod' => 'GET', 'uri' => '/v1/coupons/{id}', 'summary' => 'Get an existing coupon', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the plan', @@ -1591,11 +1730,12 @@ ] ], - 'GetCoupons' => [ + 'getCoupons' => [ 'httpMethod' => 'GET', 'uri' => '/v1/coupons/{id}', 'summary' => 'Get existing plans', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many coupons are retrieved', @@ -1632,11 +1772,12 @@ ] ], - 'UpdateCoupon' => [ + 'updateCoupon' => [ 'httpMethod' => 'POST', 'uri' => '/v1/coupons/{id}', 'summary' => 'Update an existing coupon', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the coupon to update', @@ -1655,6 +1796,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -1667,11 +1815,12 @@ * -------------------------------------------------------------------------------- */ - 'DeleteCustomerDiscount' => [ + 'deleteCustomerDiscount' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/customers/{customer}/discount', 'summary' => 'Delete a customer wide discount', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Unique identifier of the customer to delete the discount from', @@ -1688,11 +1837,12 @@ ] ], - 'DeleteSubscriptionDiscount' => [ + 'deleteSubscriptionDiscount' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/customers/{customer}/subscriptions/{subscription}/discount', 'summary' => 'Delete a discount applied on a subscription', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Unique identifier of the customer to delete the discount from', @@ -1723,11 +1873,12 @@ * -------------------------------------------------------------------------------- */ - 'CreateInvoice' => [ + 'createInvoice' => [ 'httpMethod' => 'POST', 'uri' => '/v1/invoices', 'summary' => 'Create a new invoice', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Unique string to identify the plan', @@ -1747,7 +1898,7 @@ 'type' => 'string', 'required' => false ], - 'statement_descriptor' => [ + 'statement_description' => [ 'description' => 'Extra information about a charge for the customer\'s credit card statement', 'location' => 'query', 'type' => 'string', @@ -1764,15 +1915,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'GetInvoice' => [ + 'getInvoice' => [ 'httpMethod' => 'GET', 'uri' => '/v1/invoices/{id}', 'summary' => 'Get an existing invoice', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the invoice', @@ -1789,11 +1948,12 @@ ] ], - 'GetInvoiceLineItems' => [ + 'getInvoiceLineItems' => [ 'httpMethod' => 'GET', 'uri' => '/v1/invoices/{invoice}/lines', 'summary' => 'Get an existing invoice line items', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'invoice' => [ 'description' => 'Unique identifier of the invoice to retrieve invoice items from', @@ -1842,11 +2002,12 @@ ] ], - 'GetInvoices' => [ + 'getInvoices' => [ 'httpMethod' => 'GET', 'uri' => '/v1/invoices', 'summary' => 'Get existing invoices', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many invoices are retrieved', @@ -1895,11 +2056,12 @@ ] ], - 'GetUpcomingInvoice' => [ + 'getUpcomingInvoice' => [ 'httpMethod' => 'GET', 'uri' => '/v1/invoices/upcoming', 'summary' => 'Get upcoming invoices', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Only return upcoming invoices for a specific customer', @@ -1922,11 +2084,12 @@ ] ], - 'GetUpcomingInvoiceLineItems' => [ + 'getUpcomingInvoiceLineItems' => [ 'httpMethod' => 'GET', 'uri' => '/v1/invoices/upcoming/lines', 'summary' => 'Get an existing invoice line items', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'Only return invoice line items for a specific customer', @@ -1969,11 +2132,12 @@ ] ], - 'PayInvoice' => [ + 'payInvoice' => [ 'httpMethod' => 'POST', 'uri' => '/v1/invoices/{id}/pay', 'summary' => 'Pay an existing invoice', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the invoice to pay', @@ -1986,15 +2150,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'UpdateInvoice' => [ + 'updateInvoice' => [ 'httpMethod' => 'POST', 'uri' => '/v1/invoices/{id}', 'summary' => 'Update an existing invoice', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the invoice to update', @@ -2008,7 +2180,7 @@ 'type' => 'string', 'required' => false ], - 'statement_descriptor' => [ + 'statement_description' => [ 'description' => 'Extra information about a charge for the customer\'s credit card statement', 'location' => 'query', 'type' => 'string', @@ -2039,6 +2211,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -2051,11 +2230,12 @@ * -------------------------------------------------------------------------------- */ - 'CreateInvoiceItem' => [ + 'createInvoiceItem' => [ 'httpMethod' => 'POST', 'uri' => '/v1/invoiceitems', 'summary' => 'Create a new invoice item', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'customer' => [ 'description' => 'ID of the customer who will be billed when this invoice item is billed', @@ -2093,6 +2273,13 @@ 'type' => 'string', 'required' => false ], + 'discountable' => [ + 'description' => 'Controls whether discounts apply to this invoice item', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], 'metadata' => [ 'description' => 'Optional metadata', 'location' => 'query', @@ -2104,15 +2291,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'DeleteInvoiceItem' => [ + 'deleteInvoiceItem' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/invoiceitems/{id}', 'summary' => 'Delete an existing invoice item', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the invoice item', @@ -2129,11 +2324,12 @@ ] ], - 'GetInvoiceItem' => [ + 'getInvoiceItem' => [ 'httpMethod' => 'GET', 'uri' => '/v1/invoiceitems/{id}', 'summary' => 'Get an existing invoice item', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the invoice item', @@ -2150,11 +2346,12 @@ ] ], - 'GetInvoiceItems' => [ + 'getInvoiceItems' => [ 'httpMethod' => 'GET', 'uri' => '/v1/invoiceitems', 'summary' => 'Get existing invoice items', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many invoice items are retrieved', @@ -2209,11 +2406,12 @@ ] ], - 'UpdateInvoiceItem' => [ + 'updateInvoiceItem' => [ 'httpMethod' => 'POST', 'uri' => '/v1/invoiceitems/{id}', 'summary' => 'Update an existing invoice item', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the invoice item to update', @@ -2227,6 +2425,13 @@ 'type' => 'string', 'required' => false ], + 'discountable' => [ + 'description' => 'Controls whether discounts apply to this invoice item', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], 'metadata' => [ 'description' => 'Optional metadata', 'location' => 'query', @@ -2238,6 +2443,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -2250,11 +2462,12 @@ * -------------------------------------------------------------------------------- */ - 'CloseDispute' => [ + 'closeDispute' => [ 'httpMethod' => 'POST', 'uri' => '/v1/charges/{charge}/dispute/close', 'summary' => 'Close a dispute', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'charge' => [ 'description' => 'ID of the charge to close the dispute', @@ -2267,15 +2480,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'UpdateDispute' => [ - 'httpMethod' => 'DELETE', + 'updateDispute' => [ + 'httpMethod' => 'POST', 'uri' => '/v1/charges/{charge}/dispute', 'summary' => 'Update a dispute', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'charge' => [ 'description' => 'ID of the charge to update the dispute', @@ -2284,9 +2505,9 @@ 'required' => true ], 'evidence' => [ - 'description' => 'Evidence text', - 'location' => 'uri', - 'type' => 'string', + 'description' => 'Evidence hash', + 'location' => 'query', + 'type' => 'array', 'required' => false ], 'metadata' => [ @@ -2300,6 +2521,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -2312,11 +2540,12 @@ * -------------------------------------------------------------------------------- */ - 'CancelTransfer' => [ + 'cancelTransfer' => [ 'httpMethod' => 'POST', 'uri' => '/v1/transfers/{id}/cancel', 'summary' => 'Cancel an existing transfer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the transfer', @@ -2329,15 +2558,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'CreateTransfer' => [ + 'createTransfer' => [ 'httpMethod' => 'POST', 'uri' => '/v1/transfers', 'summary' => 'Create a new transfer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'amount' => [ 'description' => 'Amount (in cents)', @@ -2363,7 +2600,7 @@ 'type' => 'string', 'required' => false ], - 'statement_descriptor' => [ + 'statement_description' => [ 'description' => 'An arbitrary string which will be displayed on the recipient\'s bank statement', 'location' => 'query', 'type' => 'string', @@ -2380,15 +2617,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'GetTransfer' => [ + 'getTransfer' => [ 'httpMethod' => 'GET', 'uri' => '/v1/transfers/{id}', 'summary' => 'Get an existing transfer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the transfer', @@ -2405,11 +2650,12 @@ ] ], - 'GetTransfers' => [ + 'getTransfers' => [ 'httpMethod' => 'GET', 'uri' => '/v1/transfers', 'summary' => 'Get existing transfers', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many transfers are retrieved', @@ -2464,11 +2710,12 @@ ] ], - 'UpdateTransfer' => [ + 'updateTransfer' => [ 'httpMethod' => 'POST', 'uri' => '/v1/transfers/{id}', 'summary' => 'Update an existing transfer', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the transfer to update', @@ -2493,6 +2740,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -2505,11 +2759,12 @@ * -------------------------------------------------------------------------------- */ - 'CreateRecipient' => [ + 'createRecipient' => [ 'httpMethod' => 'POST', 'uri' => '/v1/recipients', 'summary' => 'Create a new recipient', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'name' => [ 'description' => 'The recipient\'s full, legal name', @@ -2559,15 +2814,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'DeleteRecipient' => [ + 'deleteRecipient' => [ 'httpMethod' => 'DELETE', 'uri' => '/v1/recipients/{id}', 'summary' => 'Delete an existing recipient', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the recipient', @@ -2584,11 +2847,12 @@ ] ], - 'GetRecipient' => [ + 'getRecipient' => [ 'httpMethod' => 'GET', 'uri' => '/v1/recipients/{id}', 'summary' => 'Get an existing recipient', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the recipient', @@ -2605,11 +2869,12 @@ ] ], - 'GetRecipients' => [ + 'getRecipients' => [ 'httpMethod' => 'GET', 'uri' => '/v1/recipients', 'summary' => 'Get existing recipients', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many recipients are retrieved', @@ -2647,11 +2912,12 @@ ] ], - 'UpdateRecipient' => [ + 'updateRecipient' => [ 'httpMethod' => 'POST', 'uri' => '/v1/recipients/{id}', 'summary' => 'Update an existing recipient', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the recipient to update', @@ -2700,6 +2966,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -2712,11 +2985,12 @@ * -------------------------------------------------------------------------------- */ - 'GetRefund' => [ + 'getRefund' => [ 'httpMethod' => 'GET', 'uri' => '/v1/charges/{charge}/refunds/{id}', 'summary' => 'Get an existing refund', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the refund', @@ -2739,11 +3013,12 @@ ] ], - 'GetRefunds' => [ + 'getRefunds' => [ 'httpMethod' => 'GET', 'uri' => '/v1/charges/{charge}/refunds', 'summary' => 'Get existing refunds for a given charge', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'charge' => [ 'description' => 'Charge to get the refunds from', @@ -2786,11 +3061,12 @@ ] ], - 'UpdateRefund' => [ + 'updateRefund' => [ 'httpMethod' => 'POST', 'uri' => '/v1/charges/{charge}/refunds/{id}', 'summary' => 'Update an existing charge', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the refund to update', @@ -2815,6 +3091,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -2827,11 +3110,12 @@ * -------------------------------------------------------------------------------- */ - 'GetApplicationFee' => [ + 'getApplicationFee' => [ 'httpMethod' => 'GET', 'uri' => '/v1/application_fees/{id}', 'summary' => 'Get details about an application fee that your account has collected', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the application fee', @@ -2848,11 +3132,12 @@ ] ], - 'GetApplicationFees' => [ + 'getApplicationFees' => [ 'httpMethod' => 'GET', 'uri' => '/v1/application_fees', 'summary' => 'Get details about all application fees that your account has collected', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many application fees are retrieved', @@ -2901,11 +3186,12 @@ ] ], - 'RefundApplicationFee' => [ + 'refundApplicationFee' => [ 'httpMethod' => 'POST', 'uri' => '/v1/application_fees/{id}/refunds', 'summary' => 'Refund an application fee that has previously been collected but not yet refunded', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of application fee to be refunded', @@ -2924,6 +3210,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -2936,11 +3229,12 @@ * -------------------------------------------------------------------------------- */ - 'GetApplicationFeeRefund' => [ + 'getApplicationFeeRefund' => [ 'httpMethod' => 'GET', 'uri' => '/v1/application_fees/{fee}/refunds/{id}', 'summary' => 'Get details about an application fee refund', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the application fee refund', @@ -2963,11 +3257,12 @@ ] ], - 'GetApplicationFeeRefunds' => [ + 'getApplicationFeeRefunds' => [ 'httpMethod' => 'GET', 'uri' => '/v1/application_fees/{fee}/refunds', 'summary' => 'Get details about all application fee refunds', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'fee' => [ 'description' => 'Unique identifier of the application fee we want refunds', @@ -3010,11 +3305,12 @@ ] ], - 'UpdateApplicationFeeRefund' => [ + 'updateApplicationFeeRefund' => [ 'httpMethod' => 'POST', 'uri' => '/v1/application_fees/{fee}/refunds/{id}', 'summary' => 'Update an application fee refund', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of application fee refund', @@ -3039,6 +3335,13 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], @@ -3051,11 +3354,12 @@ * -------------------------------------------------------------------------------- */ - 'GetAccountBalance' => [ + 'getAccountBalance' => [ 'httpMethod' => 'GET', 'uri' => '/v1/balance', 'summary' => 'Get the current account balance', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'expand' => [ 'description' => 'Allow to expand some properties', @@ -3066,11 +3370,12 @@ ] ], - 'GetBalanceTransaction' => [ + 'getBalanceTransaction' => [ 'httpMethod' => 'GET', 'uri' => '/v1/balance/history/{id}', 'summary' => 'Get an existing balance transaction by its id', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the balance transaction to get', @@ -3087,11 +3392,12 @@ ] ], - 'GetBalanceTransactions' => [ + 'getBalanceTransactions' => [ 'httpMethod' => 'GET', 'uri' => '/v1/balance/history', 'summary' => 'Get all the balance transactions', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many application fees are retrieved', @@ -3175,11 +3481,12 @@ * -------------------------------------------------------------------------------- */ - 'CreateCardToken' => [ + 'createCardToken' => [ 'httpMethod' => 'POST', 'uri' => '/v1/tokens', 'summary' => 'Create a new card token (note you must either specify card OR customer but not both)', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'card' => [ 'description' => 'Unique card identifier (can either be an ID or a hash)', @@ -3198,15 +3505,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'CreateBankAccountToken' => [ + 'createBankAccountToken' => [ 'httpMethod' => 'POST', 'uri' => '/v1/tokens', 'summary' => 'Create a bank account token', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'bank_account' => [ 'description' => 'A bank account to attach to the recipient', @@ -3219,15 +3534,23 @@ 'location' => 'query', 'type' => 'array', 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false ] ] ], - 'GetToken' => [ + 'getToken' => [ 'httpMethod' => 'GET', 'uri' => '/v1/tokens/{id}', 'summary' => 'Get details about an existing token', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the token', @@ -3252,11 +3575,12 @@ * -------------------------------------------------------------------------------- */ - 'GetEvent' => [ + 'getEvent' => [ 'httpMethod' => 'GET', 'uri' => '/v1/events/{id}', 'summary' => 'Get details about an event', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'id' => [ 'description' => 'Unique identifier of the event', @@ -3273,11 +3597,12 @@ ] ], - 'GetEvents' => [ + 'getEvents' => [ 'httpMethod' => 'GET', 'uri' => '/v1/events', 'summary' => 'Get details about all events (up to 30 days)', 'errorResponses' => $errors, + 'responseModel' => 'getResponse', 'parameters' => [ 'limit' => [ 'description' => 'Limit on how many events are retrieved', @@ -3340,11 +3665,20 @@ * -------------------------------------------------------------------------------- */ - 'GetAccount' => [ + 'getAccount' => [ 'httpMethod' => 'GET', 'uri' => '/v1/account', 'summary' => 'Get details about the account', 'errorResponses' => $errors, + 'responseModel' => 'getResponse' + ] + ], + 'models' => [ + 'getResponse' => [ + 'type' => 'object', + 'additionalProperties' => [ + 'location' => 'json' + ] ] ] ]; diff --git a/src/Client/ServiceDescription/Stripe-v1.2.php b/src/Client/ServiceDescription/Stripe-v1.2.php new file mode 100644 index 0000000..0655a9a --- /dev/null +++ b/src/Client/ServiceDescription/Stripe-v1.2.php @@ -0,0 +1,3684 @@ + 'ZfrStripe\Exception\BadRequestException', + 'code' => 400 + ], + [ + 'class' => 'ZfrStripe\Exception\UnauthorizedException', + 'code' => 401 + ], + [ + 'class' => 'ZfrStripe\Exception\RequestFailedException', + 'code' => 402 + ], + [ + 'class' => 'ZfrStripe\Exception\NotFoundException', + 'code' => 404 + ], + [ + 'class' => 'ZfrStripe\Exception\ServerErrorException', + 'code' => 500 + ], + [ + 'class' => 'ZfrStripe\Exception\ServerErrorException', + 'code' => 502 + ], + [ + 'class' => 'ZfrStripe\Exception\ServerErrorException', + 'code' => 503 + ], + [ + 'class' => 'ZfrStripe\Exception\ServerErrorException', + 'code' => 504 + ] +]; + +return [ + 'name' => 'Stripe', + 'baseUrl' => 'https://api.stripe.com', + 'description' => 'Stripe is a payment system', + 'operations' => [ + /** + * -------------------------------------------------------------------------------- + * CHARGES RELATED METHODS + * + * DOC: https://stripe.com/docs/api#charges + * -------------------------------------------------------------------------------- + */ + + 'captureCharge' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/charges/{id}/capture', + 'summary' => 'Capture an existing charge', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the charge', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'amount' => [ + 'description' => 'Amount (in cents) to capture', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'receipt_email' => [ + 'description' => 'The email address to send this charge\'s receipt to', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'application_fee' => [ + 'description' => 'A fee in cents that will be applied to the charge and transferred to the application owner\'s Stripe account', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'createCharge' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/charges', + 'summary' => 'Create a new charge (either card or customer is needed)', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'amount' => [ + 'description' => 'Amount (in cents)', + 'location' => 'query', + 'type' => 'integer', + 'required' => true + ], + 'currency' => [ + 'description' => '3-letter ISO code for currency', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'customer' => [ + 'description' => 'Unique client identifier', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'card' => [ + 'description' => 'Unique card identifier (can either be an ID or a hash)', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'capture' => [ + 'description' => 'Whether or not to immediately capture the charge', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'description' => [ + 'description' => 'Optional description for the charge', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'statement_descriptor' => [ + 'description' => 'An arbitrary string to be displayed alongside your customer\'s credit card statement', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'receipt_email' => [ + 'description' => 'The email address to send this charge\'s receipt to', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'destination' => [ + 'description' => 'An account to make the charge on behalf of', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'application_fee' => [ + 'description' => 'A fee in cents that will be applied to the charge and transferred to the application owner\'s Stripe account', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'shipping' => [ + 'description' => 'Shipping information for the charge', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'getCharge' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/charges/{id}', + 'summary' => 'Get an existing charge', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the charge', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getCharges' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/charges', + 'summary' => 'Get existing charges', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many charges are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'created' => [ + 'description' => 'A filter based on the "created" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'customer' => [ + 'description' => 'Only return charges for a specific customer', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'paid' => [ + 'description' => 'Only return paid charges (true) or not paid (false) (CAUTION: this is not explicitly documented by Stripe)', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'refundCharge' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/charges/{id}/refunds', + 'summary' => 'Refund an existing charge', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the charge', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'amount' => [ + 'description' => 'Amount (in cents) - default to the whole charge', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'refund_application_fee' => [ + 'description' => 'Indicate whether the application fee should be refunded when refunding this charge', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'reason' => [ + 'description' => 'Specify a reason for the refund', + 'location' => 'query', + 'type' => 'string', + 'required' => false, + 'enum' => ['duplicate', 'fraudulent', 'requested_by_customer'] + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'updateCharge' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/charges/{id}', + 'summary' => 'Update an existing charge', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the charge to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'description' => [ + 'description' => 'Optional description for the charge', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * CUSTOMER RELATED METHODS + * + * DOC: https://stripe.com/docs/api#customers + * -------------------------------------------------------------------------------- + */ + + 'createCustomer' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/customers', + 'summary' => 'Create a new customer (either card or customer is needed)', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'account_balance' => [ + 'description' => 'An integer amount in cents that is the starting account balance for your customer', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'card' => [ + 'description' => 'Unique card identifier (can either be an ID or a hash)', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'coupon' => [ + 'description' => 'Optional coupon identifier that applies a discount on all recurring charges', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'plan' => [ + 'description' => 'Optional plan for the customer', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'quantity' => [ + 'description' => 'Quantity you\'d like to apply to the subscription you\'re creating', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'trial_end' => [ + 'description' => 'UTC integer timestamp representing the end of the trial period the customer will get before being charged for the first time', + 'location' => 'query', + 'type' => ['integer', 'string'], + 'required' => false + ], + 'description' => [ + 'description' => 'Optional description for the customer', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'email' => [ + 'description' => 'Optional customer\'s email address', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'deleteCustomer' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/customers/{id}', + 'summary' => 'Delete an existing customer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the customer', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getCustomer' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/customers/{id}', + 'summary' => 'Get an existing customer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the customer', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getCustomers' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/customers', + 'summary' => 'Get existing customers', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many customers are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'created' => [ + 'description' => 'A filter based on the "created" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'deleted' => [ + 'description' => 'Only return deleted customers (true) or other (false) (CAUTION: this is not explicitly documented by Stripe)', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateCustomer' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/customers/{id}', + 'summary' => 'Update an existing customer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the customer to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'account_balance' => [ + 'description' => 'An integer amount in cents that is the starting account balance for your customer', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'card' => [ + 'description' => 'Unique card identifier (can either be an ID or a hash)', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'coupon' => [ + 'description' => 'Optional coupon identifier that applies a discount on all recurring charges', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'description' => [ + 'description' => 'Optional description for the customer', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'email' => [ + 'description' => 'Optional customer\'s email address', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * CARD RELATED METHODS + * + * DOC: https://stripe.com/docs/api#cards + * -------------------------------------------------------------------------------- + */ + + 'createCard' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/customers/{customer}/cards', + 'summary' => 'Create a new card for a customer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Unique identifier of the customer', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'card' => [ + 'description' => 'Unique card identifier (can either be an ID or a hash)', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'deleteCard' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/customers/{customer}/cards/{id}', + 'summary' => 'Delete an existing customer\'s card', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the card to delete', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'customer' => [ + 'description' => 'Unique identifier of the customer to delete the card', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getCard' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/customers/{customer}/cards/{id}', + 'summary' => 'Get an existing customer\'s card', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the card to get', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'customer' => [ + 'description' => 'Unique identifier of the customer to get the card from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getCards' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/customers/{customer}/cards', + 'summary' => 'Get existing customers\'s cards', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Unique identifier of the customer to get the cards from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'limit' => [ + 'description' => 'Limit on how many cards are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateCard' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/customers/{customer}/cards/{id}', + 'summary' => 'Update an existing customer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the card to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'customer' => [ + 'description' => 'Unique identifier of the customer to get the card from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'address_city' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_country' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_line1' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_line2' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_state' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_zip' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'exp_month' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'exp_year' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'name' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * CARD RECIPIENTS RELATED METHODS + * + * DOC: https://stripe.com/docs/api#cards + * -------------------------------------------------------------------------------- + */ + + 'createRecipientCard' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/recipients/{recipient}/cards', + 'summary' => 'Create a new card for a recipient', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'recipient' => [ + 'description' => 'Unique identifier of the recipient', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'card' => [ + 'description' => 'Unique card identifier (can either be an ID or a hash)', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'deleteRecipientCard' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/recipients/{recipient}/cards/{id}', + 'summary' => 'Delete an existing recipients\'s card', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the card to delete', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'recipient' => [ + 'description' => 'Unique identifier of the recipient to delete the card', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getRecipientCard' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/recipients/{recipient}/cards/{id}', + 'summary' => 'Get an existing recipient\'s card', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the card to get', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'recipient' => [ + 'description' => 'Unique identifier of the recipient to get the card from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getRecipientCards' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/recipients/{recipient}/cards', + 'summary' => 'Get existing recipients\'s cards', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'recipient' => [ + 'description' => 'Unique identifier of the recipient to get the cards from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'limit' => [ + 'description' => 'Limit on how many cards are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateRecipientCard' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/recipients/{recipient}/cards/{id}', + 'summary' => 'Update an existing recipient\'s card', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the card to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'recipient' => [ + 'description' => 'Unique identifier of the recipient to get the card from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'address_city' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_country' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_line1' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_line2' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_state' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_zip' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'exp_month' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'exp_year' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'name' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * SUBSCRIPTION RELATED METHODS + * + * DOC: https://stripe.com/docs/api#subscriptions + * -------------------------------------------------------------------------------- + */ + + 'cancelSubscription' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/customers/{customer}/subscriptions/{id}', + 'summary' => 'Delete an existing customer\'s subscription', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the subscription to cancel', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'customer' => [ + 'description' => 'Unique identifier of the customer to delete the card', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'at_period_end' => [ + 'description' => 'A flag that if set to true will delay the cancellation of the subscription until the end of the current period.', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'createSubscription' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/customers/{customer}/subscriptions', + 'summary' => 'Create a customer\'s new subscription', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Unique identifier of the customer', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'plan' => [ + 'description' => 'Unique plan identifier', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'quantity' => [ + 'description' => 'Quantity you\'d like to apply to the subscription you\'re creating', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'card' => [ + 'description' => 'Unique card identifier (can either be an ID or a hash)', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'coupon' => [ + 'description' => 'Optional coupon identifier that applies a discount at the same time as creating the subscription', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'billing_cycle_anchor' => [ + 'description' => 'UTC integer timestamp that defines the date of the recurring billing cycle', + 'location' => 'query', + 'type' => ['integer', 'string'], + 'required' => false + ], + 'trial_end' => [ + 'description' => 'UTC integer timestamp representing the end of the trial period the customer will get before being charged for the first time', + 'location' => 'query', + 'type' => ['integer', 'string'], + 'required' => false + ], + 'application_fee_percent' => [ + 'description' => 'A positive decimal (with at most two decimal places) between 1 and 100 that represents the percentage of the subscription invoice amount due each billing period that will be transferred to the application owner’s Stripe account', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'tax_percent' => [ + 'description' => 'A positive decimal (with at most two decimal places) between 1 and 100 that represents the percentage of the subscription invoice subtotal that will be calculated and added as tax to the final amount each billing period', + 'location' => 'query', + 'type' => 'number', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'getSubscription' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/customers/{customer}/subscriptions/{id}', + 'summary' => 'Get an existing customer\'s active subscription', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the active subscription to get', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'customer' => [ + 'description' => 'Unique identifier of the customer to get the subscription from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getSubscriptions' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/customers/{customer}/subscriptions', + 'summary' => 'Get existing customers\'s active subscriptions', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Unique identifier of the customer to get the subscriptions from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'limit' => [ + 'description' => 'Limit on how many subscriptions are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateSubscription' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/customers/{customer}/subscriptions/{id}', + 'summary' => 'Update a customer\'s subscription', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the subscription to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'customer' => [ + 'description' => 'Unique identifier of the customer', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'plan' => [ + 'description' => 'Unique plan identifier', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'quantity' => [ + 'description' => 'Quantity you\'d like to apply to the subscription you\'re creating', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'card' => [ + 'description' => 'Unique card identifier (can either be an ID or a hash)', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'coupon' => [ + 'description' => 'Optional coupon identifier that applies a discount at the same time as creating the subscription', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'prorate' => [ + 'description' => 'Flag telling us whether to prorate switching plans during a billing cycle', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'billing_cycle_anchor' => [ + 'description' => 'UTC integer timestamp that defines the date of the recurring billing cycle', + 'location' => 'query', + 'type' => ['integer', 'string'], + 'required' => false + ], + 'trial_end' => [ + 'description' => 'UTC integer timestamp representing the end of the trial period the customer will get before being charged for the first time', + 'location' => 'query', + 'type' => ['integer', 'string'], + 'required' => false + ], + 'application_fee_percent' => [ + 'description' => 'A positive decimal (with at most two decimal places) between 1 and 100 that represents the percentage of the subscription invoice amount due each billing period that will be transferred to the application owner’s Stripe account', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'tax_percent' => [ + 'description' => 'A positive decimal (with at most two decimal places) between 1 and 100 that represents the percentage of the subscription invoice subtotal that will be calculated and added as tax to the final amount each billing period', + 'location' => 'query', + 'type' => 'number', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * PLAN RELATED METHODS + * + * DOC: https://stripe.com/docs/api#plans + * -------------------------------------------------------------------------------- + */ + + 'createPlan' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/plans', + 'summary' => 'Create a new plan', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique string to identify the plan', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'name' => [ + 'description' => 'Unique name of the plan', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'amount' => [ + 'description' => 'Amount (in cents)', + 'location' => 'query', + 'type' => 'integer', + 'required' => true + ], + 'currency' => [ + 'description' => '3-letter ISO code for currency', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'interval' => [ + 'description' => 'Specify the billing frequency', + 'location' => 'query', + 'type' => 'string', + 'required' => true, + 'enum' => ['day', 'week', 'month', 'year'] + ], + 'interval_count' => [ + 'description' => 'Number of interval between each subscription billing', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'trial_period_days' => [ + 'description' => 'Specifies a trial period in (an integer number of) days', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'statement_descriptor' => [ + 'description' => 'An arbitrary string to be displayed alongside your customer\'s credit card statement', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'deletePlan' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/plans/{id}', + 'summary' => 'Delete an existing plan', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the plan', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getPlan' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/plans/{id}', + 'summary' => 'Get an existing plan', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the plan', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getPlans' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/plans', + 'summary' => 'Get existing plans', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many plans are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updatePlan' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/plans/{id}', + 'summary' => 'Update an existing plan', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the plan to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'name' => [ + 'description' => 'Unique name of the plan', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'statement_descriptor' => [ + 'description' => 'An arbitrary string to be displayed alongside your customer\'s credit card statement', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * COUPON RELATED METHODS + * + * DOC: https://stripe.com/docs/api#coupons + * -------------------------------------------------------------------------------- + */ + + 'createCoupon' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/coupons', + 'summary' => 'Create a new coupon', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique string to identify the coupon (you can specify none and it will be auto-generated)', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'duration' => [ + 'description' => 'Specifies how long the discount will be in effect (can be "forever", "once" or "repeating")', + 'location' => 'query', + 'type' => 'string', + 'required' => true, + 'enum' => ['forever', 'once', 'repeating'] + ], + 'amount_off' => [ + 'description' => 'A positive integer representing the amount to subtract from an invoice total (required if "percent_off" is not passed)', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'currency' => [ + 'description' => 'Currency of the amount_off parameter (required if "amount_off" is passed)', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'duration_in_months' => [ + 'description' => 'If "duration" is repeating, a positive integer that specifies the number of months the discount will be in effect', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'max_redemptions' => [ + 'description' => 'A positive integer specifying the number of times the coupon can be redeemed before it\'s no longer valid', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'percent_off' => [ + 'description' => 'A positive integer between 1 and 100 that represents the discount the coupon will apply (required if amount_off is not passed)', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'redeem_by' => [ + 'description' => 'UTC timestamp specifying the last time at which the coupon can be redeemed', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'deleteCoupon' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/coupons/{id}', + 'summary' => 'Delete an existing coupon', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the coupon', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getCoupon' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/coupons/{id}', + 'summary' => 'Get an existing coupon', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the plan', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getCoupons' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/coupons/{id}', + 'summary' => 'Get existing plans', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many coupons are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateCoupon' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/coupons/{id}', + 'summary' => 'Update an existing coupon', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the coupon to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * DISCOUNT RELATED METHODS + * + * DOC: https://stripe.com/docs/api#discounts + * -------------------------------------------------------------------------------- + */ + + 'deleteCustomerDiscount' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/customers/{customer}/discount', + 'summary' => 'Delete a customer wide discount', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Unique identifier of the customer to delete the discount from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'deleteSubscriptionDiscount' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/customers/{customer}/subscriptions/{subscription}/discount', + 'summary' => 'Delete a discount applied on a subscription', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Unique identifier of the customer to delete the discount from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'subscription' => [ + 'description' => 'Unique identifier of the subscription to delete the discount from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * INVOICE RELATED METHODS + * + * DOC: https://stripe.com/docs/api#invoices + * -------------------------------------------------------------------------------- + */ + + 'createInvoice' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/invoices', + 'summary' => 'Create a new invoice', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Unique string to identify the plan', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'subscription' => [ + 'description' => 'Identifier of the subscription to invoice', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'description' => [ + 'description' => 'Optional description for the invoice', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'statement_descriptor' => [ + 'description' => 'Extra information about a charge for the customer\'s credit card statement', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'application_fee' => [ + 'description' => 'A fee in cents that will be applied to the invoice and transferred to the application owner\'s Stripe account', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'getInvoice' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/invoices/{id}', + 'summary' => 'Get an existing invoice', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the invoice', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getInvoiceLineItems' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/invoices/{invoice}/lines', + 'summary' => 'Get an existing invoice line items', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'invoice' => [ + 'description' => 'Unique identifier of the invoice to retrieve invoice items from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'customer' => [ + 'description' => 'Only return invoice line items for a specific customer', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'subscription' => [ + 'description' => 'In the case of upcoming invoices, the subscription is optional. Otherwise it is ignored', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'limit' => [ + 'description' => 'Limit on how many invoice line items are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getInvoices' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/invoices', + 'summary' => 'Get existing invoices', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many invoices are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'date' => [ + 'description' => 'A filter based on the "date" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'customer' => [ + 'description' => 'Only return invoices for a specific customer', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getUpcomingInvoice' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/invoices/upcoming', + 'summary' => 'Get upcoming invoices', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Only return upcoming invoices for a specific customer', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'subscription' => [ + 'description' => 'The identifier of the subscription for which you\'d like to retrieve the upcoming invoice', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getUpcomingInvoiceLineItems' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/invoices/upcoming/lines', + 'summary' => 'Get an existing invoice line items', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Only return invoice line items for a specific customer', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'subscription' => [ + 'description' => 'In the case of upcoming invoices, the subscription is optional. Otherwise it is ignored', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'limit' => [ + 'description' => 'Limit on how many invoice line items are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'payInvoice' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/invoices/{id}/pay', + 'summary' => 'Pay an existing invoice', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the invoice to pay', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'updateInvoice' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/invoices/{id}', + 'summary' => 'Update an existing invoice', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the invoice to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'description' => [ + 'description' => 'Optional description for the invoice', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'statement_descriptor' => [ + 'description' => 'Extra information about a charge for the customer\'s credit card statement', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'forgiven' => [ + 'description' => 'Whether an invoice is forgiven or not', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'application_fee' => [ + 'description' => 'A fee in cents that will be applied to the invoice and transferred to the application owner\'s Stripe account', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'closed' => [ + 'description' => 'Boolean representing whether an invoice is closed or not', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * INVOICE ITEM RELATED METHODS + * + * DOC: https://stripe.com/docs/api#invoiceitems + * -------------------------------------------------------------------------------- + */ + + 'createInvoiceItem' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/invoiceitems', + 'summary' => 'Create a new invoice item', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'ID of the customer who will be billed when this invoice item is billed', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'amount' => [ + 'description' => 'Amount (in cents)', + 'location' => 'query', + 'type' => 'integer', + 'required' => true + ], + 'currency' => [ + 'description' => '3-letter ISO code for currency', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'invoice' => [ + 'description' => 'Identifier of an existing invoice to add this invoice item to', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'subscription' => [ + 'description' => 'Identifier of a subscription to add this invoice item to', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'description' => [ + 'description' => 'Optional description to add', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'discountable' => [ + 'description' => 'Controls whether discounts apply to this invoice item', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'deleteInvoiceItem' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/invoiceitems/{id}', + 'summary' => 'Delete an existing invoice item', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the invoice item', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getInvoiceItem' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/invoiceitems/{id}', + 'summary' => 'Get an existing invoice item', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the invoice item', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getInvoiceItems' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/invoiceitems', + 'summary' => 'Get existing invoice items', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many invoice items are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'created' => [ + 'description' => 'A filter based on the "date" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'required' => false + ], + 'customer' => [ + 'description' => 'Only return invoices for a specific customer', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'proration' => [ + 'description' => 'Only return proration item (true) or other (false) (CAUTION: this is not explicitly documented by Stripe)', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateInvoiceItem' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/invoiceitems/{id}', + 'summary' => 'Update an existing invoice item', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the invoice item to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'description' => [ + 'description' => 'Optional description', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'discountable' => [ + 'description' => 'Controls whether discounts apply to this invoice item', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * DISPUTE RELATED METHODS + * + * DOC: https://stripe.com/docs/api#disputes + * -------------------------------------------------------------------------------- + */ + + 'closeDispute' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/charges/{charge}/dispute/close', + 'summary' => 'Close a dispute', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'charge' => [ + 'description' => 'ID of the charge to close the dispute', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'updateDispute' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/charges/{charge}/dispute', + 'summary' => 'Update a dispute', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'charge' => [ + 'description' => 'ID of the charge to update the dispute', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'evidence' => [ + 'description' => 'Evidence hash', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * TRANSFER RELATED METHODS + * + * DOC: https://stripe.com/docs/api#transfers + * -------------------------------------------------------------------------------- + */ + + 'cancelTransfer' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/transfers/{id}/cancel', + 'summary' => 'Cancel an existing transfer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the transfer', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'createTransfer' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/transfers', + 'summary' => 'Create a new transfer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'amount' => [ + 'description' => 'Amount (in cents)', + 'location' => 'query', + 'type' => 'integer', + 'required' => true + ], + 'currency' => [ + 'description' => '3-letter ISO code for currency', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'recipient' => [ + 'description' => 'ID of an existing, verified recipient', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'description' => [ + 'description' => 'Optional description to add', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'statement_descriptor' => [ + 'description' => 'An arbitrary string which will be displayed on the recipient\'s bank statement', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'getTransfer' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/transfers/{id}', + 'summary' => 'Get an existing transfer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the transfer', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getTransfers' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/transfers', + 'summary' => 'Get existing transfers', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many transfers are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'date' => [ + 'description' => 'A filter based on the "date" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'required' => false + ], + 'recipient' => [ + 'description' => 'Only return transfers for a specific recipient', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'status' => [ + 'description' => 'Optionally filter by status', + 'location' => 'query', + 'type' => 'string', + 'required' => false, + 'enum' => ['pending', 'paid', 'failed'] + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateTransfer' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/transfers/{id}', + 'summary' => 'Update an existing transfer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the transfer to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'description' => [ + 'description' => 'Optional description', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * RECIPIENT RELATED METHODS + * + * DOC: https://stripe.com/docs/api#recipients + * -------------------------------------------------------------------------------- + */ + + 'createRecipient' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/recipients', + 'summary' => 'Create a new recipient', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'name' => [ + 'description' => 'The recipient\'s full, legal name', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'type' => [ + 'description' => 'Type of the recipient (can be "individual" or "corporation")', + 'location' => 'query', + 'type' => 'string', + 'required' => true, + 'enum' => ['individual', 'corporation'] + ], + 'tax_id' => [ + 'description' => 'The recipient\'s tax ID, as a string', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'bank_account' => [ + 'description' => 'A bank account to attach to the recipient', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'email' => [ + 'description' => 'The recipient\'s email address', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'description' => [ + 'description' => 'Optional description to add', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'deleteRecipient' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/recipients/{id}', + 'summary' => 'Delete an existing recipient', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the recipient', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getRecipient' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/recipients/{id}', + 'summary' => 'Get an existing recipient', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the recipient', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getRecipients' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/recipients', + 'summary' => 'Get existing recipients', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many recipients are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'verified' => [ + 'description' => 'Boolean to only return recipients that are verified or unverified', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateRecipient' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/recipients/{id}', + 'summary' => 'Update an existing recipient', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the recipient to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'name' => [ + 'description' => 'The recipient\'s full, legal name', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'tax_id' => [ + 'description' => 'The recipient\'s tax ID, as a string', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'bank_account' => [ + 'description' => 'A bank account to attach to the recipient', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'email' => [ + 'description' => 'The recipient\'s email address', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'description' => [ + 'description' => 'Optional description to add', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * REFUND RELATED METHODS + * + * DOC: https://stripe.com/docs/api#refunds + * -------------------------------------------------------------------------------- + */ + + 'getRefund' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/charges/{charge}/refunds/{id}', + 'summary' => 'Get an existing refund', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the refund', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'charge' => [ + 'description' => 'Unique identifier of the charge to get the refund from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getRefunds' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/charges/{charge}/refunds', + 'summary' => 'Get existing refunds for a given charge', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'charge' => [ + 'description' => 'Charge to get the refunds from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'limit' => [ + 'description' => 'Limit on how many charges are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateRefund' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/charges/{charge}/refunds/{id}', + 'summary' => 'Update an existing charge', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the refund to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'charge' => [ + 'description' => 'Charge to get the refunds from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * APPLICATION FEE RELATED METHODS + * + * DOC: https://stripe.com/docs/api#application_fees + * -------------------------------------------------------------------------------- + */ + + 'getApplicationFee' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/application_fees/{id}', + 'summary' => 'Get details about an application fee that your account has collected', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the application fee', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getApplicationFees' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/application_fees', + 'summary' => 'Get details about all application fees that your account has collected', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many application fees are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'created' => [ + 'description' => 'A filter based on the "created" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'charge' => [ + 'description' => 'Only return application fees for a given charge', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'refundApplicationFee' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/application_fees/{id}/refunds', + 'summary' => 'Refund an application fee that has previously been collected but not yet refunded', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of application fee to be refunded', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'amount' => [ + 'description' => 'A positive integer in cents representing how many of this fee to refund', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * APPLICATION FEE REFUND RELATED METHODS + * + * DOC: https://stripe.com/docs/api#fee_refunds + * -------------------------------------------------------------------------------- + */ + + 'getApplicationFeeRefund' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/application_fees/{fee}/refunds/{id}', + 'summary' => 'Get details about an application fee refund', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the application fee refund', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'fee' => [ + 'description' => 'Unique identifier of the application fee that was refunded', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getApplicationFeeRefunds' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/application_fees/{fee}/refunds', + 'summary' => 'Get details about all application fee refunds', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'fee' => [ + 'description' => 'Unique identifier of the application fee we want refunds', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'limit' => [ + 'description' => 'Limit on how many application fee refunds are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateApplicationFeeRefund' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/application_fees/{fee}/refunds/{id}', + 'summary' => 'Update an application fee refund', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of application fee refund', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'fee' => [ + 'description' => 'Unique identifier of the application fee refund to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * BALANCE RELATED METHODS + * + * DOC: https://stripe.com/docs/api#balance + * -------------------------------------------------------------------------------- + */ + + 'getAccountBalance' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/balance', + 'summary' => 'Get the current account balance', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getBalanceTransaction' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/balance/history/{id}', + 'summary' => 'Get an existing balance transaction by its id', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the balance transaction to get', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getBalanceTransactions' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/balance/history', + 'summary' => 'Get all the balance transactions', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many application fees are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'available_on' => [ + 'description' => 'A filter based on the "available_on" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'created' => [ + 'description' => 'A filter based on the "created" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'currency' => [ + 'description' => 'Filter for currency', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'source' => [ + 'description' => 'Filter balance transactions using a specific source id (for example a charge id)', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'transfer' => [ + 'description' => 'For automatic Stripe transfers only, only returns transactions that were transferred out on the specified transfer ID', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'type' => [ + 'description' => 'Only returns transactions of the given type', + 'location' => 'query', + 'type' => 'string', + 'required' => false, + 'enum' => [ + 'adjustment', 'application_fee', 'charge', 'fee_refund', 'refund', 'transfer', 'transfer_failure' + ] + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * TOKEN RELATED METHODS + * + * DOC: https://stripe.com/docs/api#tokens + * -------------------------------------------------------------------------------- + */ + + 'createCardToken' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/tokens', + 'summary' => 'Create a new card token (note you must either specify card OR customer but not both)', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'card' => [ + 'description' => 'Unique card identifier (can either be an ID or a hash)', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'customer' => [ + 'description' => 'A customer (owned by the application\'s account) to create a token for', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'createBankAccountToken' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/tokens', + 'summary' => 'Create a bank account token', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'bank_account' => [ + 'description' => 'A bank account to attach to the recipient', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'getToken' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/tokens/{id}', + 'summary' => 'Get details about an existing token', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the token', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * EVENT RELATED METHODS + * + * DOC: https://stripe.com/docs/api#events + * -------------------------------------------------------------------------------- + */ + + 'getEvent' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/events/{id}', + 'summary' => 'Get details about an event', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the event', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getEvents' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/events', + 'summary' => 'Get details about all events (up to 30 days)', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many events are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'created' => [ + 'description' => 'A filter based on the "created" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'type' => [ + 'description' => 'Allow to filter events by type', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'object_id' => [ + 'description' => 'Allow to filter by customer (CAUTION: this is not explicitly documented by Stripe)', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * ACCOUNT RELATED METHODS + * + * DOC: https://stripe.com/docs/api#account + * -------------------------------------------------------------------------------- + */ + + 'getAccount' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/account', + 'summary' => 'Get details about the account', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse' + ] + ], + 'models' => [ + 'getResponse' => [ + 'type' => 'object', + 'additionalProperties' => [ + 'location' => 'json' + ] + ] + ] +]; diff --git a/src/Client/ServiceDescription/Stripe-v1.3.php b/src/Client/ServiceDescription/Stripe-v1.3.php new file mode 100644 index 0000000..6bae2ad --- /dev/null +++ b/src/Client/ServiceDescription/Stripe-v1.3.php @@ -0,0 +1,3684 @@ + 'ZfrStripe\Exception\BadRequestException', + 'code' => 400 + ], + [ + 'class' => 'ZfrStripe\Exception\UnauthorizedException', + 'code' => 401 + ], + [ + 'class' => 'ZfrStripe\Exception\RequestFailedException', + 'code' => 402 + ], + [ + 'class' => 'ZfrStripe\Exception\NotFoundException', + 'code' => 404 + ], + [ + 'class' => 'ZfrStripe\Exception\ServerErrorException', + 'code' => 500 + ], + [ + 'class' => 'ZfrStripe\Exception\ServerErrorException', + 'code' => 502 + ], + [ + 'class' => 'ZfrStripe\Exception\ServerErrorException', + 'code' => 503 + ], + [ + 'class' => 'ZfrStripe\Exception\ServerErrorException', + 'code' => 504 + ] +]; + +return [ + 'name' => 'Stripe', + 'baseUrl' => 'https://api.stripe.com', + 'description' => 'Stripe is a payment system', + 'operations' => [ + /** + * -------------------------------------------------------------------------------- + * CHARGES RELATED METHODS + * + * DOC: https://stripe.com/docs/api#charges + * -------------------------------------------------------------------------------- + */ + + 'captureCharge' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/charges/{id}/capture', + 'summary' => 'Capture an existing charge', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the charge', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'amount' => [ + 'description' => 'Amount (in cents) to capture', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'receipt_email' => [ + 'description' => 'The email address to send this charge\'s receipt to', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'application_fee' => [ + 'description' => 'A fee in cents that will be applied to the charge and transferred to the application owner\'s Stripe account', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'createCharge' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/charges', + 'summary' => 'Create a new charge (either card or customer is needed)', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'amount' => [ + 'description' => 'Amount (in cents)', + 'location' => 'query', + 'type' => 'integer', + 'required' => true + ], + 'currency' => [ + 'description' => '3-letter ISO code for currency', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'customer' => [ + 'description' => 'Unique client identifier', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'source' => [ + 'description' => 'Unique source identifier (can either be an ID or a hash)', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'capture' => [ + 'description' => 'Whether or not to immediately capture the charge', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'description' => [ + 'description' => 'Optional description for the charge', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'statement_descriptor' => [ + 'description' => 'An arbitrary string to be displayed alongside your customer\'s credit card statement', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'receipt_email' => [ + 'description' => 'The email address to send this charge\'s receipt to', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'destination' => [ + 'description' => 'An account to make the charge on behalf of', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'application_fee' => [ + 'description' => 'A fee in cents that will be applied to the charge and transferred to the application owner\'s Stripe account', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'shipping' => [ + 'description' => 'Shipping information for the charge', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'getCharge' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/charges/{id}', + 'summary' => 'Get an existing charge', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the charge', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getCharges' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/charges', + 'summary' => 'Get existing charges', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many charges are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'created' => [ + 'description' => 'A filter based on the "created" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'customer' => [ + 'description' => 'Only return charges for a specific customer', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'paid' => [ + 'description' => 'Only return paid charges (true) or not paid (false) (CAUTION: this is not explicitly documented by Stripe)', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'refundCharge' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/charges/{id}/refunds', + 'summary' => 'Refund an existing charge', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the charge', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'amount' => [ + 'description' => 'Amount (in cents) - default to the whole charge', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'refund_application_fee' => [ + 'description' => 'Indicate whether the application fee should be refunded when refunding this charge', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'reason' => [ + 'description' => 'Specify a reason for the refund', + 'location' => 'query', + 'type' => 'string', + 'required' => false, + 'enum' => ['duplicate', 'fraudulent', 'requested_by_customer'] + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'updateCharge' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/charges/{id}', + 'summary' => 'Update an existing charge', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the charge to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'description' => [ + 'description' => 'Optional description for the charge', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * CUSTOMER RELATED METHODS + * + * DOC: https://stripe.com/docs/api#customers + * -------------------------------------------------------------------------------- + */ + + 'createCustomer' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/customers', + 'summary' => 'Create a new customer (either card or customer is needed)', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'account_balance' => [ + 'description' => 'An integer amount in cents that is the starting account balance for your customer', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'source' => [ + 'description' => 'Unique source identifier (can either be an ID or a hash)', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'coupon' => [ + 'description' => 'Optional coupon identifier that applies a discount on all recurring charges', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'plan' => [ + 'description' => 'Optional plan for the customer', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'quantity' => [ + 'description' => 'Quantity you\'d like to apply to the subscription you\'re creating', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'trial_end' => [ + 'description' => 'UTC integer timestamp representing the end of the trial period the customer will get before being charged for the first time', + 'location' => 'query', + 'type' => ['integer', 'string'], + 'required' => false + ], + 'description' => [ + 'description' => 'Optional description for the customer', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'email' => [ + 'description' => 'Optional customer\'s email address', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'deleteCustomer' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/customers/{id}', + 'summary' => 'Delete an existing customer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the customer', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getCustomer' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/customers/{id}', + 'summary' => 'Get an existing customer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the customer', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getCustomers' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/customers', + 'summary' => 'Get existing customers', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many customers are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'created' => [ + 'description' => 'A filter based on the "created" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'deleted' => [ + 'description' => 'Only return deleted customers (true) or other (false) (CAUTION: this is not explicitly documented by Stripe)', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateCustomer' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/customers/{id}', + 'summary' => 'Update an existing customer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the customer to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'account_balance' => [ + 'description' => 'An integer amount in cents that is the starting account balance for your customer', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'source' => [ + 'description' => 'Unique source identifier (can either be an ID or a hash)', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'coupon' => [ + 'description' => 'Optional coupon identifier that applies a discount on all recurring charges', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'description' => [ + 'description' => 'Optional description for the customer', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'email' => [ + 'description' => 'Optional customer\'s email address', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * CARD RELATED METHODS + * + * DOC: https://stripe.com/docs/api#cards + * -------------------------------------------------------------------------------- + */ + + 'createCard' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/customers/{customer}/cards', + 'summary' => 'Create a new card for a customer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Unique identifier of the customer', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'card' => [ + 'description' => 'Unique card identifier (can either be an ID or a hash)', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'deleteCard' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/customers/{customer}/cards/{id}', + 'summary' => 'Delete an existing customer\'s card', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the card to delete', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'customer' => [ + 'description' => 'Unique identifier of the customer to delete the card', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getCard' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/customers/{customer}/cards/{id}', + 'summary' => 'Get an existing customer\'s card', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the card to get', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'customer' => [ + 'description' => 'Unique identifier of the customer to get the card from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getCards' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/customers/{customer}/cards', + 'summary' => 'Get existing customers\'s cards', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Unique identifier of the customer to get the cards from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'limit' => [ + 'description' => 'Limit on how many cards are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateCard' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/customers/{customer}/cards/{id}', + 'summary' => 'Update an existing customer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the card to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'customer' => [ + 'description' => 'Unique identifier of the customer to get the card from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'address_city' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_country' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_line1' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_line2' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_state' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_zip' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'exp_month' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'exp_year' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'name' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * CARD RECIPIENTS RELATED METHODS + * + * DOC: https://stripe.com/docs/api#cards + * -------------------------------------------------------------------------------- + */ + + 'createRecipientCard' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/recipients/{recipient}/cards', + 'summary' => 'Create a new card for a recipient', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'recipient' => [ + 'description' => 'Unique identifier of the recipient', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'card' => [ + 'description' => 'Unique card identifier (can either be an ID or a hash)', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'deleteRecipientCard' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/recipients/{recipient}/cards/{id}', + 'summary' => 'Delete an existing recipients\'s card', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the card to delete', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'recipient' => [ + 'description' => 'Unique identifier of the recipient to delete the card', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getRecipientCard' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/recipients/{recipient}/cards/{id}', + 'summary' => 'Get an existing recipient\'s card', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the card to get', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'recipient' => [ + 'description' => 'Unique identifier of the recipient to get the card from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getRecipientCards' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/recipients/{recipient}/cards', + 'summary' => 'Get existing recipients\'s cards', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'recipient' => [ + 'description' => 'Unique identifier of the recipient to get the cards from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'limit' => [ + 'description' => 'Limit on how many cards are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateRecipientCard' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/recipients/{recipient}/cards/{id}', + 'summary' => 'Update an existing recipient\'s card', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the card to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'recipient' => [ + 'description' => 'Unique identifier of the recipient to get the card from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'address_city' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_country' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_line1' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_line2' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_state' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'address_zip' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'exp_month' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'exp_year' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'name' => [ + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * SUBSCRIPTION RELATED METHODS + * + * DOC: https://stripe.com/docs/api#subscriptions + * -------------------------------------------------------------------------------- + */ + + 'cancelSubscription' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/customers/{customer}/subscriptions/{id}', + 'summary' => 'Delete an existing customer\'s subscription', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the subscription to cancel', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'customer' => [ + 'description' => 'Unique identifier of the customer to delete the card', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'at_period_end' => [ + 'description' => 'A flag that if set to true will delay the cancellation of the subscription until the end of the current period.', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'createSubscription' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/customers/{customer}/subscriptions', + 'summary' => 'Create a customer\'s new subscription', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Unique identifier of the customer', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'plan' => [ + 'description' => 'Unique plan identifier', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'quantity' => [ + 'description' => 'Quantity you\'d like to apply to the subscription you\'re creating', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'card' => [ + 'description' => 'Unique card identifier (can either be an ID or a hash)', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'coupon' => [ + 'description' => 'Optional coupon identifier that applies a discount at the same time as creating the subscription', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'billing_cycle_anchor' => [ + 'description' => 'UTC integer timestamp that defines the date of the recurring billing cycle', + 'location' => 'query', + 'type' => ['integer', 'string'], + 'required' => false + ], + 'trial_end' => [ + 'description' => 'UTC integer timestamp representing the end of the trial period the customer will get before being charged for the first time', + 'location' => 'query', + 'type' => ['integer', 'string'], + 'required' => false + ], + 'application_fee_percent' => [ + 'description' => 'A positive decimal (with at most two decimal places) between 1 and 100 that represents the percentage of the subscription invoice amount due each billing period that will be transferred to the application owner’s Stripe account', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'tax_percent' => [ + 'description' => 'A positive decimal (with at most two decimal places) between 1 and 100 that represents the percentage of the subscription invoice subtotal that will be calculated and added as tax to the final amount each billing period', + 'location' => 'query', + 'type' => 'number', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'getSubscription' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/customers/{customer}/subscriptions/{id}', + 'summary' => 'Get an existing customer\'s active subscription', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the active subscription to get', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'customer' => [ + 'description' => 'Unique identifier of the customer to get the subscription from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getSubscriptions' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/customers/{customer}/subscriptions', + 'summary' => 'Get existing customers\'s active subscriptions', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Unique identifier of the customer to get the subscriptions from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'limit' => [ + 'description' => 'Limit on how many subscriptions are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateSubscription' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/customers/{customer}/subscriptions/{id}', + 'summary' => 'Update a customer\'s subscription', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the subscription to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'customer' => [ + 'description' => 'Unique identifier of the customer', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'plan' => [ + 'description' => 'Unique plan identifier', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'quantity' => [ + 'description' => 'Quantity you\'d like to apply to the subscription you\'re creating', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'card' => [ + 'description' => 'Unique card identifier (can either be an ID or a hash)', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'coupon' => [ + 'description' => 'Optional coupon identifier that applies a discount at the same time as creating the subscription', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'prorate' => [ + 'description' => 'Flag telling us whether to prorate switching plans during a billing cycle', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'billing_cycle_anchor' => [ + 'description' => 'UTC integer timestamp that defines the date of the recurring billing cycle', + 'location' => 'query', + 'type' => ['integer', 'string'], + 'required' => false + ], + 'trial_end' => [ + 'description' => 'UTC integer timestamp representing the end of the trial period the customer will get before being charged for the first time', + 'location' => 'query', + 'type' => ['integer', 'string'], + 'required' => false + ], + 'application_fee_percent' => [ + 'description' => 'A positive decimal (with at most two decimal places) between 1 and 100 that represents the percentage of the subscription invoice amount due each billing period that will be transferred to the application owner’s Stripe account', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'tax_percent' => [ + 'description' => 'A positive decimal (with at most two decimal places) between 1 and 100 that represents the percentage of the subscription invoice subtotal that will be calculated and added as tax to the final amount each billing period', + 'location' => 'query', + 'type' => 'number', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * PLAN RELATED METHODS + * + * DOC: https://stripe.com/docs/api#plans + * -------------------------------------------------------------------------------- + */ + + 'createPlan' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/plans', + 'summary' => 'Create a new plan', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique string to identify the plan', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'name' => [ + 'description' => 'Unique name of the plan', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'amount' => [ + 'description' => 'Amount (in cents)', + 'location' => 'query', + 'type' => 'integer', + 'required' => true + ], + 'currency' => [ + 'description' => '3-letter ISO code for currency', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'interval' => [ + 'description' => 'Specify the billing frequency', + 'location' => 'query', + 'type' => 'string', + 'required' => true, + 'enum' => ['day', 'week', 'month', 'year'] + ], + 'interval_count' => [ + 'description' => 'Number of interval between each subscription billing', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'trial_period_days' => [ + 'description' => 'Specifies a trial period in (an integer number of) days', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'statement_descriptor' => [ + 'description' => 'An arbitrary string to be displayed alongside your customer\'s credit card statement', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'deletePlan' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/plans/{id}', + 'summary' => 'Delete an existing plan', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the plan', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getPlan' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/plans/{id}', + 'summary' => 'Get an existing plan', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the plan', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getPlans' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/plans', + 'summary' => 'Get existing plans', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many plans are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updatePlan' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/plans/{id}', + 'summary' => 'Update an existing plan', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the plan to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'name' => [ + 'description' => 'Unique name of the plan', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'statement_descriptor' => [ + 'description' => 'An arbitrary string to be displayed alongside your customer\'s credit card statement', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * COUPON RELATED METHODS + * + * DOC: https://stripe.com/docs/api#coupons + * -------------------------------------------------------------------------------- + */ + + 'createCoupon' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/coupons', + 'summary' => 'Create a new coupon', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique string to identify the coupon (you can specify none and it will be auto-generated)', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'duration' => [ + 'description' => 'Specifies how long the discount will be in effect (can be "forever", "once" or "repeating")', + 'location' => 'query', + 'type' => 'string', + 'required' => true, + 'enum' => ['forever', 'once', 'repeating'] + ], + 'amount_off' => [ + 'description' => 'A positive integer representing the amount to subtract from an invoice total (required if "percent_off" is not passed)', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'currency' => [ + 'description' => 'Currency of the amount_off parameter (required if "amount_off" is passed)', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'duration_in_months' => [ + 'description' => 'If "duration" is repeating, a positive integer that specifies the number of months the discount will be in effect', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'max_redemptions' => [ + 'description' => 'A positive integer specifying the number of times the coupon can be redeemed before it\'s no longer valid', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'percent_off' => [ + 'description' => 'A positive integer between 1 and 100 that represents the discount the coupon will apply (required if amount_off is not passed)', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'redeem_by' => [ + 'description' => 'UTC timestamp specifying the last time at which the coupon can be redeemed', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'deleteCoupon' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/coupons/{id}', + 'summary' => 'Delete an existing coupon', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the coupon', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getCoupon' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/coupons/{id}', + 'summary' => 'Get an existing coupon', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the plan', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getCoupons' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/coupons/{id}', + 'summary' => 'Get existing plans', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many coupons are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateCoupon' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/coupons/{id}', + 'summary' => 'Update an existing coupon', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the coupon to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * DISCOUNT RELATED METHODS + * + * DOC: https://stripe.com/docs/api#discounts + * -------------------------------------------------------------------------------- + */ + + 'deleteCustomerDiscount' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/customers/{customer}/discount', + 'summary' => 'Delete a customer wide discount', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Unique identifier of the customer to delete the discount from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'deleteSubscriptionDiscount' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/customers/{customer}/subscriptions/{subscription}/discount', + 'summary' => 'Delete a discount applied on a subscription', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Unique identifier of the customer to delete the discount from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'subscription' => [ + 'description' => 'Unique identifier of the subscription to delete the discount from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * INVOICE RELATED METHODS + * + * DOC: https://stripe.com/docs/api#invoices + * -------------------------------------------------------------------------------- + */ + + 'createInvoice' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/invoices', + 'summary' => 'Create a new invoice', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Unique string to identify the plan', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'subscription' => [ + 'description' => 'Identifier of the subscription to invoice', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'description' => [ + 'description' => 'Optional description for the invoice', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'statement_descriptor' => [ + 'description' => 'Extra information about a charge for the customer\'s credit card statement', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'application_fee' => [ + 'description' => 'A fee in cents that will be applied to the invoice and transferred to the application owner\'s Stripe account', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'getInvoice' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/invoices/{id}', + 'summary' => 'Get an existing invoice', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the invoice', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getInvoiceLineItems' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/invoices/{invoice}/lines', + 'summary' => 'Get an existing invoice line items', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'invoice' => [ + 'description' => 'Unique identifier of the invoice to retrieve invoice items from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'customer' => [ + 'description' => 'Only return invoice line items for a specific customer', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'subscription' => [ + 'description' => 'In the case of upcoming invoices, the subscription is optional. Otherwise it is ignored', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'limit' => [ + 'description' => 'Limit on how many invoice line items are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getInvoices' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/invoices', + 'summary' => 'Get existing invoices', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many invoices are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'date' => [ + 'description' => 'A filter based on the "date" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'customer' => [ + 'description' => 'Only return invoices for a specific customer', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getUpcomingInvoice' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/invoices/upcoming', + 'summary' => 'Get upcoming invoices', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Only return upcoming invoices for a specific customer', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'subscription' => [ + 'description' => 'The identifier of the subscription for which you\'d like to retrieve the upcoming invoice', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getUpcomingInvoiceLineItems' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/invoices/upcoming/lines', + 'summary' => 'Get an existing invoice line items', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'Only return invoice line items for a specific customer', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'subscription' => [ + 'description' => 'In the case of upcoming invoices, the subscription is optional. Otherwise it is ignored', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'limit' => [ + 'description' => 'Limit on how many invoice line items are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'payInvoice' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/invoices/{id}/pay', + 'summary' => 'Pay an existing invoice', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the invoice to pay', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'updateInvoice' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/invoices/{id}', + 'summary' => 'Update an existing invoice', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the invoice to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'description' => [ + 'description' => 'Optional description for the invoice', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'statement_descriptor' => [ + 'description' => 'Extra information about a charge for the customer\'s credit card statement', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'forgiven' => [ + 'description' => 'Whether an invoice is forgiven or not', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'application_fee' => [ + 'description' => 'A fee in cents that will be applied to the invoice and transferred to the application owner\'s Stripe account', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'closed' => [ + 'description' => 'Boolean representing whether an invoice is closed or not', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * INVOICE ITEM RELATED METHODS + * + * DOC: https://stripe.com/docs/api#invoiceitems + * -------------------------------------------------------------------------------- + */ + + 'createInvoiceItem' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/invoiceitems', + 'summary' => 'Create a new invoice item', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'customer' => [ + 'description' => 'ID of the customer who will be billed when this invoice item is billed', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'amount' => [ + 'description' => 'Amount (in cents)', + 'location' => 'query', + 'type' => 'integer', + 'required' => true + ], + 'currency' => [ + 'description' => '3-letter ISO code for currency', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'invoice' => [ + 'description' => 'Identifier of an existing invoice to add this invoice item to', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'subscription' => [ + 'description' => 'Identifier of a subscription to add this invoice item to', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'description' => [ + 'description' => 'Optional description to add', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'discountable' => [ + 'description' => 'Controls whether discounts apply to this invoice item', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'deleteInvoiceItem' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/invoiceitems/{id}', + 'summary' => 'Delete an existing invoice item', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the invoice item', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getInvoiceItem' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/invoiceitems/{id}', + 'summary' => 'Get an existing invoice item', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the invoice item', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getInvoiceItems' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/invoiceitems', + 'summary' => 'Get existing invoice items', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many invoice items are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'created' => [ + 'description' => 'A filter based on the "date" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'required' => false + ], + 'customer' => [ + 'description' => 'Only return invoices for a specific customer', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'proration' => [ + 'description' => 'Only return proration item (true) or other (false) (CAUTION: this is not explicitly documented by Stripe)', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateInvoiceItem' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/invoiceitems/{id}', + 'summary' => 'Update an existing invoice item', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the invoice item to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'description' => [ + 'description' => 'Optional description', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'discountable' => [ + 'description' => 'Controls whether discounts apply to this invoice item', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * DISPUTE RELATED METHODS + * + * DOC: https://stripe.com/docs/api#disputes + * -------------------------------------------------------------------------------- + */ + + 'closeDispute' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/charges/{charge}/dispute/close', + 'summary' => 'Close a dispute', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'charge' => [ + 'description' => 'ID of the charge to close the dispute', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'updateDispute' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/charges/{charge}/dispute', + 'summary' => 'Update a dispute', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'charge' => [ + 'description' => 'ID of the charge to update the dispute', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'evidence' => [ + 'description' => 'Evidence hash', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * TRANSFER RELATED METHODS + * + * DOC: https://stripe.com/docs/api#transfers + * -------------------------------------------------------------------------------- + */ + + 'cancelTransfer' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/transfers/{id}/cancel', + 'summary' => 'Cancel an existing transfer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the transfer', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'createTransfer' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/transfers', + 'summary' => 'Create a new transfer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'amount' => [ + 'description' => 'Amount (in cents)', + 'location' => 'query', + 'type' => 'integer', + 'required' => true + ], + 'currency' => [ + 'description' => '3-letter ISO code for currency', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'recipient' => [ + 'description' => 'ID of an existing, verified recipient', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'description' => [ + 'description' => 'Optional description to add', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'statement_descriptor' => [ + 'description' => 'An arbitrary string which will be displayed on the recipient\'s bank statement', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'getTransfer' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/transfers/{id}', + 'summary' => 'Get an existing transfer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the transfer', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getTransfers' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/transfers', + 'summary' => 'Get existing transfers', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many transfers are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'date' => [ + 'description' => 'A filter based on the "date" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'required' => false + ], + 'recipient' => [ + 'description' => 'Only return transfers for a specific recipient', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'status' => [ + 'description' => 'Optionally filter by status', + 'location' => 'query', + 'type' => 'string', + 'required' => false, + 'enum' => ['pending', 'paid', 'failed'] + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateTransfer' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/transfers/{id}', + 'summary' => 'Update an existing transfer', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the transfer to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'description' => [ + 'description' => 'Optional description', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * RECIPIENT RELATED METHODS + * + * DOC: https://stripe.com/docs/api#recipients + * -------------------------------------------------------------------------------- + */ + + 'createRecipient' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/recipients', + 'summary' => 'Create a new recipient', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'name' => [ + 'description' => 'The recipient\'s full, legal name', + 'location' => 'query', + 'type' => 'string', + 'required' => true + ], + 'type' => [ + 'description' => 'Type of the recipient (can be "individual" or "corporation")', + 'location' => 'query', + 'type' => 'string', + 'required' => true, + 'enum' => ['individual', 'corporation'] + ], + 'tax_id' => [ + 'description' => 'The recipient\'s tax ID, as a string', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'bank_account' => [ + 'description' => 'A bank account to attach to the recipient', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'email' => [ + 'description' => 'The recipient\'s email address', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'description' => [ + 'description' => 'Optional description to add', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'deleteRecipient' => [ + 'httpMethod' => 'DELETE', + 'uri' => '/v1/recipients/{id}', + 'summary' => 'Delete an existing recipient', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the recipient', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getRecipient' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/recipients/{id}', + 'summary' => 'Get an existing recipient', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the recipient', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getRecipients' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/recipients', + 'summary' => 'Get existing recipients', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many recipients are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'verified' => [ + 'description' => 'Boolean to only return recipients that are verified or unverified', + 'location' => 'query', + 'type' => 'boolean', + 'filters' => ['ZfrStripe\Client\Filter\BooleanFilter::encodeValue'], + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateRecipient' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/recipients/{id}', + 'summary' => 'Update an existing recipient', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the recipient to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'name' => [ + 'description' => 'The recipient\'s full, legal name', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'tax_id' => [ + 'description' => 'The recipient\'s tax ID, as a string', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'bank_account' => [ + 'description' => 'A bank account to attach to the recipient', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'email' => [ + 'description' => 'The recipient\'s email address', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'description' => [ + 'description' => 'Optional description to add', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * REFUND RELATED METHODS + * + * DOC: https://stripe.com/docs/api#refunds + * -------------------------------------------------------------------------------- + */ + + 'getRefund' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/charges/{charge}/refunds/{id}', + 'summary' => 'Get an existing refund', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the refund', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'charge' => [ + 'description' => 'Unique identifier of the charge to get the refund from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getRefunds' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/charges/{charge}/refunds', + 'summary' => 'Get existing refunds for a given charge', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'charge' => [ + 'description' => 'Charge to get the refunds from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'limit' => [ + 'description' => 'Limit on how many charges are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateRefund' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/charges/{charge}/refunds/{id}', + 'summary' => 'Update an existing charge', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the refund to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'charge' => [ + 'description' => 'Charge to get the refunds from', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * APPLICATION FEE RELATED METHODS + * + * DOC: https://stripe.com/docs/api#application_fees + * -------------------------------------------------------------------------------- + */ + + 'getApplicationFee' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/application_fees/{id}', + 'summary' => 'Get details about an application fee that your account has collected', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the application fee', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getApplicationFees' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/application_fees', + 'summary' => 'Get details about all application fees that your account has collected', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many application fees are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'created' => [ + 'description' => 'A filter based on the "created" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'charge' => [ + 'description' => 'Only return application fees for a given charge', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'refundApplicationFee' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/application_fees/{id}/refunds', + 'summary' => 'Refund an application fee that has previously been collected but not yet refunded', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of application fee to be refunded', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'amount' => [ + 'description' => 'A positive integer in cents representing how many of this fee to refund', + 'location' => 'query', + 'type' => 'integer', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * APPLICATION FEE REFUND RELATED METHODS + * + * DOC: https://stripe.com/docs/api#fee_refunds + * -------------------------------------------------------------------------------- + */ + + 'getApplicationFeeRefund' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/application_fees/{fee}/refunds/{id}', + 'summary' => 'Get details about an application fee refund', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the application fee refund', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'fee' => [ + 'description' => 'Unique identifier of the application fee that was refunded', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getApplicationFeeRefunds' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/application_fees/{fee}/refunds', + 'summary' => 'Get details about all application fee refunds', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'fee' => [ + 'description' => 'Unique identifier of the application fee we want refunds', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'limit' => [ + 'description' => 'Limit on how many application fee refunds are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'updateApplicationFeeRefund' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/application_fees/{fee}/refunds/{id}', + 'summary' => 'Update an application fee refund', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of application fee refund', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'fee' => [ + 'description' => 'Unique identifier of the application fee refund to update', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'metadata' => [ + 'description' => 'Optional metadata', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * BALANCE RELATED METHODS + * + * DOC: https://stripe.com/docs/api#balance + * -------------------------------------------------------------------------------- + */ + + 'getAccountBalance' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/balance', + 'summary' => 'Get the current account balance', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getBalanceTransaction' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/balance/history/{id}', + 'summary' => 'Get an existing balance transaction by its id', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the balance transaction to get', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getBalanceTransactions' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/balance/history', + 'summary' => 'Get all the balance transactions', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many application fees are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'available_on' => [ + 'description' => 'A filter based on the "available_on" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'created' => [ + 'description' => 'A filter based on the "created" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'currency' => [ + 'description' => 'Filter for currency', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'source' => [ + 'description' => 'Filter balance transactions using a specific source id (for example a charge id)', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'transfer' => [ + 'description' => 'For automatic Stripe transfers only, only returns transactions that were transferred out on the specified transfer ID', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'type' => [ + 'description' => 'Only returns transactions of the given type', + 'location' => 'query', + 'type' => 'string', + 'required' => false, + 'enum' => [ + 'adjustment', 'application_fee', 'charge', 'fee_refund', 'refund', 'transfer', 'transfer_failure' + ] + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * TOKEN RELATED METHODS + * + * DOC: https://stripe.com/docs/api#tokens + * -------------------------------------------------------------------------------- + */ + + 'createCardToken' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/tokens', + 'summary' => 'Create a new card token (note you must either specify card OR customer but not both)', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'card' => [ + 'description' => 'Unique card identifier (can either be an ID or a hash)', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'customer' => [ + 'description' => 'A customer (owned by the application\'s account) to create a token for', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'createBankAccountToken' => [ + 'httpMethod' => 'POST', + 'uri' => '/v1/tokens', + 'summary' => 'Create a bank account token', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'bank_account' => [ + 'description' => 'A bank account to attach to the recipient', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'idempotency_key' => [ + 'description' => 'An indempotency key that prevents accidentally performing the same POST operation twice', + 'location' => 'header', + 'sentAs' => 'Idempotency-Key', + 'type' => 'string', + 'required' => false + ] + ] + ], + + 'getToken' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/tokens/{id}', + 'summary' => 'Get details about an existing token', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the token', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * EVENT RELATED METHODS + * + * DOC: https://stripe.com/docs/api#events + * -------------------------------------------------------------------------------- + */ + + 'getEvent' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/events/{id}', + 'summary' => 'Get details about an event', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'id' => [ + 'description' => 'Unique identifier of the event', + 'location' => 'uri', + 'type' => 'string', + 'required' => true + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'getEvents' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/events', + 'summary' => 'Get details about all events (up to 30 days)', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse', + 'parameters' => [ + 'limit' => [ + 'description' => 'Limit on how many events are retrieved', + 'location' => 'query', + 'type' => 'integer', + 'min' => 1, + 'max' => 100, + 'required' => false + ], + 'starting_after' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'ending_before' => [ + 'description' => 'A cursor for use in the pagination', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'created' => [ + 'description' => 'A filter based on the "created" field. Can be an exact UTC timestamp, or a hash', + 'location' => 'query', + 'type' => ['string', 'array'], + 'required' => false + ], + 'type' => [ + 'description' => 'Allow to filter events by type', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'object_id' => [ + 'description' => 'Allow to filter by customer (CAUTION: this is not explicitly documented by Stripe)', + 'location' => 'query', + 'type' => 'string', + 'required' => false + ], + 'expand' => [ + 'description' => 'Allow to expand some properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ], + 'include' => [ + 'description' => 'Allow to include some additional properties', + 'location' => 'query', + 'type' => 'array', + 'required' => false + ] + ] + ], + + /** + * -------------------------------------------------------------------------------- + * ACCOUNT RELATED METHODS + * + * DOC: https://stripe.com/docs/api#account + * -------------------------------------------------------------------------------- + */ + + 'getAccount' => [ + 'httpMethod' => 'GET', + 'uri' => '/v1/account', + 'summary' => 'Get details about the account', + 'errorResponses' => $errors, + 'responseModel' => 'getResponse' + ] + ], + 'models' => [ + 'getResponse' => [ + 'type' => 'object', + 'additionalProperties' => [ + 'location' => 'json' + ] + ] + ] +]; diff --git a/src/Client/StripeClient.php b/src/Client/StripeClient.php index c1b7c97..08441d0 100644 --- a/src/Client/StripeClient.php +++ b/src/Client/StripeClient.php @@ -18,14 +18,13 @@ namespace ZfrStripe\Client; -use Guzzle\Common\Event; -use Guzzle\Plugin\ErrorResponse\ErrorResponsePlugin; -use Guzzle\Service\Client; -use Guzzle\Service\Description\ServiceDescription; -use Guzzle\Service\Resource\ResourceIterator; +use GuzzleHttp\Client; +use GuzzleHttp\Command\Event\PreparedEvent; +use GuzzleHttp\Command\Guzzle\Description; +use GuzzleHttp\Command\Guzzle\GuzzleClient; +use GuzzleHttp\Query; use ZfrStripe\Client\Iterator\StripeCommandsCursorIterator; use ZfrStripe\Exception\UnsupportedStripeVersionException; -use ZfrStripe\Http\QueryAggregator\StripeQueryAggregator; /** * @author Michaël Gallego @@ -33,190 +32,196 @@ * * CHARGE RELATED METHODS: * - * @method array captureCharge(array $args = array()) {@command Stripe CaptureCharge} - * @method array createCharge(array $args = array()) {@command Stripe CreateCharge} - * @method array getCharge(array $args = array()) {@command Stripe GetCharge} - * @method array getCharges(array $args = array()) {@command Stripe GetCharges} - * @method array refundCharge(array $args = array()) {@command Stripe RefundCharge} - * @method array updateCharge(array $args = array()) {@command Stripe UpdateCharge} + * @method array captureCharge(array $args = array()) {@command Stripe captureCharge} + * @method array createCharge(array $args = array()) {@command Stripe createCharge} + * @method array getCharge(array $args = array()) {@command Stripe getCharge} + * @method array getCharges(array $args = array()) {@command Stripe getCharges} + * @method array refundCharge(array $args = array()) {@command Stripe refundCharge} + * @method array updateCharge(array $args = array()) {@command Stripe updateCharge} * * CUSTOMER RELATED METHODS: * - * @method array createCustomer(array $args = array()) {@command Stripe CreateCustomer} - * @method array deleteCustomer(array $args = array()) {@command Stripe DeleteCustomer} - * @method array getCustomer(array $args = array()) {@command Stripe GetCustomer} - * @method array getCustomers(array $args = array()) {@command Stripe GetCustomers} - * @method array updateCustomer(array $args = array()) {@command Stripe UpdateCustomer} + * @method array createCustomer(array $args = array()) {@command Stripe createCustomer} + * @method array deleteCustomer(array $args = array()) {@command Stripe deleteCustomer} + * @method array getCustomer(array $args = array()) {@command Stripe getCustomer} + * @method array getCustomers(array $args = array()) {@command Stripe getCustomers} + * @method array updateCustomer(array $args = array()) {@command Stripe updateCustomer} * * CARD RELATED METHODS: * - * @method array createCard(array $args = array()) {@command Stripe CreateCard} - * @method array deleteCard(array $args = array()) {@command Stripe DeleteCard} - * @method array getCard(array $args = array()) {@command Stripe GetCard} - * @method array getCards(array $args = array()) {@command Stripe GetCards} - * @method array updateCard(array $args = array()) {@command Stripe UpdateCard} + * @method array createCard(array $args = array()) {@command Stripe createCard} + * @method array deleteCard(array $args = array()) {@command Stripe deleteCard} + * @method array getCard(array $args = array()) {@command Stripe getCard} + * @method array getCards(array $args = array()) {@command Stripe getCards} + * @method array updateCard(array $args = array()) {@command Stripe updateCard} * * RECIPIENT CARD RELATED METHODS: * - * @method array createRecipientCard(array $args = array()) {@command Stripe CreateRecipientCard} - * @method array deleteRecipientCard(array $args = array()) {@command Stripe DeleteRecipientCard} - * @method array getRecipientCard(array $args = array()) {@command Stripe GetRecipientCard} - * @method array getRecipientCards(array $args = array()) {@command Stripe GetRecipientCards} - * @method array updateRecipientCard(array $args = array()) {@command Stripe UpdateRecipientCard} + * @method array createRecipientCard(array $args = array()) {@command Stripe createRecipientCard} + * @method array deleteRecipientCard(array $args = array()) {@command Stripe deleteRecipientCard} + * @method array getRecipientCard(array $args = array()) {@command Stripe getRecipientCard} + * @method array getRecipientCards(array $args = array()) {@command Stripe getRecipientCards} + * @method array updateRecipientCard(array $args = array()) {@command Stripe updateRecipientCard} * * SUBSCRIPTION RELATED METHODS: * - * @method array cancelSubscription(array $args = array()) {@command Stripe CancelSubscription} - * @method array createSubscription(array $args = array()) {@command Stripe CreateSubscription} - * @method array getSubscription(array $args = array()) {@command Stripe GetSubscription} - * @method array getSubscriptions(array $args = array()) {@command Stripe GetSubscriptions} - * @method array updateSubscription(array $args = array()) {@command Stripe UpdateSubscription} + * @method array cancelSubscription(array $args = array()) {@command Stripe cancelSubscription} + * @method array createSubscription(array $args = array()) {@command Stripe createSubscription} + * @method array getSubscription(array $args = array()) {@command Stripe getSubscription} + * @method array getSubscriptions(array $args = array()) {@command Stripe getSubscriptions} + * @method array updateSubscription(array $args = array()) {@command Stripe updateSubscription} * * PLAN RELATED METHODS: * - * @method array createPlan(array $args = array()) {@command Stripe CreatePlan} - * @method array deletePlan(array $args = array()) {@command Stripe DeletePlan} - * @method array getPlan(array $args = array()) {@command Stripe GetPlan} - * @method array getPlans(array $args = array()) {@command Stripe GetPlans} - * @method array updatePlan(array $args = array()) {@command Stripe UpdatePlan} + * @method array createPlan(array $args = array()) {@command Stripe createPlan} + * @method array deletePlan(array $args = array()) {@command Stripe deletePlan} + * @method array getPlan(array $args = array()) {@command Stripe getPlan} + * @method array getPlans(array $args = array()) {@command Stripe getPlans} + * @method array updatePlan(array $args = array()) {@command Stripe updatePlan} * * COUPON RELATED METHODS: * - * @method array createCoupon(array $args = array()) {@command Stripe CreateCoupon} - * @method array deleteCoupon(array $args = array()) {@command Stripe DeleteCoupon} - * @method array getCoupon(array $args = array()) {@command Stripe GetCoupon} - * @method array getCoupons(array $args = array()) {@command Stripe GetCoupons} - * @method array updateCoupon(array $args = array()) {@command Stripe UpdateCoupon} + * @method array createCoupon(array $args = array()) {@command Stripe createCoupon} + * @method array deleteCoupon(array $args = array()) {@command Stripe deleteCoupon} + * @method array getCoupon(array $args = array()) {@command Stripe getCoupon} + * @method array getCoupons(array $args = array()) {@command Stripe getCoupons} + * @method array updateCoupon(array $args = array()) {@command Stripe updateCoupon} * * DISCOUNT RELATED METHODS: * - * @method array deleteCustomerDiscount(array $args = array()) {@command Stripe DeleteCustomerDiscount} - * @method array deleteSubscriptionDiscount(array $args = array()) {@command Stripe DeleteSubscriptionDiscount} + * @method array deleteCustomerDiscount(array $args = array()) {@command Stripe deleteCustomerDiscount} + * @method array deleteSubscriptionDiscount(array $args = array()) {@command Stripe deleteSubscriptionDiscount} * * INVOICE RELATED METHODS: * - * @method array createInvoice(array $args = array()) {@command Stripe CreateInvoice} - * @method array getInvoice(array $args = array()) {@command Stripe GetInvoice} - * @method array getInvoiceLineItems(array $args = array()) {@command Stripe GetInvoiceLineItems} - * @method array getInvoices(array $args = array()) {@command Stripe GetInvoices} - * @method array getUpcomingInvoice(array $args = array()) {@command Stripe GetUpcomingInvoice} - * @method array getUpcomingInvoiceLineItems(array $args = array()) {@command Stripe GetUpcomingInvoiceLineItems} - * @method array payInvoice(array $args = array()) {@command Stripe PayInvoice} - * @method array updateInvoice(array $args = array()) {@command Stripe UpdateInvoice} + * @method array createInvoice(array $args = array()) {@command Stripe createInvoice} + * @method array getInvoice(array $args = array()) {@command Stripe getInvoice} + * @method array getInvoiceLineItems(array $args = array()) {@command Stripe getInvoiceLineItems} + * @method array getInvoices(array $args = array()) {@command Stripe getInvoices} + * @method array getUpcomingInvoice(array $args = array()) {@command Stripe getUpcomingInvoice} + * @method array getUpcomingInvoiceLineItems(array $args = array()) {@command Stripe getUpcomingInvoiceLineItems} + * @method array payInvoice(array $args = array()) {@command Stripe payInvoice} + * @method array updateInvoice(array $args = array()) {@command Stripe updateInvoice} * * INVOICE ITEM RELATED METHODS: * - * @method array createInvoiceItem(array $args = array()) {@command Stripe CreateInvoiceItem} - * @method array deleteInvoiceItem(array $args = array()) {@command Stripe DeleteInvoiceItem} - * @method array getInvoiceItem(array $args = array()) {@command Stripe GetInvoiceItem} - * @method array getInvoiceItems(array $args = array()) {@command Stripe GetInvoiceItems} - * @method array updateInvoiceItem(array $args = array()) {@command Stripe UpdateInvoiceItem} + * @method array createInvoiceItem(array $args = array()) {@command Stripe createInvoiceItem} + * @method array deleteInvoiceItem(array $args = array()) {@command Stripe deleteInvoiceItem} + * @method array getInvoiceItem(array $args = array()) {@command Stripe getInvoiceItem} + * @method array getInvoiceItems(array $args = array()) {@command Stripe getInvoiceItems} + * @method array updateInvoiceItem(array $args = array()) {@command Stripe updateInvoiceItem} * * DISPUTE RELATED METHODS: * - * @method array closeDispute(array $args = array()) {@command Stripe CloseDispute} - * @method array updateDispute(array $args = array()) {@command Stripe UpdateDispute} + * @method array closeDispute(array $args = array()) {@command Stripe closeDispute} + * @method array updateDispute(array $args = array()) {@command Stripe updateDispute} * * TRANSFER RELATED METHODS: * - * @method array cancelTransfer(array $args = array()) {@command Stripe CancelTransfer} - * @method array createTransfer(array $args = array()) {@command Stripe CreateTransfer} - * @method array getTransfer(array $args = array()) {@command Stripe GetTransfer} - * @method array getTransfers(array $args = array()) {@command Stripe GetTransfers} - * @method array updateTransfer(array $args = array()) {@command Stripe UpdateTransfer} + * @method array cancelTransfer(array $args = array()) {@command Stripe cancelTransfer} + * @method array createTransfer(array $args = array()) {@command Stripe createTransfer} + * @method array getTransfer(array $args = array()) {@command Stripe getTransfer} + * @method array getTransfers(array $args = array()) {@command Stripe getTransfers} + * @method array updateTransfer(array $args = array()) {@command Stripe updateTransfer} * * RECIPIENT RELATED METHODS: * - * @method array createRecipient(array $args = array()) {@command Stripe CreateRecipient} - * @method array deleteRecipient(array $args = array()) {@command Stripe DeleteRecipient} - * @method array getRecipient(array $args = array()) {@command Stripe GetRecipient} - * @method array getRecipients(array $args = array()) {@command Stripe GetRecipients} - * @method array updateRecipient(array $args = array()) {@command Stripe UpdateRecipient} + * @method array createRecipient(array $args = array()) {@command Stripe createRecipient} + * @method array deleteRecipient(array $args = array()) {@command Stripe deleteRecipient} + * @method array getRecipient(array $args = array()) {@command Stripe getRecipient} + * @method array getRecipients(array $args = array()) {@command Stripe getRecipients} + * @method array updateRecipient(array $args = array()) {@command Stripe updateRecipient} * * REFUND RELATED METHODS: * - * @method array getRefund(array $args = array()) {@command Stripe GetRefund} - * @method array getRefunds(array $args = array()) {@command Stripe GetRefunds} - * @method array updateRefund(array $args = array()) {@command Stripe UpdateRefunds} + * @method array getRefund(array $args = array()) {@command Stripe getRefund} + * @method array getRefunds(array $args = array()) {@command Stripe getRefunds} + * @method array updateRefund(array $args = array()) {@command Stripe updateRefunds} * * APPLICATION FEE RELATED METHODS: * - * @method array getApplicationFee(array $args = array()) {@command Stripe GetApplicationFee} - * @method array getApplicationFees(array $args = array()) {@command Stripe GetApplicationFees} - * @method array refundApplicationFee(array $args = array()) {@command Stripe RefundApplicationFee} + * @method array getApplicationFee(array $args = array()) {@command Stripe getApplicationFee} + * @method array getApplicationFees(array $args = array()) {@command Stripe getApplicationFees} + * @method array refundApplicationFee(array $args = array()) {@command Stripe refundApplicationFee} * * APPLICATION FEE REFUND RELATED METHODS: * - * @method array getApplicationFeeRefund(array $args = array()) {@command Stripe GetApplicationFeeRefund} - * @method array getApplicationFeeRefunds(array $args = array()) {@command Stripe GetApplicationFeeRefunds} - * @method array updateApplicationFeeRefund(array $args = array()) {@command Stripe UpdateApplicationFeeRefund} + * @method array getApplicationFeeRefund(array $args = array()) {@command Stripe getApplicationFeeRefund} + * @method array getApplicationFeeRefunds(array $args = array()) {@command Stripe getApplicationFeeRefunds} + * @method array updateApplicationFeeRefund(array $args = array()) {@command Stripe updateApplicationFeeRefund} * * BALANCE RELATED METHODS: * - * @method array getAccountBalance(array $args = array()) {@command Stripe GetAccountBalance} - * @method array getBalanceTransaction(array $args = array()) {@command Stripe GetBalanceTransaction} - * @method array getBalanceTransactions(array $args = array()) {@command Stripe GetBalanceTransactions} + * @method array getAccountBalance(array $args = array()) {@command Stripe getAccountBalance} + * @method array getBalanceTransaction(array $args = array()) {@command Stripe getBalanceTransaction} + * @method array getBalanceTransactions(array $args = array()) {@command Stripe getBalanceTransactions} * * TOKEN RELATED METHODS: * - * @method array createCardToken(array $args = array()) {@command Stripe CreateCardToken} - * @method array createBankAccountToken(array $args = array()) {@command Stripe CreateBankAccountToken} - * @method array getToken(array $args = array()) {@command Stripe GetToken} + * @method array createCardToken(array $args = array()) {@command Stripe createCardToken} + * @method array createBankAccountToken(array $args = array()) {@command Stripe createBankAccountToken} + * @method array getToken(array $args = array()) {@command Stripe getToken} * * EVENT RELATED METHODS: * - * @method array getEvent(array $args = array()) {@command Stripe GetEvent} - * @method array getEvents(array $args = array()) {@command Stripe GetEvents} + * @method array getEvent(array $args = array()) {@command Stripe getEvent} + * @method array getEvents(array $args = array()) {@command Stripe getEvents} * * ACCOUNT RELATED METHODS: * - * @method array getAccount(array $args = array()) {@command Stripe GetAccount} + * @method array getAccount(array $args = array()) {@command Stripe getAccount} * * ITERATOR METHODS: * - * @method ResourceIterator getCustomersIterator() - * @method ResourceIterator getChargesIterator() - * @method ResourceIterator getCardsIterator() - * @method ResourceIterator getRecipientCardsIterator() - * @method ResourceIterator getSubscriptionsIterator() - * @method ResourceIterator getPlansIterator() - * @method ResourceIterator getCouponsIterator() - * @method ResourceIterator getInvoicesIterator() - * @method ResourceIterator getInvoiceLineItemsIterator() - * @method ResourceIterator GetUpcomingInvoiceLineItemsIterator() - * @method ResourceIterator getInvoiceItemsIterator() - * @method ResourceIterator getTransfersIterator() - * @method ResourceIterator getRecipientsIterator() - * @method ResourceIterator getRefundsIterator() - * @method ResourceIterator getApplicationFeesIterator() - * @method ResourceIterator getApplicationFeeRefundsIterator() - * @method ResourceIterator getBalanceTransactionsIterator() - * @method ResourceIterator getEventsIterator() + * @method StripeCommandsCursorIterator getCustomersIterator() + * @method StripeCommandsCursorIterator getChargesIterator() + * @method StripeCommandsCursorIterator getCardsIterator() + * @method StripeCommandsCursorIterator getRecipientCardsIterator() + * @method StripeCommandsCursorIterator getSubscriptionsIterator() + * @method StripeCommandsCursorIterator getPlansIterator() + * @method StripeCommandsCursorIterator getCouponsIterator() + * @method StripeCommandsCursorIterator getInvoicesIterator() + * @method StripeCommandsCursorIterator getInvoiceLineItemsIterator() + * @method StripeCommandsCursorIterator GetUpcomingInvoiceLineItemsIterator() + * @method StripeCommandsCursorIterator getInvoiceItemsIterator() + * @method StripeCommandsCursorIterator getTransfersIterator() + * @method StripeCommandsCursorIterator getRecipientsIterator() + * @method StripeCommandsCursorIterator getRefundsIterator() + * @method StripeCommandsCursorIterator getApplicationFeesIterator() + * @method StripeCommandsCursorIterator getApplicationFeeRefundsIterator() + * @method StripeCommandsCursorIterator getBalanceTransactionsIterator() + * @method StripeCommandsCursorIterator getEventsIterator() */ -class StripeClient extends Client +class StripeClient { /** * Stripe API version */ - const LATEST_API_VERSION = '2014-12-22'; + const LATEST_API_VERSION = '2015-04-07'; + + /** + * @var GuzzleClient + */ + private $guzzleClient; /** * @var array */ - protected $availableVersions = [ + private $availableVersions = [ '2014-03-28', '2014-05-19', '2014-06-13', '2014-06-17', '2014-07-22', '2014-07-26', '2014-08-04', '2014-08-20', - '2014-09-08', '2014-10-07', '2014-11-05', '2014-11-20', '2014-12-08', '2014-12-17', '2014-12-22' + '2014-09-08', '2014-10-07', '2014-11-05', '2014-11-20', '2014-12-08', '2014-12-17', '2014-12-22', '2015-01-11', + '2015-01-26', '2015-02-10', '2015-02-16', '2015-02-18', '2015-03-24', '2015-04-07' ]; /** * @var string */ - protected $apiKey; + private $apiKey; /** * @var string */ - protected $version; + private $version; /** * Constructor @@ -226,19 +231,24 @@ class StripeClient extends Client */ public function __construct($apiKey, $version = self::LATEST_API_VERSION) { - parent::__construct(); - $this->setApiKey($apiKey); $this->setApiVersion($version); + } - $this->setUserAgent('zfr-stripe-php', true); + /** + * {@inheritdoc} + */ + public function __call($name, array $arguments = []) + { + if (substr($name, -8) === 'Iterator') { + // Allow magic method calls for iterators (e.g. $client->Iterator($params)) + $commandOptions = isset($arguments[0]) ? $arguments[0] : []; + $command = $this->guzzleClient->getCommand(substr($name, 0, -8), $commandOptions); - // Add an event to set the Authorization param before sending any request - $dispatcher = $this->getEventDispatcher(); + return new StripeCommandsCursorIterator($this->guzzleClient, $command); + } - $dispatcher->addSubscriber(new ErrorResponsePlugin()); - $dispatcher->addListener('command.after_prepare', [$this, 'afterPrepare']); - $dispatcher->addListener('command.before_send', [$this, 'authorizeRequest']); + return $this->guzzleClient->__call($name, $arguments); } /** @@ -262,23 +272,6 @@ public function getApiKey() return $this->apiKey; } - /** - * {@inheritdoc} - */ - public function __call($method, $args = []) - { - if (substr($method, -8) === 'Iterator') { - // Allow magic method calls for iterators (e.g. $client->Iterator($params)) - $commandOptions = isset($args[0]) ? $args[0] : []; - $iteratorOptions = isset($args[1]) ? $args[1] : []; - $command = $this->getCommand(substr($method, 0, -8), $commandOptions); - - return new StripeCommandsCursorIterator($command, $iteratorOptions); - } - - return parent::__call(ucfirst($method), $args); - } - /** * Set the Stripe API version * @@ -299,15 +292,24 @@ public function setApiVersion($version) } $this->version = (string) $version; - $this->setDefaultOption('headers', ['Stripe-Version' => $this->version]); - if ($this->version < '2014-12-17') { - $descriptor = __DIR__ . '/ServiceDescription/Stripe-v1.0.php'; + if ($this->version < '2014-12-08') { + $description = new Description(include __DIR__ . '/ServiceDescription/Stripe-v1.0.php'); + } elseif ($this->version < '2014-12-17') { + $description = new Description(include __DIR__ . '/ServiceDescription/Stripe-v1.1.php'); + } elseif ($this->version < '2015-02-18') { + $description = new Description(include __DIR__ . '/ServiceDescription/Stripe-v1.2.php'); } else { - $descriptor = __DIR__ . '/ServiceDescription/Stripe-v1.1.php'; + $description = new Description(include __DIR__ . '/ServiceDescription/Stripe-v1.3.php'); } - $this->setDescription(ServiceDescription::factory($descriptor)); + $httpClient = new Client(); + $httpClient->setDefaultOption('headers/Stripe-Version', $this->version); + + // Create a new Guzzle client and attach events + $this->guzzleClient = new GuzzleClient($httpClient, $description); + $this->guzzleClient->getEmitter()->on('prepared', [$this, 'prepareQueryParams']); + $this->guzzleClient->getEmitter()->on('prepared', [$this, 'authorizeRequest']); } /** @@ -324,31 +326,23 @@ public function getApiVersion() * Modify the query aggregator * * @internal - * @param Event $event + * @param PreparedEvent $event * @return void */ - public function afterPrepare(Event $event) + public function prepareQueryParams(PreparedEvent $event) { - /* @var \Guzzle\Service\Command\CommandInterface $command */ - $command = $event['command']; - $request = $command->getRequest(); - - $request->getQuery()->setAggregator(new StripeQueryAggregator()); + $event->getRequest()->getQuery()->setAggregator(Query::phpAggregator(false)); } /** * Authorize the request * * @internal - * @param Event $event + * @param PreparedEvent $event * @return void */ - public function authorizeRequest(Event $event) + public function authorizeRequest(PreparedEvent $event) { - /* @var \Guzzle\Service\Command\CommandInterface $command */ - $command = $event['command']; - - $request = $command->getRequest(); - $request->setAuth($this->apiKey); + $event->getRequest()->setHeader('Authorization', 'Basic ' . base64_encode($this->apiKey)); } } diff --git a/src/Exception/AbstractResponseException.php b/src/Exception/AbstractResponseException.php index cdd6ceb..8331f62 100644 --- a/src/Exception/AbstractResponseException.php +++ b/src/Exception/AbstractResponseException.php @@ -23,6 +23,8 @@ use Guzzle\Http\Message\Response; use Guzzle\Plugin\ErrorResponse\ErrorResponseExceptionInterface; use Guzzle\Service\Command\CommandInterface; +use GuzzleHttp\Command\CommandTransaction; +use GuzzleHttp\Command\Exception\CommandException; /** * @author Michaël Gallego diff --git a/src/Http/QueryAggregator/StripeQueryAggregator.php b/src/Http/QueryAggregator/StripeQueryAggregator.php deleted file mode 100644 index 54e0ba4..0000000 --- a/src/Http/QueryAggregator/StripeQueryAggregator.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @licence MIT - */ -class StripeQueryAggregator implements QueryAggregatorInterface -{ - /** - * {@inheritDoc} - */ - public function aggregate($key, $value, QueryString $query) - { - $ret = []; - - foreach ($value as $k => $v) { - if (is_int($k)) { - return [$query->encodeValue("{$key}[]") => $value]; - } - - $k = "{$key}[{$k}]"; - - if (is_array($v)) { - $ret = array_merge($ret, self::aggregate($k, $v, $query)); - } else { - $ret[$query->encodeValue($k)] = $query->encodeValue($v); - } - } - - return $ret; - } -} diff --git a/tests/ZfrStripeTest/Client/StripeClientTest.php b/tests/ZfrStripeTest/Client/StripeClientTest.php index d2c21f2..8896ee3 100644 --- a/tests/ZfrStripeTest/Client/StripeClientTest.php +++ b/tests/ZfrStripeTest/Client/StripeClientTest.php @@ -58,13 +58,4 @@ public function testAssertApiVersionHeaderIsAdded() $this->client->setApiVersion('2014-05-19'); $this->assertEquals('2014-05-19', $this->client->getDefaultOption('headers/Stripe-Version')); } - - public function testUserAgentIsIncluded() - { - // Make sure the user agent contains "zfr-stripe-php" - $command = $this->client->getCommand('GetAccount'); - $request = $command->prepare(); - $this->client->dispatch('command.before_send', ['command' => $command]); - $this->assertRegExp('/^zfr-stripe-php/', (string)$request->getHeader('User-Agent', true)); - } } diff --git a/tests/ZfrStripeTest/Http/QueryAggregator/StripeQueryAggregatorTest.php b/tests/ZfrStripeTest/Http/QueryAggregator/StripeQueryAggregatorTest.php deleted file mode 100644 index b563ef2..0000000 --- a/tests/ZfrStripeTest/Http/QueryAggregator/StripeQueryAggregatorTest.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @licence MIT - */ -class StripeQueryAggregatorTest extends \PHPUnit_Framework_TestCase -{ - public function testAggregator() - { - $query = new QueryString(); - $aggregator = new StripeQueryAggregator(); - - $result = $aggregator->aggregate('expand', ['customer', 'invoice'], $query); - $expected[$query->encodeValue('expand[]')] = ['customer', 'invoice']; - - $this->assertEquals($expected, $result); - - $result = $aggregator->aggregate('card', ['ccv' => '123', 'name' => 'foo'], $query); - $expected = [ - $query->encodeValue('card[ccv]') => '123', - $query->encodeValue('card[name]') => 'foo' - ]; - - $this->assertEquals($expected, $result); - } -}