File manager - Edit - /home/premiey/www/wp-includes/images/media/stripe.tar
Back
stripe-php/CODE_OF_CONDUCT.md 0000666 00000006450 15165746005 0011460 0 ustar 00 # Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at conduct@stripe.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq stripe-php/lib/Product.php 0000666 00000011277 15165746005 0011563 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Products describe the specific goods or services you offer to your customers. * For example, you might offer a Standard and Premium version of your goods or * service; each version would be a separate Product. They can be used in * conjunction with <a href="https://stripe.com/docs/api#prices">Prices</a> to * configure pricing in Payment Links, Checkout, and Subscriptions. * * Related guides: <a * href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up * a subscription</a>, <a * href="https://stripe.com/docs/payments/payment-links/overview">share a Payment * Link</a>, <a * href="https://stripe.com/docs/payments/accept-a-payment#create-product-prices-upfront">accept * payments with Checkout</a>, and more about <a * href="https://stripe.com/docs/products-prices/overview">Products and Prices</a> * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property bool $active Whether the product is currently available for purchase. * @property null|string[] $attributes A list of up to 5 attributes that each SKU can provide values for (e.g., <code>["color", "size"]</code>). * @property null|string $caption A short one-line description of the product, meant to be displayable to the customer. Only applicable to products of <code>type=good</code>. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string[] $deactivate_on An array of connect application identifiers that cannot purchase this product. Only applicable to products of <code>type=good</code>. * @property null|string|\AmeliaStripe\Price $default_price The ID of the <a href="https://stripe.com/docs/api/prices">Price</a> object that is the default price for this product. * @property null|string $description The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes. * @property string[] $images A list of up to 8 URLs of images for this product, meant to be displayable to the customer. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $name The product's name, meant to be displayable to the customer. * @property null|\AmeliaStripe\StripeObject $package_dimensions The dimensions of this product for shipping purposes. * @property null|bool $shippable Whether this product is shipped (i.e., physical goods). * @property null|string $statement_descriptor Extra information about a product which will appear on your customer's credit card statement. In the case that multiple products are billed at once, the first statement descriptor will be used. * @property null|string|\AmeliaStripe\TaxCode $tax_code A <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> ID. * @property string $type The type of the product. The product is either of type <code>good</code>, which is eligible for use with Orders and SKUs, or <code>service</code>, which is eligible for use with Subscriptions and Plans. * @property null|string $unit_label A label that represents units of this product in Stripe and on customers’ receipts and invoices. When set, this will be included in associated invoice line item descriptions. * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch. * @property null|string $url A URL of a publicly-accessible webpage for this product. */ class Product extends ApiResource { const OBJECT_NAME = 'product'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Search; use ApiOperations\Update; const TYPE_GOOD = 'good'; const TYPE_SERVICE = 'service'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SearchResult<Product> the product search results */ public static function search($params = null, $opts = null) { $url = '/v1/products/search'; return self::_searchResource($url, $params, $opts); } } stripe-php/lib/OAuth.php 0000666 00000006523 15165746005 0011161 0 ustar 00 <?php namespace AmeliaStripe; abstract class OAuth { /** * Generates a URL to Stripe's OAuth form. * * @param null|array $params * @param null|array $opts * * @return string the URL to Stripe's OAuth form */ public static function authorizeUrl($params = null, $opts = null) { $params = $params ?: []; $base = ($opts && \array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase; $params['client_id'] = self::_getClientId($params); if (!\array_key_exists('response_type', $params)) { $params['response_type'] = 'code'; } $query = Util\Util::encodeParameters($params); return $base . '/oauth/authorize?' . $query; } /** * Use an authoriztion code to connect an account to your platform and * fetch the user's credentials. * * @param null|array $params * @param null|array $opts * * @throws \AmeliaStripe\Exception\OAuth\OAuthErrorException if the request fails * * @return StripeObject object containing the response from the API */ public static function token($params = null, $opts = null) { $base = ($opts && \array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase; $requestor = new ApiRequestor(null, $base); list($response, $apiKey) = $requestor->request( 'post', '/oauth/token', $params, null ); return Util\Util::convertToStripeObject($response->json, $opts); } /** * Disconnects an account from your platform. * * @param null|array $params * @param null|array $opts * * @throws \AmeliaStripe\Exception\OAuth\OAuthErrorException if the request fails * * @return StripeObject object containing the response from the API */ public static function deauthorize($params = null, $opts = null) { $params = $params ?: []; $base = ($opts && \array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase; $requestor = new ApiRequestor(null, $base); $params['client_id'] = self::_getClientId($params); list($response, $apiKey) = $requestor->request( 'post', '/oauth/deauthorize', $params, null ); return Util\Util::convertToStripeObject($response->json, $opts); } private static function _getClientId($params = null) { $clientId = ($params && \array_key_exists('client_id', $params)) ? $params['client_id'] : null; if (null === $clientId) { $clientId = Stripe::getClientId(); } if (null === $clientId) { $msg = 'No client_id provided. (HINT: set your client_id using ' . '"Stripe::setClientId(<CLIENT-ID>)". You can find your client_ids ' . 'in your Stripe dashboard at ' . 'https://dashboard.stripe.com/account/applications/settings, ' . 'after registering your account as a platform. See ' . 'https://stripe.com/docs/connect/standard-accounts for details, ' . 'or email support@stripe.com if you have any questions.'; throw new Exception\AuthenticationException($msg); } return $clientId; } } stripe-php/lib/FileLink.php 0000666 00000002740 15165746005 0011633 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * To share the contents of a <code>File</code> object with non-Stripe users, you * can create a <code>FileLink</code>. <code>FileLink</code>s contain a URL that * can be used to retrieve the contents of the file without authentication. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property bool $expired Whether this link is already expired. * @property null|int $expires_at Time at which the link expires. * @property string|\AmeliaStripe\File $file The file object this link points to. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string $url The publicly accessible URL to download the file. */ class FileLink extends ApiResource { const OBJECT_NAME = 'file_link'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; } stripe-php/lib/CustomerBalanceTransaction.php 0000666 00000012402 15165746005 0015407 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Each customer has a <a * href="https://stripe.com/docs/api/customers/object#customer_object-balance"><code>balance</code></a> * value, which denotes a debit or credit that's automatically applied to their * next invoice upon finalization. You may modify the value directly by using the * <a href="https://stripe.com/docs/api/customers/update">update customer API</a>, * or by creating a Customer Balance Transaction, which increments or decrements * the customer's <code>balance</code> by the specified <code>amount</code>. * * Related guide: <a * href="https://stripe.com/docs/billing/customer/balance">Customer Balance</a> to * learn more. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount The amount of the transaction. A negative value is a credit for the customer's balance, and a positive value is a debit to the customer's <code>balance</code>. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string|\AmeliaStripe\CreditNote $credit_note The ID of the credit note (if any) related to the transaction. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property string|\AmeliaStripe\Customer $customer The ID of the customer the transaction belongs to. * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property int $ending_balance The customer's <code>balance</code> after the transaction was applied. A negative value decreases the amount due on the customer's next invoice. A positive value increases the amount due on the customer's next invoice. * @property null|string|\AmeliaStripe\Invoice $invoice The ID of the invoice (if any) related to the transaction. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $type Transaction type: <code>adjustment</code>, <code>applied_to_invoice</code>, <code>credit_note</code>, <code>initial</code>, <code>invoice_too_large</code>, <code>invoice_too_small</code>, <code>unspent_receiver_credit</code>, or <code>unapplied_from_invoice</code>. See the <a href="https://stripe.com/docs/billing/customer/balance#types">Customer Balance page</a> to learn more about transaction types. */ class CustomerBalanceTransaction extends ApiResource { const OBJECT_NAME = 'customer_balance_transaction'; const TYPE_ADJUSTMENT = 'adjustment'; const TYPE_APPLIED_TO_INVOICE = 'applied_to_invoice'; const TYPE_CREDIT_NOTE = 'credit_note'; const TYPE_INITIAL = 'initial'; const TYPE_INVOICE_TOO_LARGE = 'invoice_too_large'; const TYPE_INVOICE_TOO_SMALL = 'invoice_too_small'; const TYPE_UNSPENT_RECEIVER_CREDIT = 'unspent_receiver_credit'; const TYPE_ADJUSTEMENT = 'adjustment'; /** * @return string the API URL for this balance transaction */ public function instanceUrl() { $id = $this['id']; $customer = $this['customer']; if (!$id) { throw new Exception\UnexpectedValueException( "Could not determine which URL to request: class instance has invalid ID: {$id}", null ); } $id = Util\Util::utf8($id); $customer = Util\Util::utf8($customer); $base = Customer::classUrl(); $customerExtn = \urlencode($customer); $extn = \urlencode($id); return "{$base}/{$customerExtn}/balance_transactions/{$extn}"; } /** * @param array|string $_id * @param null|array|string $_opts * * @throws \AmeliaStripe\Exception\BadMethodCallException */ public static function retrieve($_id, $_opts = null) { $msg = 'Customer Balance Transactions cannot be retrieved without a ' . 'customer ID. Retrieve a Customer Balance Transaction using ' . "`Customer::retrieveBalanceTransaction('customer_id', " . "'balance_transaction_id')`."; throw new Exception\BadMethodCallException($msg); } /** * @param string $_id * @param null|array $_params * @param null|array|string $_options * * @throws \AmeliaStripe\Exception\BadMethodCallException */ public static function update($_id, $_params = null, $_options = null) { $msg = 'Customer Balance Transactions cannot be updated without a ' . 'customer ID. Update a Customer Balance Transaction using ' . "`Customer::updateBalanceTransaction('customer_id', " . "'balance_transaction_id', \$updateParams)`."; throw new Exception\BadMethodCallException($msg); } } stripe-php/lib/Collection.php 0000666 00000020523 15165746005 0012230 0 ustar 00 <?php namespace AmeliaStripe; /** * Class Collection. * * @template TStripeObject of StripeObject * @template-implements \IteratorAggregate<TStripeObject> * * @property string $object * @property string $url * @property bool $has_more * @property TStripeObject[] $data */ class Collection extends StripeObject implements \Countable, \IteratorAggregate { const OBJECT_NAME = 'list'; use ApiOperations\Request; /** @var array */ protected $filters = []; /** * @return string the base URL for the given class */ public static function baseUrl() { return Stripe::$apiBase; } /** * Returns the filters. * * @return array the filters */ public function getFilters() { return $this->filters; } /** * Sets the filters, removing paging options. * * @param array $filters the filters */ public function setFilters($filters) { $this->filters = $filters; } /** * @return mixed */ #[\ReturnTypeWillChange] public function offsetGet($k) { if (\is_string($k)) { return parent::offsetGet($k); } $msg = "You tried to access the {$k} index, but Collection " . 'types only support string keys. (HINT: List calls ' . 'return an object with a `data` (which is the data ' . "array). You likely want to call ->data[{$k}])"; throw new Exception\InvalidArgumentException($msg); } /** * @param null|array $params * @param null|array|string $opts * * @throws Exception\ApiErrorException * * @return Collection<TStripeObject> */ public function all($params = null, $opts = null) { self::_validateParams($params); list($url, $params) = $this->extractPathAndUpdateParams($params); list($response, $opts) = $this->_request('get', $url, $params, $opts); $obj = Util\Util::convertToStripeObject($response, $opts); if (!($obj instanceof \AmeliaStripe\Collection)) { throw new \AmeliaStripe\Exception\UnexpectedValueException( 'Expected type ' . \AmeliaStripe\Collection::class . ', got "' . \get_class($obj) . '" instead.' ); } $obj->setFilters($params); return $obj; } /** * @param null|array $params * @param null|array|string $opts * * @throws Exception\ApiErrorException * * @return TStripeObject */ public function create($params = null, $opts = null) { self::_validateParams($params); list($url, $params) = $this->extractPathAndUpdateParams($params); list($response, $opts) = $this->_request('post', $url, $params, $opts); return Util\Util::convertToStripeObject($response, $opts); } /** * @param string $id * @param null|array $params * @param null|array|string $opts * * @throws Exception\ApiErrorException * * @return TStripeObject */ public function retrieve($id, $params = null, $opts = null) { self::_validateParams($params); list($url, $params) = $this->extractPathAndUpdateParams($params); $id = Util\Util::utf8($id); $extn = \urlencode($id); list($response, $opts) = $this->_request( 'get', "{$url}/{$extn}", $params, $opts ); return Util\Util::convertToStripeObject($response, $opts); } /** * @return int the number of objects in the current page */ #[\ReturnTypeWillChange] public function count() { return \count($this->data); } /** * @return \ArrayIterator an iterator that can be used to iterate * across objects in the current page */ #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->data); } /** * @return \ArrayIterator an iterator that can be used to iterate * backwards across objects in the current page */ public function getReverseIterator() { return new \ArrayIterator(\array_reverse($this->data)); } /** * @return \Generator|TStripeObject[] A generator that can be used to * iterate across all objects across all pages. As page boundaries are * encountered, the next page will be fetched automatically for * continued iteration. */ public function autoPagingIterator() { $page = $this; while (true) { $filters = $this->filters ?: []; if (\array_key_exists('ending_before', $filters) && !\array_key_exists('starting_after', $filters)) { foreach ($page->getReverseIterator() as $item) { yield $item; } $page = $page->previousPage(); } else { foreach ($page as $item) { yield $item; } $page = $page->nextPage(); } if ($page->isEmpty()) { break; } } } /** * Returns an empty collection. This is returned from {@see nextPage()} * when we know that there isn't a next page in order to replicate the * behavior of the API when it attempts to return a page beyond the last. * * @param null|array|string $opts * * @return Collection */ public static function emptyCollection($opts = null) { return Collection::constructFrom(['data' => []], $opts); } /** * Returns true if the page object contains no element. * * @return bool */ public function isEmpty() { return empty($this->data); } /** * Fetches the next page in the resource list (if there is one). * * This method will try to respect the limit of the current page. If none * was given, the default limit will be fetched again. * * @param null|array $params * @param null|array|string $opts * * @return Collection<TStripeObject> */ public function nextPage($params = null, $opts = null) { if (!$this->has_more) { return static::emptyCollection($opts); } $lastId = \end($this->data)->id; $params = \array_merge( $this->filters ?: [], ['starting_after' => $lastId], $params ?: [] ); return $this->all($params, $opts); } /** * Fetches the previous page in the resource list (if there is one). * * This method will try to respect the limit of the current page. If none * was given, the default limit will be fetched again. * * @param null|array $params * @param null|array|string $opts * * @return Collection<TStripeObject> */ public function previousPage($params = null, $opts = null) { if (!$this->has_more) { return static::emptyCollection($opts); } $firstId = $this->data[0]->id; $params = \array_merge( $this->filters ?: [], ['ending_before' => $firstId], $params ?: [] ); return $this->all($params, $opts); } /** * Gets the first item from the current page. Returns `null` if the current page is empty. * * @return null|TStripeObject */ public function first() { return \count($this->data) > 0 ? $this->data[0] : null; } /** * Gets the last item from the current page. Returns `null` if the current page is empty. * * @return null|TStripeObject */ public function last() { return \count($this->data) > 0 ? $this->data[\count($this->data) - 1] : null; } private function extractPathAndUpdateParams($params) { $url = \parse_url($this->url); if (!isset($url['path'])) { throw new Exception\UnexpectedValueException("Could not parse list url into parts: {$url}"); } if (isset($url['query'])) { // If the URL contains a query param, parse it out into $params so they // don't interact weirdly with each other. $query = []; \parse_str($url['query'], $query); $params = \array_merge($params ?: [], $query); } return [$url['path'], $params]; } } stripe-php/lib/Invoice.php 0000666 00000054344 15165746005 0011541 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Invoices are statements of amounts owed by a customer, and are either generated * one-off, or generated periodically from a subscription. * * They contain <a href="https://stripe.com/docs/api#invoiceitems">invoice * items</a>, and proration adjustments that may be caused by subscription * upgrades/downgrades (if necessary). * * If your invoice is configured to be billed through automatic charges, Stripe * automatically finalizes your invoice and attempts payment. Note that finalizing * the invoice, <a * href="https://stripe.com/docs/billing/invoices/workflow/#auto_advance">when * automatic</a>, does not happen immediately as the invoice is created. Stripe * waits until one hour after the last webhook was successfully sent (or the last * webhook timed out after failing). If you (and the platforms you may have * connected to) have no webhooks configured, Stripe waits one hour after creation * to finalize the invoice. * * If your invoice is configured to be billed by sending an email, then based on * your <a href="https://dashboard.stripe.com/account/billing/automatic">email * settings</a>, Stripe will email the invoice to your customer and await payment. * These emails can contain a link to a hosted page to pay the invoice. * * Stripe applies any customer credit on the account before determining the amount * due for the invoice (i.e., the amount that will be actually charged). If the * amount due for the invoice is less than Stripe's <a * href="/docs/currencies#minimum-and-maximum-charge-amounts">minimum allowed * charge per currency</a>, the invoice is automatically marked paid, and we add * the amount due to the customer's credit balance which is applied to the next * invoice. * * More details on the customer's credit balance are <a * href="https://stripe.com/docs/billing/customer/balance">here</a>. * * Related guide: <a href="https://stripe.com/docs/billing/invoices/sending">Send * Invoices to Customers</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string $account_country The country of the business associated with this invoice, most often the business creating the invoice. * @property null|string $account_name The public name of the business associated with this invoice, most often the business creating the invoice. * @property null|(string|\AmeliaStripe\TaxId)[] $account_tax_ids The account tax IDs associated with the invoice. Only editable when the invoice is a draft. * @property int $amount_due Final amount due at this time for this invoice. If the invoice's total is smaller than the minimum charge amount, for example, or if there is account credit that can be applied to the invoice, the <code>amount_due</code> may be 0. If there is a positive <code>starting_balance</code> for the invoice (the customer owes money), the <code>amount_due</code> will also take that into account. The charge that gets generated for the invoice will be for the amount specified in <code>amount_due</code>. * @property int $amount_paid The amount, in %s, that was paid. * @property int $amount_remaining The difference between amount_due and amount_paid, in %s. * @property null|string|\AmeliaStripe\StripeObject $application ID of the Connect Application that created the invoice. * @property null|int $application_fee_amount The fee in %s that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid. * @property int $attempt_count Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count. In other words, manual payment attempts after the first attempt do not affect the retry schedule. * @property bool $attempted Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the <code>invoice.created</code> webhook, for example, so you might not want to display that invoice as unpaid to your users. * @property bool $auto_advance Controls whether Stripe will perform <a href="https://stripe.com/docs/billing/invoices/workflow/#auto_advance">automatic collection</a> of the invoice. When <code>false</code>, the invoice's state will not automatically advance without an explicit action. * @property \AmeliaStripe\StripeObject $automatic_tax * @property null|string $billing_reason Indicates the reason why the invoice was created. <code>subscription_cycle</code> indicates an invoice created by a subscription advancing into a new period. <code>subscription_create</code> indicates an invoice created due to creating a subscription. <code>subscription_update</code> indicates an invoice created due to updating a subscription. <code>subscription</code> is set for all old invoices to indicate either a change to a subscription or a period advancement. <code>manual</code> is set for all invoices unrelated to a subscription (for example: created via the invoice editor). The <code>upcoming</code> value is reserved for simulated invoices per the upcoming invoice endpoint. <code>subscription_threshold</code> indicates an invoice created due to a billing threshold being reached. * @property null|string|\AmeliaStripe\Charge $charge ID of the latest charge generated for this invoice, if any. * @property string $collection_method Either <code>charge_automatically</code>, or <code>send_invoice</code>. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|\AmeliaStripe\StripeObject[] $custom_fields Custom fields displayed on the invoice. * @property null|string|\AmeliaStripe\Customer $customer The ID of the customer who will be billed. * @property null|\AmeliaStripe\StripeObject $customer_address The customer's address. Until the invoice is finalized, this field will equal <code>customer.address</code>. Once the invoice is finalized, this field will no longer be updated. * @property null|string $customer_email The customer's email. Until the invoice is finalized, this field will equal <code>customer.email</code>. Once the invoice is finalized, this field will no longer be updated. * @property null|string $customer_name The customer's name. Until the invoice is finalized, this field will equal <code>customer.name</code>. Once the invoice is finalized, this field will no longer be updated. * @property null|string $customer_phone The customer's phone number. Until the invoice is finalized, this field will equal <code>customer.phone</code>. Once the invoice is finalized, this field will no longer be updated. * @property null|\AmeliaStripe\StripeObject $customer_shipping The customer's shipping information. Until the invoice is finalized, this field will equal <code>customer.shipping</code>. Once the invoice is finalized, this field will no longer be updated. * @property null|string $customer_tax_exempt The customer's tax exempt status. Until the invoice is finalized, this field will equal <code>customer.tax_exempt</code>. Once the invoice is finalized, this field will no longer be updated. * @property null|\AmeliaStripe\StripeObject[] $customer_tax_ids The customer's tax IDs. Until the invoice is finalized, this field will contain the same tax IDs as <code>customer.tax_ids</code>. Once the invoice is finalized, this field will no longer be updated. * @property null|string|\AmeliaStripe\PaymentMethod $default_payment_method ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings. * @property null|string|\AmeliaStripe\Account|\AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source $default_source ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription's default source, if any, or to the customer's default source. * @property \AmeliaStripe\TaxRate[] $default_tax_rates The tax rates applied to this invoice, if any. * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. Referenced as 'memo' in the Dashboard. * @property null|\AmeliaStripe\Discount $discount Describes the current discount applied to this invoice, if there is one. Not populated if there are multiple discounts. * @property null|(string|\AmeliaStripe\Discount)[] $discounts The discounts applied to the invoice. Line item discounts are applied before invoice discounts. Use <code>expand[]=discounts</code> to expand each discount. * @property null|int $due_date The date on which payment for this invoice is due. This value will be <code>null</code> for invoices where <code>collection_method=charge_automatically</code>. * @property null|int $ending_balance Ending customer balance after the invoice is finalized. Invoices are finalized approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice. If the invoice has not been finalized yet, this will be null. * @property null|string $footer Footer displayed on the invoice. * @property null|\AmeliaStripe\StripeObject $from_invoice Details of the invoice that was cloned. See the <a href="https://stripe.com/docs/invoicing/invoice-revisions">revision documentation</a> for more details. * @property null|string $hosted_invoice_url The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been finalized yet, this will be null. * @property null|string $invoice_pdf The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null. * @property null|\AmeliaStripe\StripeObject $last_finalization_error The error encountered during the previous attempt to finalize the invoice. This field is cleared when the invoice is successfully finalized. * @property null|string|\AmeliaStripe\Invoice $latest_revision The ID of the most recent non-draft revision of this invoice * @property \AmeliaStripe\Collection<\AmeliaStripe\InvoiceLineItem> $lines The individual line items that make up the invoice. <code>lines</code> is sorted as follows: invoice items in reverse chronological order, followed by the subscription, if any. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|int $next_payment_attempt The time at which payment will next be attempted. This value will be <code>null</code> for invoices where <code>collection_method=send_invoice</code>. * @property null|string $number A unique, identifying string that appears on emails sent to the customer for this invoice. This starts with the customer's unique invoice_prefix if it is specified. * @property null|string|\AmeliaStripe\Account $on_behalf_of The account (if any) for which the funds of the invoice payment are intended. If set, the invoice will be presented with the branding and support information of the specified account. See the <a href="https://stripe.com/docs/billing/invoices/connect">Invoices with Connect</a> documentation for details. * @property bool $paid Whether payment was successfully collected for this invoice. An invoice can be paid (most commonly) with a charge or with credit from the customer's account balance. * @property bool $paid_out_of_band Returns true if the invoice was manually marked paid, returns false if the invoice hasn't been paid yet or was paid on Stripe. * @property null|string|\AmeliaStripe\PaymentIntent $payment_intent The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel the PaymentIntent. * @property \AmeliaStripe\StripeObject $payment_settings * @property int $period_end End of the usage period during which invoice items were added to this invoice. * @property int $period_start Start of the usage period during which invoice items were added to this invoice. * @property int $post_payment_credit_notes_amount Total amount of all post-payment credit notes issued for this invoice. * @property int $pre_payment_credit_notes_amount Total amount of all pre-payment credit notes issued for this invoice. * @property null|string|\AmeliaStripe\Quote $quote The quote this invoice was generated from. * @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this invoice. * @property null|\AmeliaStripe\StripeObject $rendering_options Options for invoice PDF rendering. * @property int $starting_balance Starting customer balance before the invoice is finalized. If the invoice has not been finalized yet, this will be the current customer balance. For revision invoices, this also includes any customer balance that was applied to the original invoice. * @property null|string $statement_descriptor Extra information about an invoice for the customer's credit card statement. * @property null|string $status The status of the invoice, one of <code>draft</code>, <code>open</code>, <code>paid</code>, <code>uncollectible</code>, or <code>void</code>. <a href="https://stripe.com/docs/billing/invoices/workflow#workflow-overview">Learn more</a> * @property \AmeliaStripe\StripeObject $status_transitions * @property null|string|\AmeliaStripe\Subscription $subscription The subscription that this invoice was prepared for, if any. * @property int $subscription_proration_date Only set for upcoming invoices that preview prorations. The time used to calculate prorations. * @property int $subtotal Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or exclusive tax is applied. Item discounts are already incorporated * @property null|int $subtotal_excluding_tax The integer amount in %s representing the subtotal of the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated * @property null|int $tax The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice. * @property null|string|\AmeliaStripe\TestHelpers\TestClock $test_clock ID of the test clock this invoice belongs to. * @property \AmeliaStripe\StripeObject $threshold_reason * @property int $total Total after discounts and taxes. * @property null|\AmeliaStripe\StripeObject[] $total_discount_amounts The aggregate amounts calculated per discount across all line items. * @property null|int $total_excluding_tax The integer amount in %s representing the total amount of the invoice including all discounts but excluding all tax. * @property \AmeliaStripe\StripeObject[] $total_tax_amounts The aggregate amounts calculated per tax rate for all line items. * @property null|\AmeliaStripe\StripeObject $transfer_data The account (if any) the payment will be attributed to for tax reporting, and where funds from the payment will be transferred to for the invoice. * @property null|int $webhooks_delivered_at Invoices are automatically paid or sent 1 hour after webhooks are delivered, or until all webhook delivery attempts have <a href="https://stripe.com/docs/billing/webhooks#understand">been exhausted</a>. This field tracks the time when webhooks for this invoice were successfully delivered. If the invoice had no webhooks to deliver, this will be set while the invoice is being created. */ class Invoice extends ApiResource { const OBJECT_NAME = 'invoice'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\NestedResource; use ApiOperations\Retrieve; use ApiOperations\Search; use ApiOperations\Update; const BILLING_CHARGE_AUTOMATICALLY = 'charge_automatically'; const BILLING_SEND_INVOICE = 'send_invoice'; const BILLING_REASON_AUTOMATIC_PENDING_INVOICE_ITEM_INVOICE = 'automatic_pending_invoice_item_invoice'; const BILLING_REASON_MANUAL = 'manual'; const BILLING_REASON_QUOTE_ACCEPT = 'quote_accept'; const BILLING_REASON_SUBSCRIPTION = 'subscription'; const BILLING_REASON_SUBSCRIPTION_CREATE = 'subscription_create'; const BILLING_REASON_SUBSCRIPTION_CYCLE = 'subscription_cycle'; const BILLING_REASON_SUBSCRIPTION_THRESHOLD = 'subscription_threshold'; const BILLING_REASON_SUBSCRIPTION_UPDATE = 'subscription_update'; const BILLING_REASON_UPCOMING = 'upcoming'; const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically'; const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice'; const STATUS_DELETED = 'deleted'; const STATUS_DRAFT = 'draft'; const STATUS_OPEN = 'open'; const STATUS_PAID = 'paid'; const STATUS_UNCOLLECTIBLE = 'uncollectible'; const STATUS_VOID = 'void'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Invoice the finalized invoice */ public function finalizeInvoice($params = null, $opts = null) { $url = $this->instanceUrl() . '/finalize'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Invoice the uncollectible invoice */ public function markUncollectible($params = null, $opts = null) { $url = $this->instanceUrl() . '/mark_uncollectible'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Invoice the paid invoice */ public function pay($params = null, $opts = null) { $url = $this->instanceUrl() . '/pay'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Invoice the sent invoice */ public function sendInvoice($params = null, $opts = null) { $url = $this->instanceUrl() . '/send'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Invoice the upcoming invoice */ public static function upcoming($params = null, $opts = null) { $url = static::classUrl() . '/upcoming'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\InvoiceLineItem> list of InvoiceLineItems */ public static function upcomingLines($params = null, $opts = null) { $url = static::classUrl() . '/upcoming/lines'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Invoice the voided invoice */ public function voidInvoice($params = null, $opts = null) { $url = $this->instanceUrl() . '/void'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SearchResult<Invoice> the invoice search results */ public static function search($params = null, $opts = null) { $url = '/v1/invoices/search'; return self::_searchResource($url, $params, $opts); } const PATH_LINES = '/lines'; /** * @param string $id the ID of the invoice on which to retrieve the line items * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\LineItem> the list of line items */ public static function allLines($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_LINES, $params, $opts); } } stripe-php/lib/PromotionCode.php 0000666 00000004767 15165746005 0012732 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * A Promotion Code represents a customer-redeemable code for a <a * href="https://stripe.com/docs/api#coupons">coupon</a>. It can be used to create * multiple codes for a single coupon. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property bool $active Whether the promotion code is currently active. A promotion code is only active if the coupon is also valid. * @property string $code The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer. * @property \AmeliaStripe\Coupon $coupon A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to <a href="https://stripe.com/docs/api#subscriptions">subscriptions</a>, <a href="https://stripe.com/docs/api#invoices">invoices</a>, <a href="https://stripe.com/docs/api/checkout/sessions">checkout sessions</a>, <a href="https://stripe.com/docs/api#quotes">quotes</a>, and more. Coupons do not work with conventional one-off <a href="https://stripe.com/docs/api#create_charge">charges</a> or <a href="https://stripe.com/docs/api/payment_intents">payment intents</a>. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string|\AmeliaStripe\Customer $customer The customer that this promotion code can be used by. * @property null|int $expires_at Date at which the promotion code can no longer be redeemed. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|int $max_redemptions Maximum number of times this promotion code can be redeemed. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property \AmeliaStripe\StripeObject $restrictions * @property int $times_redeemed Number of times this promotion code has been used. */ class PromotionCode extends ApiResource { const OBJECT_NAME = 'promotion_code'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; } stripe-php/lib/Plan.php 0000666 00000013127 15165746005 0011031 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * You can now model subscriptions more flexibly using the <a * href="https://stripe.com/docs/api#prices">Prices API</a>. It replaces the Plans * API and is backwards compatible to simplify your migration. * * Plans define the base price, currency, and billing cycle for recurring purchases * of products. <a href="https://stripe.com/docs/api#products">Products</a> help * you track inventory or provisioning, and plans help you track pricing. Different * physical goods or levels of service should be represented by products, and * pricing options should be represented by plans. This approach lets you change * prices without having to change your provisioning scheme. * * For example, you might have a single "gold" product that has plans for * $10/month, $100/year, €9/month, and €90/year. * * Related guides: <a * href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up * a subscription</a> and more about <a * href="https://stripe.com/docs/products-prices/overview">products and prices</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property bool $active Whether the plan can be used for new purchases. * @property null|string $aggregate_usage Specifies a usage aggregation strategy for plans of <code>usage_type=metered</code>. Allowed values are <code>sum</code> for summing up all usage during a period, <code>last_during_period</code> for using the last usage record reported within a period, <code>last_ever</code> for using the last usage record ever (across period bounds) or <code>max</code> which uses the usage record with the maximum reported usage during a period. Defaults to <code>sum</code>. * @property null|int $amount The unit amount in %s to be charged, represented as a whole integer if possible. Only set if <code>billing_scheme=per_unit</code>. * @property null|string $amount_decimal The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. Only set if <code>billing_scheme=per_unit</code>. * @property string $billing_scheme Describes how to compute the price per period. Either <code>per_unit</code> or <code>tiered</code>. <code>per_unit</code> indicates that the fixed amount (specified in <code>amount</code>) will be charged per unit in <code>quantity</code> (for plans with <code>usage_type=licensed</code>), or per unit of total usage (for plans with <code>usage_type=metered</code>). <code>tiered</code> indicates that the unit pricing will be computed using a tiering strategy as defined using the <code>tiers</code> and <code>tiers_mode</code> attributes. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property string $interval The frequency at which a subscription is billed. One of <code>day</code>, <code>week</code>, <code>month</code> or <code>year</code>. * @property int $interval_count The number of intervals (specified in the <code>interval</code> attribute) between subscription billings. For example, <code>interval=month</code> and <code>interval_count=3</code> bills every 3 months. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string $nickname A brief description of the plan, hidden from customers. * @property null|string|\AmeliaStripe\Product $product The product whose pricing this plan determines. * @property \AmeliaStripe\StripeObject[] $tiers Each element represents a pricing tier. This parameter requires <code>billing_scheme</code> to be set to <code>tiered</code>. See also the documentation for <code>billing_scheme</code>. * @property null|string $tiers_mode Defines if the tiering price should be <code>graduated</code> or <code>volume</code> based. In <code>volume</code>-based tiering, the maximum quantity within a period determines the per unit price. In <code>graduated</code> tiering, pricing can change as the quantity grows. * @property null|\AmeliaStripe\StripeObject $transform_usage Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with <code>tiers</code>. * @property null|int $trial_period_days Default number of trial days when subscribing a customer to this plan using <a href="https://stripe.com/docs/api#create_subscription-trial_from_plan"><code>trial_from_plan=true</code></a>. * @property string $usage_type Configures how the quantity per period should be determined. Can be either <code>metered</code> or <code>licensed</code>. <code>licensed</code> automatically bills the <code>quantity</code> set when adding it to a subscription. <code>metered</code> aggregates the total usage based on usage records. Defaults to <code>licensed</code>. */ class Plan extends ApiResource { const OBJECT_NAME = 'plan'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Update; } stripe-php/lib/PaymentIntent.php 0000666 00000033532 15165746005 0012740 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * A PaymentIntent guides you through the process of collecting a payment from your * customer. We recommend that you create exactly one PaymentIntent for each order * or customer session in your system. You can reference the PaymentIntent later to * see the history of payment attempts for a particular session. * * A PaymentIntent transitions through <a * href="https://stripe.com/docs/payments/intents#intent-statuses">multiple * statuses</a> throughout its lifetime as it interfaces with Stripe.js to perform * authentication flows and ultimately creates at most one successful charge. * * Related guide: <a * href="https://stripe.com/docs/payments/payment-intents">Payment Intents API</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a> (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or <a href="https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts">equivalent in charge currency</a>. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). * @property int $amount_capturable Amount that can be captured from this PaymentIntent. * @property \AmeliaStripe\StripeObject $amount_details * @property int $amount_received Amount that was collected by this PaymentIntent. * @property null|string|\AmeliaStripe\StripeObject $application ID of the Connect application that created the PaymentIntent. * @property null|int $application_fee_amount The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. The amount of the application fee collected will be capped at the total payment amount. For more information, see the PaymentIntents <a href="https://stripe.com/docs/payments/connected-accounts">use case for connected accounts</a>. * @property null|\AmeliaStripe\StripeObject $automatic_payment_methods Settings to configure compatible payment methods from the <a href="https://dashboard.stripe.com/settings/payment_methods">Stripe Dashboard</a> * @property null|int $canceled_at Populated when <code>status</code> is <code>canceled</code>, this is the time at which the PaymentIntent was canceled. Measured in seconds since the Unix epoch. * @property null|string $cancellation_reason Reason for cancellation of this PaymentIntent, either user-provided (<code>duplicate</code>, <code>fraudulent</code>, <code>requested_by_customer</code>, or <code>abandoned</code>) or generated by Stripe internally (<code>failed_invoice</code>, <code>void_invoice</code>, or <code>automatic</code>). * @property string $capture_method Controls when the funds will be captured from the customer's account. * @property \AmeliaStripe\Collection<\AmeliaStripe\Charge> $charges Charges that were created by this PaymentIntent, if any. * @property null|string $client_secret <p>The client secret of this PaymentIntent. Used for client-side retrieval using a publishable key.</p><p>The client secret can be used to complete a payment from your frontend. It should not be stored, logged, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.</p><p>Refer to our docs to <a href="https://stripe.com/docs/payments/accept-a-payment?ui=elements">accept a payment</a> and learn about how <code>client_secret</code> should be handled.</p> * @property string $confirmation_method * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string|\AmeliaStripe\Customer $customer <p>ID of the Customer this PaymentIntent belongs to, if one exists.</p><p>Payment methods attached to other Customers cannot be used with this PaymentIntent.</p><p>If present in combination with <a href="https://stripe.com/docs/api#payment_intent_object-setup_future_usage">setup_future_usage</a>, this PaymentIntent's payment method will be attached to the Customer after the PaymentIntent has been confirmed and any required actions from the user are complete.</p> * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|string|\AmeliaStripe\Invoice $invoice ID of the invoice that created this PaymentIntent, if it exists. * @property null|\AmeliaStripe\StripeObject $last_payment_error The payment error encountered in the previous PaymentIntent confirmation. It will be cleared if the PaymentIntent is later updated for any reason. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. For more information, see the <a href="https://stripe.com/docs/payments/payment-intents/creating-payment-intents#storing-information-in-metadata">documentation</a>. * @property null|\AmeliaStripe\StripeObject $next_action If present, this property tells you what actions you need to take in order for your customer to fulfill a payment using the provided source. * @property null|string|\AmeliaStripe\Account $on_behalf_of The account (if any) for which the funds of the PaymentIntent are intended. See the PaymentIntents <a href="https://stripe.com/docs/payments/connected-accounts">use case for connected accounts</a> for details. * @property null|string|\AmeliaStripe\PaymentMethod $payment_method ID of the payment method used in this PaymentIntent. * @property null|\AmeliaStripe\StripeObject $payment_method_options Payment-method-specific configuration for this PaymentIntent. * @property string[] $payment_method_types The list of payment method types (e.g. card) that this PaymentIntent is allowed to use. * @property null|\AmeliaStripe\StripeObject $processing If present, this property tells you about the processing state of the payment. * @property null|string $receipt_email Email address that the receipt for the resulting payment will be sent to. If <code>receipt_email</code> is specified for a payment in live mode, a receipt will be sent regardless of your <a href="https://dashboard.stripe.com/account/emails">email settings</a>. * @property null|string|\AmeliaStripe\Review $review ID of the review associated with this PaymentIntent, if any. * @property null|string $setup_future_usage <p>Indicates that you intend to make future payments with this PaymentIntent's payment method.</p><p>Providing this parameter will <a href="https://stripe.com/docs/payments/save-during-payment">attach the payment method</a> to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be <a href="https://stripe.com/docs/api/payment_methods/attach">attached</a> to a Customer after the transaction completes.</p><p>When processing card payments, Stripe also uses <code>setup_future_usage</code> to dynamically optimize your payment flow and comply with regional legislation and network rules, such as <a href="https://stripe.com/docs/strong-customer-authentication">SCA</a>.</p> * @property null|\AmeliaStripe\StripeObject $shipping Shipping information for this PaymentIntent. * @property null|string|\AmeliaStripe\Account|\AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source $source This is a legacy field that will be removed in the future. It is the ID of the Source object that is associated with this PaymentIntent, if one was supplied. * @property null|string $statement_descriptor For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters. * @property null|string $statement_descriptor_suffix Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor. * @property string $status Status of this PaymentIntent, one of <code>requires_payment_method</code>, <code>requires_confirmation</code>, <code>requires_action</code>, <code>processing</code>, <code>requires_capture</code>, <code>canceled</code>, or <code>succeeded</code>. Read more about each PaymentIntent <a href="https://stripe.com/docs/payments/intents#intent-statuses">status</a>. * @property null|\AmeliaStripe\StripeObject $transfer_data The data with which to automatically create a Transfer when the payment is finalized. See the PaymentIntents <a href="https://stripe.com/docs/payments/connected-accounts">use case for connected accounts</a> for details. * @property null|string $transfer_group A string that identifies the resulting payment as part of a group. See the PaymentIntents <a href="https://stripe.com/docs/payments/connected-accounts">use case for connected accounts</a> for details. */ class PaymentIntent extends ApiResource { const OBJECT_NAME = 'payment_intent'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Search; use ApiOperations\Update; const STATUS_CANCELED = 'canceled'; const STATUS_PROCESSING = 'processing'; const STATUS_REQUIRES_ACTION = 'requires_action'; const STATUS_REQUIRES_CAPTURE = 'requires_capture'; const STATUS_REQUIRES_CONFIRMATION = 'requires_confirmation'; const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method'; const STATUS_SUCCEEDED = 'succeeded'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentIntent the applied payment intent */ public function applyCustomerBalance($params = null, $opts = null) { $url = $this->instanceUrl() . '/apply_customer_balance'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentIntent the canceled payment intent */ public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentIntent the captured payment intent */ public function capture($params = null, $opts = null) { $url = $this->instanceUrl() . '/capture'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentIntent the confirmed payment intent */ public function confirm($params = null, $opts = null) { $url = $this->instanceUrl() . '/confirm'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentIntent the incremented payment intent */ public function incrementAuthorization($params = null, $opts = null) { $url = $this->instanceUrl() . '/increment_authorization'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentIntent the verified payment intent */ public function verifyMicrodeposits($params = null, $opts = null) { $url = $this->instanceUrl() . '/verify_microdeposits'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SearchResult<PaymentIntent> the payment intent search results */ public static function search($params = null, $opts = null) { $url = '/v1/payment_intents/search'; return self::_searchResource($url, $params, $opts); } } stripe-php/lib/Sigma/ScheduledQueryRun.php 0000666 00000003433 15165746005 0014611 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Sigma; /** * If you have <a href="https://stripe.com/docs/sigma/scheduled-queries">scheduled * a Sigma query</a>, you'll receive a * <code>sigma.scheduled_query_run.created</code> webhook each time the query runs. * The webhook contains a <code>ScheduledQueryRun</code> object, which you can use * to retrieve the query results. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property int $data_load_time When the query was run, Sigma contained a snapshot of your Stripe data at this time. * @property \AmeliaStripe\StripeObject $error * @property null|\AmeliaStripe\File $file The file object representing the results of the query. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property int $result_available_until Time at which the result expires and is no longer available for download. * @property string $sql SQL for the query. * @property string $status The query's execution status, which will be <code>completed</code> for successful runs, and <code>canceled</code>, <code>failed</code>, or <code>timed_out</code> otherwise. * @property string $title Title of the query. */ class ScheduledQueryRun extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'scheduled_query_run'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Retrieve; public static function classUrl() { return '/v1/sigma/scheduled_query_runs'; } } stripe-php/lib/Token.php 0000666 00000007077 15165746005 0011226 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Tokenization is the process Stripe uses to collect sensitive card or bank * account details, or personally identifiable information (PII), directly from * your customers in a secure manner. A token representing this information is * returned to your server to use. You should use our <a * href="https://stripe.com/docs/payments">recommended payments integrations</a> to * perform this process client-side. This ensures that no sensitive card data * touches your server, and allows your integration to operate in a PCI-compliant * way. * * If you cannot use client-side tokenization, you can also create tokens using the * API with either your publishable or secret API key. Keep in mind that if your * integration uses this method, you are responsible for any PCI compliance that * may be required, and you must keep your secret API key safe. Unlike with * client-side tokenization, your customer's information is not sent directly to * Stripe, so we cannot determine how it is handled or stored. * * Tokens cannot be stored or used more than once. To store card or bank account * information for later use, you can create <a * href="https://stripe.com/docs/api#customers">Customer</a> objects or <a * href="https://stripe.com/docs/api#external_accounts">Custom accounts</a>. Note * that <a href="https://stripe.com/docs/radar">Radar</a>, our integrated solution * for automatic fraud protection, performs best with integrations that use * client-side tokenization. * * Related guide: <a * href="https://stripe.com/docs/payments/accept-a-payment-charges#web-create-token">Accept * a payment</a> * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \AmeliaStripe\BankAccount $bank_account <p>These bank accounts are payment methods on <code>Customer</code> objects.</p><p>On the other hand <a href="https://stripe.com/docs/api#external_accounts">External Accounts</a> are transfer destinations on <code>Account</code> objects for <a href="https://stripe.com/docs/connect/custom-accounts">Custom accounts</a>. They can be bank accounts or debit cards as well, and are documented in the links above.</p><p>Related guide: <a href="https://stripe.com/docs/payments/bank-debits-transfers">Bank Debits and Transfers</a>.</p> * @property \AmeliaStripe\Card $card <p>You can store multiple cards on a customer in order to charge the customer later. You can also store multiple debit cards on a recipient in order to transfer to those cards later.</p><p>Related guide: <a href="https://stripe.com/docs/sources/cards">Card Payments with Sources</a>.</p> * @property null|string $client_ip IP address of the client that generated the token. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property string $type Type of the token: <code>account</code>, <code>bank_account</code>, <code>card</code>, or <code>pii</code>. * @property bool $used Whether this token has already been used (tokens can be used only once). */ class Token extends ApiResource { const OBJECT_NAME = 'token'; use ApiOperations\Create; use ApiOperations\Retrieve; const TYPE_ACCOUNT = 'account'; const TYPE_BANK_ACCOUNT = 'bank_account'; const TYPE_CARD = 'card'; const TYPE_PII = 'pii'; } stripe-php/lib/Customer.php 0000666 00000044376 15165746005 0011752 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * This object represents a customer of your business. It lets you create recurring * charges and track payments that belong to the same customer. * * Related guide: <a * href="https://stripe.com/docs/payments/save-during-payment">Save a card during * payment</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|\AmeliaStripe\StripeObject $address The customer's address. * @property int $balance Current balance, if any, being stored on the customer. If negative, the customer has credit to apply to their next invoice. If positive, the customer has an amount owed that will be added to their next invoice. The balance does not refer to any unpaid invoices; it solely takes into account amounts that have yet to be successfully applied to any invoice. This balance is only taken into account as invoices are finalized. * @property null|\AmeliaStripe\CashBalance $cash_balance The current funds being held by Stripe on behalf of the customer. These funds can be applied towards payment intents with source "cash_balance". The settings[reconciliation_mode] field describes whether these funds are applied to such payment intents manually or automatically. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $currency Three-letter <a href="https://stripe.com/docs/currencies">ISO code for the currency</a> the customer can be charged in for recurring billing purposes. * @property null|string|\AmeliaStripe\Account|\AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source $default_source <p>ID of the default payment source for the customer.</p><p>If you are using payment methods created via the PaymentMethods API, see the <a href="https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method">invoice_settings.default_payment_method</a> field instead.</p> * @property null|bool $delinquent <p>When the customer's latest invoice is billed by charging automatically, <code>delinquent</code> is <code>true</code> if the invoice's latest charge failed. When the customer's latest invoice is billed by sending an invoice, <code>delinquent</code> is <code>true</code> if the invoice isn't paid by its due date.</p><p>If an invoice is marked uncollectible by <a href="https://stripe.com/docs/billing/automatic-collection">dunning</a>, <code>delinquent</code> doesn't get reset to <code>false</code>.</p> * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|\AmeliaStripe\Discount $discount Describes the current discount active on the customer, if there is one. * @property null|string $email The customer's email address. * @property \AmeliaStripe\StripeObject $invoice_credit_balance The current multi-currency balances, if any, being stored on the customer. If positive in a currency, the customer has a credit to apply to their next invoice denominated in that currency. If negative, the customer has an amount owed that will be added to their next invoice denominated in that currency. These balances do not refer to any unpaid invoices. They solely track amounts that have yet to be successfully applied to any invoice. A balance in a particular currency is only applied to any invoice as an invoice in that currency is finalized. * @property null|string $invoice_prefix The prefix for the customer used to generate unique invoice numbers. * @property \AmeliaStripe\StripeObject $invoice_settings * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string $name The customer's full name or business name. * @property int $next_invoice_sequence The suffix of the customer's next invoice number, e.g., 0001. * @property null|string $phone The customer's phone number. * @property null|string[] $preferred_locales The customer's preferred locales (languages), ordered by preference. * @property null|\AmeliaStripe\StripeObject $shipping Mailing and shipping address for the customer. Appears on invoices emailed to this customer. * @property \AmeliaStripe\Collection<\AmeliaStripe\Account|\AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source> $sources The customer's payment sources, if any. * @property \AmeliaStripe\Collection<\AmeliaStripe\Subscription> $subscriptions The customer's current subscriptions, if any. * @property \AmeliaStripe\StripeObject $tax * @property null|string $tax_exempt Describes the customer's tax exemption status. One of <code>none</code>, <code>exempt</code>, or <code>reverse</code>. When set to <code>reverse</code>, invoice and receipt PDFs include the text <strong>"Reverse charge"</strong>. * @property \AmeliaStripe\Collection<\AmeliaStripe\TaxId> $tax_ids The customer's tax IDs. * @property null|string|\AmeliaStripe\TestHelpers\TestClock $test_clock ID of the test clock this customer belongs to. */ class Customer extends ApiResource { const OBJECT_NAME = 'customer'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\NestedResource; use ApiOperations\Retrieve; use ApiOperations\Search; use ApiOperations\Update; const TAX_EXEMPT_EXEMPT = 'exempt'; const TAX_EXEMPT_NONE = 'none'; const TAX_EXEMPT_REVERSE = 'reverse'; public static function getSavedNestedResources() { static $savedNestedResources = null; if (null === $savedNestedResources) { $savedNestedResources = new Util\Set([ 'source', ]); } return $savedNestedResources; } /** * @param null|array $params * @param null|array|string $opts * * @return \AmeliaStripe\Customer the updated customer */ public function deleteDiscount($params = null, $opts = null) { $url = $this->instanceUrl() . '/discount'; list($response, $opts) = $this->_request('delete', $url, $params, $opts); $this->refreshFrom(['discount' => null], $opts, true); return $this; } /** * @param string $id * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\PaymentMethod> list of PaymentMethods */ public static function allPaymentMethods($id, $params = null, $opts = null) { $url = static::resourceUrl($id) . '/payment_methods'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } /** * @param string $payment_method * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Customer the retrieved customer */ public function retrievePaymentMethod($payment_method, $params = null, $opts = null) { $url = $this->instanceUrl() . '/payment_methods/' . $payment_method; list($response, $opts) = $this->_request('get', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response, $opts); $obj->setLastResponse($response); return $obj; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SearchResult<Customer> the customer search results */ public static function search($params = null, $opts = null) { $url = '/v1/customers/search'; return self::_searchResource($url, $params, $opts); } const PATH_CASH_BALANCE = '/cash_balance'; /** * @param string $id the ID of the customer to which the cash balance belongs * @param null|array $params * @param null|array|string $opts * @param mixed $cashBalanceId * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CashBalance */ public static function retrieveCashBalance($id, $cashBalanceId, $params = null, $opts = null) { return self::_retrieveNestedResource($id, static::PATH_CASH_BALANCE, $params, $opts); } /** * @param string $id the ID of the customer to which the cash balance belongs * @param null|array $params * @param null|array|string $opts * @param mixed $cashBalanceId * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CashBalance */ public static function updateCashBalance($id, $cashBalanceId, $params = null, $opts = null) { return self::_updateNestedResource($id, static::PATH_CASH_BALANCE, $params, $opts); } const PATH_BALANCE_TRANSACTIONS = '/balance_transactions'; /** * @param string $id the ID of the customer on which to retrieve the customer balance transactions * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\CustomerBalanceTransaction> the list of customer balance transactions */ public static function allBalanceTransactions($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts); } /** * @param string $id the ID of the customer on which to create the customer balance transaction * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CustomerBalanceTransaction */ public static function createBalanceTransaction($id, $params = null, $opts = null) { return self::_createNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts); } /** * @param string $id the ID of the customer to which the customer balance transaction belongs * @param string $balanceTransactionId the ID of the customer balance transaction to retrieve * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CustomerBalanceTransaction */ public static function retrieveBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null) { return self::_retrieveNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts); } /** * @param string $id the ID of the customer to which the customer balance transaction belongs * @param string $balanceTransactionId the ID of the customer balance transaction to update * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CustomerBalanceTransaction */ public static function updateBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null) { return self::_updateNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts); } const PATH_CASH_BALANCE_TRANSACTIONS = '/cash_balance_transactions'; /** * @param string $id the ID of the customer on which to retrieve the customer cash balance transactions * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\CustomerCashBalanceTransaction> the list of customer cash balance transactions */ public static function allCashBalanceTransactions($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_CASH_BALANCE_TRANSACTIONS, $params, $opts); } /** * @param string $id the ID of the customer to which the customer cash balance transaction belongs * @param string $cashBalanceTransactionId the ID of the customer cash balance transaction to retrieve * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CustomerCashBalanceTransaction */ public static function retrieveCashBalanceTransaction($id, $cashBalanceTransactionId, $params = null, $opts = null) { return self::_retrieveNestedResource($id, static::PATH_CASH_BALANCE_TRANSACTIONS, $cashBalanceTransactionId, $params, $opts); } const PATH_SOURCES = '/sources'; /** * @param string $id the ID of the customer on which to retrieve the payment sources * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source> the list of payment sources (BankAccount, Card or Source) */ public static function allSources($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_SOURCES, $params, $opts); } /** * @param string $id the ID of the customer on which to create the payment source * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source */ public static function createSource($id, $params = null, $opts = null) { return self::_createNestedResource($id, static::PATH_SOURCES, $params, $opts); } /** * @param string $id the ID of the customer to which the payment source belongs * @param string $sourceId the ID of the payment source to delete * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source */ public static function deleteSource($id, $sourceId, $params = null, $opts = null) { return self::_deleteNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts); } /** * @param string $id the ID of the customer to which the payment source belongs * @param string $sourceId the ID of the payment source to retrieve * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source */ public static function retrieveSource($id, $sourceId, $params = null, $opts = null) { return self::_retrieveNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts); } /** * @param string $id the ID of the customer to which the payment source belongs * @param string $sourceId the ID of the payment source to update * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source */ public static function updateSource($id, $sourceId, $params = null, $opts = null) { return self::_updateNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts); } const PATH_TAX_IDS = '/tax_ids'; /** * @param string $id the ID of the customer on which to retrieve the tax ids * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\TaxId> the list of tax ids */ public static function allTaxIds($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_TAX_IDS, $params, $opts); } /** * @param string $id the ID of the customer on which to create the tax id * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TaxId */ public static function createTaxId($id, $params = null, $opts = null) { return self::_createNestedResource($id, static::PATH_TAX_IDS, $params, $opts); } /** * @param string $id the ID of the customer to which the tax id belongs * @param string $taxIdId the ID of the tax id to delete * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TaxId */ public static function deleteTaxId($id, $taxIdId, $params = null, $opts = null) { return self::_deleteNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts); } /** * @param string $id the ID of the customer to which the tax id belongs * @param string $taxIdId the ID of the tax id to retrieve * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TaxId */ public static function retrieveTaxId($id, $taxIdId, $params = null, $opts = null) { return self::_retrieveNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts); } } stripe-php/lib/Event.php 0000666 00000043240 15165746005 0011217 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Events are our way of letting you know when something interesting happens in * your account. When an interesting event occurs, we create a new * <code>Event</code> object. For example, when a charge succeeds, we create a * <code>charge.succeeded</code> event; and when an invoice payment attempt fails, * we create an <code>invoice.payment_failed</code> event. Note that many API * requests may cause multiple events to be created. For example, if you create a * new subscription for a customer, you will receive both a * <code>customer.subscription.created</code> event and a * <code>charge.succeeded</code> event. * * Events occur when the state of another API resource changes. The state of that * resource at the time of the change is embedded in the event's data field. For * example, a <code>charge.succeeded</code> event will contain a charge, and an * <code>invoice.payment_failed</code> event will contain an invoice. * * As with other API resources, you can use endpoints to retrieve an <a * href="https://stripe.com/docs/api#retrieve_event">individual event</a> or a <a * href="https://stripe.com/docs/api#list_events">list of events</a> from the API. * We also have a separate <a * href="http://en.wikipedia.org/wiki/Webhook">webhooks</a> system for sending the * <code>Event</code> objects directly to an endpoint on your server. Webhooks are * managed in your <a href="https://dashboard.stripe.com/account/webhooks">account * settings</a>, and our <a href="https://stripe.com/docs/webhooks">Using * Webhooks</a> guide will help you get set up. * * When using <a href="https://stripe.com/docs/connect">Connect</a>, you can also * receive notifications of events that occur in connected accounts. For these * events, there will be an additional <code>account</code> attribute in the * received <code>Event</code> object. * * <strong>NOTE:</strong> Right now, access to events through the <a * href="https://stripe.com/docs/api#retrieve_event">Retrieve Event API</a> is * guaranteed only for 30 days. * * This class includes constants for the possible string representations of * event types. See https://stripe.com/docs/api#event_types for more details. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property string $account The connected account that originated the event. * @property null|string $api_version The Stripe API version used to render <code>data</code>. <em>Note: This property is populated only for events on or after October 31, 2014</em>. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property \AmeliaStripe\StripeObject $data * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property int $pending_webhooks Number of webhooks that have yet to be successfully delivered (i.e., to return a 20x response) to the URLs you've specified. * @property null|\AmeliaStripe\StripeObject $request Information on the API request that instigated the event. * @property string $type Description of the event (e.g., <code>invoice.created</code> or <code>charge.refunded</code>). */ class Event extends ApiResource { const OBJECT_NAME = 'event'; use ApiOperations\All; use ApiOperations\Retrieve; const ACCOUNT_APPLICATION_AUTHORIZED = 'account.application.authorized'; const ACCOUNT_APPLICATION_DEAUTHORIZED = 'account.application.deauthorized'; const ACCOUNT_EXTERNAL_ACCOUNT_CREATED = 'account.external_account.created'; const ACCOUNT_EXTERNAL_ACCOUNT_DELETED = 'account.external_account.deleted'; const ACCOUNT_EXTERNAL_ACCOUNT_UPDATED = 'account.external_account.updated'; const ACCOUNT_UPDATED = 'account.updated'; const APPLICATION_FEE_CREATED = 'application_fee.created'; const APPLICATION_FEE_REFUND_UPDATED = 'application_fee.refund.updated'; const APPLICATION_FEE_REFUNDED = 'application_fee.refunded'; const BALANCE_AVAILABLE = 'balance.available'; const BILLING_PORTAL_CONFIGURATION_CREATED = 'billing_portal.configuration.created'; const BILLING_PORTAL_CONFIGURATION_UPDATED = 'billing_portal.configuration.updated'; const BILLING_PORTAL_SESSION_CREATED = 'billing_portal.session.created'; const CAPABILITY_UPDATED = 'capability.updated'; const CASH_BALANCE_FUNDS_AVAILABLE = 'cash_balance.funds_available'; const CHARGE_CAPTURED = 'charge.captured'; const CHARGE_DISPUTE_CLOSED = 'charge.dispute.closed'; const CHARGE_DISPUTE_CREATED = 'charge.dispute.created'; const CHARGE_DISPUTE_FUNDS_REINSTATED = 'charge.dispute.funds_reinstated'; const CHARGE_DISPUTE_FUNDS_WITHDRAWN = 'charge.dispute.funds_withdrawn'; const CHARGE_DISPUTE_UPDATED = 'charge.dispute.updated'; const CHARGE_EXPIRED = 'charge.expired'; const CHARGE_FAILED = 'charge.failed'; const CHARGE_PENDING = 'charge.pending'; const CHARGE_REFUND_UPDATED = 'charge.refund.updated'; const CHARGE_REFUNDED = 'charge.refunded'; const CHARGE_SUCCEEDED = 'charge.succeeded'; const CHARGE_UPDATED = 'charge.updated'; const CHECKOUT_SESSION_ASYNC_PAYMENT_FAILED = 'checkout.session.async_payment_failed'; const CHECKOUT_SESSION_ASYNC_PAYMENT_SUCCEEDED = 'checkout.session.async_payment_succeeded'; const CHECKOUT_SESSION_COMPLETED = 'checkout.session.completed'; const CHECKOUT_SESSION_EXPIRED = 'checkout.session.expired'; const COUPON_CREATED = 'coupon.created'; const COUPON_DELETED = 'coupon.deleted'; const COUPON_UPDATED = 'coupon.updated'; const CREDIT_NOTE_CREATED = 'credit_note.created'; const CREDIT_NOTE_UPDATED = 'credit_note.updated'; const CREDIT_NOTE_VOIDED = 'credit_note.voided'; const CUSTOMER_CREATED = 'customer.created'; const CUSTOMER_DELETED = 'customer.deleted'; const CUSTOMER_DISCOUNT_CREATED = 'customer.discount.created'; const CUSTOMER_DISCOUNT_DELETED = 'customer.discount.deleted'; const CUSTOMER_DISCOUNT_UPDATED = 'customer.discount.updated'; const CUSTOMER_SOURCE_CREATED = 'customer.source.created'; const CUSTOMER_SOURCE_DELETED = 'customer.source.deleted'; const CUSTOMER_SOURCE_EXPIRING = 'customer.source.expiring'; const CUSTOMER_SOURCE_UPDATED = 'customer.source.updated'; const CUSTOMER_SUBSCRIPTION_CREATED = 'customer.subscription.created'; const CUSTOMER_SUBSCRIPTION_DELETED = 'customer.subscription.deleted'; const CUSTOMER_SUBSCRIPTION_PENDING_UPDATE_APPLIED = 'customer.subscription.pending_update_applied'; const CUSTOMER_SUBSCRIPTION_PENDING_UPDATE_EXPIRED = 'customer.subscription.pending_update_expired'; const CUSTOMER_SUBSCRIPTION_TRIAL_WILL_END = 'customer.subscription.trial_will_end'; const CUSTOMER_SUBSCRIPTION_UPDATED = 'customer.subscription.updated'; const CUSTOMER_TAX_ID_CREATED = 'customer.tax_id.created'; const CUSTOMER_TAX_ID_DELETED = 'customer.tax_id.deleted'; const CUSTOMER_TAX_ID_UPDATED = 'customer.tax_id.updated'; const CUSTOMER_UPDATED = 'customer.updated'; const CUSTOMER_CASH_BALANCE_TRANSACTION_CREATED = 'customer_cash_balance_transaction.created'; const FILE_CREATED = 'file.created'; const FINANCIAL_CONNECTIONS_ACCOUNT_CREATED = 'financial_connections.account.created'; const FINANCIAL_CONNECTIONS_ACCOUNT_DEACTIVATED = 'financial_connections.account.deactivated'; const FINANCIAL_CONNECTIONS_ACCOUNT_DISCONNECTED = 'financial_connections.account.disconnected'; const FINANCIAL_CONNECTIONS_ACCOUNT_REACTIVATED = 'financial_connections.account.reactivated'; const FINANCIAL_CONNECTIONS_ACCOUNT_REFRESHED_BALANCE = 'financial_connections.account.refreshed_balance'; const IDENTITY_VERIFICATION_SESSION_CANCELED = 'identity.verification_session.canceled'; const IDENTITY_VERIFICATION_SESSION_CREATED = 'identity.verification_session.created'; const IDENTITY_VERIFICATION_SESSION_PROCESSING = 'identity.verification_session.processing'; const IDENTITY_VERIFICATION_SESSION_REDACTED = 'identity.verification_session.redacted'; const IDENTITY_VERIFICATION_SESSION_REQUIRES_INPUT = 'identity.verification_session.requires_input'; const IDENTITY_VERIFICATION_SESSION_VERIFIED = 'identity.verification_session.verified'; const INVOICE_CREATED = 'invoice.created'; const INVOICE_DELETED = 'invoice.deleted'; const INVOICE_FINALIZATION_FAILED = 'invoice.finalization_failed'; const INVOICE_FINALIZED = 'invoice.finalized'; const INVOICE_MARKED_UNCOLLECTIBLE = 'invoice.marked_uncollectible'; const INVOICE_PAID = 'invoice.paid'; const INVOICE_PAYMENT_ACTION_REQUIRED = 'invoice.payment_action_required'; const INVOICE_PAYMENT_FAILED = 'invoice.payment_failed'; const INVOICE_PAYMENT_SUCCEEDED = 'invoice.payment_succeeded'; const INVOICE_SENT = 'invoice.sent'; const INVOICE_UPCOMING = 'invoice.upcoming'; const INVOICE_UPDATED = 'invoice.updated'; const INVOICE_VOIDED = 'invoice.voided'; const INVOICEITEM_CREATED = 'invoiceitem.created'; const INVOICEITEM_DELETED = 'invoiceitem.deleted'; const INVOICEITEM_UPDATED = 'invoiceitem.updated'; const ISSUING_AUTHORIZATION_CREATED = 'issuing_authorization.created'; const ISSUING_AUTHORIZATION_REQUEST = 'issuing_authorization.request'; const ISSUING_AUTHORIZATION_UPDATED = 'issuing_authorization.updated'; const ISSUING_CARD_CREATED = 'issuing_card.created'; const ISSUING_CARD_UPDATED = 'issuing_card.updated'; const ISSUING_CARDHOLDER_CREATED = 'issuing_cardholder.created'; const ISSUING_CARDHOLDER_UPDATED = 'issuing_cardholder.updated'; const ISSUING_DISPUTE_CLOSED = 'issuing_dispute.closed'; const ISSUING_DISPUTE_CREATED = 'issuing_dispute.created'; const ISSUING_DISPUTE_FUNDS_REINSTATED = 'issuing_dispute.funds_reinstated'; const ISSUING_DISPUTE_SUBMITTED = 'issuing_dispute.submitted'; const ISSUING_DISPUTE_UPDATED = 'issuing_dispute.updated'; const ISSUING_TRANSACTION_CREATED = 'issuing_transaction.created'; const ISSUING_TRANSACTION_UPDATED = 'issuing_transaction.updated'; const MANDATE_UPDATED = 'mandate.updated'; const ORDER_CREATED = 'order.created'; const PAYMENT_INTENT_AMOUNT_CAPTURABLE_UPDATED = 'payment_intent.amount_capturable_updated'; const PAYMENT_INTENT_CANCELED = 'payment_intent.canceled'; const PAYMENT_INTENT_CREATED = 'payment_intent.created'; const PAYMENT_INTENT_PARTIALLY_FUNDED = 'payment_intent.partially_funded'; const PAYMENT_INTENT_PAYMENT_FAILED = 'payment_intent.payment_failed'; const PAYMENT_INTENT_PROCESSING = 'payment_intent.processing'; const PAYMENT_INTENT_REQUIRES_ACTION = 'payment_intent.requires_action'; const PAYMENT_INTENT_SUCCEEDED = 'payment_intent.succeeded'; const PAYMENT_LINK_CREATED = 'payment_link.created'; const PAYMENT_LINK_UPDATED = 'payment_link.updated'; const PAYMENT_METHOD_ATTACHED = 'payment_method.attached'; const PAYMENT_METHOD_AUTOMATICALLY_UPDATED = 'payment_method.automatically_updated'; const PAYMENT_METHOD_DETACHED = 'payment_method.detached'; const PAYMENT_METHOD_UPDATED = 'payment_method.updated'; const PAYOUT_CANCELED = 'payout.canceled'; const PAYOUT_CREATED = 'payout.created'; const PAYOUT_FAILED = 'payout.failed'; const PAYOUT_PAID = 'payout.paid'; const PAYOUT_UPDATED = 'payout.updated'; const PERSON_CREATED = 'person.created'; const PERSON_DELETED = 'person.deleted'; const PERSON_UPDATED = 'person.updated'; const PLAN_CREATED = 'plan.created'; const PLAN_DELETED = 'plan.deleted'; const PLAN_UPDATED = 'plan.updated'; const PRICE_CREATED = 'price.created'; const PRICE_DELETED = 'price.deleted'; const PRICE_UPDATED = 'price.updated'; const PRODUCT_CREATED = 'product.created'; const PRODUCT_DELETED = 'product.deleted'; const PRODUCT_UPDATED = 'product.updated'; const PROMOTION_CODE_CREATED = 'promotion_code.created'; const PROMOTION_CODE_UPDATED = 'promotion_code.updated'; const QUOTE_ACCEPTED = 'quote.accepted'; const QUOTE_CANCELED = 'quote.canceled'; const QUOTE_CREATED = 'quote.created'; const QUOTE_FINALIZED = 'quote.finalized'; const RADAR_EARLY_FRAUD_WARNING_CREATED = 'radar.early_fraud_warning.created'; const RADAR_EARLY_FRAUD_WARNING_UPDATED = 'radar.early_fraud_warning.updated'; const RECIPIENT_CREATED = 'recipient.created'; const RECIPIENT_DELETED = 'recipient.deleted'; const RECIPIENT_UPDATED = 'recipient.updated'; const REPORTING_REPORT_RUN_FAILED = 'reporting.report_run.failed'; const REPORTING_REPORT_RUN_SUCCEEDED = 'reporting.report_run.succeeded'; const REPORTING_REPORT_TYPE_UPDATED = 'reporting.report_type.updated'; const REVIEW_CLOSED = 'review.closed'; const REVIEW_OPENED = 'review.opened'; const SETUP_INTENT_CANCELED = 'setup_intent.canceled'; const SETUP_INTENT_CREATED = 'setup_intent.created'; const SETUP_INTENT_REQUIRES_ACTION = 'setup_intent.requires_action'; const SETUP_INTENT_SETUP_FAILED = 'setup_intent.setup_failed'; const SETUP_INTENT_SUCCEEDED = 'setup_intent.succeeded'; const SIGMA_SCHEDULED_QUERY_RUN_CREATED = 'sigma.scheduled_query_run.created'; const SKU_CREATED = 'sku.created'; const SKU_DELETED = 'sku.deleted'; const SKU_UPDATED = 'sku.updated'; const SOURCE_CANCELED = 'source.canceled'; const SOURCE_CHARGEABLE = 'source.chargeable'; const SOURCE_FAILED = 'source.failed'; const SOURCE_MANDATE_NOTIFICATION = 'source.mandate_notification'; const SOURCE_REFUND_ATTRIBUTES_REQUIRED = 'source.refund_attributes_required'; const SOURCE_TRANSACTION_CREATED = 'source.transaction.created'; const SOURCE_TRANSACTION_UPDATED = 'source.transaction.updated'; const SUBSCRIPTION_SCHEDULE_ABORTED = 'subscription_schedule.aborted'; const SUBSCRIPTION_SCHEDULE_CANCELED = 'subscription_schedule.canceled'; const SUBSCRIPTION_SCHEDULE_COMPLETED = 'subscription_schedule.completed'; const SUBSCRIPTION_SCHEDULE_CREATED = 'subscription_schedule.created'; const SUBSCRIPTION_SCHEDULE_EXPIRING = 'subscription_schedule.expiring'; const SUBSCRIPTION_SCHEDULE_RELEASED = 'subscription_schedule.released'; const SUBSCRIPTION_SCHEDULE_UPDATED = 'subscription_schedule.updated'; const TAX_RATE_CREATED = 'tax_rate.created'; const TAX_RATE_UPDATED = 'tax_rate.updated'; const TERMINAL_READER_ACTION_FAILED = 'terminal.reader.action_failed'; const TERMINAL_READER_ACTION_SUCCEEDED = 'terminal.reader.action_succeeded'; const TEST_HELPERS_TEST_CLOCK_ADVANCING = 'test_helpers.test_clock.advancing'; const TEST_HELPERS_TEST_CLOCK_CREATED = 'test_helpers.test_clock.created'; const TEST_HELPERS_TEST_CLOCK_DELETED = 'test_helpers.test_clock.deleted'; const TEST_HELPERS_TEST_CLOCK_INTERNAL_FAILURE = 'test_helpers.test_clock.internal_failure'; const TEST_HELPERS_TEST_CLOCK_READY = 'test_helpers.test_clock.ready'; const TOPUP_CANCELED = 'topup.canceled'; const TOPUP_CREATED = 'topup.created'; const TOPUP_FAILED = 'topup.failed'; const TOPUP_REVERSED = 'topup.reversed'; const TOPUP_SUCCEEDED = 'topup.succeeded'; const TRANSFER_CREATED = 'transfer.created'; const TRANSFER_REVERSED = 'transfer.reversed'; const TRANSFER_UPDATED = 'transfer.updated'; const TREASURY_CREDIT_REVERSAL_CREATED = 'treasury.credit_reversal.created'; const TREASURY_CREDIT_REVERSAL_POSTED = 'treasury.credit_reversal.posted'; const TREASURY_DEBIT_REVERSAL_COMPLETED = 'treasury.debit_reversal.completed'; const TREASURY_DEBIT_REVERSAL_CREATED = 'treasury.debit_reversal.created'; const TREASURY_DEBIT_REVERSAL_INITIAL_CREDIT_GRANTED = 'treasury.debit_reversal.initial_credit_granted'; const TREASURY_FINANCIAL_ACCOUNT_CLOSED = 'treasury.financial_account.closed'; const TREASURY_FINANCIAL_ACCOUNT_CREATED = 'treasury.financial_account.created'; const TREASURY_FINANCIAL_ACCOUNT_FEATURES_STATUS_UPDATED = 'treasury.financial_account.features_status_updated'; const TREASURY_INBOUND_TRANSFER_CANCELED = 'treasury.inbound_transfer.canceled'; const TREASURY_INBOUND_TRANSFER_CREATED = 'treasury.inbound_transfer.created'; const TREASURY_INBOUND_TRANSFER_FAILED = 'treasury.inbound_transfer.failed'; const TREASURY_INBOUND_TRANSFER_SUCCEEDED = 'treasury.inbound_transfer.succeeded'; const TREASURY_OUTBOUND_PAYMENT_CANCELED = 'treasury.outbound_payment.canceled'; const TREASURY_OUTBOUND_PAYMENT_CREATED = 'treasury.outbound_payment.created'; const TREASURY_OUTBOUND_PAYMENT_EXPECTED_ARRIVAL_DATE_UPDATED = 'treasury.outbound_payment.expected_arrival_date_updated'; const TREASURY_OUTBOUND_PAYMENT_FAILED = 'treasury.outbound_payment.failed'; const TREASURY_OUTBOUND_PAYMENT_POSTED = 'treasury.outbound_payment.posted'; const TREASURY_OUTBOUND_PAYMENT_RETURNED = 'treasury.outbound_payment.returned'; const TREASURY_OUTBOUND_TRANSFER_CANCELED = 'treasury.outbound_transfer.canceled'; const TREASURY_OUTBOUND_TRANSFER_CREATED = 'treasury.outbound_transfer.created'; const TREASURY_OUTBOUND_TRANSFER_EXPECTED_ARRIVAL_DATE_UPDATED = 'treasury.outbound_transfer.expected_arrival_date_updated'; const TREASURY_OUTBOUND_TRANSFER_FAILED = 'treasury.outbound_transfer.failed'; const TREASURY_OUTBOUND_TRANSFER_POSTED = 'treasury.outbound_transfer.posted'; const TREASURY_OUTBOUND_TRANSFER_RETURNED = 'treasury.outbound_transfer.returned'; const TREASURY_RECEIVED_CREDIT_CREATED = 'treasury.received_credit.created'; const TREASURY_RECEIVED_CREDIT_FAILED = 'treasury.received_credit.failed'; const TREASURY_RECEIVED_CREDIT_SUCCEEDED = 'treasury.received_credit.succeeded'; const TREASURY_RECEIVED_DEBIT_CREATED = 'treasury.received_debit.created'; } stripe-php/lib/Checkout/Session.php 0000666 00000023641 15165746005 0013331 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Checkout; /** * A Checkout Session represents your customer's session as they pay for one-time * purchases or subscriptions through <a * href="https://stripe.com/docs/payments/checkout">Checkout</a> or <a * href="https://stripe.com/docs/payments/payment-links">Payment Links</a>. We * recommend creating a new Session each time your customer attempts to pay. * * Once payment is successful, the Checkout Session will contain a reference to the * <a href="https://stripe.com/docs/api/customers">Customer</a>, and either the * successful <a * href="https://stripe.com/docs/api/payment_intents">PaymentIntent</a> or an * active <a href="https://stripe.com/docs/api/subscriptions">Subscription</a>. * * You can create a Checkout Session on your server and pass its ID to the client * to begin Checkout. * * Related guide: <a href="https://stripe.com/docs/checkout/quickstart">Checkout * Quickstart</a>. * * @property string $id Unique identifier for the object. Used to pass to <code>redirectToCheckout</code> in Stripe.js. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|\AmeliaStripe\StripeObject $after_expiration When set, provides configuration for actions to take if this Checkout Session expires. * @property null|bool $allow_promotion_codes Enables user redeemable promotion codes. * @property null|int $amount_subtotal Total of all items before discounts or taxes are applied. * @property null|int $amount_total Total of all items after discounts and taxes are applied. * @property \AmeliaStripe\StripeObject $automatic_tax * @property null|string $billing_address_collection Describes whether Checkout should collect the customer's billing address. * @property string $cancel_url The URL the customer will be directed to if they decide to cancel payment and return to your website. * @property null|string $client_reference_id A unique string to reference the Checkout Session. This can be a customer ID, a cart ID, or similar, and can be used to reconcile the Session with your internal systems. * @property null|\AmeliaStripe\StripeObject $consent Results of <code>consent_collection</code> for this session. * @property null|\AmeliaStripe\StripeObject $consent_collection When set, provides configuration for the Checkout Session to gather active consent from customers. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string|\AmeliaStripe\Customer $customer The ID of the customer for this Session. For Checkout Sessions in <code>payment</code> or <code>subscription</code> mode, Checkout will create a new customer object based on information provided during the payment flow unless an existing customer was provided when the Session was created. * @property null|string $customer_creation Configure whether a Checkout Session creates a Customer when the Checkout Session completes. * @property null|\AmeliaStripe\StripeObject $customer_details The customer details including the customer's tax exempt status and the customer's tax IDs. Only the customer's email is present on Sessions in <code>setup</code> mode. * @property null|string $customer_email If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once the payment flow is complete, use the <code>customer</code> attribute. * @property int $expires_at The timestamp at which the Checkout Session will expire. * @property \AmeliaStripe\Collection<\AmeliaStripe\LineItem> $line_items The line items purchased by the customer. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|string $locale The IETF language tag of the locale Checkout is displayed in. If blank or <code>auto</code>, the browser's locale is used. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $mode The mode of the Checkout Session. * @property null|string|\AmeliaStripe\PaymentIntent $payment_intent The ID of the PaymentIntent for Checkout Sessions in <code>payment</code> mode. * @property null|string|\AmeliaStripe\PaymentLink $payment_link The ID of the Payment Link that created this Session. * @property null|string $payment_method_collection Configure whether a Checkout Session should collect a payment method. * @property null|\AmeliaStripe\StripeObject $payment_method_options Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession. * @property string[] $payment_method_types A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept. * @property string $payment_status The payment status of the Checkout Session, one of <code>paid</code>, <code>unpaid</code>, or <code>no_payment_required</code>. You can use this value to decide when to fulfill your customer's order. * @property \AmeliaStripe\StripeObject $phone_number_collection * @property null|string $recovered_from The ID of the original expired Checkout Session that triggered the recovery flow. * @property null|string|\AmeliaStripe\SetupIntent $setup_intent The ID of the SetupIntent for Checkout Sessions in <code>setup</code> mode. * @property null|\AmeliaStripe\StripeObject $shipping_address_collection When set, provides configuration for Checkout to collect a shipping address from a customer. * @property null|\AmeliaStripe\StripeObject $shipping_cost The details of the customer cost of shipping, including the customer chosen ShippingRate. * @property null|\AmeliaStripe\StripeObject $shipping_details Shipping information for this Checkout Session. * @property \AmeliaStripe\StripeObject[] $shipping_options The shipping rate options applied to this Session. * @property null|string $status The status of the Checkout Session, one of <code>open</code>, <code>complete</code>, or <code>expired</code>. * @property null|string $submit_type Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button. <code>submit_type</code> can only be specified on Checkout Sessions in <code>payment</code> mode, but not Checkout Sessions in <code>subscription</code> or <code>setup</code> mode. * @property null|string|\AmeliaStripe\Subscription $subscription The ID of the subscription for Checkout Sessions in <code>subscription</code> mode. * @property string $success_url The URL the customer will be directed to after the payment or subscription creation is successful. * @property \AmeliaStripe\StripeObject $tax_id_collection * @property null|\AmeliaStripe\StripeObject $total_details Tax and discount details for the computed total amount. * @property null|string $url The URL to the Checkout Session. Redirect customers to this URL to take them to Checkout. If you’re using <a href="https://stripe.com/docs/payments/checkout/custom-domains">Custom Domains</a>, the URL will use your subdomain. Otherwise, it’ll use <code>checkout.stripe.com.</code> This value is only present when the session is active. */ class Session extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'checkout.session'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Retrieve; const BILLING_ADDRESS_COLLECTION_AUTO = 'auto'; const BILLING_ADDRESS_COLLECTION_REQUIRED = 'required'; const CUSTOMER_CREATION_ALWAYS = 'always'; const CUSTOMER_CREATION_IF_REQUIRED = 'if_required'; const MODE_PAYMENT = 'payment'; const MODE_SETUP = 'setup'; const MODE_SUBSCRIPTION = 'subscription'; const PAYMENT_METHOD_COLLECTION_ALWAYS = 'always'; const PAYMENT_METHOD_COLLECTION_IF_REQUIRED = 'if_required'; const PAYMENT_STATUS_NO_PAYMENT_REQUIRED = 'no_payment_required'; const PAYMENT_STATUS_PAID = 'paid'; const PAYMENT_STATUS_UNPAID = 'unpaid'; const STATUS_COMPLETE = 'complete'; const STATUS_EXPIRED = 'expired'; const STATUS_OPEN = 'open'; const SUBMIT_TYPE_AUTO = 'auto'; const SUBMIT_TYPE_BOOK = 'book'; const SUBMIT_TYPE_DONATE = 'donate'; const SUBMIT_TYPE_PAY = 'pay'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Checkout\Session the expired session */ public function expire($params = null, $opts = null) { $url = $this->instanceUrl() . '/expire'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param string $id * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\LineItem> list of LineItems */ public static function allLineItems($id, $params = null, $opts = null) { $url = static::resourceUrl($id) . '/line_items'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } } stripe-php/lib/TaxRate.php 0000666 00000005714 15165746005 0011512 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Tax rates can be applied to <a * href="https://stripe.com/docs/billing/invoices/tax-rates">invoices</a>, <a * href="https://stripe.com/docs/billing/subscriptions/taxes">subscriptions</a> and * <a * href="https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates">Checkout * Sessions</a> to collect tax. * * Related guide: <a href="https://stripe.com/docs/billing/taxes/tax-rates">Tax * Rates</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property bool $active Defaults to <code>true</code>. When set to <code>false</code>, this tax rate cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set. * @property null|string $country Two-letter country code (<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>). * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $description An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers. * @property string $display_name The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page. * @property bool $inclusive This specifies if the tax rate is inclusive or exclusive. * @property null|string $jurisdiction The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property float $percentage This represents the tax rate percent out of 100. * @property null|string $state <a href="https://en.wikipedia.org/wiki/ISO_3166-2:US">ISO 3166-2 subdivision code</a>, without country prefix. For example, "NY" for New York, United States. * @property null|string $tax_type The high-level tax type, such as <code>vat</code> or <code>sales_tax</code>. */ class TaxRate extends ApiResource { const OBJECT_NAME = 'tax_rate'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; const TAX_TYPE_GST = 'gst'; const TAX_TYPE_HST = 'hst'; const TAX_TYPE_JCT = 'jct'; const TAX_TYPE_PST = 'pst'; const TAX_TYPE_QST = 'qst'; const TAX_TYPE_RST = 'rst'; const TAX_TYPE_SALES_TAX = 'sales_tax'; const TAX_TYPE_VAT = 'vat'; } stripe-php/lib/ApiResponse.php 0000666 00000001324 15165746005 0012363 0 ustar 00 <?php namespace AmeliaStripe; use AmeliaStripe\Util\CaseInsensitiveArray; /** * Class ApiResponse. */ class ApiResponse { /** * @var null|array|CaseInsensitiveArray */ public $headers; /** * @var string */ public $body; /** * @var null|array */ public $json; /** * @var int */ public $code; /** * @param string $body * @param int $code * @param null|array|CaseInsensitiveArray $headers * @param null|array $json */ public function __construct($body, $code, $headers, $json) { $this->body = $body; $this->code = $code; $this->headers = $headers; $this->json = $json; } } stripe-php/lib/Issuing/Cardholder.php 0000666 00000004756 15165746005 0013637 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Issuing; /** * An Issuing <code>Cardholder</code> object represents an individual or business * entity who is <a href="https://stripe.com/docs/issuing">issued</a> cards. * * Related guide: <a * href="https://stripe.com/docs/issuing/cards#create-cardholder">How to create a * Cardholder</a> * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \AmeliaStripe\StripeObject $billing * @property null|\AmeliaStripe\StripeObject $company Additional information about a <code>company</code> cardholder. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $email The cardholder's email address. * @property null|\AmeliaStripe\StripeObject $individual Additional information about an <code>individual</code> cardholder. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $name The cardholder's name. This will be printed on cards issued to them. * @property null|string $phone_number The cardholder's phone number. This is required for all cardholders who will be creating EU cards. See the <a href="https://stripe.com/docs/issuing/3d-secure#when-is-3d-secure-applied">3D Secure documentation</a> for more details. * @property \AmeliaStripe\StripeObject $requirements * @property null|\AmeliaStripe\StripeObject $spending_controls Rules that control spending across this cardholder's cards. Refer to our <a href="https://stripe.com/docs/issuing/controls/spending-controls">documentation</a> for more details. * @property string $status Specifies whether to permit authorizations on this cardholder's cards. * @property string $type One of <code>individual</code> or <code>company</code>. */ class Cardholder extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'issuing.cardholder'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Retrieve; use \AmeliaStripe\ApiOperations\Update; } stripe-php/lib/Issuing/Transaction.php 0000666 00000007371 15165746005 0014051 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Issuing; /** * Any use of an <a href="https://stripe.com/docs/issuing">issued card</a> that * results in funds entering or leaving your Stripe account, such as a completed * purchase or refund, is represented by an Issuing <code>Transaction</code> * object. * * Related guide: <a * href="https://stripe.com/docs/issuing/purchases/transactions">Issued Card * Transactions</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount The transaction amount, which will be reflected in your balance. This amount is in your currency and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. * @property null|\AmeliaStripe\StripeObject $amount_details Detailed breakdown of amount components. These amounts are denominated in <code>currency</code> and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. * @property null|string|\AmeliaStripe\Issuing\Authorization $authorization The <code>Authorization</code> object that led to this transaction. * @property null|string|\AmeliaStripe\BalanceTransaction $balance_transaction ID of the <a href="https://stripe.com/docs/api/balance_transactions">balance transaction</a> associated with this transaction. * @property string|\AmeliaStripe\Issuing\Card $card The card used to make this transaction. * @property null|string|\AmeliaStripe\Issuing\Cardholder $cardholder The cardholder to whom this transaction belongs. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string|\AmeliaStripe\Issuing\Dispute $dispute If you've disputed the transaction, the ID of the dispute. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property int $merchant_amount The amount that the merchant will receive, denominated in <code>merchant_currency</code> and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. It will be different from <code>amount</code> if the merchant is taking payment in a different currency. * @property string $merchant_currency The currency with which the merchant is taking payment. * @property \AmeliaStripe\StripeObject $merchant_data * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|\AmeliaStripe\StripeObject $purchase_details Additional purchase information that is optionally provided by the merchant. * @property null|\AmeliaStripe\StripeObject $treasury <a href="https://stripe.com/docs/api/treasury">Treasury</a> details related to this transaction if it was created on a [FinancialAccount](/docs/api/treasury/financial_accounts * @property string $type The nature of the transaction. * @property null|string $wallet The digital wallet used for this transaction. One of <code>apple_pay</code>, <code>google_pay</code>, or <code>samsung_pay</code>. */ class Transaction extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'issuing.transaction'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Retrieve; use \AmeliaStripe\ApiOperations\Update; } stripe-php/lib/Issuing/Card.php 0000666 00000007416 15165746005 0012435 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Issuing; /** * You can <a href="https://stripe.com/docs/issuing/cards">create physical or * virtual cards</a> that are issued to cardholders. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property string $brand The brand of the card. * @property null|string $cancellation_reason The reason why the card was canceled. * @property \AmeliaStripe\Issuing\Cardholder $cardholder <p>An Issuing <code>Cardholder</code> object represents an individual or business entity who is <a href="https://stripe.com/docs/issuing">issued</a> cards.</p><p>Related guide: <a href="https://stripe.com/docs/issuing/cards#create-cardholder">How to create a Cardholder</a></p> * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Supported currencies are <code>usd</code> in the US, <code>eur</code> in the EU, and <code>gbp</code> in the UK. * @property string $cvc The card's CVC. For security reasons, this is only available for virtual cards, and will be omitted unless you explicitly request it with <a href="https://stripe.com/docs/api/expanding_objects">the <code>expand</code> parameter</a>. Additionally, it's only available via the <a href="https://stripe.com/docs/api/issuing/cards/retrieve">"Retrieve a card" endpoint</a>, not via "List all cards" or any other endpoint. * @property int $exp_month The expiration month of the card. * @property int $exp_year The expiration year of the card. * @property null|string $financial_account The financial account this card is attached to. * @property string $last4 The last 4 digits of the card number. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $number The full unredacted card number. For security reasons, this is only available for virtual cards, and will be omitted unless you explicitly request it with <a href="https://stripe.com/docs/api/expanding_objects">the <code>expand</code> parameter</a>. Additionally, it's only available via the <a href="https://stripe.com/docs/api/issuing/cards/retrieve">"Retrieve a card" endpoint</a>, not via "List all cards" or any other endpoint. * @property null|string|\AmeliaStripe\Issuing\Card $replaced_by The latest card that replaces this card, if any. * @property null|string|\AmeliaStripe\Issuing\Card $replacement_for The card this card replaces, if any. * @property null|string $replacement_reason The reason why the previous card needed to be replaced. * @property null|\AmeliaStripe\StripeObject $shipping Where and how the card will be shipped. * @property \AmeliaStripe\StripeObject $spending_controls * @property string $status Whether authorizations can be approved on this card. * @property string $type The type of the card. * @property null|\AmeliaStripe\StripeObject $wallets Information relating to digital wallets (like Apple Pay and Google Pay). */ class Card extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'issuing.card'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Retrieve; use \AmeliaStripe\ApiOperations\Update; } stripe-php/lib/Issuing/CardDetails.php 0000666 00000000551 15165746005 0013734 0 ustar 00 <?php namespace AmeliaStripe\Issuing; /** * Class CardDetails. * * @property string $id * @property string $object * @property Card $card * @property string $cvc * @property int $exp_month * @property int $exp_year * @property string $number */ class CardDetails extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'issuing.card_details'; } stripe-php/lib/Issuing/Dispute.php 0000666 00000005362 15165746005 0013177 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Issuing; /** * As a <a href="https://stripe.com/docs/issuing">card issuer</a>, you can dispute * transactions that the cardholder does not recognize, suspects to be fraudulent, * or has other issues with. * * Related guide: <a * href="https://stripe.com/docs/issuing/purchases/disputes">Disputing * Transactions</a> * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Disputed amount in the card's currency and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. Usually the amount of the <code>transaction</code>, but can differ (usually because of currency fluctuation). * @property null|\AmeliaStripe\BalanceTransaction[] $balance_transactions List of balance transactions associated with the dispute. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency The currency the <code>transaction</code> was made in. * @property \AmeliaStripe\StripeObject $evidence * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $status Current status of the dispute. * @property string|\AmeliaStripe\Issuing\Transaction $transaction The transaction being disputed. * @property null|\AmeliaStripe\StripeObject $treasury <a href="https://stripe.com/docs/api/treasury">Treasury</a> details related to this dispute if it was created on a [FinancialAccount](/docs/api/treasury/financial_accounts */ class Dispute extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'issuing.dispute'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Retrieve; use \AmeliaStripe\ApiOperations\Update; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Dispute the submited dispute */ public function submit($params = null, $opts = null) { $url = $this->instanceUrl() . '/submit'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/Issuing/Authorization.php 0000666 00000013425 15165746005 0014421 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Issuing; /** * When an <a href="https://stripe.com/docs/issuing">issued card</a> is used to * make a purchase, an Issuing <code>Authorization</code> object is created. <a * href="https://stripe.com/docs/issuing/purchases/authorizations">Authorizations</a> * must be approved for the purchase to be completed successfully. * * Related guide: <a * href="https://stripe.com/docs/issuing/purchases/authorizations">Issued Card * Authorizations</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount The total amount that was authorized or rejected. This amount is in the card's currency and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. * @property null|\AmeliaStripe\StripeObject $amount_details Detailed breakdown of amount components. These amounts are denominated in <code>currency</code> and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. * @property bool $approved Whether the authorization has been approved. * @property string $authorization_method How the card details were provided. * @property \AmeliaStripe\BalanceTransaction[] $balance_transactions List of balance transactions associated with this authorization. * @property \AmeliaStripe\Issuing\Card $card You can <a href="https://stripe.com/docs/issuing/cards">create physical or virtual cards</a> that are issued to cardholders. * @property null|string|\AmeliaStripe\Issuing\Cardholder $cardholder The cardholder to whom this authorization belongs. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property int $merchant_amount The total amount that was authorized or rejected. This amount is in the <code>merchant_currency</code> and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. * @property string $merchant_currency The currency that was presented to the cardholder for the authorization. Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property \AmeliaStripe\StripeObject $merchant_data * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|\AmeliaStripe\StripeObject $network_data Details about the authorization, such as identifiers, set by the card network. * @property null|\AmeliaStripe\StripeObject $pending_request The pending authorization request. This field will only be non-null during an <code>issuing_authorization.request</code> webhook. * @property \AmeliaStripe\StripeObject[] $request_history History of every time <code>pending_request</code> was approved/denied, either by you directly or by Stripe (e.g. based on your <code>spending_controls</code>). If the merchant changes the authorization by performing an <a href="https://stripe.com/docs/issuing/purchases/authorizations">incremental authorization</a>, you can look at this field to see the previous requests for the authorization. * @property string $status The current status of the authorization in its lifecycle. * @property \AmeliaStripe\Issuing\Transaction[] $transactions List of <a href="https://stripe.com/docs/api/issuing/transactions">transactions</a> associated with this authorization. * @property null|\AmeliaStripe\StripeObject $treasury <a href="https://stripe.com/docs/api/treasury">Treasury</a> details related to this authorization if it was created on a <a href="https://stripe.com/docs/api/treasury/financial_accounts">FinancialAccount</a>. * @property \AmeliaStripe\StripeObject $verification_data * @property null|string $wallet The digital wallet used for this authorization. One of <code>apple_pay</code>, <code>google_pay</code>, or <code>samsung_pay</code>. */ class Authorization extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'issuing.authorization'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Retrieve; use \AmeliaStripe\ApiOperations\Update; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Authorization the approved authorization */ public function approve($params = null, $opts = null) { $url = $this->instanceUrl() . '/approve'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Authorization the declined authorization */ public function decline($params = null, $opts = null) { $url = $this->instanceUrl() . '/decline'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/BalanceTransaction.php 0000666 00000013074 15165746005 0013673 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Balance transactions represent funds moving through your Stripe account. They're * created for every type of transaction that comes into or flows out of your * Stripe account balance. * * Related guide: <a * href="https://stripe.com/docs/reports/balance-transaction-types">Balance * Transaction Types</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Gross amount of the transaction, in %s. * @property int $available_on The date the transaction's net funds will become available in the Stripe balance. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|float $exchange_rate The exchange rate used, if applicable, for this transaction. Specifically, if money was converted from currency A to currency B, then the <code>amount</code> in currency A, times <code>exchange_rate</code>, would be the <code>amount</code> in currency B. For example, suppose you charged a customer 10.00 EUR. Then the PaymentIntent's <code>amount</code> would be <code>1000</code> and <code>currency</code> would be <code>eur</code>. Suppose this was converted into 12.34 USD in your Stripe account. Then the BalanceTransaction's <code>amount</code> would be <code>1234</code>, <code>currency</code> would be <code>usd</code>, and <code>exchange_rate</code> would be <code>1.234</code>. * @property int $fee Fees (in %s) paid for this transaction. * @property \AmeliaStripe\StripeObject[] $fee_details Detailed breakdown of fees (in %s) paid for this transaction. * @property int $net Net amount of the transaction, in %s. * @property string $reporting_category <a href="https://stripe.com/docs/reports/reporting-categories">Learn more</a> about how reporting categories can help you understand balance transactions from an accounting perspective. * @property null|string|\AmeliaStripe\StripeObject $source The Stripe object to which this transaction is related. * @property string $status If the transaction's net funds are available in the Stripe balance yet. Either <code>available</code> or <code>pending</code>. * @property string $type Transaction type: <code>adjustment</code>, <code>advance</code>, <code>advance_funding</code>, <code>anticipation_repayment</code>, <code>application_fee</code>, <code>application_fee_refund</code>, <code>charge</code>, <code>connect_collection_transfer</code>, <code>contribution</code>, <code>issuing_authorization_hold</code>, <code>issuing_authorization_release</code>, <code>issuing_dispute</code>, <code>issuing_transaction</code>, <code>payment</code>, <code>payment_failure_refund</code>, <code>payment_refund</code>, <code>payout</code>, <code>payout_cancel</code>, <code>payout_failure</code>, <code>refund</code>, <code>refund_failure</code>, <code>reserve_transaction</code>, <code>reserved_funds</code>, <code>stripe_fee</code>, <code>stripe_fx_fee</code>, <code>tax_fee</code>, <code>topup</code>, <code>topup_reversal</code>, <code>transfer</code>, <code>transfer_cancel</code>, <code>transfer_failure</code>, or <code>transfer_refund</code>. <a href="https://stripe.com/docs/reports/balance-transaction-types">Learn more</a> about balance transaction types and what they represent. If you are looking to classify transactions for accounting purposes, you might want to consider <code>reporting_category</code> instead. */ class BalanceTransaction extends ApiResource { const OBJECT_NAME = 'balance_transaction'; use ApiOperations\All; use ApiOperations\Retrieve; const TYPE_ADJUSTMENT = 'adjustment'; const TYPE_ADVANCE = 'advance'; const TYPE_ADVANCE_FUNDING = 'advance_funding'; const TYPE_ANTICIPATION_REPAYMENT = 'anticipation_repayment'; const TYPE_APPLICATION_FEE = 'application_fee'; const TYPE_APPLICATION_FEE_REFUND = 'application_fee_refund'; const TYPE_CHARGE = 'charge'; const TYPE_CONNECT_COLLECTION_TRANSFER = 'connect_collection_transfer'; const TYPE_CONTRIBUTION = 'contribution'; const TYPE_ISSUING_AUTHORIZATION_HOLD = 'issuing_authorization_hold'; const TYPE_ISSUING_AUTHORIZATION_RELEASE = 'issuing_authorization_release'; const TYPE_ISSUING_DISPUTE = 'issuing_dispute'; const TYPE_ISSUING_TRANSACTION = 'issuing_transaction'; const TYPE_PAYMENT = 'payment'; const TYPE_PAYMENT_FAILURE_REFUND = 'payment_failure_refund'; const TYPE_PAYMENT_REFUND = 'payment_refund'; const TYPE_PAYOUT = 'payout'; const TYPE_PAYOUT_CANCEL = 'payout_cancel'; const TYPE_PAYOUT_FAILURE = 'payout_failure'; const TYPE_REFUND = 'refund'; const TYPE_REFUND_FAILURE = 'refund_failure'; const TYPE_RESERVE_TRANSACTION = 'reserve_transaction'; const TYPE_RESERVED_FUNDS = 'reserved_funds'; const TYPE_STRIPE_FEE = 'stripe_fee'; const TYPE_STRIPE_FX_FEE = 'stripe_fx_fee'; const TYPE_TAX_FEE = 'tax_fee'; const TYPE_TOPUP = 'topup'; const TYPE_TOPUP_REVERSAL = 'topup_reversal'; const TYPE_TRANSFER = 'transfer'; const TYPE_TRANSFER_CANCEL = 'transfer_cancel'; const TYPE_TRANSFER_FAILURE = 'transfer_failure'; const TYPE_TRANSFER_REFUND = 'transfer_refund'; } stripe-php/lib/SubscriptionItem.php 0000666 00000011556 15165746005 0013446 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Subscription items allow you to create customer subscriptions with more than one * plan, making it easy to represent complex billing relationships. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|\AmeliaStripe\StripeObject $billing_thresholds Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property \AmeliaStripe\Plan $plan <p>You can now model subscriptions more flexibly using the <a href="https://stripe.com/docs/api#prices">Prices API</a>. It replaces the Plans API and is backwards compatible to simplify your migration.</p><p>Plans define the base price, currency, and billing cycle for recurring purchases of products. <a href="https://stripe.com/docs/api#products">Products</a> help you track inventory or provisioning, and plans help you track pricing. Different physical goods or levels of service should be represented by products, and pricing options should be represented by plans. This approach lets you change prices without having to change your provisioning scheme.</p><p>For example, you might have a single "gold" product that has plans for $10/month, $100/year, €9/month, and €90/year.</p><p>Related guides: <a href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up a subscription</a> and more about <a href="https://stripe.com/docs/products-prices/overview">products and prices</a>.</p> * @property \AmeliaStripe\Price $price <p>Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. <a href="https://stripe.com/docs/api#products">Products</a> help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme.</p><p>For example, you might have a single "gold" product that has prices for $10/month, $100/year, and €9 once.</p><p>Related guides: <a href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up a subscription</a>, <a href="https://stripe.com/docs/billing/invoices/create">create an invoice</a>, and more about <a href="https://stripe.com/docs/products-prices/overview">products and prices</a>.</p> * @property int $quantity The <a href="https://stripe.com/docs/subscriptions/quantities">quantity</a> of the plan to which the customer should be subscribed. * @property string $subscription The <code>subscription</code> this <code>subscription_item</code> belongs to. * @property null|\AmeliaStripe\TaxRate[] $tax_rates The tax rates which apply to this <code>subscription_item</code>. When set, the <code>default_tax_rates</code> on the subscription do not apply to this <code>subscription_item</code>. */ class SubscriptionItem extends ApiResource { const OBJECT_NAME = 'subscription_item'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\NestedResource; use ApiOperations\Retrieve; use ApiOperations\Update; const PATH_USAGE_RECORDS = '/usage_records'; /** * @param null|string $id the ID of the subscription item on which to create the usage record * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\UsageRecord */ public static function createUsageRecord($id, $params = null, $opts = null) { return self::_createNestedResource($id, static::PATH_USAGE_RECORDS, $params, $opts); } const PATH_USAGE_RECORD_SUMMARIES = '/usage_record_summaries'; /** * @param string $id the ID of the subscription item on which to retrieve the usage record summaries * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\UsageRecordSummary> the list of usage record summaries */ public static function allUsageRecordSummaries($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_USAGE_RECORD_SUMMARIES, $params, $opts); } } stripe-php/lib/Coupon.php 0000666 00000006712 15165746005 0011404 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * A coupon contains information about a percent-off or amount-off discount you * might want to apply to a customer. Coupons may be applied to <a * href="https://stripe.com/docs/api#subscriptions">subscriptions</a>, <a * href="https://stripe.com/docs/api#invoices">invoices</a>, <a * href="https://stripe.com/docs/api/checkout/sessions">checkout sessions</a>, <a * href="https://stripe.com/docs/api#quotes">quotes</a>, and more. Coupons do not * work with conventional one-off <a * href="https://stripe.com/docs/api#create_charge">charges</a> or <a * href="https://stripe.com/docs/api/payment_intents">payment intents</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|int $amount_off Amount (in the <code>currency</code> specified) that will be taken off the subtotal of any invoices for this customer. * @property \AmeliaStripe\StripeObject $applies_to * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $currency If <code>amount_off</code> has been set, the three-letter <a href="https://stripe.com/docs/currencies">ISO code for the currency</a> of the amount to take off. * @property \AmeliaStripe\StripeObject $currency_options Coupons defined in each available currency option. Each key must be a three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a> and a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property string $duration One of <code>forever</code>, <code>once</code>, and <code>repeating</code>. Describes how long a customer who applies this coupon will get the discount. * @property null|int $duration_in_months If <code>duration</code> is <code>repeating</code>, the number of months the coupon applies. Null if coupon <code>duration</code> is <code>forever</code> or <code>once</code>. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|int $max_redemptions Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string $name Name of the coupon displayed to customers on for instance invoices or receipts. * @property null|float $percent_off Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a %s100 invoice %s50 instead. * @property null|int $redeem_by Date after which the coupon can no longer be redeemed. * @property int $times_redeemed Number of times this coupon has been applied to a customer. * @property bool $valid Taking account of the above properties, whether this coupon can still be applied to a customer. */ class Coupon extends ApiResource { const OBJECT_NAME = 'coupon'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Update; } stripe-php/lib/Radar/ValueListItem.php 0000666 00000002416 15165746005 0013716 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Radar; /** * Value list items allow you to add specific values to a given Radar value list, * which can then be used in rules. * * Related guide: <a * href="https://stripe.com/docs/radar/lists#managing-list-items">Managing List * Items</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $created_by The name or email address of the user who added this item to the value list. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property string $value The value of the item. * @property string $value_list The identifier of the value list this item belongs to. */ class ValueListItem extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'radar.value_list_item'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Delete; use \AmeliaStripe\ApiOperations\Retrieve; } stripe-php/lib/Radar/EarlyFraudWarning.php 0000666 00000004326 15165746005 0014555 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Radar; /** * An early fraud warning indicates that the card issuer has notified us that a * charge may be fraudulent. * * Related guide: <a * href="https://stripe.com/docs/disputes/measuring#early-fraud-warnings">Early * Fraud Warnings</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property bool $actionable An EFW is actionable if it has not received a dispute and has not been fully refunded. You may wish to proactively refund a charge that receives an EFW, in order to avoid receiving a dispute later. * @property string|\AmeliaStripe\Charge $charge ID of the charge this early fraud warning is for, optionally expanded. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $fraud_type The type of fraud labelled by the issuer. One of <code>card_never_received</code>, <code>fraudulent_card_application</code>, <code>made_with_counterfeit_card</code>, <code>made_with_lost_card</code>, <code>made_with_stolen_card</code>, <code>misc</code>, <code>unauthorized_use_of_card</code>. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property string|\AmeliaStripe\PaymentIntent $payment_intent ID of the Payment Intent this early fraud warning is for, optionally expanded. */ class EarlyFraudWarning extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'radar.early_fraud_warning'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Retrieve; const FRAUD_TYPE_CARD_NEVER_RECEIVED = 'card_never_received'; const FRAUD_TYPE_FRAUDULENT_CARD_APPLICATION = 'fraudulent_card_application'; const FRAUD_TYPE_MADE_WITH_COUNTERFEIT_CARD = 'made_with_counterfeit_card'; const FRAUD_TYPE_MADE_WITH_LOST_CARD = 'made_with_lost_card'; const FRAUD_TYPE_MADE_WITH_STOLEN_CARD = 'made_with_stolen_card'; const FRAUD_TYPE_MISC = 'misc'; const FRAUD_TYPE_UNAUTHORIZED_USE_OF_CARD = 'unauthorized_use_of_card'; } stripe-php/lib/Radar/ValueList.php 0000666 00000003637 15165746005 0013105 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Radar; /** * Value lists allow you to group values together which can then be referenced in * rules. * * Related guide: <a * href="https://stripe.com/docs/radar/lists#managing-list-items">Default Stripe * Lists</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property string $alias The name of the value list for use in rules. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $created_by The name or email address of the user who created this value list. * @property string $item_type The type of items in the value list. One of <code>card_fingerprint</code>, <code>card_bin</code>, <code>email</code>, <code>ip_address</code>, <code>country</code>, <code>string</code>, <code>case_sensitive_string</code>, or <code>customer_id</code>. * @property \AmeliaStripe\Collection<\AmeliaStripe\Radar\ValueListItem> $list_items List of items contained within this value list. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $name The name of the value list. */ class ValueList extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'radar.value_list'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Delete; use \AmeliaStripe\ApiOperations\Retrieve; use \AmeliaStripe\ApiOperations\Update; } stripe-php/lib/Stripe.php 0000666 00000016122 15165746005 0011403 0 ustar 00 <?php namespace AmeliaStripe; /** * Class Stripe. */ class Stripe { /** @var string The Stripe API key to be used for requests. */ public static $apiKey; /** @var string The Stripe client_id to be used for Connect requests. */ public static $clientId; /** @var string The base URL for the Stripe API. */ public static $apiBase = 'https://api.stripe.com'; /** @var string The base URL for the OAuth API. */ public static $connectBase = 'https://connect.stripe.com'; /** @var string The base URL for the Stripe API uploads endpoint. */ public static $apiUploadBase = 'https://files.stripe.com'; /** @var null|string The version of the Stripe API to use for requests. */ public static $apiVersion = null; /** @var null|string The account ID for connected accounts requests. */ public static $accountId = null; /** @var string Path to the CA bundle used to verify SSL certificates */ public static $caBundlePath = null; /** @var bool Defaults to true. */ public static $verifySslCerts = true; /** @var array The application's information (name, version, URL) */ public static $appInfo = null; /** * @var null|Util\LoggerInterface the logger to which the library will * produce messages */ public static $logger = null; /** @var int Maximum number of request retries */ public static $maxNetworkRetries = 0; /** @var bool Whether client telemetry is enabled. Defaults to true. */ public static $enableTelemetry = true; /** @var float Maximum delay between retries, in seconds */ private static $maxNetworkRetryDelay = 2.0; /** @var float Maximum delay between retries, in seconds, that will be respected from the Stripe API */ private static $maxRetryAfter = 60.0; /** @var float Initial delay between retries, in seconds */ private static $initialNetworkRetryDelay = 0.5; const VERSION = '9.7.0'; /** * @return string the API key used for requests */ public static function getApiKey() { return self::$apiKey; } /** * @return string the client_id used for Connect requests */ public static function getClientId() { return self::$clientId; } /** * @return Util\LoggerInterface the logger to which the library will * produce messages */ public static function getLogger() { if (null === self::$logger) { return new Util\DefaultLogger(); } return self::$logger; } /** * @param \Psr\Log\LoggerInterface|Util\LoggerInterface $logger the logger to which the library * will produce messages */ public static function setLogger($logger) { self::$logger = $logger; } /** * Sets the API key to be used for requests. * * @param string $apiKey */ public static function setApiKey($apiKey) { self::$apiKey = $apiKey; } /** * Sets the client_id to be used for Connect requests. * * @param string $clientId */ public static function setClientId($clientId) { self::$clientId = $clientId; } /** * @return string The API version used for requests. null if we're using the * latest version. */ public static function getApiVersion() { return self::$apiVersion; } /** * @param string $apiVersion the API version to use for requests */ public static function setApiVersion($apiVersion) { self::$apiVersion = $apiVersion; } /** * @return string */ private static function getDefaultCABundlePath() { return \realpath(__DIR__ . '/../data/ca-certificates.crt'); } /** * @return string */ public static function getCABundlePath() { return self::$caBundlePath ?: self::getDefaultCABundlePath(); } /** * @param string $caBundlePath */ public static function setCABundlePath($caBundlePath) { self::$caBundlePath = $caBundlePath; } /** * @return bool */ public static function getVerifySslCerts() { return self::$verifySslCerts; } /** * @param bool $verify */ public static function setVerifySslCerts($verify) { self::$verifySslCerts = $verify; } /** * @return null|string The Stripe account ID for connected account * requests */ public static function getAccountId() { return self::$accountId; } /** * @param string $accountId the Stripe account ID to set for connected * account requests */ public static function setAccountId($accountId) { self::$accountId = $accountId; } /** * @return null|array The application's information */ public static function getAppInfo() { return self::$appInfo; } /** * @param string $appName The application's name * @param null|string $appVersion The application's version * @param null|string $appUrl The application's URL * @param null|string $appPartnerId The application's partner ID */ public static function setAppInfo($appName, $appVersion = null, $appUrl = null, $appPartnerId = null) { self::$appInfo = self::$appInfo ?: []; self::$appInfo['name'] = $appName; self::$appInfo['partner_id'] = $appPartnerId; self::$appInfo['url'] = $appUrl; self::$appInfo['version'] = $appVersion; } /** * @return int Maximum number of request retries */ public static function getMaxNetworkRetries() { return self::$maxNetworkRetries; } /** * @param int $maxNetworkRetries Maximum number of request retries */ public static function setMaxNetworkRetries($maxNetworkRetries) { self::$maxNetworkRetries = $maxNetworkRetries; } /** * @return float Maximum delay between retries, in seconds */ public static function getMaxNetworkRetryDelay() { return self::$maxNetworkRetryDelay; } /** * @return float Maximum delay between retries, in seconds, that will be respected from the Stripe API */ public static function getMaxRetryAfter() { return self::$maxRetryAfter; } /** * @return float Initial delay between retries, in seconds */ public static function getInitialNetworkRetryDelay() { return self::$initialNetworkRetryDelay; } /** * @return bool Whether client telemetry is enabled */ public static function getEnableTelemetry() { return self::$enableTelemetry; } /** * @param bool $enableTelemetry Enables client telemetry. * * Client telemetry enables timing and request metrics to be sent back to Stripe as an HTTP Header * with the current request. This enables Stripe to do latency and metrics analysis without adding extra * overhead (such as extra network calls) on the client. */ public static function setEnableTelemetry($enableTelemetry) { self::$enableTelemetry = $enableTelemetry; } } stripe-php/lib/Mandate.php 0000666 00000002164 15165746005 0011507 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * A Mandate is a record of the permission a customer has given you to debit their * payment method. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \AmeliaStripe\StripeObject $customer_acceptance * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $multi_use * @property string|\AmeliaStripe\PaymentMethod $payment_method ID of the payment method associated with this mandate. * @property \AmeliaStripe\StripeObject $payment_method_details * @property \AmeliaStripe\StripeObject $single_use * @property string $status The status of the mandate, which indicates whether it can be used to initiate a payment. * @property string $type The type of the mandate. */ class Mandate extends ApiResource { const OBJECT_NAME = 'mandate'; use ApiOperations\Retrieve; } stripe-php/lib/InvoiceItem.php 0000666 00000007546 15165746005 0012362 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Sometimes you want to add a charge or credit to a customer, but actually charge * or credit the customer's card only at the end of a regular billing cycle. This * is useful for combining several charges (to minimize per-transaction fees), or * for having Stripe tabulate your usage-based billing totals. * * Related guide: <a * href="https://stripe.com/docs/billing/invoices/subscription#adding-upcoming-invoice-items">Subscription * Invoices</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Amount (in the <code>currency</code> specified) of the invoice item. This should always be equal to <code>unit_amount * quantity</code>. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property string|\AmeliaStripe\Customer $customer The ID of the customer who will be billed when this invoice item is billed. * @property int $date Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property bool $discountable If true, discounts will apply to this invoice item. Always false for prorations. * @property null|(string|\AmeliaStripe\Discount)[] $discounts The discounts which apply to the invoice item. Item discounts are applied before invoice discounts. Use <code>expand[]=discounts</code> to expand each discount. * @property null|string|\AmeliaStripe\Invoice $invoice The ID of the invoice this invoice item belongs to. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property \AmeliaStripe\StripeObject $period * @property null|\AmeliaStripe\Plan $plan If the invoice item is a proration, the plan of the subscription that the proration was computed for. * @property null|\AmeliaStripe\Price $price The price of the invoice item. * @property bool $proration Whether the invoice item was created automatically as a proration adjustment when the customer switched plans. * @property int $quantity Quantity of units for the invoice item. If the invoice item is a proration, the quantity of the subscription that the proration was computed for. * @property null|string|\AmeliaStripe\Subscription $subscription The subscription that this invoice item has been created for, if any. * @property string $subscription_item The subscription item that this invoice item has been created for, if any. * @property null|\AmeliaStripe\TaxRate[] $tax_rates The tax rates which apply to the invoice item. When set, the <code>default_tax_rates</code> on the invoice do not apply to this invoice item. * @property null|string|\AmeliaStripe\TestHelpers\TestClock $test_clock ID of the test clock this invoice item belongs to. * @property null|int $unit_amount Unit amount (in the <code>currency</code> specified) of the invoice item. * @property null|string $unit_amount_decimal Same as <code>unit_amount</code>, but contains a decimal value with at most 12 decimal places. */ class InvoiceItem extends ApiResource { const OBJECT_NAME = 'invoiceitem'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Update; } stripe-php/lib/TaxCode.php 0000666 00000001242 15165746005 0011461 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * <a href="https://stripe.com/docs/tax/tax-categories">Tax codes</a> classify * goods and services for tax purposes. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property string $description A detailed description of which types of products the tax code represents. * @property string $name A short name for the tax code. */ class TaxCode extends ApiResource { const OBJECT_NAME = 'tax_code'; use ApiOperations\All; use ApiOperations\Retrieve; } stripe-php/lib/TestHelpers/TestClock.php 0000666 00000004312 15165746005 0014270 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\TestHelpers; /** * A test clock enables deterministic control over objects in testmode. With a test * clock, you can create objects at a frozen time in the past or future, and * advance to a specific future time to observe webhooks and state changes. After * the clock advances, you can either validate the current state of your scenario * (and test your assumptions), change the current state of your scenario (and test * more complex scenarios), or keep advancing forward in time. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property int $deletes_after Time at which this clock is scheduled to auto delete. * @property int $frozen_time Time at which all objects belonging to this clock are frozen. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|string $name The custom name supplied at creation. * @property string $status The status of the Test Clock. */ class TestClock extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'test_helpers.test_clock'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Delete; use \AmeliaStripe\ApiOperations\Retrieve; const STATUS_ADVANCING = 'advancing'; const STATUS_INTERNAL_FAILURE = 'internal_failure'; const STATUS_READY = 'ready'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TestHelpers\TestClock the advanced test clock */ public function advance($params = null, $opts = null) { $url = $this->instanceUrl() . '/advance'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/SetupIntent.php 0000666 00000020753 15165746005 0012424 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * A SetupIntent guides you through the process of setting up and saving a * customer's payment credentials for future payments. For example, you could use a * SetupIntent to set up and save your customer's card without immediately * collecting a payment. Later, you can use <a * href="https://stripe.com/docs/api#payment_intents">PaymentIntents</a> to drive * the payment flow. * * Create a SetupIntent as soon as you're ready to collect your customer's payment * credentials. Do not maintain long-lived, unconfirmed SetupIntents as they may no * longer be valid. The SetupIntent then transitions through multiple <a * href="https://stripe.com/docs/payments/intents#intent-statuses">statuses</a> as * it guides you through the setup process. * * Successful SetupIntents result in payment credentials that are optimized for * future payments. For example, cardholders in <a * href="/guides/strong-customer-authentication">certain regions</a> may need to be * run through <a * href="https://stripe.com/docs/strong-customer-authentication">Strong Customer * Authentication</a> at the time of payment method collection in order to * streamline later <a * href="https://stripe.com/docs/payments/setup-intents">off-session payments</a>. * If the SetupIntent is used with a <a * href="https://stripe.com/docs/api#setup_intent_object-customer">Customer</a>, * upon success, it will automatically attach the resulting payment method to that * Customer. We recommend using SetupIntents or <a * href="https://stripe.com/docs/api#payment_intent_object-setup_future_usage">setup_future_usage</a> * on PaymentIntents to save payment methods in order to prevent saving invalid or * unoptimized payment methods. * * By using SetupIntents, you ensure that your customers experience the minimum set * of required friction, even as regulations change over time. * * Related guide: <a href="https://stripe.com/docs/payments/setup-intents">Setup * Intents API</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string|\AmeliaStripe\StripeObject $application ID of the Connect application that created the SetupIntent. * @property bool $attach_to_self <p>If present, the SetupIntent's payment method will be attached to the in-context Stripe Account.</p><p>It can only be used for this Stripe Account’s own money movement flows like InboundTransfer and OutboundTransfers. It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer.</p> * @property null|string $cancellation_reason Reason for cancellation of this SetupIntent, one of <code>abandoned</code>, <code>requested_by_customer</code>, or <code>duplicate</code>. * @property null|string $client_secret <p>The client secret of this SetupIntent. Used for client-side retrieval using a publishable key.</p><p>The client secret can be used to complete payment setup from your frontend. It should not be stored, logged, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.</p> * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string|\AmeliaStripe\Customer $customer <p>ID of the Customer this SetupIntent belongs to, if one exists.</p><p>If present, the SetupIntent's payment method will be attached to the Customer on successful setup. Payment methods attached to other Customers cannot be used with this SetupIntent.</p> * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|string[] $flow_directions <p>Indicates the directions of money movement for which this payment method is intended to be used.</p><p>Include <code>inbound</code> if you intend to use the payment method as the origin to pull funds from. Include <code>outbound</code> if you intend to use the payment method as the destination to send funds to. You can include both if you intend to use the payment method for both purposes.</p> * @property null|\AmeliaStripe\StripeObject $last_setup_error The error encountered in the previous SetupIntent confirmation. * @property null|string|\AmeliaStripe\SetupAttempt $latest_attempt The most recent SetupAttempt for this SetupIntent. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|string|\AmeliaStripe\Mandate $mandate ID of the multi use Mandate generated by the SetupIntent. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|\AmeliaStripe\StripeObject $next_action If present, this property tells you what actions you need to take in order for your customer to continue payment setup. * @property null|string|\AmeliaStripe\Account $on_behalf_of The account (if any) for which the setup is intended. * @property null|string|\AmeliaStripe\PaymentMethod $payment_method ID of the payment method used with this SetupIntent. * @property null|\AmeliaStripe\StripeObject $payment_method_options Payment-method-specific configuration for this SetupIntent. * @property string[] $payment_method_types The list of payment method types (e.g. card) that this SetupIntent is allowed to set up. * @property null|string|\AmeliaStripe\Mandate $single_use_mandate ID of the single_use Mandate generated by the SetupIntent. * @property string $status <a href="https://stripe.com/docs/payments/intents#intent-statuses">Status</a> of this SetupIntent, one of <code>requires_payment_method</code>, <code>requires_confirmation</code>, <code>requires_action</code>, <code>processing</code>, <code>canceled</code>, or <code>succeeded</code>. * @property string $usage <p>Indicates how the payment method is intended to be used in the future.</p><p>Use <code>on_session</code> if you intend to only reuse the payment method when the customer is in your checkout flow. Use <code>off_session</code> if your customer may or may not be in your checkout flow. If not provided, this value defaults to <code>off_session</code>.</p> */ class SetupIntent extends ApiResource { const OBJECT_NAME = 'setup_intent'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; const STATUS_CANCELED = 'canceled'; const STATUS_PROCESSING = 'processing'; const STATUS_REQUIRES_ACTION = 'requires_action'; const STATUS_REQUIRES_CONFIRMATION = 'requires_confirmation'; const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method'; const STATUS_SUCCEEDED = 'succeeded'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SetupIntent the canceled setup intent */ public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SetupIntent the confirmed setup intent */ public function confirm($params = null, $opts = null) { $url = $this->instanceUrl() . '/confirm'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SetupIntent the verified setup intent */ public function verifyMicrodeposits($params = null, $opts = null) { $url = $this->instanceUrl() . '/verify_microdeposits'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/FundingInstructions.php 0000666 00000002621 15165746005 0014153 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Each customer has a <a * href="https://stripe.com/docs/api/customers/object#customer_object-balance"><code>balance</code></a> * that is automatically applied to future invoices and payments using the * <code>customer_balance</code> payment method. Customers can fund this balance by * initiating a bank transfer to any account in the * <code>financial_addresses</code> field. Related guide: <a * href="https://stripe.com/docs/payments/customer-balance/funding-instructions">Customer * Balance - Funding Instructions</a> to learn more. * * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \AmeliaStripe\StripeObject $bank_transfer * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property string $funding_type The <code>funding_type</code> of the returned instructions * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. */ class FundingInstructions extends ApiResource { const OBJECT_NAME = 'funding_instructions'; const FUNDING_TYPE_BANK_TRANSFER = 'bank_transfer'; } stripe-php/lib/HttpClient/CurlClient.php 0000666 00000060310 15165746005 0014255 0 ustar 00 <?php namespace AmeliaStripe\HttpClient; use AmeliaStripe\Exception; use AmeliaStripe\Stripe; use AmeliaStripe\Util; // @codingStandardsIgnoreStart // PSR2 requires all constants be upper case. Sadly, the CURL_SSLVERSION // constants do not abide by those rules. // Note the values come from their position in the enums that // defines them in cURL's source code. // Available since PHP 5.5.19 and 5.6.3 if (!\defined('CURL_SSLVERSION_TLSv1_2')) { \define('CURL_SSLVERSION_TLSv1_2', 6); } // @codingStandardsIgnoreEnd // Available since PHP 7.0.7 and cURL 7.47.0 if (!\defined('CURL_HTTP_VERSION_2TLS')) { \define('CURL_HTTP_VERSION_2TLS', 4); } class CurlClient implements ClientInterface, StreamingClientInterface { protected static $instance; public static function instance() { if (!static::$instance) { static::$instance = new static(); } return static::$instance; } protected $defaultOptions; /** @var \AmeliaStripe\Util\RandomGenerator */ protected $randomGenerator; protected $userAgentInfo; protected $enablePersistentConnections = true; protected $enableHttp2; protected $curlHandle; protected $requestStatusCallback; /** * CurlClient constructor. * * Pass in a callable to $defaultOptions that returns an array of CURLOPT_* values to start * off a request with, or an flat array with the same format used by curl_setopt_array() to * provide a static set of options. Note that many options are overridden later in the request * call, including timeouts, which can be set via setTimeout() and setConnectTimeout(). * * Note that request() will silently ignore a non-callable, non-array $defaultOptions, and will * throw an exception if $defaultOptions returns a non-array value. * * @param null|array|callable $defaultOptions * @param null|\AmeliaStripe\Util\RandomGenerator $randomGenerator */ public function __construct($defaultOptions = null, $randomGenerator = null) { $this->defaultOptions = $defaultOptions; $this->randomGenerator = $randomGenerator ?: new Util\RandomGenerator(); $this->initUserAgentInfo(); $this->enableHttp2 = $this->canSafelyUseHttp2(); } public function __destruct() { $this->closeCurlHandle(); } public function initUserAgentInfo() { $curlVersion = \curl_version(); $this->userAgentInfo = [ 'httplib' => 'curl ' . $curlVersion['version'], 'ssllib' => $curlVersion['ssl_version'], ]; } public function getDefaultOptions() { return $this->defaultOptions; } public function getUserAgentInfo() { return $this->userAgentInfo; } /** * @return bool */ public function getEnablePersistentConnections() { return $this->enablePersistentConnections; } /** * @param bool $enable */ public function setEnablePersistentConnections($enable) { $this->enablePersistentConnections = $enable; } /** * @return bool */ public function getEnableHttp2() { return $this->enableHttp2; } /** * @param bool $enable */ public function setEnableHttp2($enable) { $this->enableHttp2 = $enable; } /** * @return null|callable */ public function getRequestStatusCallback() { return $this->requestStatusCallback; } /** * Sets a callback that is called after each request. The callback will * receive the following parameters: * <ol> * <li>string $rbody The response body</li> * <li>integer $rcode The response status code</li> * <li>\AmeliaStripe\Util\CaseInsensitiveArray $rheaders The response headers</li> * <li>integer $errno The curl error number</li> * <li>string|null $message The curl error message</li> * <li>boolean $shouldRetry Whether the request will be retried</li> * <li>integer $numRetries The number of the retry attempt</li> * </ol>. * * @param null|callable $requestStatusCallback */ public function setRequestStatusCallback($requestStatusCallback) { $this->requestStatusCallback = $requestStatusCallback; } // USER DEFINED TIMEOUTS const DEFAULT_TIMEOUT = 80; const DEFAULT_CONNECT_TIMEOUT = 30; private $timeout = self::DEFAULT_TIMEOUT; private $connectTimeout = self::DEFAULT_CONNECT_TIMEOUT; public function setTimeout($seconds) { $this->timeout = (int) \max($seconds, 0); return $this; } public function setConnectTimeout($seconds) { $this->connectTimeout = (int) \max($seconds, 0); return $this; } public function getTimeout() { return $this->timeout; } public function getConnectTimeout() { return $this->connectTimeout; } // END OF USER DEFINED TIMEOUTS private function constructRequest($method, $absUrl, $headers, $params, $hasFile) { $method = \strtolower($method); $opts = []; if (\is_callable($this->defaultOptions)) { // call defaultOptions callback, set options to return value $opts = \call_user_func_array($this->defaultOptions, \func_get_args()); if (!\is_array($opts)) { throw new Exception\UnexpectedValueException('Non-array value returned by defaultOptions CurlClient callback'); } } elseif (\is_array($this->defaultOptions)) { // set default curlopts from array $opts = $this->defaultOptions; } $params = Util\Util::objectsToIds($params); if ('get' === $method) { if ($hasFile) { throw new Exception\UnexpectedValueException( 'Issuing a GET request with a file parameter' ); } $opts[\CURLOPT_HTTPGET] = 1; if (\count($params) > 0) { $encoded = Util\Util::encodeParameters($params); $absUrl = "{$absUrl}?{$encoded}"; } } elseif ('post' === $method) { $opts[\CURLOPT_POST] = 1; $opts[\CURLOPT_POSTFIELDS] = $hasFile ? $params : Util\Util::encodeParameters($params); } elseif ('delete' === $method) { $opts[\CURLOPT_CUSTOMREQUEST] = 'DELETE'; if (\count($params) > 0) { $encoded = Util\Util::encodeParameters($params); $absUrl = "{$absUrl}?{$encoded}"; } } else { throw new Exception\UnexpectedValueException("Unrecognized method {$method}"); } // It is only safe to retry network failures on POST requests if we // add an Idempotency-Key header if (('post' === $method) && (Stripe::$maxNetworkRetries > 0)) { if (!$this->hasHeader($headers, 'Idempotency-Key')) { $headers[] = 'Idempotency-Key: ' . $this->randomGenerator->uuid(); } } // By default for large request body sizes (> 1024 bytes), cURL will // send a request without a body and with a `Expect: 100-continue` // header, which gives the server a chance to respond with an error // status code in cases where one can be determined right away (say // on an authentication problem for example), and saves the "large" // request body from being ever sent. // // Unfortunately, the bindings don't currently correctly handle the // success case (in which the server sends back a 100 CONTINUE), so // we'll error under that condition. To compensate for that problem // for the time being, override cURL's behavior by simply always // sending an empty `Expect:` header. $headers[] = 'Expect: '; $absUrl = Util\Util::utf8($absUrl); $opts[\CURLOPT_URL] = $absUrl; $opts[\CURLOPT_RETURNTRANSFER] = true; $opts[\CURLOPT_CONNECTTIMEOUT] = $this->connectTimeout; $opts[\CURLOPT_TIMEOUT] = $this->timeout; $opts[\CURLOPT_HTTPHEADER] = $headers; $opts[\CURLOPT_CAINFO] = Stripe::getCABundlePath(); if (!Stripe::getVerifySslCerts()) { $opts[\CURLOPT_SSL_VERIFYPEER] = false; } if (!isset($opts[\CURLOPT_HTTP_VERSION]) && $this->getEnableHttp2()) { // For HTTPS requests, enable HTTP/2, if supported $opts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2TLS; } // If the user didn't explicitly specify a CURLOPT_IPRESOLVE option, we // force IPv4 resolving as Stripe's API servers are only accessible over // IPv4 (see. https://github.com/stripe/stripe-php/issues/1045). // We let users specify a custom option in case they need to say proxy // through an IPv6 proxy. if (!isset($opts[\CURLOPT_IPRESOLVE])) { $opts[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V4; } return [$opts, $absUrl]; } public function request($method, $absUrl, $headers, $params, $hasFile) { list($opts, $absUrl) = $this->constructRequest($method, $absUrl, $headers, $params, $hasFile); list($rbody, $rcode, $rheaders) = $this->executeRequestWithRetries($opts, $absUrl); return [$rbody, $rcode, $rheaders]; } public function requestStream($method, $absUrl, $headers, $params, $hasFile, $readBodyChunk) { list($opts, $absUrl) = $this->constructRequest($method, $absUrl, $headers, $params, $hasFile); $opts[\CURLOPT_RETURNTRANSFER] = false; list($rbody, $rcode, $rheaders) = $this->executeStreamingRequestWithRetries($opts, $absUrl, $readBodyChunk); return [$rbody, $rcode, $rheaders]; } /** * Curl permits sending \CURLOPT_HEADERFUNCTION, which is called with lines * from the header and \CURLOPT_WRITEFUNCTION, which is called with bytes * from the body. You usually want to handle the body differently depending * on what was in the header. * * This function makes it easier to specify different callbacks depending * on the contents of the heeder. After the header has been completely read * and the body begins to stream, it will call $determineWriteCallback with * the array of headers. $determineWriteCallback should, based on the * headers it receives, return a "writeCallback" that describes what to do * with the incoming HTTP response body. * * @param array $opts * @param callable $determineWriteCallback * * @return array */ private function useHeadersToDetermineWriteCallback($opts, $determineWriteCallback) { $rheaders = new Util\CaseInsensitiveArray(); $headerCallback = function ($curl, $header_line) use (&$rheaders) { return self::parseLineIntoHeaderArray($header_line, $rheaders); }; $writeCallback = null; $writeCallbackWrapper = function ($curl, $data) use (&$writeCallback, &$rheaders, &$determineWriteCallback) { if (null === $writeCallback) { $writeCallback = \call_user_func_array($determineWriteCallback, [$rheaders]); } return \call_user_func_array($writeCallback, [$curl, $data]); }; return [$headerCallback, $writeCallbackWrapper]; } private static function parseLineIntoHeaderArray($line, &$headers) { if (false === \strpos($line, ':')) { return \strlen($line); } list($key, $value) = \explode(':', \trim($line), 2); $headers[\trim($key)] = \trim($value); return \strlen($line); } /** * Like `executeRequestWithRetries` except: * 1. Does not buffer the body of a successful (status code < 300) * response into memory -- instead, calls the caller-provided * $readBodyChunk with each chunk of incoming data. * 2. Does not retry if a network error occurs while streaming the * body of a successful response. * * @param array $opts cURL options * @param string $absUrl * @param callable $readBodyChunk * * @return array */ public function executeStreamingRequestWithRetries($opts, $absUrl, $readBodyChunk) { /** @var bool */ $shouldRetry = false; /** @var int */ $numRetries = 0; // Will contain the bytes of the body of the last request // if it was not successful and should not be retries /** @var null|string */ $rbody = null; // Status code of the last request /** @var null|bool */ $rcode = null; // Array of headers from the last request /** @var null|array */ $lastRHeaders = null; $errno = null; $message = null; $determineWriteCallback = function ($rheaders) use ( &$readBodyChunk, &$shouldRetry, &$rbody, &$numRetries, &$rcode, &$lastRHeaders, &$errno ) { $lastRHeaders = $rheaders; $errno = \curl_errno($this->curlHandle); $rcode = \curl_getinfo($this->curlHandle, \CURLINFO_HTTP_CODE); // Send the bytes from the body of a successful request to the caller-provided $readBodyChunk. if ($rcode < 300) { $rbody = null; return function ($curl, $data) use (&$readBodyChunk) { // Don't expose the $curl handle to the user, and don't require them to // return the length of $data. \call_user_func_array($readBodyChunk, [$data]); return \strlen($data); }; } $shouldRetry = $this->shouldRetry($errno, $rcode, $rheaders, $numRetries); // Discard the body from an unsuccessful request that should be retried. if ($shouldRetry) { return function ($curl, $data) { return \strlen($data); }; } else { // Otherwise, buffer the body into $rbody. It will need to be parsed to determine // which exception to throw to the user. $rbody = ''; return function ($curl, $data) use (&$rbody) { $rbody .= $data; return \strlen($data); }; } }; while (true) { list($headerCallback, $writeCallback) = $this->useHeadersToDetermineWriteCallback($opts, $determineWriteCallback); $opts[\CURLOPT_HEADERFUNCTION] = $headerCallback; $opts[\CURLOPT_WRITEFUNCTION] = $writeCallback; $shouldRetry = false; $rbody = null; $this->resetCurlHandle(); \curl_setopt_array($this->curlHandle, $opts); $result = \curl_exec($this->curlHandle); $errno = \curl_errno($this->curlHandle); if (0 !== $errno) { $message = \curl_error($this->curlHandle); } if (!$this->getEnablePersistentConnections()) { $this->closeCurlHandle(); } if (\is_callable($this->getRequestStatusCallback())) { \call_user_func_array( $this->getRequestStatusCallback(), [$rbody, $rcode, $lastRHeaders, $errno, $message, $shouldRetry, $numRetries] ); } if ($shouldRetry) { ++$numRetries; $sleepSeconds = $this->sleepTime($numRetries, $lastRHeaders); \usleep((int) ($sleepSeconds * 1000000)); } else { break; } } if (0 !== $errno) { $this->handleCurlError($absUrl, $errno, $message, $numRetries); } return [$rbody, $rcode, $lastRHeaders]; } /** * @param array $opts cURL options * @param string $absUrl */ public function executeRequestWithRetries($opts, $absUrl) { $numRetries = 0; while (true) { $rcode = 0; $errno = 0; $message = null; // Create a callback to capture HTTP headers for the response $rheaders = new Util\CaseInsensitiveArray(); $headerCallback = function ($curl, $header_line) use (&$rheaders) { return CurlClient::parseLineIntoHeaderArray($header_line, $rheaders); }; $opts[\CURLOPT_HEADERFUNCTION] = $headerCallback; $this->resetCurlHandle(); \curl_setopt_array($this->curlHandle, $opts); $rbody = \curl_exec($this->curlHandle); if (false === $rbody) { $errno = \curl_errno($this->curlHandle); $message = \curl_error($this->curlHandle); } else { $rcode = \curl_getinfo($this->curlHandle, \CURLINFO_HTTP_CODE); } if (!$this->getEnablePersistentConnections()) { $this->closeCurlHandle(); } $shouldRetry = $this->shouldRetry($errno, $rcode, $rheaders, $numRetries); if (\is_callable($this->getRequestStatusCallback())) { \call_user_func_array( $this->getRequestStatusCallback(), [$rbody, $rcode, $rheaders, $errno, $message, $shouldRetry, $numRetries] ); } if ($shouldRetry) { ++$numRetries; $sleepSeconds = $this->sleepTime($numRetries, $rheaders); \usleep((int) ($sleepSeconds * 1000000)); } else { break; } } if (false === $rbody) { $this->handleCurlError($absUrl, $errno, $message, $numRetries); } return [$rbody, $rcode, $rheaders]; } /** * @param string $url * @param int $errno * @param string $message * @param int $numRetries * * @throws Exception\ApiConnectionException */ private function handleCurlError($url, $errno, $message, $numRetries) { switch ($errno) { case \CURLE_COULDNT_CONNECT: case \CURLE_COULDNT_RESOLVE_HOST: case \CURLE_OPERATION_TIMEOUTED: $msg = "Could not connect to Stripe ({$url}). Please check your " . 'internet connection and try again. If this problem persists, ' . "you should check Stripe's service status at " . 'https://twitter.com/stripestatus, or'; break; case \CURLE_SSL_CACERT: case \CURLE_SSL_PEER_CERTIFICATE: $msg = "Could not verify Stripe's SSL certificate. Please make sure " . 'that your network is not intercepting certificates. ' . "(Try going to {$url} in your browser.) " . 'If this problem persists,'; break; default: $msg = 'Unexpected error communicating with Stripe. ' . 'If this problem persists,'; } $msg .= ' let us know at support@stripe.com.'; $msg .= "\n\n(Network error [errno {$errno}]: {$message})"; if ($numRetries > 0) { $msg .= "\n\nRequest was retried {$numRetries} times."; } throw new Exception\ApiConnectionException($msg); } /** * Checks if an error is a problem that we should retry on. This includes both * socket errors that may represent an intermittent problem and some special * HTTP statuses. * * @param int $errno * @param int $rcode * @param array|\AmeliaStripe\Util\CaseInsensitiveArray $rheaders * @param int $numRetries * * @return bool */ private function shouldRetry($errno, $rcode, $rheaders, $numRetries) { if ($numRetries >= Stripe::getMaxNetworkRetries()) { return false; } // Retry on timeout-related problems (either on open or read). if (\CURLE_OPERATION_TIMEOUTED === $errno) { return true; } // Destination refused the connection, the connection was reset, or a // variety of other connection failures. This could occur from a single // saturated server, so retry in case it's intermittent. if (\CURLE_COULDNT_CONNECT === $errno) { return true; } // The API may ask us not to retry (eg; if doing so would be a no-op) // or advise us to retry (eg; in cases of lock timeouts); we defer to that. if (isset($rheaders['stripe-should-retry'])) { if ('false' === $rheaders['stripe-should-retry']) { return false; } if ('true' === $rheaders['stripe-should-retry']) { return true; } } // 409 Conflict if (409 === $rcode) { return true; } // Retry on 500, 503, and other internal errors. // // Note that we expect the stripe-should-retry header to be false // in most cases when a 500 is returned, since our idempotency framework // would typically replay it anyway. if ($rcode >= 500) { return true; } return false; } /** * Provides the number of seconds to wait before retrying a request. * * @param int $numRetries * @param array|\AmeliaStripe\Util\CaseInsensitiveArray $rheaders * * @return int */ private function sleepTime($numRetries, $rheaders) { // Apply exponential backoff with $initialNetworkRetryDelay on the // number of $numRetries so far as inputs. Do not allow the number to exceed // $maxNetworkRetryDelay. $sleepSeconds = \min( Stripe::getInitialNetworkRetryDelay() * 1.0 * 2 ** ($numRetries - 1), Stripe::getMaxNetworkRetryDelay() ); // Apply some jitter by randomizing the value in the range of // ($sleepSeconds / 2) to ($sleepSeconds). $sleepSeconds *= 0.5 * (1 + $this->randomGenerator->randFloat()); // But never sleep less than the base sleep seconds. $sleepSeconds = \max(Stripe::getInitialNetworkRetryDelay(), $sleepSeconds); // And never sleep less than the time the API asks us to wait, assuming it's a reasonable ask. $retryAfter = isset($rheaders['retry-after']) ? (float) ($rheaders['retry-after']) : 0.0; if (\floor($retryAfter) === $retryAfter && $retryAfter <= Stripe::getMaxRetryAfter()) { $sleepSeconds = \max($sleepSeconds, $retryAfter); } return $sleepSeconds; } /** * Initializes the curl handle. If already initialized, the handle is closed first. */ private function initCurlHandle() { $this->closeCurlHandle(); $this->curlHandle = \curl_init(); } /** * Closes the curl handle if initialized. Do nothing if already closed. */ private function closeCurlHandle() { if (null !== $this->curlHandle) { \curl_close($this->curlHandle); $this->curlHandle = null; } } /** * Resets the curl handle. If the handle is not already initialized, or if persistent * connections are disabled, the handle is reinitialized instead. */ private function resetCurlHandle() { if (null !== $this->curlHandle && $this->getEnablePersistentConnections()) { \curl_reset($this->curlHandle); } else { $this->initCurlHandle(); } } /** * Indicates whether it is safe to use HTTP/2 or not. * * @return bool */ private function canSafelyUseHttp2() { // Versions of curl older than 7.60.0 don't respect GOAWAY frames // (cf. https://github.com/curl/curl/issues/2416), which Stripe use. $curlVersion = \curl_version()['version']; return \version_compare($curlVersion, '7.60.0') >= 0; } /** * Checks if a list of headers contains a specific header name. * * @param string[] $headers * @param string $name * * @return bool */ private function hasHeader($headers, $name) { foreach ($headers as $header) { if (0 === \strncasecmp($header, "{$name}: ", \strlen($name) + 2)) { return true; } } return false; } } stripe-php/lib/HttpClient/StreamingClientInterface.php 0000666 00000002074 15165746005 0017125 0 ustar 00 <?php namespace AmeliaStripe\HttpClient; interface StreamingClientInterface { /** * @param string $method The HTTP method being used * @param string $absUrl The URL being requested, including domain and protocol * @param array $headers Headers to be used in the request (full strings, not KV pairs) * @param array $params KV pairs for parameters. Can be nested for arrays and hashes * @param bool $hasFile Whether or not $params references a file (via an @ prefix or * CURLFile) * @param callable $readBodyChunkCallable a function that will be called with chunks of bytes from the body if the request is successful * * @throws \AmeliaStripe\Exception\ApiConnectionException * @throws \AmeliaStripe\Exception\UnexpectedValueException * * @return array an array whose first element is raw request body, second * element is HTTP status code and third array of HTTP headers */ public function requestStream($method, $absUrl, $headers, $params, $hasFile, $readBodyChunkCallable); } stripe-php/lib/HttpClient/ClientInterface.php 0000666 00000001610 15165746005 0015246 0 ustar 00 <?php namespace AmeliaStripe\HttpClient; interface ClientInterface { /** * @param string $method The HTTP method being used * @param string $absUrl The URL being requested, including domain and protocol * @param array $headers Headers to be used in the request (full strings, not KV pairs) * @param array $params KV pairs for parameters. Can be nested for arrays and hashes * @param bool $hasFile Whether or not $params references a file (via an @ prefix or * CURLFile) * * @throws \AmeliaStripe\Exception\ApiConnectionException * @throws \AmeliaStripe\Exception\UnexpectedValueException * * @return array an array whose first element is raw request body, second * element is HTTP status code and third array of HTTP headers */ public function request($method, $absUrl, $headers, $params, $hasFile); } stripe-php/lib/Reporting/ReportType.php 0000666 00000004312 15165746005 0014221 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Reporting; /** * The Report Type resource corresponds to a particular type of report, such as the * "Activity summary" or "Itemized payouts" reports. These * objects are identified by an ID belonging to a set of enumerated values. See <a * href="https://stripe.com/docs/reporting/statements/api">API Access to Reports * documentation</a> for those Report Type IDs, along with required and optional * parameters. * * Note that certain report types can only be run based on your live-mode data (not * test-mode data), and will error when queried without a <a * href="https://stripe.com/docs/keys#test-live-modes">live-mode API key</a>. * * @property string $id The <a href="https://stripe.com/docs/reporting/statements/api#available-report-types">ID of the Report Type</a>, such as <code>balance.summary.1</code>. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $data_available_end Most recent time for which this Report Type is available. Measured in seconds since the Unix epoch. * @property int $data_available_start Earliest time for which this Report Type is available. Measured in seconds since the Unix epoch. * @property null|string[] $default_columns List of column names that are included by default when this Report Type gets run. (If the Report Type doesn't support the <code>columns</code> parameter, this will be null.) * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property string $name Human-readable name of the Report Type * @property int $updated When this Report Type was latest updated. Measured in seconds since the Unix epoch. * @property int $version Version of the Report Type. Different versions report with the same ID will have the same purpose, but may take different run parameters or have different result schemas. */ class ReportType extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'reporting.report_type'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Retrieve; } stripe-php/lib/Reporting/ReportRun.php 0000666 00000004646 15165746005 0014056 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Reporting; /** * The Report Run object represents an instance of a report type generated with * specific run parameters. Once the object is created, Stripe begins processing * the report. When the report has finished running, it will give you a reference * to a file where you can retrieve your results. For an overview, see <a * href="https://stripe.com/docs/reporting/statements/api">API Access to * Reports</a>. * * Note that certain report types can only be run based on your live-mode data (not * test-mode data), and will error when queried without a <a * href="https://stripe.com/docs/keys#test-live-modes">live-mode API key</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $error If something should go wrong during the run, a message about the failure (populated when <code>status=failed</code>). * @property bool $livemode <code>true</code> if the report is run on live mode data and <code>false</code> if it is run on test mode data. * @property \AmeliaStripe\StripeObject $parameters * @property string $report_type The ID of the <a href="https://stripe.com/docs/reports/report-types">report type</a> to run, such as <code>"balance.summary.1"</code>. * @property null|\AmeliaStripe\File $result The file object representing the result of the report run (populated when <code>status=succeeded</code>). * @property string $status Status of this report run. This will be <code>pending</code> when the run is initially created. When the run finishes, this will be set to <code>succeeded</code> and the <code>result</code> field will be populated. Rarely, we may encounter an error, at which point this will be set to <code>failed</code> and the <code>error</code> field will be populated. * @property null|int $succeeded_at Timestamp at which this run successfully finished (populated when <code>status=succeeded</code>). Measured in seconds since the Unix epoch. */ class ReportRun extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'reporting.report_run'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Retrieve; } stripe-php/lib/UsageRecord.php 0000666 00000001732 15165746005 0012341 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Usage records allow you to report customer usage and metrics to Stripe for * metered billing of subscription prices. * * Related guide: <a * href="https://stripe.com/docs/billing/subscriptions/metered-billing">Metered * Billing</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property int $quantity The usage quantity for the specified date. * @property string $subscription_item The ID of the subscription item this usage record contains data for. * @property int $timestamp The timestamp when this usage occurred. */ class UsageRecord extends ApiResource { const OBJECT_NAME = 'usage_record'; } stripe-php/lib/Order.php 0000666 00000015210 15165746005 0011205 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * An Order describes a purchase being made by a customer, including the products * & quantities being purchased, the order status, the payment information, and * the billing/shipping details. * * Related guide: <a href="https://stripe.com/docs/orders">Orders overview</a> * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount_subtotal Order cost before any discounts or taxes are applied. A positive integer representing the subtotal of the order in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a> (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). * @property int $amount_total Total order cost after discounts and taxes are applied. A positive integer representing the cost of the order in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a> (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). To submit an order, the total must be either 0 or at least $0.50 USD or <a href="https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts">equivalent in charge currency</a>. * @property null|string|\AmeliaStripe\StripeObject $application ID of the Connect application that created the Order, if any. * @property \AmeliaStripe\StripeObject $automatic_tax * @property null|\AmeliaStripe\StripeObject $billing_details Customer billing details associated with the order. * @property null|string $client_secret <p>The client secret of this Order. Used for client-side retrieval using a publishable key.</p><p>The client secret can be used to complete a payment for an Order from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.</p><p>Refer to our docs for <a href="https://stripe.com/docs/orders-beta/create-and-process">creating and processing an order</a> to learn about how client_secret should be handled.</p> * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string|\AmeliaStripe\Customer $customer The customer which this orders belongs to. * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|(string|\AmeliaStripe\Discount)[] $discounts The discounts applied to the order. Use <code>expand[]=discounts</code> to expand each discount. * @property null|string $ip_address A recent IP address of the purchaser used for tax reporting and tax location inference. * @property \AmeliaStripe\Collection<\AmeliaStripe\LineItem> $line_items A list of line items the customer is ordering. Each line item includes information about the product, the quantity, and the resulting cost. There is a maximum of 100 line items. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property \AmeliaStripe\StripeObject $payment * @property null|\AmeliaStripe\StripeObject $shipping_cost The details of the customer cost of shipping, including the customer chosen ShippingRate. * @property null|\AmeliaStripe\StripeObject $shipping_details Customer shipping information associated with the order. * @property string $status The overall status of the order. * @property \AmeliaStripe\StripeObject $tax_details * @property \AmeliaStripe\StripeObject $total_details */ class Order extends ApiResource { const OBJECT_NAME = 'order'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; const STATUS_CANCELED = 'canceled'; const STATUS_COMPLETE = 'complete'; const STATUS_OPEN = 'open'; const STATUS_PROCESSING = 'processing'; const STATUS_SUBMITTED = 'submitted'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Order the canceled order */ public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param string $id * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\LineItem> list of LineItems */ public static function allLineItems($id, $params = null, $opts = null) { $url = static::resourceUrl($id) . '/line_items'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Order the reopened order */ public function reopen($params = null, $opts = null) { $url = $this->instanceUrl() . '/reopen'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Order the submited order */ public function submit($params = null, $opts = null) { $url = $this->instanceUrl() . '/submit'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/ApiResource.php 0000666 00000006656 15165746005 0012371 0 ustar 00 <?php namespace AmeliaStripe; /** * Class ApiResource. */ abstract class ApiResource extends StripeObject { use ApiOperations\Request; /** * @return \AmeliaStripe\Util\Set A list of fields that can be their own type of * API resource (say a nested card under an account for example), and if * that resource is set, it should be transmitted to the API on a create or * update. Doing so is not the default behavior because API resources * should normally be persisted on their own RESTful endpoints. */ public static function getSavedNestedResources() { static $savedNestedResources = null; if (null === $savedNestedResources) { $savedNestedResources = new Util\Set(); } return $savedNestedResources; } /** * @var bool A flag that can be set a behavior that will cause this * resource to be encoded and sent up along with an update of its parent * resource. This is usually not desirable because resources are updated * individually on their own endpoints, but there are certain cases, * replacing a customer's source for example, where this is allowed. */ public $saveWithParent = false; public function __set($k, $v) { parent::__set($k, $v); $v = $this->{$k}; if ((static::getSavedNestedResources()->includes($k)) && ($v instanceof ApiResource)) { $v->saveWithParent = true; } } /** * @throws Exception\ApiErrorException * * @return ApiResource the refreshed resource */ public function refresh() { $requestor = new ApiRequestor($this->_opts->apiKey, static::baseUrl()); $url = $this->instanceUrl(); list($response, $this->_opts->apiKey) = $requestor->request( 'get', $url, $this->_retrieveOptions, $this->_opts->headers ); $this->setLastResponse($response); $this->refreshFrom($response->json, $this->_opts); return $this; } /** * @return string the base URL for the given class */ public static function baseUrl() { return Stripe::$apiBase; } /** * @return string the endpoint URL for the given class */ public static function classUrl() { // Replace dots with slashes for namespaced resources, e.g. if the object's name is // "foo.bar", then its URL will be "/v1/foo/bars". /** @phpstan-ignore-next-line */ $base = \str_replace('.', '/', static::OBJECT_NAME); return "/v1/{$base}s"; } /** * @param null|string $id the ID of the resource * * @throws Exception\UnexpectedValueException if $id is null * * @return string the instance endpoint URL for the given class */ public static function resourceUrl($id) { if (null === $id) { $class = static::class; $message = 'Could not determine which URL to request: ' . "{$class} instance has invalid ID: {$id}"; throw new Exception\UnexpectedValueException($message); } $id = Util\Util::utf8($id); $base = static::classUrl(); $extn = \urlencode($id); return "{$base}/{$extn}"; } /** * @return string the full API URL for this API resource */ public function instanceUrl() { return static::resourceUrl($this['id']); } } stripe-php/lib/Subscription.php 0000666 00000031602 15165746005 0012621 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Subscriptions allow you to charge a customer on a recurring basis. * * Related guide: <a * href="https://stripe.com/docs/billing/subscriptions/creating">Creating * Subscriptions</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string|\AmeliaStripe\StripeObject $application ID of the Connect Application that created the subscription. * @property null|float $application_fee_percent A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. * @property \AmeliaStripe\StripeObject $automatic_tax * @property int $billing_cycle_anchor Determines the date of the first full invoice, and, for plans with <code>month</code> or <code>year</code> intervals, the day of the month for subsequent invoices. The timestamp is in UTC format. * @property null|\AmeliaStripe\StripeObject $billing_thresholds Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period * @property null|int $cancel_at A date in the future at which the subscription will automatically get canceled * @property bool $cancel_at_period_end If the subscription has been canceled with the <code>at_period_end</code> flag set to <code>true</code>, <code>cancel_at_period_end</code> on the subscription will be true. You can use this attribute to determine whether a subscription that has a status of active is scheduled to be canceled at the end of the current period. * @property null|int $canceled_at If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with <code>cancel_at_period_end</code>, <code>canceled_at</code> will reflect the time of the most recent update request, not the end of the subscription period when the subscription is automatically moved to a canceled state. * @property string $collection_method Either <code>charge_automatically</code>, or <code>send_invoice</code>. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as <code>active</code>. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property int $current_period_end End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created. * @property int $current_period_start Start of the current period that the subscription has been invoiced for. * @property string|\AmeliaStripe\Customer $customer ID of the customer who owns the subscription. * @property null|int $days_until_due Number of days a customer has to pay invoices generated by this subscription. This value will be <code>null</code> for subscriptions where <code>collection_method=charge_automatically</code>. * @property null|string|\AmeliaStripe\PaymentMethod $default_payment_method ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over <code>default_source</code>. If neither are set, invoices will use the customer's <a href="https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method">invoice_settings.default_payment_method</a> or <a href="https://stripe.com/docs/api/customers/object#customer_object-default_source">default_source</a>. * @property null|string|\AmeliaStripe\Account|\AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source $default_source ID of the default payment source for the subscription. It must belong to the customer associated with the subscription and be in a chargeable state. If <code>default_payment_method</code> is also set, <code>default_payment_method</code> will take precedence. If neither are set, invoices will use the customer's <a href="https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method">invoice_settings.default_payment_method</a> or <a href="https://stripe.com/docs/api/customers/object#customer_object-default_source">default_source</a>. * @property null|\AmeliaStripe\TaxRate[] $default_tax_rates The tax rates that will apply to any subscription item that does not have <code>tax_rates</code> set. Invoices created will have their <code>default_tax_rates</code> populated from the subscription. * @property null|string $description The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces. * @property null|\AmeliaStripe\Discount $discount Describes the current discount applied to this subscription, if there is one. When billing, a discount applied to a subscription overrides a discount applied on a customer-wide basis. * @property null|int $ended_at If the subscription has ended, the date the subscription ended. * @property \AmeliaStripe\Collection<\AmeliaStripe\SubscriptionItem> $items List of subscription items, each with an attached price. * @property null|string|\AmeliaStripe\Invoice $latest_invoice The most recent invoice this subscription has generated. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|int $next_pending_invoice_item_invoice Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided at <code>pending_invoice_item_interval</code>. * @property null|\AmeliaStripe\StripeObject $pause_collection If specified, payment collection for this subscription will be paused. * @property null|\AmeliaStripe\StripeObject $payment_settings Payment settings passed on to invoices created by the subscription. * @property null|\AmeliaStripe\StripeObject $pending_invoice_item_interval Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling <a href="https://stripe.com/docs/api#create_invoice">Create an invoice</a> for the given subscription at the specified interval. * @property null|string|\AmeliaStripe\SetupIntent $pending_setup_intent You can use this <a href="https://stripe.com/docs/api/setup_intents">SetupIntent</a> to collect user authentication when creating a subscription without immediate payment or updating a subscription's payment method, allowing you to optimize for off-session payments. Learn more in the <a href="https://stripe.com/docs/billing/migration/strong-customer-authentication#scenario-2">SCA Migration Guide</a>. * @property null|\AmeliaStripe\StripeObject $pending_update If specified, <a href="https://stripe.com/docs/billing/subscriptions/pending-updates">pending updates</a> that will be applied to the subscription once the <code>latest_invoice</code> has been paid. * @property null|string|\AmeliaStripe\SubscriptionSchedule $schedule The schedule attached to the subscription * @property int $start_date Date when the subscription was first created. The date might differ from the <code>created</code> date due to backdating. * @property string $status <p>Possible values are <code>incomplete</code>, <code>incomplete_expired</code>, <code>trialing</code>, <code>active</code>, <code>past_due</code>, <code>canceled</code>, or <code>unpaid</code>.</p><p>For <code>collection_method=charge_automatically</code> a subscription moves into <code>incomplete</code> if the initial payment attempt fails. A subscription in this state can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an <code>active</code> state. If the first invoice is not paid within 23 hours, the subscription transitions to <code>incomplete_expired</code>. This is a terminal state, the open invoice will be voided and no further invoices will be generated.</p><p>A subscription that is currently in a trial period is <code>trialing</code> and moves to <code>active</code> when the trial period is over.</p><p>If subscription <code>collection_method=charge_automatically</code> it becomes <code>past_due</code> when payment to renew it fails and <code>canceled</code> or <code>unpaid</code> (depending on your subscriptions settings) when Stripe has exhausted all payment retry attempts.</p><p>If subscription <code>collection_method=send_invoice</code> it becomes <code>past_due</code> when its invoice is not paid by the due date, and <code>canceled</code> or <code>unpaid</code> if it is still not paid by an additional deadline after that. Note that when a subscription has a status of <code>unpaid</code>, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.</p> * @property null|string|\AmeliaStripe\TestHelpers\TestClock $test_clock ID of the test clock this subscription belongs to. * @property null|\AmeliaStripe\StripeObject $transfer_data The account (if any) the subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices. * @property null|int $trial_end If the subscription has a trial, the end of that trial. * @property null|int $trial_start If the subscription has a trial, the beginning of that trial. */ class Subscription extends ApiResource { const OBJECT_NAME = 'subscription'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Search; use ApiOperations\Update; const PAYMENT_BEHAVIOR_ALLOW_INCOMPLETE = 'allow_incomplete'; const PAYMENT_BEHAVIOR_DEFAULT_INCOMPLETE = 'default_incomplete'; const PAYMENT_BEHAVIOR_ERROR_IF_INCOMPLETE = 'error_if_incomplete'; const PAYMENT_BEHAVIOR_PENDING_IF_INCOMPLETE = 'pending_if_incomplete'; const PRORATION_BEHAVIOR_ALWAYS_INVOICE = 'always_invoice'; const PRORATION_BEHAVIOR_CREATE_PRORATIONS = 'create_prorations'; const PRORATION_BEHAVIOR_NONE = 'none'; const STATUS_ACTIVE = 'active'; const STATUS_CANCELED = 'canceled'; const STATUS_INCOMPLETE = 'incomplete'; const STATUS_INCOMPLETE_EXPIRED = 'incomplete_expired'; const STATUS_PAST_DUE = 'past_due'; const STATUS_TRIALING = 'trialing'; const STATUS_UNPAID = 'unpaid'; use ApiOperations\Delete { delete as protected _delete; } public static function getSavedNestedResources() { static $savedNestedResources = null; if (null === $savedNestedResources) { $savedNestedResources = new Util\Set([ 'source', ]); } return $savedNestedResources; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Subscription the updated subscription */ public function deleteDiscount($params = null, $opts = null) { $url = $this->instanceUrl() . '/discount'; list($response, $opts) = $this->_request('delete', $url, $params, $opts); $this->refreshFrom(['discount' => null], $opts, true); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Subscription the canceled subscription */ public function cancel($params = null, $opts = null) { $url = $this->instanceUrl(); list($response, $opts) = $this->_request('delete', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SearchResult<Subscription> the subscription search results */ public static function search($params = null, $opts = null) { $url = '/v1/subscriptions/search'; return self::_searchResource($url, $params, $opts); } } stripe-php/lib/TaxId.php 0000666 00000012312 15165746005 0011143 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * You can add one or multiple tax IDs to a <a * href="https://stripe.com/docs/api/customers">customer</a>. A customer's tax IDs * are displayed on invoices and credit notes issued for the customer. * * Related guide: <a href="https://stripe.com/docs/billing/taxes/tax-ids">Customer * Tax Identification Numbers</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string $country Two-letter ISO code representing the country of the tax ID. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string|\AmeliaStripe\Customer $customer ID of the customer. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property string $type Type of the tax ID, one of <code>ae_trn</code>, <code>au_abn</code>, <code>au_arn</code>, <code>bg_uic</code>, <code>br_cnpj</code>, <code>br_cpf</code>, <code>ca_bn</code>, <code>ca_gst_hst</code>, <code>ca_pst_bc</code>, <code>ca_pst_mb</code>, <code>ca_pst_sk</code>, <code>ca_qst</code>, <code>ch_vat</code>, <code>cl_tin</code>, <code>es_cif</code>, <code>eu_oss_vat</code>, <code>eu_vat</code>, <code>gb_vat</code>, <code>ge_vat</code>, <code>hk_br</code>, <code>hu_tin</code>, <code>id_npwp</code>, <code>il_vat</code>, <code>in_gst</code>, <code>is_vat</code>, <code>jp_cn</code>, <code>jp_rn</code>, <code>kr_brn</code>, <code>li_uid</code>, <code>mx_rfc</code>, <code>my_frp</code>, <code>my_itn</code>, <code>my_sst</code>, <code>no_vat</code>, <code>nz_gst</code>, <code>ru_inn</code>, <code>ru_kpp</code>, <code>sa_vat</code>, <code>sg_gst</code>, <code>sg_uen</code>, <code>si_tin</code>, <code>th_vat</code>, <code>tw_vat</code>, <code>ua_vat</code>, <code>us_ein</code>, or <code>za_vat</code>. Note that some legacy tax IDs have type <code>unknown</code> * @property string $value Value of the tax ID. * @property null|\AmeliaStripe\StripeObject $verification Tax ID verification information. */ class TaxId extends ApiResource { const OBJECT_NAME = 'tax_id'; use ApiOperations\Delete; const TYPE_AE_TRN = 'ae_trn'; const TYPE_AU_ABN = 'au_abn'; const TYPE_AU_ARN = 'au_arn'; const TYPE_BG_UIC = 'bg_uic'; const TYPE_BR_CNPJ = 'br_cnpj'; const TYPE_BR_CPF = 'br_cpf'; const TYPE_CA_BN = 'ca_bn'; const TYPE_CA_GST_HST = 'ca_gst_hst'; const TYPE_CA_PST_BC = 'ca_pst_bc'; const TYPE_CA_PST_MB = 'ca_pst_mb'; const TYPE_CA_PST_SK = 'ca_pst_sk'; const TYPE_CA_QST = 'ca_qst'; const TYPE_CH_VAT = 'ch_vat'; const TYPE_CL_TIN = 'cl_tin'; const TYPE_ES_CIF = 'es_cif'; const TYPE_EU_OSS_VAT = 'eu_oss_vat'; const TYPE_EU_VAT = 'eu_vat'; const TYPE_GB_VAT = 'gb_vat'; const TYPE_GE_VAT = 'ge_vat'; const TYPE_HK_BR = 'hk_br'; const TYPE_HU_TIN = 'hu_tin'; const TYPE_ID_NPWP = 'id_npwp'; const TYPE_IL_VAT = 'il_vat'; const TYPE_IN_GST = 'in_gst'; const TYPE_IS_VAT = 'is_vat'; const TYPE_JP_CN = 'jp_cn'; const TYPE_JP_RN = 'jp_rn'; const TYPE_KR_BRN = 'kr_brn'; const TYPE_LI_UID = 'li_uid'; const TYPE_MX_RFC = 'mx_rfc'; const TYPE_MY_FRP = 'my_frp'; const TYPE_MY_ITN = 'my_itn'; const TYPE_MY_SST = 'my_sst'; const TYPE_NO_VAT = 'no_vat'; const TYPE_NZ_GST = 'nz_gst'; const TYPE_RU_INN = 'ru_inn'; const TYPE_RU_KPP = 'ru_kpp'; const TYPE_SA_VAT = 'sa_vat'; const TYPE_SG_GST = 'sg_gst'; const TYPE_SG_UEN = 'sg_uen'; const TYPE_SI_TIN = 'si_tin'; const TYPE_TH_VAT = 'th_vat'; const TYPE_TW_VAT = 'tw_vat'; const TYPE_UA_VAT = 'ua_vat'; const TYPE_UNKNOWN = 'unknown'; const TYPE_US_EIN = 'us_ein'; const TYPE_ZA_VAT = 'za_vat'; const VERIFICATION_STATUS_PENDING = 'pending'; const VERIFICATION_STATUS_UNAVAILABLE = 'unavailable'; const VERIFICATION_STATUS_UNVERIFIED = 'unverified'; const VERIFICATION_STATUS_VERIFIED = 'verified'; /** * @return string the API URL for this tax id */ public function instanceUrl() { $id = $this['id']; $customer = $this['customer']; if (!$id) { throw new Exception\UnexpectedValueException( "Could not determine which URL to request: class instance has invalid ID: {$id}" ); } $id = Util\Util::utf8($id); $customer = Util\Util::utf8($customer); $base = Customer::classUrl(); $customerExtn = \urlencode($customer); $extn = \urlencode($id); return "{$base}/{$customerExtn}/tax_ids/{$extn}"; } /** * @param array|string $_id * @param null|array|string $_opts * * @throws \AmeliaStripe\Exception\BadMethodCallException */ public static function retrieve($_id, $_opts = null) { $msg = 'Tax IDs cannot be retrieved without a customer ID. Retrieve ' . "a tax ID using `Customer::retrieveTaxId('customer_id', " . "'tax_id_id')`."; throw new Exception\BadMethodCallException($msg); } } stripe-php/lib/CashBalance.php 0000666 00000004711 15165746005 0012262 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * A customer's <code>Cash balance</code> represents real funds. Customers can add * funds to their cash balance by sending a bank transfer. These funds can be used * for payment and can eventually be paid out to your bank account. * * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|\AmeliaStripe\StripeObject $available A hash of all cash balances available to this customer. You cannot delete a customer with any cash balances, even if the balance is 0. Amounts are represented in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. * @property string $customer The ID of the customer whose cash balance this object represents. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $settings */ class CashBalance extends ApiResource { const OBJECT_NAME = 'cash_balance'; /** * @return string the API URL for this balance transaction */ public function instanceUrl() { $customer = $this['customer']; $customer = Util\Util::utf8($customer); $base = Customer::classUrl(); $customerExtn = \urlencode($customer); return "{$base}/{$customerExtn}/cash_balance"; } /** * @param array|string $_id * @param null|array|string $_opts * * @throws \AmeliaStripe\Exception\BadMethodCallException */ public static function retrieve($_id, $_opts = null) { $msg = 'Customer Cash Balance cannot be retrieved without a ' . 'customer ID. Retrieve a Customer Cash Balance using ' . "`Customer::retrieveCashBalance('customer_id')`."; throw new Exception\BadMethodCallException($msg); } /** * @param string $_id * @param null|array $_params * @param null|array|string $_options * * @throws \AmeliaStripe\Exception\BadMethodCallException */ public static function update($_id, $_params = null, $_options = null) { $msg = 'Customer Cash Balance cannot be updated without a ' . 'customer ID. Retrieve a Customer Cash Balance using ' . "`Customer::updateCashBalance('customer_id')`."; throw new Exception\BadMethodCallException($msg); } } stripe-php/lib/Quote.php 0000666 00000022104 15165746005 0011227 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * A Quote is a way to model prices that you'd like to provide to a customer. Once * accepted, it will automatically create an invoice, subscription or subscription * schedule. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount_subtotal Total before any discounts or taxes are applied. * @property int $amount_total Total after discounts and taxes are applied. * @property null|string|\AmeliaStripe\StripeObject $application ID of the Connect Application that created the quote. * @property null|int $application_fee_amount The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. Only applicable if there are no line items with recurring prices on the quote. * @property null|float $application_fee_percent A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. Only applicable if there are line items with recurring prices on the quote. * @property \AmeliaStripe\StripeObject $automatic_tax * @property string $collection_method Either <code>charge_automatically</code>, or <code>send_invoice</code>. When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or on finalization using the default payment method attached to the subscription or customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as <code>active</code>. Defaults to <code>charge_automatically</code>. * @property \AmeliaStripe\StripeObject $computed * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string|\AmeliaStripe\Customer $customer The customer which this quote belongs to. A customer is required before finalizing the quote. Once specified, it cannot be changed. * @property (string|\AmeliaStripe\TaxRate)[] $default_tax_rates The tax rates applied to this quote. * @property null|string $description A description that will be displayed on the quote PDF. * @property (string|\AmeliaStripe\Discount)[] $discounts The discounts applied to this quote. * @property int $expires_at The date on which the quote will be canceled if in <code>open</code> or <code>draft</code> status. Measured in seconds since the Unix epoch. * @property null|string $footer A footer that will be displayed on the quote PDF. * @property null|\AmeliaStripe\StripeObject $from_quote Details of the quote that was cloned. See the <a href="https://stripe.com/docs/quotes/clone">cloning documentation</a> for more details. * @property null|string $header A header that will be displayed on the quote PDF. * @property null|string|\AmeliaStripe\Invoice $invoice The invoice that was created from this quote. * @property null|\AmeliaStripe\StripeObject $invoice_settings All invoices will be billed using the specified settings. * @property \AmeliaStripe\Collection<\AmeliaStripe\LineItem> $line_items A list of items the customer is being quoted for. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string $number A unique number that identifies this particular quote. This number is assigned once the quote is <a href="https://stripe.com/docs/quotes/overview#finalize">finalized</a>. * @property null|string|\AmeliaStripe\Account $on_behalf_of The account on behalf of which to charge. See the <a href="https://support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts">Connect documentation</a> for details. * @property string $status The status of the quote. * @property \AmeliaStripe\StripeObject $status_transitions * @property null|string|\AmeliaStripe\Subscription $subscription The subscription that was created or updated from this quote. * @property \AmeliaStripe\StripeObject $subscription_data * @property null|string|\AmeliaStripe\SubscriptionSchedule $subscription_schedule The subscription schedule that was created or updated from this quote. * @property null|string|\AmeliaStripe\TestHelpers\TestClock $test_clock ID of the test clock this quote belongs to. * @property \AmeliaStripe\StripeObject $total_details * @property null|\AmeliaStripe\StripeObject $transfer_data The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the invoices. */ class Quote extends ApiResource { const OBJECT_NAME = 'quote'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically'; const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice'; const STATUS_ACCEPTED = 'accepted'; const STATUS_CANCELED = 'canceled'; const STATUS_DRAFT = 'draft'; const STATUS_OPEN = 'open'; /** * @param callable $readBodyChunkCallable * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails */ public function pdf($readBodyChunkCallable, $params = null, $opts = null) { $opts = \AmeliaStripe\Util\RequestOptions::parse($opts); if (null === $opts->apiBase) { $opts->apiBase = Stripe::$apiUploadBase; } $url = $this->instanceUrl() . '/pdf'; $this->_requestStream('get', $url, $readBodyChunkCallable, $params, $opts); } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Quote the accepted quote */ public function accept($params = null, $opts = null) { $url = $this->instanceUrl() . '/accept'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Quote the canceled quote */ public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Quote the finalized quote */ public function finalizeQuote($params = null, $opts = null) { $url = $this->instanceUrl() . '/finalize'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param string $id * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\LineItem> list of LineItems */ public static function allComputedUpfrontLineItems($id, $params = null, $opts = null) { $url = static::resourceUrl($id) . '/computed_upfront_line_items'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } /** * @param string $id * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\LineItem> list of LineItems */ public static function allLineItems($id, $params = null, $opts = null) { $url = static::resourceUrl($id) . '/line_items'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } } stripe-php/lib/BaseStripeClient.php 0000666 00000026570 15165746005 0013345 0 ustar 00 <?php namespace AmeliaStripe; class BaseStripeClient implements StripeClientInterface, StripeStreamingClientInterface { /** @var string default base URL for Stripe's API */ const DEFAULT_API_BASE = 'https://api.stripe.com'; /** @var string default base URL for Stripe's OAuth API */ const DEFAULT_CONNECT_BASE = 'https://connect.stripe.com'; /** @var string default base URL for Stripe's Files API */ const DEFAULT_FILES_BASE = 'https://files.stripe.com'; /** @var array<string, mixed> */ private $config; /** @var \AmeliaStripe\Util\RequestOptions */ private $defaultOpts; /** * Initializes a new instance of the {@link BaseStripeClient} class. * * The constructor takes a single argument. The argument can be a string, in which case it * should be the API key. It can also be an array with various configuration settings. * * Configuration settings include the following options: * * - api_key (null|string): the Stripe API key, to be used in regular API requests. * - client_id (null|string): the Stripe client ID, to be used in OAuth requests. * - stripe_account (null|string): a Stripe account ID. If set, all requests sent by the client * will automatically use the {@code Stripe-Account} header with that account ID. * - stripe_version (null|string): a Stripe API verion. If set, all requests sent by the client * will include the {@code Stripe-Version} header with that API version. * * The following configuration settings are also available, though setting these should rarely be necessary * (only useful if you want to send requests to a mock server like stripe-mock): * * - api_base (string): the base URL for regular API requests. Defaults to * {@link DEFAULT_API_BASE}. * - connect_base (string): the base URL for OAuth requests. Defaults to * {@link DEFAULT_CONNECT_BASE}. * - files_base (string): the base URL for file creation requests. Defaults to * {@link DEFAULT_FILES_BASE}. * * @param array<string, mixed>|string $config the API key as a string, or an array containing * the client configuration settings */ public function __construct($config = []) { if (\is_string($config)) { $config = ['api_key' => $config]; } elseif (!\is_array($config)) { throw new \AmeliaStripe\Exception\InvalidArgumentException('$config must be a string or an array'); } $config = \array_merge($this->getDefaultConfig(), $config); $this->validateConfig($config); $this->config = $config; $this->defaultOpts = \AmeliaStripe\Util\RequestOptions::parse([ 'stripe_account' => $config['stripe_account'], 'stripe_version' => $config['stripe_version'], ]); } /** * Gets the API key used by the client to send requests. * * @return null|string the API key used by the client to send requests */ public function getApiKey() { return $this->config['api_key']; } /** * Gets the client ID used by the client in OAuth requests. * * @return null|string the client ID used by the client in OAuth requests */ public function getClientId() { return $this->config['client_id']; } /** * Gets the base URL for Stripe's API. * * @return string the base URL for Stripe's API */ public function getApiBase() { return $this->config['api_base']; } /** * Gets the base URL for Stripe's OAuth API. * * @return string the base URL for Stripe's OAuth API */ public function getConnectBase() { return $this->config['connect_base']; } /** * Gets the base URL for Stripe's Files API. * * @return string the base URL for Stripe's Files API */ public function getFilesBase() { return $this->config['files_base']; } /** * Sends a request to Stripe's API. * * @param string $method the HTTP method * @param string $path the path of the request * @param array $params the parameters of the request * @param array|\AmeliaStripe\Util\RequestOptions $opts the special modifiers of the request * * @return \AmeliaStripe\StripeObject the object returned by Stripe's API */ public function request($method, $path, $params, $opts) { $opts = $this->defaultOpts->merge($opts, true); $baseUrl = $opts->apiBase ?: $this->getApiBase(); $requestor = new \AmeliaStripe\ApiRequestor($this->apiKeyForRequest($opts), $baseUrl); list($response, $opts->apiKey) = $requestor->request($method, $path, $params, $opts->headers); $opts->discardNonPersistentHeaders(); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } /** * Sends a request to Stripe's API, passing chunks of the streamed response * into a user-provided $readBodyChunkCallable callback. * * @param string $method the HTTP method * @param string $path the path of the request * @param callable $readBodyChunkCallable a function that will be called * @param array $params the parameters of the request * @param array|\AmeliaStripe\Util\RequestOptions $opts the special modifiers of the request * with chunks of bytes from the body if the request is successful */ public function requestStream($method, $path, $readBodyChunkCallable, $params, $opts) { $opts = $this->defaultOpts->merge($opts, true); $baseUrl = $opts->apiBase ?: $this->getApiBase(); $requestor = new \AmeliaStripe\ApiRequestor($this->apiKeyForRequest($opts), $baseUrl); list($response, $opts->apiKey) = $requestor->requestStream($method, $path, $readBodyChunkCallable, $params, $opts->headers); } /** * Sends a request to Stripe's API. * * @param string $method the HTTP method * @param string $path the path of the request * @param array $params the parameters of the request * @param array|\AmeliaStripe\Util\RequestOptions $opts the special modifiers of the request * * @return \AmeliaStripe\Collection of ApiResources */ public function requestCollection($method, $path, $params, $opts) { $obj = $this->request($method, $path, $params, $opts); if (!($obj instanceof \AmeliaStripe\Collection)) { $received_class = \get_class($obj); $msg = "Expected to receive `AmeliaStripe\\Collection` object from Stripe API. Instead received `{$received_class}`."; throw new \AmeliaStripe\Exception\UnexpectedValueException($msg); } $obj->setFilters($params); return $obj; } /** * Sends a request to Stripe's API. * * @param string $method the HTTP method * @param string $path the path of the request * @param array $params the parameters of the request * @param array|\AmeliaStripe\Util\RequestOptions $opts the special modifiers of the request * * @return \AmeliaStripe\SearchResult of ApiResources */ public function requestSearchResult($method, $path, $params, $opts) { $obj = $this->request($method, $path, $params, $opts); if (!($obj instanceof \AmeliaStripe\SearchResult)) { $received_class = \get_class($obj); $msg = "Expected to receive `AmeliaStripe\\SearchResult` object from Stripe API. Instead received `{$received_class}`."; throw new \AmeliaStripe\Exception\UnexpectedValueException($msg); } $obj->setFilters($params); return $obj; } /** * @param \AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\AuthenticationException * * @return string */ private function apiKeyForRequest($opts) { $apiKey = $opts->apiKey ?: $this->getApiKey(); if (null === $apiKey) { $msg = 'No API key provided. Set your API key when constructing the ' . 'StripeClient instance, or provide it on a per-request basis ' . 'using the `api_key` key in the $opts argument.'; throw new \AmeliaStripe\Exception\AuthenticationException($msg); } return $apiKey; } /** * TODO: replace this with a private constant when we drop support for PHP < 5. * * @return array<string, mixed> */ private function getDefaultConfig() { return [ 'api_key' => null, 'client_id' => null, 'stripe_account' => null, 'stripe_version' => null, 'api_base' => self::DEFAULT_API_BASE, 'connect_base' => self::DEFAULT_CONNECT_BASE, 'files_base' => self::DEFAULT_FILES_BASE, ]; } /** * @param array<string, mixed> $config * * @throws \AmeliaStripe\Exception\InvalidArgumentException */ private function validateConfig($config) { // api_key if (null !== $config['api_key'] && !\is_string($config['api_key'])) { throw new \AmeliaStripe\Exception\InvalidArgumentException('api_key must be null or a string'); } if (null !== $config['api_key'] && ('' === $config['api_key'])) { $msg = 'api_key cannot be the empty string'; throw new \AmeliaStripe\Exception\InvalidArgumentException($msg); } if (null !== $config['api_key'] && (\preg_match('/\s/', $config['api_key']))) { $msg = 'api_key cannot contain whitespace'; throw new \AmeliaStripe\Exception\InvalidArgumentException($msg); } // client_id if (null !== $config['client_id'] && !\is_string($config['client_id'])) { throw new \AmeliaStripe\Exception\InvalidArgumentException('client_id must be null or a string'); } // stripe_account if (null !== $config['stripe_account'] && !\is_string($config['stripe_account'])) { throw new \AmeliaStripe\Exception\InvalidArgumentException('stripe_account must be null or a string'); } // stripe_version if (null !== $config['stripe_version'] && !\is_string($config['stripe_version'])) { throw new \AmeliaStripe\Exception\InvalidArgumentException('stripe_version must be null or a string'); } // api_base if (!\is_string($config['api_base'])) { throw new \AmeliaStripe\Exception\InvalidArgumentException('api_base must be a string'); } // connect_base if (!\is_string($config['connect_base'])) { throw new \AmeliaStripe\Exception\InvalidArgumentException('connect_base must be a string'); } // files_base if (!\is_string($config['files_base'])) { throw new \AmeliaStripe\Exception\InvalidArgumentException('files_base must be a string'); } // check absence of extra keys $extraConfigKeys = \array_diff(\array_keys($config), \array_keys($this->getDefaultConfig())); if (!empty($extraConfigKeys)) { // Wrap in single quote to more easily catch trailing spaces errors $invalidKeys = "'" . \implode("', '", $extraConfigKeys) . "'"; throw new \AmeliaStripe\Exception\InvalidArgumentException('Found unknown key(s) in configuration array: ' . $invalidKeys); } } } stripe-php/lib/CountrySpec.php 0000666 00000003412 15165746005 0012411 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Stripe needs to collect certain pieces of information about each account * created. These requirements can differ depending on the account's country. The * Country Specs API makes these rules available to your integration. * * You can also view the information from this API call as <a * href="/docs/connect/required-verification-information">an online guide</a>. * * @property string $id Unique identifier for the object. Represented as the ISO country code for this country. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property string $default_currency The default currency for this country. This applies to both payment methods and bank accounts. * @property \AmeliaStripe\StripeObject $supported_bank_account_currencies Currencies that can be accepted in the specific country (for transfers). * @property string[] $supported_payment_currencies Currencies that can be accepted in the specified country (for payments). * @property string[] $supported_payment_methods Payment methods available in the specified country. You may need to enable some payment methods (e.g., <a href="https://stripe.com/docs/ach">ACH</a>) on your account before they appear in this list. The <code>stripe</code> payment method refers to <a href="https://stripe.com/docs/connect/destination-charges">charging through your platform</a>. * @property string[] $supported_transfer_countries Countries that can accept transfers from the specified country. * @property \AmeliaStripe\StripeObject $verification_fields */ class CountrySpec extends ApiResource { const OBJECT_NAME = 'country_spec'; use ApiOperations\All; use ApiOperations\Retrieve; } stripe-php/lib/Transfer.php 0000666 00000013432 15165746005 0011722 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * A <code>Transfer</code> object is created when you move funds between Stripe * accounts as part of Connect. * * Before April 6, 2017, transfers also represented movement of funds from a Stripe * account to a card or bank account. This behavior has since been split out into a * <a href="https://stripe.com/docs/api#payout_object">Payout</a> object, with * corresponding payout endpoints. For more information, read about the <a * href="https://stripe.com/docs/transfer-payout-split">transfer/payout split</a>. * * Related guide: <a * href="https://stripe.com/docs/connect/charges-transfers">Creating Separate * Charges and Transfers</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Amount in %s to be transferred. * @property int $amount_reversed Amount in %s reversed (can be less than the amount attribute on the transfer if a partial reversal was issued). * @property null|string|\AmeliaStripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact of this transfer on your account balance. * @property int $created Time that this record of the transfer was first created. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|string|\AmeliaStripe\Account $destination ID of the Stripe account the transfer was sent to. * @property string|\AmeliaStripe\Charge $destination_payment If the destination is a Stripe account, this will be the ID of the payment that the destination account received for the transfer. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property \AmeliaStripe\Collection<\AmeliaStripe\TransferReversal> $reversals A list of reversals that have been applied to the transfer. * @property bool $reversed Whether the transfer has been fully reversed. If the transfer is only partially reversed, this attribute will still be false. * @property null|string|\AmeliaStripe\Charge $source_transaction ID of the charge or payment that was used to fund the transfer. If null, the transfer was funded from the available balance. * @property string $source_type The source balance this transfer came from. One of <code>card</code>, <code>fpx</code>, or <code>bank_account</code>. * @property null|string $transfer_group A string that identifies this transaction as part of a group. See the <a href="https://stripe.com/docs/connect/charges-transfers#transfer-options">Connect documentation</a> for details. */ class Transfer extends ApiResource { const OBJECT_NAME = 'transfer'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\NestedResource; use ApiOperations\Retrieve; use ApiOperations\Update; const SOURCE_TYPE_BANK_ACCOUNT = 'bank_account'; const SOURCE_TYPE_CARD = 'card'; const SOURCE_TYPE_FPX = 'fpx'; const PATH_REVERSALS = '/reversals'; /** * @param string $id the ID of the transfer on which to retrieve the transfer reversals * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\TransferReversal> the list of transfer reversals */ public static function allReversals($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_REVERSALS, $params, $opts); } /** * @param string $id the ID of the transfer on which to create the transfer reversal * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TransferReversal */ public static function createReversal($id, $params = null, $opts = null) { return self::_createNestedResource($id, static::PATH_REVERSALS, $params, $opts); } /** * @param string $id the ID of the transfer to which the transfer reversal belongs * @param string $reversalId the ID of the transfer reversal to retrieve * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TransferReversal */ public static function retrieveReversal($id, $reversalId, $params = null, $opts = null) { return self::_retrieveNestedResource($id, static::PATH_REVERSALS, $reversalId, $params, $opts); } /** * @param string $id the ID of the transfer to which the transfer reversal belongs * @param string $reversalId the ID of the transfer reversal to update * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TransferReversal */ public static function updateReversal($id, $reversalId, $params = null, $opts = null) { return self::_updateNestedResource($id, static::PATH_REVERSALS, $reversalId, $params, $opts); } } stripe-php/lib/SearchResult.php 0000666 00000014660 15165746005 0012546 0 ustar 00 <?php namespace AmeliaStripe; /** * Search results for an API resource. * * This behaves similarly to <code>Collection</code> in that they both wrap * around a list of objects and provide pagination. However the * <code>SearchResult</code> object paginates by relying on a * <code>next_page</code> token included in the response rather than using * object IDs and a <code>starting_before</code>/<code>ending_after</code> * parameter. Thus, <code>SearchResult</code> only supports forwards pagination. * * The {@see $total_count} property is only available when * the `expand` parameter contains `total_count`. * * @template TStripeObject of StripeObject * @template-implements \IteratorAggregate<TStripeObject> * * @property string $object * @property string $url * @property string $next_page * @property int $total_count * @property bool $has_more * @property TStripeObject[] $data */ class SearchResult extends StripeObject implements \Countable, \IteratorAggregate { const OBJECT_NAME = 'search_result'; use ApiOperations\Request; /** @var array */ protected $filters = []; /** * @return string the base URL for the given class */ public static function baseUrl() { return Stripe::$apiBase; } /** * Returns the filters. * * @return array the filters */ public function getFilters() { return $this->filters; } /** * Sets the filters, removing paging options. * * @param array $filters the filters */ public function setFilters($filters) { $this->filters = $filters; } /** * @return mixed */ #[\ReturnTypeWillChange] public function offsetGet($k) { if (\is_string($k)) { return parent::offsetGet($k); } $msg = "You tried to access the {$k} index, but SearchResult " . 'types only support string keys. (HINT: Search calls ' . 'return an object with a `data` (which is the data ' . "array). You likely want to call ->data[{$k}])"; throw new Exception\InvalidArgumentException($msg); } /** * @param null|array $params * @param null|array|string $opts * * @throws Exception\ApiErrorException * * @return SearchResult<TStripeObject> */ public function all($params = null, $opts = null) { self::_validateParams($params); list($url, $params) = $this->extractPathAndUpdateParams($params); list($response, $opts) = $this->_request('get', $url, $params, $opts); $obj = Util\Util::convertToStripeObject($response, $opts); if (!($obj instanceof \AmeliaStripe\SearchResult)) { throw new \AmeliaStripe\Exception\UnexpectedValueException( 'Expected type ' . \AmeliaStripe\SearchResult::class . ', got "' . \get_class($obj) . '" instead.' ); } $obj->setFilters($params); return $obj; } /** * @return int the number of objects in the current page */ #[\ReturnTypeWillChange] public function count() { return \count($this->data); } /** * @return \ArrayIterator an iterator that can be used to iterate * across objects in the current page */ #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->data); } /** * @return \Generator|TStripeObject[] A generator that can be used to * iterate across all objects across all pages. As page boundaries are * encountered, the next page will be fetched automatically for * continued iteration. */ public function autoPagingIterator() { $page = $this; while (true) { foreach ($page as $item) { yield $item; } $page = $page->nextPage(); if ($page->isEmpty()) { break; } } } /** * Returns an empty set of search results. This is returned from * {@see nextPage()} when we know that there isn't a next page in order to * replicate the behavior of the API when it attempts to return a page * beyond the last. * * @param null|array|string $opts * * @return SearchResult */ public static function emptySearchResult($opts = null) { return SearchResult::constructFrom(['data' => []], $opts); } /** * Returns true if the page object contains no element. * * @return bool */ public function isEmpty() { return empty($this->data); } /** * Fetches the next page in the resource list (if there is one). * * This method will try to respect the limit of the current page. If none * was given, the default limit will be fetched again. * * @param null|array $params * @param null|array|string $opts * * @return SearchResult<TStripeObject> */ public function nextPage($params = null, $opts = null) { if (!$this->has_more) { return static::emptySearchResult($opts); } $params = \array_merge( $this->filters ?: [], ['page' => $this->next_page], $params ?: [] ); return $this->all($params, $opts); } /** * Gets the first item from the current page. Returns `null` if the current page is empty. * * @return null|TStripeObject */ public function first() { return \count($this->data) > 0 ? $this->data[0] : null; } /** * Gets the last item from the current page. Returns `null` if the current page is empty. * * @return null|TStripeObject */ public function last() { return \count($this->data) > 0 ? $this->data[\count($this->data) - 1] : null; } private function extractPathAndUpdateParams($params) { $url = \parse_url($this->url); if (!isset($url['path'])) { throw new Exception\UnexpectedValueException("Could not parse list url into parts: {$url}"); } if (isset($url['query'])) { // If the URL contains a query param, parse it out into $params so they // don't interact weirdly with each other. $query = []; \parse_str($url['query'], $query); $params = \array_merge($params ?: [], $query); } return [$url['path'], $params]; } } stripe-php/lib/ShippingRate.php 0000666 00000004671 15165746005 0012540 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Shipping rates describe the price of shipping presented to your customers and * can be applied to <a * href="https://stripe.com/docs/payments/checkout/shipping">Checkout Sessions</a> * and <a href="https://stripe.com/docs/orders/shipping">Orders</a> to collect * shipping costs. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property bool $active Whether the shipping rate can be used for new purchases. Defaults to <code>true</code>. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|\AmeliaStripe\StripeObject $delivery_estimate The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions. * @property null|string $display_name The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions. * @property \AmeliaStripe\StripeObject $fixed_amount * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string $tax_behavior Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of <code>inclusive</code>, <code>exclusive</code>, or <code>unspecified</code>. * @property null|string|\AmeliaStripe\TaxCode $tax_code A <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> ID. The Shipping tax code is <code>txcd_92010001</code>. * @property string $type The type of calculation to use on the shipping rate. Can only be <code>fixed_amount</code> for now. */ class ShippingRate extends ApiResource { const OBJECT_NAME = 'shipping_rate'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; const TAX_BEHAVIOR_EXCLUSIVE = 'exclusive'; const TAX_BEHAVIOR_INCLUSIVE = 'inclusive'; const TAX_BEHAVIOR_UNSPECIFIED = 'unspecified'; const TYPE_FIXED_AMOUNT = 'fixed_amount'; } stripe-php/lib/WebhookSignature.php 0000666 00000010437 15165746005 0013420 0 ustar 00 <?php namespace AmeliaStripe; abstract class WebhookSignature { const EXPECTED_SCHEME = 'v1'; /** * Verifies the signature header sent by Stripe. Throws an * Exception\SignatureVerificationException exception if the verification fails for * any reason. * * @param string $payload the payload sent by Stripe * @param string $header the contents of the signature header sent by * Stripe * @param string $secret secret used to generate the signature * @param int $tolerance maximum difference allowed between the header's * timestamp and the current time * * @throws Exception\SignatureVerificationException if the verification fails * * @return bool */ public static function verifyHeader($payload, $header, $secret, $tolerance = null) { // Extract timestamp and signatures from header $timestamp = self::getTimestamp($header); $signatures = self::getSignatures($header, self::EXPECTED_SCHEME); if (-1 === $timestamp) { throw Exception\SignatureVerificationException::factory( 'Unable to extract timestamp and signatures from header', $payload, $header ); } if (empty($signatures)) { throw Exception\SignatureVerificationException::factory( 'No signatures found with expected scheme', $payload, $header ); } // Check if expected signature is found in list of signatures from // header $signedPayload = "{$timestamp}.{$payload}"; $expectedSignature = self::computeSignature($signedPayload, $secret); $signatureFound = false; foreach ($signatures as $signature) { if (Util\Util::secureCompare($expectedSignature, $signature)) { $signatureFound = true; break; } } if (!$signatureFound) { throw Exception\SignatureVerificationException::factory( 'No signatures found matching the expected signature for payload', $payload, $header ); } // Check if timestamp is within tolerance if (($tolerance > 0) && (\abs(\time() - $timestamp) > $tolerance)) { throw Exception\SignatureVerificationException::factory( 'Timestamp outside the tolerance zone', $payload, $header ); } return true; } /** * Extracts the timestamp in a signature header. * * @param string $header the signature header * * @return int the timestamp contained in the header, or -1 if no valid * timestamp is found */ private static function getTimestamp($header) { $items = \explode(',', $header); foreach ($items as $item) { $itemParts = \explode('=', $item, 2); if ('t' === $itemParts[0]) { if (!\is_numeric($itemParts[1])) { return -1; } return (int) ($itemParts[1]); } } return -1; } /** * Extracts the signatures matching a given scheme in a signature header. * * @param string $header the signature header * @param string $scheme the signature scheme to look for * * @return array the list of signatures matching the provided scheme */ private static function getSignatures($header, $scheme) { $signatures = []; $items = \explode(',', $header); foreach ($items as $item) { $itemParts = \explode('=', $item, 2); if (\trim($itemParts[0]) === $scheme) { $signatures[] = $itemParts[1]; } } return $signatures; } /** * Computes the signature for a given payload and secret. * * The current scheme used by Stripe ("v1") is HMAC/SHA-256. * * @param string $payload the payload to sign * @param string $secret the secret used to generate the signature * * @return string the signature as a string */ private static function computeSignature($payload, $secret) { return \hash_hmac('sha256', $payload, $secret); } } stripe-php/lib/Identity/VerificationReport.php 0000666 00000004176 15165746005 0015552 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Identity; /** * A VerificationReport is the result of an attempt to collect and verify data from * a user. The collection of verification checks performed is determined from the * <code>type</code> and <code>options</code> parameters used. You can find the * result of each verification check performed in the appropriate sub-resource: * <code>document</code>, <code>id_number</code>, <code>selfie</code>. * * Each VerificationReport contains a copy of any data collected by the user as * well as reference IDs which can be used to access collected images through the * <a href="https://stripe.com/docs/api/files">FileUpload</a> API. To configure and * create VerificationReports, use the <a * href="https://stripe.com/docs/api/identity/verification_sessions">VerificationSession</a> * API. * * Related guides: <a * href="https://stripe.com/docs/identity/verification-sessions#results">Accessing * verification results</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property \AmeliaStripe\StripeObject $document Result from a document check * @property \AmeliaStripe\StripeObject $id_number Result from an id_number check * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $options * @property \AmeliaStripe\StripeObject $selfie Result from a selfie check * @property string $type Type of report. * @property null|string $verification_session ID of the VerificationSession that created this report. */ class VerificationReport extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'identity.verification_report'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Retrieve; const TYPE_DOCUMENT = 'document'; const TYPE_ID_NUMBER = 'id_number'; } stripe-php/lib/Identity/VerificationSession.php 0000666 00000012253 15165746005 0015715 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Identity; /** * A VerificationSession guides you through the process of collecting and verifying * the identities of your users. It contains details about the type of * verification, such as what <a * href="/docs/identity/verification-checks">verification check</a> to perform. * Only create one VerificationSession for each verification in your system. * * A VerificationSession transitions through <a * href="/docs/identity/how-sessions-work">multiple statuses</a> throughout its * lifetime as it progresses through the verification flow. The VerificationSession * contains the user's verified data after verification checks are complete. * * Related guide: <a * href="https://stripe.com/docs/identity/verification-sessions">The Verification * Sessions API</a> * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string $client_secret The short-lived client secret used by Stripe.js to <a href="https://stripe.com/docs/js/identity/modal">show a verification modal</a> inside your app. This client secret expires after 24 hours and can only be used once. Don’t store it, log it, embed it in a URL, or expose it to anyone other than the user. Make sure that you have TLS enabled on any page that includes the client secret. Refer to our docs on <a href="https://stripe.com/docs/identity/verification-sessions#client-secret">passing the client secret to the frontend</a> to learn more. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|\AmeliaStripe\StripeObject $last_error If present, this property tells you the last error encountered when processing the verification. * @property null|string|\AmeliaStripe\Identity\VerificationReport $last_verification_report ID of the most recent VerificationReport. <a href="https://stripe.com/docs/identity/verification-sessions#results">Learn more about accessing detailed verification results.</a> * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property \AmeliaStripe\StripeObject $options * @property null|\AmeliaStripe\StripeObject $redaction Redaction status of this VerificationSession. If the VerificationSession is not redacted, this field will be null. * @property string $status Status of this VerificationSession. <a href="https://stripe.com/docs/identity/how-sessions-work">Learn more about the lifecycle of sessions</a>. * @property string $type The type of <a href="https://stripe.com/docs/identity/verification-checks">verification check</a> to be performed. * @property null|string $url The short-lived URL that you use to redirect a user to Stripe to submit their identity information. This URL expires after 48 hours and can only be used once. Don’t store it, log it, send it in emails or expose it to anyone other than the user. Refer to our docs on <a href="https://stripe.com/docs/identity/verify-identity-documents?platform=web&type=redirect">verifying identity documents</a> to learn how to redirect users to Stripe. * @property null|\AmeliaStripe\StripeObject $verified_outputs The user’s verified data. */ class VerificationSession extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'identity.verification_session'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Retrieve; use \AmeliaStripe\ApiOperations\Update; const STATUS_CANCELED = 'canceled'; const STATUS_PROCESSING = 'processing'; const STATUS_REQUIRES_INPUT = 'requires_input'; const STATUS_VERIFIED = 'verified'; const TYPE_DOCUMENT = 'document'; const TYPE_ID_NUMBER = 'id_number'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Identity\VerificationSession the canceled verification session */ public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Identity\VerificationSession the redacted verification session */ public function redact($params = null, $opts = null) { $url = $this->instanceUrl() . '/redact'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/StripeClient.php 0000666 00000010623 15165746005 0012542 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Client used to send requests to Stripe's API. * * @property \AmeliaStripe\Service\AccountLinkService $accountLinks * @property \AmeliaStripe\Service\AccountService $accounts * @property \AmeliaStripe\Service\ApplePayDomainService $applePayDomains * @property \AmeliaStripe\Service\ApplicationFeeService $applicationFees * @property \AmeliaStripe\Service\Apps\AppsServiceFactory $apps * @property \AmeliaStripe\Service\BalanceService $balance * @property \AmeliaStripe\Service\BalanceTransactionService $balanceTransactions * @property \AmeliaStripe\Service\BillingPortal\BillingPortalServiceFactory $billingPortal * @property \AmeliaStripe\Service\ChargeService $charges * @property \AmeliaStripe\Service\Checkout\CheckoutServiceFactory $checkout * @property \AmeliaStripe\Service\CountrySpecService $countrySpecs * @property \AmeliaStripe\Service\CouponService $coupons * @property \AmeliaStripe\Service\CreditNoteService $creditNotes * @property \AmeliaStripe\Service\CustomerService $customers * @property \AmeliaStripe\Service\DisputeService $disputes * @property \AmeliaStripe\Service\EphemeralKeyService $ephemeralKeys * @property \AmeliaStripe\Service\EventService $events * @property \AmeliaStripe\Service\ExchangeRateService $exchangeRates * @property \AmeliaStripe\Service\FileLinkService $fileLinks * @property \AmeliaStripe\Service\FileService $files * @property \AmeliaStripe\Service\FinancialConnections\FinancialConnectionsServiceFactory $financialConnections * @property \AmeliaStripe\Service\Identity\IdentityServiceFactory $identity * @property \AmeliaStripe\Service\InvoiceItemService $invoiceItems * @property \AmeliaStripe\Service\InvoiceService $invoices * @property \AmeliaStripe\Service\Issuing\IssuingServiceFactory $issuing * @property \AmeliaStripe\Service\MandateService $mandates * @property \AmeliaStripe\Service\OAuthService $oauth * @property \AmeliaStripe\Service\OrderService $orders * @property \AmeliaStripe\Service\PaymentIntentService $paymentIntents * @property \AmeliaStripe\Service\PaymentLinkService $paymentLinks * @property \AmeliaStripe\Service\PaymentMethodService $paymentMethods * @property \AmeliaStripe\Service\PayoutService $payouts * @property \AmeliaStripe\Service\PlanService $plans * @property \AmeliaStripe\Service\PriceService $prices * @property \AmeliaStripe\Service\ProductService $products * @property \AmeliaStripe\Service\PromotionCodeService $promotionCodes * @property \AmeliaStripe\Service\QuoteService $quotes * @property \AmeliaStripe\Service\Radar\RadarServiceFactory $radar * @property \AmeliaStripe\Service\RefundService $refunds * @property \AmeliaStripe\Service\Reporting\ReportingServiceFactory $reporting * @property \AmeliaStripe\Service\ReviewService $reviews * @property \AmeliaStripe\Service\SetupAttemptService $setupAttempts * @property \AmeliaStripe\Service\SetupIntentService $setupIntents * @property \AmeliaStripe\Service\ShippingRateService $shippingRates * @property \AmeliaStripe\Service\Sigma\SigmaServiceFactory $sigma * @property \AmeliaStripe\Service\SkuService $skus * @property \AmeliaStripe\Service\SourceService $sources * @property \AmeliaStripe\Service\SubscriptionItemService $subscriptionItems * @property \AmeliaStripe\Service\SubscriptionScheduleService $subscriptionSchedules * @property \AmeliaStripe\Service\SubscriptionService $subscriptions * @property \AmeliaStripe\Service\TaxCodeService $taxCodes * @property \AmeliaStripe\Service\TaxRateService $taxRates * @property \AmeliaStripe\Service\Terminal\TerminalServiceFactory $terminal * @property \AmeliaStripe\Service\TestHelpers\TestHelpersServiceFactory $testHelpers * @property \AmeliaStripe\Service\TokenService $tokens * @property \AmeliaStripe\Service\TopupService $topups * @property \AmeliaStripe\Service\TransferService $transfers * @property \AmeliaStripe\Service\Treasury\TreasuryServiceFactory $treasury * @property \AmeliaStripe\Service\WebhookEndpointService $webhookEndpoints */ class StripeClient extends BaseStripeClient { /** * @var \AmeliaStripe\Service\CoreServiceFactory */ private $coreServiceFactory; public function __get($name) { if (null === $this->coreServiceFactory) { $this->coreServiceFactory = new \AmeliaStripe\Service\CoreServiceFactory($this); } return $this->coreServiceFactory->__get($name); } } stripe-php/lib/Webhook.php 0000666 00000002761 15165746005 0011537 0 ustar 00 <?php namespace AmeliaStripe; abstract class Webhook { const DEFAULT_TOLERANCE = 300; /** * Returns an Event instance using the provided JSON payload. Throws an * Exception\UnexpectedValueException if the payload is not valid JSON, and * an Exception\SignatureVerificationException if the signature * verification fails for any reason. * * @param string $payload the payload sent by Stripe * @param string $sigHeader the contents of the signature header sent by * Stripe * @param string $secret secret used to generate the signature * @param int $tolerance maximum difference allowed between the header's * timestamp and the current time * * @throws Exception\UnexpectedValueException if the payload is not valid JSON, * @throws Exception\SignatureVerificationException if the verification fails * * @return Event the Event instance */ public static function constructEvent($payload, $sigHeader, $secret, $tolerance = self::DEFAULT_TOLERANCE) { WebhookSignature::verifyHeader($payload, $sigHeader, $secret, $tolerance); $data = \json_decode($payload, true); $jsonError = \json_last_error(); if (null === $data && \JSON_ERROR_NONE !== $jsonError) { $msg = "Invalid payload: {$payload} " . "(json_last_error() was {$jsonError})"; throw new Exception\UnexpectedValueException($msg); } return Event::constructFrom($data); } } stripe-php/lib/PaymentLink.php 0000666 00000013463 15165746005 0012375 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * A payment link is a shareable URL that will take your customers to a hosted * payment page. A payment link can be shared and used multiple times. * * When a customer opens a payment link it will open a new <a * href="https://stripe.com/docs/api/checkout/sessions">checkout session</a> to * render the payment page. You can use <a * href="https://stripe.com/docs/api/events/types#event_types-checkout.session.completed">checkout * session events</a> to track payments through payment links. * * Related guide: <a * href="https://stripe.com/docs/payments/payment-links/api">Payment Links API</a> * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property bool $active Whether the payment link's <code>url</code> is active. If <code>false</code>, customers visiting the URL will be shown a page saying that the link has been deactivated. * @property \AmeliaStripe\StripeObject $after_completion * @property bool $allow_promotion_codes Whether user redeemable promotion codes are enabled. * @property null|int $application_fee_amount The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. * @property null|float $application_fee_percent This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. * @property \AmeliaStripe\StripeObject $automatic_tax * @property string $billing_address_collection Configuration for collecting the customer's billing address. * @property null|\AmeliaStripe\StripeObject $consent_collection When set, provides configuration to gather active consent from customers. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property string $customer_creation Configuration for Customer creation during checkout. * @property \AmeliaStripe\Collection<\AmeliaStripe\LineItem> $line_items The line items representing what is being sold. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string|\AmeliaStripe\Account $on_behalf_of The account on behalf of which to charge. See the <a href="https://support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts">Connect documentation</a> for details. * @property null|\AmeliaStripe\StripeObject $payment_intent_data Indicates the parameters to be passed to PaymentIntent creation during checkout. * @property string $payment_method_collection Configuration for collecting a payment method during checkout. * @property null|string[] $payment_method_types The list of payment method types that customers can use. When <code>null</code>, Stripe will dynamically show relevant payment methods you've enabled in your <a href="https://dashboard.stripe.com/settings/payment_methods">payment method settings</a>. * @property \AmeliaStripe\StripeObject $phone_number_collection * @property null|\AmeliaStripe\StripeObject $shipping_address_collection Configuration for collecting the customer's shipping address. * @property \AmeliaStripe\StripeObject[] $shipping_options The shipping rate options applied to the session. * @property string $submit_type Indicates the type of transaction being performed which customizes relevant text on the page, such as the submit button. * @property null|\AmeliaStripe\StripeObject $subscription_data When creating a subscription, the specified configuration data will be used. There must be at least one line item with a recurring price to use <code>subscription_data</code>. * @property \AmeliaStripe\StripeObject $tax_id_collection * @property null|\AmeliaStripe\StripeObject $transfer_data The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to. * @property string $url The public URL that can be shared with customers. */ class PaymentLink extends ApiResource { const OBJECT_NAME = 'payment_link'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; const BILLING_ADDRESS_COLLECTION_AUTO = 'auto'; const BILLING_ADDRESS_COLLECTION_REQUIRED = 'required'; const CUSTOMER_CREATION_ALWAYS = 'always'; const CUSTOMER_CREATION_IF_REQUIRED = 'if_required'; const PAYMENT_METHOD_COLLECTION_ALWAYS = 'always'; const PAYMENT_METHOD_COLLECTION_IF_REQUIRED = 'if_required'; const SUBMIT_TYPE_AUTO = 'auto'; const SUBMIT_TYPE_BOOK = 'book'; const SUBMIT_TYPE_DONATE = 'donate'; const SUBMIT_TYPE_PAY = 'pay'; /** * @param string $id * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\LineItem> list of LineItems */ public static function allLineItems($id, $params = null, $opts = null) { $url = static::resourceUrl($id) . '/line_items'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } } stripe-php/lib/AlipayAccount.php 0000666 00000004544 15165746005 0012676 0 ustar 00 <?php namespace AmeliaStripe; /** * Class AlipayAccount. * * @deprecated Alipay accounts are deprecated. Please use the sources API instead. * @see https://stripe.com/docs/sources/alipay */ class AlipayAccount extends ApiResource { const OBJECT_NAME = 'alipay_account'; use ApiOperations\Delete; use ApiOperations\Update; /** * @return string The instance URL for this resource. It needs to be special * cased because it doesn't fit into the standard resource pattern. */ public function instanceUrl() { if ($this['customer']) { $base = Customer::classUrl(); $parent = $this['customer']; $path = 'sources'; } else { $msg = 'Alipay accounts cannot be accessed without a customer ID.'; throw new Exception\UnexpectedValueException($msg); } $parentExtn = \urlencode(Util\Util::utf8($parent)); $extn = \urlencode(Util\Util::utf8($this['id'])); return "{$base}/{$parentExtn}/{$path}/{$extn}"; } /** * @param array|string $_id * @param null|array|string $_opts * * @throws \AmeliaStripe\Exception\BadMethodCallException * * @deprecated Alipay accounts are deprecated. Please use the sources API instead. * @see https://stripe.com/docs/sources/alipay */ public static function retrieve($_id, $_opts = null) { $msg = 'Alipay accounts cannot be retrieved without a customer ID. ' . 'Retrieve an Alipay account using `Customer::retrieveSource(' . "'customer_id', 'alipay_account_id')`."; throw new Exception\BadMethodCallException($msg); } /** * @param string $_id * @param null|array $_params * @param null|array|string $_options * * @throws \AmeliaStripe\Exception\BadMethodCallException * * @deprecated Alipay accounts are deprecated. Please use the sources API instead. * @see https://stripe.com/docs/sources/alipay */ public static function update($_id, $_params = null, $_options = null) { $msg = 'Alipay accounts cannot be updated without a customer ID. ' . 'Update an Alipay account using `Customer::updateSource(' . "'customer_id', 'alipay_account_id', \$updateParams)`."; throw new Exception\BadMethodCallException($msg); } } stripe-php/lib/Review.php 0000666 00000006613 15165746005 0011402 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Reviews can be used to supplement automated fraud detection with human * expertise. * * Learn more about <a href="/radar">Radar</a> and reviewing payments <a * href="https://stripe.com/docs/radar/reviews">here</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string $billing_zip The ZIP or postal code of the card used, if applicable. * @property null|string|\AmeliaStripe\Charge $charge The charge associated with this review. * @property null|string $closed_reason The reason the review was closed, or null if it has not yet been closed. One of <code>approved</code>, <code>refunded</code>, <code>refunded_as_fraud</code>, <code>disputed</code>, or <code>redacted</code>. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $ip_address The IP address where the payment originated. * @property null|\AmeliaStripe\StripeObject $ip_address_location Information related to the location of the payment. Note that this information is an approximation and attempts to locate the nearest population center - it should not be used to determine a specific address. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property bool $open If <code>true</code>, the review needs action. * @property string $opened_reason The reason the review was opened. One of <code>rule</code> or <code>manual</code>. * @property string|\AmeliaStripe\PaymentIntent $payment_intent The PaymentIntent ID associated with this review, if one exists. * @property string $reason The reason the review is currently open or closed. One of <code>rule</code>, <code>manual</code>, <code>approved</code>, <code>refunded</code>, <code>refunded_as_fraud</code>, <code>disputed</code>, or <code>redacted</code>. * @property null|\AmeliaStripe\StripeObject $session Information related to the browsing session of the user who initiated the payment. */ class Review extends ApiResource { const OBJECT_NAME = 'review'; use ApiOperations\All; use ApiOperations\Retrieve; /** * Possible string representations of the current, the opening or the closure reason of the review. * Not all of these enumeration apply to all of the ´reason´ fields. Please consult the Review object to * determine where these are apply. * * @see https://stripe.com/docs/api/radar/reviews/object */ const REASON_APPROVED = 'approved'; const REASON_DISPUTED = 'disputed'; const REASON_MANUAL = 'manual'; const REASON_REFUNDED = 'refunded'; const REASON_REFUNDED_AS_FRAUD = 'refunded_as_fraud'; const REASON_RULE = 'rule'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Review the approved review */ public function approve($params = null, $opts = null) { $url = $this->instanceUrl() . '/approve'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/FinancialConnections/Account.php 0000666 00000012050 15165746005 0015614 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\FinancialConnections; /** * A Financial Connections Account represents an account that exists outside of * Stripe, to which you have been granted some degree of access. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|\AmeliaStripe\StripeObject $account_holder The account holder that this account belongs to. * @property null|\AmeliaStripe\StripeObject $balance The most recent information about the account's balance. * @property null|\AmeliaStripe\StripeObject $balance_refresh The state of the most recent attempt to refresh the account balance. * @property string $category The type of the account. Account category is further divided in <code>subcategory</code>. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $display_name A human-readable name that has been assigned to this account, either by the account holder or by the institution. * @property string $institution_name The name of the institution that holds this account. * @property null|string $last4 The last 4 digits of the account number. If present, this will be 4 numeric characters. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|string|\AmeliaStripe\FinancialConnections\AccountOwnership $ownership The most recent information about the account's owners. * @property null|\AmeliaStripe\StripeObject $ownership_refresh The state of the most recent attempt to refresh the account owners. * @property null|string[] $permissions The list of permissions granted by this account. * @property string $status The status of the link to the account. * @property string $subcategory <p>If <code>category</code> is <code>cash</code>, one of:</p><p>- <code>checking</code> - <code>savings</code> - <code>other</code></p><p>If <code>category</code> is <code>credit</code>, one of:</p><p>- <code>mortgage</code> - <code>line_of_credit</code> - <code>credit_card</code> - <code>other</code></p><p>If <code>category</code> is <code>investment</code> or <code>other</code>, this will be <code>other</code>.</p> * @property string[] $supported_payment_method_types The <a href="https://stripe.com/docs/api/payment_methods/object#payment_method_object-type">PaymentMethod type</a>(s) that can be created from this account. */ class Account extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'financial_connections.account'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Retrieve; const CATEGORY_CASH = 'cash'; const CATEGORY_CREDIT = 'credit'; const CATEGORY_INVESTMENT = 'investment'; const CATEGORY_OTHER = 'other'; const STATUS_ACTIVE = 'active'; const STATUS_DISCONNECTED = 'disconnected'; const STATUS_INACTIVE = 'inactive'; const SUBCATEGORY_CHECKING = 'checking'; const SUBCATEGORY_CREDIT_CARD = 'credit_card'; const SUBCATEGORY_LINE_OF_CREDIT = 'line_of_credit'; const SUBCATEGORY_MORTGAGE = 'mortgage'; const SUBCATEGORY_OTHER = 'other'; const SUBCATEGORY_SAVINGS = 'savings'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\FinancialConnections\Account the disconnected account */ public function disconnect($params = null, $opts = null) { $url = $this->instanceUrl() . '/disconnect'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param string $id * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\FinancialConnections\AccountOwner> list of BankConnectionsResourceOwners */ public static function allOwners($id, $params = null, $opts = null) { $url = static::resourceUrl($id) . '/owners'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\FinancialConnections\Account the refreshed account */ public function refreshAccount($params = null, $opts = null) { $url = $this->instanceUrl() . '/refresh'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/FinancialConnections/AccountOwnership.php 0000666 00000001336 15165746005 0017520 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\FinancialConnections; /** * Describes a snapshot of the owners of an account at a particular point in time. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property \AmeliaStripe\Collection<\AmeliaStripe\FinancialConnections\AccountOwner> $owners A paginated list of owners for this account. */ class AccountOwnership extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'financial_connections.account_ownership'; } stripe-php/lib/FinancialConnections/Session.php 0000666 00000002751 15165746005 0015652 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\FinancialConnections; /** * A Financial Connections Session is the secure way to programmatically launch the * client-side Stripe.js modal that lets your users link their accounts. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|\AmeliaStripe\StripeObject $account_holder The account holder for whom accounts are collected in this session. * @property \AmeliaStripe\Collection<\AmeliaStripe\FinancialConnections\Account> $accounts The accounts that were collected as part of this Session. * @property string $client_secret A value that will be passed to the client to launch the authentication flow. * @property \AmeliaStripe\StripeObject $filters * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property string[] $permissions Permissions requested for accounts collected during this session. * @property string $return_url For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. */ class Session extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'financial_connections.session'; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Retrieve; } stripe-php/lib/FinancialConnections/AccountOwner.php 0000666 00000001472 15165746005 0016635 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\FinancialConnections; /** * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string $email The email address of the owner. * @property string $name The full name of the owner. * @property string $ownership The ownership object that this owner belongs to. * @property null|string $phone The raw phone number of the owner. * @property null|string $raw_address The raw physical address of the owner. * @property null|int $refreshed_at The timestamp of the refresh that updated this owner. */ class AccountOwner extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'financial_connections.account_owner'; } stripe-php/lib/Card.php 0000666 00000020354 15165746005 0011010 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * You can store multiple cards on a customer in order to charge the customer * later. You can also store multiple debit cards on a recipient in order to * transfer to those cards later. * * Related guide: <a href="https://stripe.com/docs/sources/cards">Card Payments * with Sources</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string|\AmeliaStripe\Account $account The account this card belongs to. This attribute will not be in the card object if the card belongs to a customer or recipient instead. * @property null|string $address_city City/District/Suburb/Town/Village. * @property null|string $address_country Billing address country, if provided when creating card. * @property null|string $address_line1 Address line 1 (Street address/PO Box/Company name). * @property null|string $address_line1_check If <code>address_line1</code> was provided, results of the check: <code>pass</code>, <code>fail</code>, <code>unavailable</code>, or <code>unchecked</code>. * @property null|string $address_line2 Address line 2 (Apartment/Suite/Unit/Building). * @property null|string $address_state State/County/Province/Region. * @property null|string $address_zip ZIP or postal code. * @property null|string $address_zip_check If <code>address_zip</code> was provided, results of the check: <code>pass</code>, <code>fail</code>, <code>unavailable</code>, or <code>unchecked</code>. * @property null|string[] $available_payout_methods A set of available payout methods for this card. Only values from this set should be passed as the <code>method</code> when creating a payout. * @property string $brand Card brand. Can be <code>American Express</code>, <code>Diners Club</code>, <code>Discover</code>, <code>JCB</code>, <code>MasterCard</code>, <code>UnionPay</code>, <code>Visa</code>, or <code>Unknown</code>. * @property null|string $country Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. * @property null|string $currency Three-letter <a href="https://stripe.com/docs/payouts">ISO code for currency</a>. Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency. * @property null|string|\AmeliaStripe\Customer $customer The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead. * @property null|string $cvc_check If a CVC was provided, results of the check: <code>pass</code>, <code>fail</code>, <code>unavailable</code>, or <code>unchecked</code>. A result of unchecked indicates that CVC was provided but hasn't been checked yet. Checks are typically performed when attaching a card to a Customer object, or when creating a charge. For more details, see <a href="https://support.stripe.com/questions/check-if-a-card-is-valid-without-a-charge">Check if a card is valid without a charge</a>. * @property null|bool $default_for_currency Whether this card is the default external account for its currency. * @property null|string $dynamic_last4 (For tokenized numbers only.) The last four digits of the device account number. * @property int $exp_month Two-digit number representing the card's expiration month. * @property int $exp_year Four-digit number representing the card's expiration year. * @property null|string $fingerprint <p>Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number.</p><p><em>Starting May 1, 2021, card fingerprint in India for Connect will change to allow two fingerprints for the same card --- one for India and one for the rest of the world.</em></p> * @property string $funding Card funding type. Can be <code>credit</code>, <code>debit</code>, <code>prepaid</code>, or <code>unknown</code>. * @property string $last4 The last four digits of the card. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string $name Cardholder name. * @property null|string $status For external accounts, possible values are <code>new</code> and <code>errored</code>. If a transfer fails, the status is set to <code>errored</code> and transfers are stopped until account details are updated. * @property null|string $tokenization_method If the card number is tokenized, this is the method that was used. Can be <code>android_pay</code> (includes Google Pay), <code>apple_pay</code>, <code>masterpass</code>, <code>visa_checkout</code>, or null. */ class Card extends ApiResource { const OBJECT_NAME = 'card'; use ApiOperations\Delete; use ApiOperations\Update; /** * Possible string representations of the CVC check status. * * @see https://stripe.com/docs/api/cards/object#card_object-cvc_check */ const CVC_CHECK_FAIL = 'fail'; const CVC_CHECK_PASS = 'pass'; const CVC_CHECK_UNAVAILABLE = 'unavailable'; const CVC_CHECK_UNCHECKED = 'unchecked'; /** * Possible string representations of the funding of the card. * * @see https://stripe.com/docs/api/cards/object#card_object-funding */ const FUNDING_CREDIT = 'credit'; const FUNDING_DEBIT = 'debit'; const FUNDING_PREPAID = 'prepaid'; const FUNDING_UNKNOWN = 'unknown'; /** * Possible string representations of the tokenization method when using Apple Pay or Google Pay. * * @see https://stripe.com/docs/api/cards/object#card_object-tokenization_method */ const TOKENIZATION_METHOD_APPLE_PAY = 'apple_pay'; const TOKENIZATION_METHOD_GOOGLE_PAY = 'google_pay'; /** * @return string The instance URL for this resource. It needs to be special * cased because cards are nested resources that may belong to different * top-level resources. */ public function instanceUrl() { if ($this['customer']) { $base = Customer::classUrl(); $parent = $this['customer']; $path = 'sources'; } elseif ($this['account']) { $base = Account::classUrl(); $parent = $this['account']; $path = 'external_accounts'; } else { $msg = 'Cards cannot be accessed without a customer ID, or account ID.'; throw new Exception\UnexpectedValueException($msg); } $parentExtn = \urlencode(Util\Util::utf8($parent)); $extn = \urlencode(Util\Util::utf8($this['id'])); return "{$base}/{$parentExtn}/{$path}/{$extn}"; } /** * @param array|string $_id * @param null|array|string $_opts * * @throws \AmeliaStripe\Exception\BadMethodCallException */ public static function retrieve($_id, $_opts = null) { $msg = 'Cards cannot be retrieved without a customer ID or an ' . 'account ID. Retrieve a card using ' . "`Customer::retrieveSource('customer_id', 'card_id')` or " . "`Account::retrieveExternalAccount('account_id', 'card_id')`."; throw new Exception\BadMethodCallException($msg); } /** * @param string $_id * @param null|array $_params * @param null|array|string $_options * * @throws \AmeliaStripe\Exception\BadMethodCallException */ public static function update($_id, $_params = null, $_options = null) { $msg = 'Cards cannot be updated without a customer ID or an ' . 'account ID. Update a card using ' . "`Customer::updateSource('customer_id', 'card_id', " . '$updateParams)` or `Account::updateExternalAccount(' . "'account_id', 'card_id', \$updateParams)`."; throw new Exception\BadMethodCallException($msg); } } stripe-php/lib/SetupAttempt.php 0000666 00000006417 15165746005 0012602 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * A SetupAttempt describes one attempted confirmation of a SetupIntent, whether * that confirmation was successful or unsuccessful. You can use SetupAttempts to * inspect details of a specific attempt at setting up a payment method using a * SetupIntent. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string|\AmeliaStripe\StripeObject $application The value of <a href="https://stripe.com/docs/api/setup_intents/object#setup_intent_object-application">application</a> on the SetupIntent at the time of this confirmation. * @property bool $attach_to_self <p>If present, the SetupIntent's payment method will be attached to the in-context Stripe Account.</p><p>It can only be used for this Stripe Account’s own money movement flows like InboundTransfer and OutboundTransfers. It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer.</p> * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string|\AmeliaStripe\Customer $customer The value of <a href="https://stripe.com/docs/api/setup_intents/object#setup_intent_object-customer">customer</a> on the SetupIntent at the time of this confirmation. * @property null|string[] $flow_directions <p>Indicates the directions of money movement for which this payment method is intended to be used.</p><p>Include <code>inbound</code> if you intend to use the payment method as the origin to pull funds from. Include <code>outbound</code> if you intend to use the payment method as the destination to send funds to. You can include both if you intend to use the payment method for both purposes.</p> * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|string|\AmeliaStripe\Account $on_behalf_of The value of <a href="https://stripe.com/docs/api/setup_intents/object#setup_intent_object-on_behalf_of">on_behalf_of</a> on the SetupIntent at the time of this confirmation. * @property string|\AmeliaStripe\PaymentMethod $payment_method ID of the payment method used with this SetupAttempt. * @property \AmeliaStripe\StripeObject $payment_method_details * @property null|\AmeliaStripe\StripeObject $setup_error The error encountered during this attempt to confirm the SetupIntent, if any. * @property string|\AmeliaStripe\SetupIntent $setup_intent ID of the SetupIntent that this attempt belongs to. * @property string $status Status of this SetupAttempt, one of <code>requires_confirmation</code>, <code>requires_action</code>, <code>processing</code>, <code>succeeded</code>, <code>failed</code>, or <code>abandoned</code>. * @property string $usage The value of <a href="https://stripe.com/docs/api/setup_intents/object#setup_intent_object-usage">usage</a> on the SetupIntent at the time of this confirmation, one of <code>off_session</code> or <code>on_session</code>. */ class SetupAttempt extends ApiResource { const OBJECT_NAME = 'setup_attempt'; use ApiOperations\All; } stripe-php/lib/Refund.php 0000666 00000011374 15165746005 0011364 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * <code>Refund</code> objects allow you to refund a charge that has previously * been created but not yet refunded. Funds will be refunded to the credit or debit * card that was originally charged. * * Related guide: <a href="https://stripe.com/docs/refunds">Refunds</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Amount, in %s. * @property null|string|\AmeliaStripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact on your account balance. * @property null|string|\AmeliaStripe\Charge $charge ID of the charge that was refunded. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property string $description An arbitrary string attached to the object. Often useful for displaying to users. (Available on non-card refunds only) * @property string|\AmeliaStripe\BalanceTransaction $failure_balance_transaction If the refund failed, this balance transaction describes the adjustment made on your account balance that reverses the initial balance transaction. * @property string $failure_reason If the refund failed, the reason for refund failure if known. Possible values are <code>lost_or_stolen_card</code>, <code>expired_or_canceled_card</code>, or <code>unknown</code>. * @property string $instructions_email Email to which refund instructions, if required, are sent to. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property \AmeliaStripe\StripeObject $next_action * @property null|string|\AmeliaStripe\PaymentIntent $payment_intent ID of the PaymentIntent that was refunded. * @property null|string $reason Reason for the refund, either user-provided (<code>duplicate</code>, <code>fraudulent</code>, or <code>requested_by_customer</code>) or generated by Stripe internally (<code>expired_uncaptured_charge</code>). * @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this refund. * @property null|string|\AmeliaStripe\TransferReversal $source_transfer_reversal The transfer reversal that is associated with the refund. Only present if the charge came from another Stripe account. See the Connect documentation for details. * @property null|string $status Status of the refund. For credit card refunds, this can be <code>pending</code>, <code>succeeded</code>, or <code>failed</code>. For other types of refunds, it can be <code>pending</code>, <code>requires_action</code>, <code>succeeded</code>, <code>failed</code>, or <code>canceled</code>. Refer to our <a href="https://stripe.com/docs/refunds#failed-refunds">refunds</a> documentation for more details. * @property null|string|\AmeliaStripe\TransferReversal $transfer_reversal If the accompanying transfer was reversed, the transfer reversal object. Only applicable if the charge was created using the destination parameter. */ class Refund extends ApiResource { const OBJECT_NAME = 'refund'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; const FAILURE_REASON_EXPIRED_OR_CANCELED_CARD = 'expired_or_canceled_card'; const FAILURE_REASON_LOST_OR_STOLEN_CARD = 'lost_or_stolen_card'; const FAILURE_REASON_UNKNOWN = 'unknown'; const REASON_DUPLICATE = 'duplicate'; const REASON_EXPIRED_UNCAPTURED_CHARGE = 'expired_uncaptured_charge'; const REASON_FRAUDULENT = 'fraudulent'; const REASON_REQUESTED_BY_CUSTOMER = 'requested_by_customer'; const STATUS_CANCELED = 'canceled'; const STATUS_FAILED = 'failed'; const STATUS_PENDING = 'pending'; const STATUS_REQUIRES_ACTION = 'requires_action'; const STATUS_SUCCEEDED = 'succeeded'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Refund the canceled refund */ public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/Person.php 0000666 00000013612 15165746005 0011404 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * This is an object representing a person associated with a Stripe account. * * A platform cannot access a Standard or Express account's persons after the * account starts onboarding, such as after generating an account link for the * account. See the <a * href="https://stripe.com/docs/connect/standard-accounts">Standard onboarding</a> * or <a href="https://stripe.com/docs/connect/express-accounts">Express onboarding * documentation</a> for information about platform pre-filling and account * onboarding steps. * * Related guide: <a * href="https://stripe.com/docs/connect/identity-verification-api#person-information">Handling * Identity Verification with the API</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property string $account The account the person is associated with. * @property \AmeliaStripe\StripeObject $address * @property null|\AmeliaStripe\StripeObject $address_kana The Kana variation of the person's address (Japan only). * @property null|\AmeliaStripe\StripeObject $address_kanji The Kanji variation of the person's address (Japan only). * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property \AmeliaStripe\StripeObject $dob * @property null|string $email The person's email address. * @property null|string $first_name The person's first name. * @property null|string $first_name_kana The Kana variation of the person's first name (Japan only). * @property null|string $first_name_kanji The Kanji variation of the person's first name (Japan only). * @property string[] $full_name_aliases A list of alternate names or aliases that the person is known by. * @property null|\AmeliaStripe\StripeObject $future_requirements Information about the upcoming new requirements for this person, including what information needs to be collected, and by when. * @property null|string $gender The person's gender (International regulations require either "male" or "female"). * @property bool $id_number_provided Whether the person's <code>id_number</code> was provided. * @property bool $id_number_secondary_provided Whether the person's <code>id_number_secondary</code> was provided. * @property null|string $last_name The person's last name. * @property null|string $last_name_kana The Kana variation of the person's last name (Japan only). * @property null|string $last_name_kanji The Kanji variation of the person's last name (Japan only). * @property null|string $maiden_name The person's maiden name. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string $nationality The country where the person is a national. * @property null|string $phone The person's phone number. * @property string $political_exposure Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. * @property \AmeliaStripe\StripeObject $registered_address * @property \AmeliaStripe\StripeObject $relationship * @property null|\AmeliaStripe\StripeObject $requirements Information about the requirements for this person, including what information needs to be collected, and by when. * @property bool $ssn_last_4_provided Whether the last four digits of the person's Social Security number have been provided (U.S. only). * @property \AmeliaStripe\StripeObject $verification */ class Person extends ApiResource { const OBJECT_NAME = 'person'; use ApiOperations\Delete; use ApiOperations\Update; const GENDER_FEMALE = 'female'; const GENDER_MALE = 'male'; const POLITICAL_EXPOSURE_EXISTING = 'existing'; const POLITICAL_EXPOSURE_NONE = 'none'; const VERIFICATION_STATUS_PENDING = 'pending'; const VERIFICATION_STATUS_UNVERIFIED = 'unverified'; const VERIFICATION_STATUS_VERIFIED = 'verified'; /** * @return string the API URL for this Stripe account reversal */ public function instanceUrl() { $id = $this['id']; $account = $this['account']; if (!$id) { throw new Exception\UnexpectedValueException( 'Could not determine which URL to request: ' . "class instance has invalid ID: {$id}", null ); } $id = Util\Util::utf8($id); $account = Util\Util::utf8($account); $base = Account::classUrl(); $accountExtn = \urlencode($account); $extn = \urlencode($id); return "{$base}/{$accountExtn}/persons/{$extn}"; } /** * @param array|string $_id * @param null|array|string $_opts * * @throws \AmeliaStripe\Exception\BadMethodCallException */ public static function retrieve($_id, $_opts = null) { $msg = 'Persons cannot be retrieved without an account ID. Retrieve ' . "a person using `Account::retrievePerson('account_id', " . "'person_id')`."; throw new Exception\BadMethodCallException($msg); } /** * @param string $_id * @param null|array $_params * @param null|array|string $_options * * @throws \AmeliaStripe\Exception\BadMethodCallException */ public static function update($_id, $_params = null, $_options = null) { $msg = 'Persons cannot be updated without an account ID. Update ' . "a person using `Account::updatePerson('account_id', " . "'person_id', \$updateParams)`."; throw new Exception\BadMethodCallException($msg); } } stripe-php/lib/Discount.php 0000666 00000003064 15165746005 0011726 0 ustar 00 <?php namespace AmeliaStripe; /** * Class Discount. * * @property null|string $checkout_session The Checkout session that this coupon is applied to, if it is applied to a particular session in payment mode. Will not be present for subscription mode. * @property \AmeliaStripe\Coupon $coupon Hash describing the coupon applied to create this discount. * @property string|\AmeliaStripe\Customer $customer The ID of the customer associated with this discount. * @property null|int $end If the coupon has a duration of repeating, the date that this discount will end. If the coupon has a duration of once or forever, this attribute will be null. * @property string $id The ID of the discount object. * @property null|string $invoice The invoice that the discount’s coupon was applied to, if it was applied directly to a particular invoice. * @property null|string $invoice_item The invoice item id (or invoice line item id for invoice line items of type=‘subscription’) that the discount’s coupon was applied to, if it was applied directly to a particular invoice item or invoice line item. * @property string $object String representing the object’s type. Objects of the same type share the same value. * @property null|string $promotion_code The promotion code applied to create this discount. * @property int $start Date that the coupon was applied. * @property null|string $subscription The subscription that this coupon is applied to, if it is applied to a particular subscription. */ class Discount extends StripeObject { const OBJECT_NAME = 'discount'; } stripe-php/lib/PaymentMethod.php 0000666 00000011066 15165746005 0012715 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * PaymentMethod objects represent your customer's payment instruments. You can use * them with <a * href="https://stripe.com/docs/payments/payment-intents">PaymentIntents</a> to * collect payments or save them to Customer objects to store instrument details * for future payments. * * Related guides: <a * href="https://stripe.com/docs/payments/payment-methods">Payment Methods</a> and * <a href="https://stripe.com/docs/payments/more-payment-scenarios">More Payment * Scenarios</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \AmeliaStripe\StripeObject $acss_debit * @property \AmeliaStripe\StripeObject $affirm * @property \AmeliaStripe\StripeObject $afterpay_clearpay * @property \AmeliaStripe\StripeObject $alipay * @property \AmeliaStripe\StripeObject $au_becs_debit * @property \AmeliaStripe\StripeObject $bacs_debit * @property \AmeliaStripe\StripeObject $bancontact * @property \AmeliaStripe\StripeObject $billing_details * @property \AmeliaStripe\StripeObject $blik * @property \AmeliaStripe\StripeObject $boleto * @property \AmeliaStripe\StripeObject $card * @property \AmeliaStripe\StripeObject $card_present * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string|\AmeliaStripe\Customer $customer The ID of the Customer to which this PaymentMethod is saved. This will not be set when the PaymentMethod has not been saved to a Customer. * @property \AmeliaStripe\StripeObject $customer_balance * @property \AmeliaStripe\StripeObject $eps * @property \AmeliaStripe\StripeObject $fpx * @property \AmeliaStripe\StripeObject $giropay * @property \AmeliaStripe\StripeObject $grabpay * @property \AmeliaStripe\StripeObject $ideal * @property \AmeliaStripe\StripeObject $interac_present * @property \AmeliaStripe\StripeObject $klarna * @property \AmeliaStripe\StripeObject $konbini * @property \AmeliaStripe\StripeObject $link * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property \AmeliaStripe\StripeObject $oxxo * @property \AmeliaStripe\StripeObject $p24 * @property \AmeliaStripe\StripeObject $paynow * @property \AmeliaStripe\StripeObject $pix * @property \AmeliaStripe\StripeObject $promptpay * @property \AmeliaStripe\StripeObject $radar_options Options to configure Radar. See <a href="https://stripe.com/docs/radar/radar-session">Radar Session</a> for more information. * @property \AmeliaStripe\StripeObject $sepa_debit * @property \AmeliaStripe\StripeObject $sofort * @property string $type The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type. * @property \AmeliaStripe\StripeObject $us_bank_account * @property \AmeliaStripe\StripeObject $wechat_pay */ class PaymentMethod extends ApiResource { const OBJECT_NAME = 'payment_method'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentMethod the attached payment method */ public function attach($params = null, $opts = null) { $url = $this->instanceUrl() . '/attach'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentMethod the detached payment method */ public function detach($params = null, $opts = null) { $url = $this->instanceUrl() . '/detach'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/CustomerCashBalanceTransaction.php 0000666 00000005624 15165746005 0016216 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Customers with certain payments enabled have a cash balance, representing funds * that were paid by the customer to a merchant, but have not yet been allocated to * a payment. Cash Balance Transactions represent when funds are moved into or out * of this balance. This includes funding by the customer, allocation to payments, * and refunds to the customer. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \AmeliaStripe\StripeObject $applied_to_payment * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property string|\AmeliaStripe\Customer $customer The customer whose available cash balance changed as a result of this transaction. * @property int $ending_balance The total available cash balance for the specified currency after this transaction was applied. Represented in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. * @property \AmeliaStripe\StripeObject $funded * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property int $net_amount The amount by which the cash balance changed, represented in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. A positive value represents funds being added to the cash balance, a negative value represents funds being removed from the cash balance. * @property \AmeliaStripe\StripeObject $refunded_from_payment * @property string $type The type of the cash balance transaction. One of <code>applied_to_payment</code>, <code>unapplied_from_payment</code>, <code>refunded_from_payment</code>, <code>funded</code>, <code>return_initiated</code>, or <code>return_canceled</code>. New types may be added in future. See <a href="https://stripe.com/docs/payments/customer-balance#types">Customer Balance</a> to learn more about these types. * @property \AmeliaStripe\StripeObject $unapplied_from_payment */ class CustomerCashBalanceTransaction extends ApiResource { const OBJECT_NAME = 'customer_cash_balance_transaction'; use ApiOperations\All; use ApiOperations\Retrieve; const TYPE_APPLIED_TO_PAYMENT = 'applied_to_payment'; const TYPE_FUNDED = 'funded'; const TYPE_REFUNDED_FROM_PAYMENT = 'refunded_from_payment'; const TYPE_RETURN_CANCELED = 'return_canceled'; const TYPE_RETURN_INITIATED = 'return_initiated'; const TYPE_UNAPPLIED_FROM_PAYMENT = 'unapplied_from_payment'; } stripe-php/lib/Payout.php 0000666 00000015667 15165746005 0011433 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * A <code>Payout</code> object is created when you receive funds from Stripe, or * when you initiate a payout to either a bank account or debit card of a <a * href="/docs/connect/bank-debit-card-payouts">connected Stripe account</a>. You * can retrieve individual payouts, as well as list all payouts. Payouts are made * on <a href="/docs/connect/manage-payout-schedule">varying schedules</a>, * depending on your country and industry. * * Related guide: <a href="https://stripe.com/docs/payouts">Receiving Payouts</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Amount (in %s) to be transferred to your bank account or debit card. * @property int $arrival_date Date the payout is expected to arrive in the bank. This factors in delays like weekends or bank holidays. * @property bool $automatic Returns <code>true</code> if the payout was created by an <a href="https://stripe.com/docs/payouts#payout-schedule">automated payout schedule</a>, and <code>false</code> if it was <a href="https://stripe.com/docs/payouts#manual-payouts">requested manually</a>. * @property null|string|\AmeliaStripe\BalanceTransaction $balance_transaction ID of the balance transaction that describes the impact of this payout on your account balance. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|string|\AmeliaStripe\BankAccount|\AmeliaStripe\Card $destination ID of the bank account or card the payout was sent to. * @property null|string|\AmeliaStripe\BalanceTransaction $failure_balance_transaction If the payout failed or was canceled, this will be the ID of the balance transaction that reversed the initial balance transaction, and puts the funds from the failed payout back in your balance. * @property null|string $failure_code Error code explaining reason for payout failure if available. See <a href="https://stripe.com/docs/api#payout_failures">Types of payout failures</a> for a list of failure codes. * @property null|string $failure_message Message to user further explaining reason for payout failure if available. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $method The method used to send this payout, which can be <code>standard</code> or <code>instant</code>. <code>instant</code> is only supported for payouts to debit cards. (See <a href="https://stripe.com/blog/instant-payouts-for-marketplaces">Instant payouts for marketplaces</a> for more information.) * @property null|string|\AmeliaStripe\Payout $original_payout If the payout reverses another, this is the ID of the original payout. * @property null|string|\AmeliaStripe\Payout $reversed_by If the payout was reversed, this is the ID of the payout that reverses this payout. * @property string $source_type The source balance this payout came from. One of <code>card</code>, <code>fpx</code>, or <code>bank_account</code>. * @property null|string $statement_descriptor Extra information about a payout to be displayed on the user's bank statement. * @property string $status Current status of the payout: <code>paid</code>, <code>pending</code>, <code>in_transit</code>, <code>canceled</code> or <code>failed</code>. A payout is <code>pending</code> until it is submitted to the bank, when it becomes <code>in_transit</code>. The status then changes to <code>paid</code> if the transaction goes through, or to <code>failed</code> or <code>canceled</code> (within 5 business days). Some failed payouts may initially show as <code>paid</code> but then change to <code>failed</code>. * @property string $type Can be <code>bank_account</code> or <code>card</code>. */ class Payout extends ApiResource { const OBJECT_NAME = 'payout'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; const FAILURE_ACCOUNT_CLOSED = 'account_closed'; const FAILURE_ACCOUNT_FROZEN = 'account_frozen'; const FAILURE_BANK_ACCOUNT_RESTRICTED = 'bank_account_restricted'; const FAILURE_BANK_OWNERSHIP_CHANGED = 'bank_ownership_changed'; const FAILURE_COULD_NOT_PROCESS = 'could_not_process'; const FAILURE_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized'; const FAILURE_DECLINED = 'declined'; const FAILURE_INCORRECT_ACCOUNT_HOLDER_ADDRESS = 'incorrect_account_holder_address'; const FAILURE_INCORRECT_ACCOUNT_HOLDER_NAME = 'incorrect_account_holder_name'; const FAILURE_INCORRECT_ACCOUNT_HOLDER_TAX_ID = 'incorrect_account_holder_tax_id'; const FAILURE_INSUFFICIENT_FUNDS = 'insufficient_funds'; const FAILURE_INVALID_ACCOUNT_NUMBER = 'invalid_account_number'; const FAILURE_INVALID_CURRENCY = 'invalid_currency'; const FAILURE_NO_ACCOUNT = 'no_account'; const FAILURE_UNSUPPORTED_CARD = 'unsupported_card'; const METHOD_INSTANT = 'instant'; const METHOD_STANDARD = 'standard'; const STATUS_CANCELED = 'canceled'; const STATUS_FAILED = 'failed'; const STATUS_IN_TRANSIT = 'in_transit'; const STATUS_PAID = 'paid'; const STATUS_PENDING = 'pending'; const TYPE_BANK_ACCOUNT = 'bank_account'; const TYPE_CARD = 'card'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Payout the canceled payout */ public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Payout the reversed payout */ public function reverse($params = null, $opts = null) { $url = $this->instanceUrl() . '/reverse'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/ExchangeRate.php 0000666 00000002662 15165746005 0012477 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * <code>Exchange Rate</code> objects allow you to determine the rates that Stripe * is currently using to convert from one currency to another. Since this number is * variable throughout the day, there are various reasons why you might want to * know the current rate (for example, to dynamically price an item for a user with * a default payment in a foreign currency). * * If you want a guarantee that the charge is made with a certain exchange rate you * expect is current, you can pass in <code>exchange_rate</code> to charges * endpoints. If the value is no longer up to date, the charge won't go through. * Please refer to our <a href="https://stripe.com/docs/exchange-rates">Exchange * Rates API</a> guide for more details. * * @property string $id Unique identifier for the object. Represented as the three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a> in lowercase. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \AmeliaStripe\StripeObject $rates Hash where the keys are supported currencies and the values are the exchange rate at which the base id currency converts to the key currency. */ class ExchangeRate extends ApiResource { const OBJECT_NAME = 'exchange_rate'; use ApiOperations\All; use ApiOperations\Retrieve; } stripe-php/lib/Terminal/Configuration.php 0000666 00000002132 15165746005 0014513 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Terminal; /** * A Configurations object represents how features should be configured for * terminal readers. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \AmeliaStripe\StripeObject $bbpos_wisepos_e * @property null|bool $is_account_default Whether this Configuration is the default for your account * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $tipping * @property \AmeliaStripe\StripeObject $verifone_p400 */ class Configuration extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'terminal.configuration'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Delete; use \AmeliaStripe\ApiOperations\Retrieve; use \AmeliaStripe\ApiOperations\Update; } stripe-php/lib/Terminal/ConnectionToken.php 0000666 00000001672 15165746005 0015014 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Terminal; /** * A Connection Token is used by the Stripe Terminal SDK to connect to a reader. * * Related guide: <a href="https://stripe.com/docs/terminal/fleet/locations">Fleet * Management</a>. * * @property string $object String representing the object's type. Objects of the same type share the same value. * @property string $location The id of the location that this connection token is scoped to. Note that location scoping only applies to internet-connected readers. For more details, see <a href="https://stripe.com/docs/terminal/fleet/locations#connection-tokens">the docs on scoping connection tokens</a>. * @property string $secret Your application should pass this token to the Stripe Terminal SDK. */ class ConnectionToken extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'terminal.connection_token'; use \AmeliaStripe\ApiOperations\Create; } stripe-php/lib/Terminal/Location.php 0000666 00000002567 15165746005 0013470 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Terminal; /** * A Location represents a grouping of readers. * * Related guide: <a href="https://stripe.com/docs/terminal/fleet/locations">Fleet * Management</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \AmeliaStripe\StripeObject $address * @property string $configuration_overrides The ID of a configuration that will be used to customize all readers in this location. * @property string $display_name The display name of the location. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. */ class Location extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'terminal.location'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Delete; use \AmeliaStripe\ApiOperations\Retrieve; use \AmeliaStripe\ApiOperations\Update; } stripe-php/lib/Terminal/Reader.php 0000666 00000010064 15165746005 0013111 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Terminal; /** * A Reader represents a physical device for accepting payment details. * * Related guide: <a * href="https://stripe.com/docs/terminal/payments/connect-reader">Connecting to a * Reader</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|\AmeliaStripe\StripeObject $action The most recent action performed by the reader. * @property null|string $device_sw_version The current software version of the reader. * @property string $device_type Type of reader, one of <code>bbpos_wisepad3</code>, <code>stripe_m2</code>, <code>bbpos_chipper2x</code>, <code>bbpos_wisepos_e</code>, <code>verifone_P400</code>, or <code>simulated_wisepos_e</code>. * @property null|string $ip_address The local IP address of the reader. * @property string $label Custom label given to the reader for easier identification. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|string|\AmeliaStripe\Terminal\Location $location The location identifier of the reader. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $serial_number Serial number of the reader. * @property null|string $status The networking status of the reader. */ class Reader extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'terminal.reader'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Delete; use \AmeliaStripe\ApiOperations\Retrieve; use \AmeliaStripe\ApiOperations\Update; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Reader the canceled reader */ public function cancelAction($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel_action'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Reader the processed reader */ public function processPaymentIntent($params = null, $opts = null) { $url = $this->instanceUrl() . '/process_payment_intent'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Reader the processed reader */ public function processSetupIntent($params = null, $opts = null) { $url = $this->instanceUrl() . '/process_setup_intent'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Reader the seted reader */ public function setReaderDisplay($params = null, $opts = null) { $url = $this->instanceUrl() . '/set_reader_display'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/TransferReversal.php 0000666 00000006445 15165746005 0013434 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * <a href="https://stripe.com/docs/connect">Stripe Connect</a> platforms can * reverse transfers made to a connected account, either entirely or partially, and * can also specify whether to refund any related application fees. Transfer * reversals add to the platform's balance and subtract from the destination * account's balance. * * Reversing a transfer that was made for a <a * href="/docs/connect/destination-charges">destination charge</a> is allowed only * up to the amount of the charge. It is possible to reverse a <a * href="https://stripe.com/docs/connect/charges-transfers#transfer-options">transfer_group</a> * transfer only if the destination account has enough balance to cover the * reversal. * * Related guide: <a * href="https://stripe.com/docs/connect/charges-transfers#reversing-transfers">Reversing * Transfers</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Amount, in %s. * @property null|string|\AmeliaStripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact on your account balance. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string|\AmeliaStripe\Refund $destination_payment_refund Linked payment refund for the transfer reversal. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string|\AmeliaStripe\Refund $source_refund ID of the refund responsible for the transfer reversal. * @property string|\AmeliaStripe\Transfer $transfer ID of the transfer that was reversed. */ class TransferReversal extends ApiResource { const OBJECT_NAME = 'transfer_reversal'; use ApiOperations\Update { save as protected _save; } /** * @return string the API URL for this Stripe transfer reversal */ public function instanceUrl() { $id = $this['id']; $transfer = $this['transfer']; if (!$id) { throw new Exception\UnexpectedValueException( 'Could not determine which URL to request: ' . "class instance has invalid ID: {$id}", null ); } $id = Util\Util::utf8($id); $transfer = Util\Util::utf8($transfer); $base = Transfer::classUrl(); $transferExtn = \urlencode($transfer); $extn = \urlencode($id); return "{$base}/{$transferExtn}/reversals/{$extn}"; } /** * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return TransferReversal the saved reversal */ public function save($opts = null) { return $this->_save($opts); } } stripe-php/lib/ErrorObject.php 0000666 00000031113 15165746005 0012352 0 ustar 00 <?php namespace AmeliaStripe; /** * Class ErrorObject. * * @property string $charge For card errors, the ID of the failed charge. * @property string $code For some errors that could be handled * programmatically, a short string indicating the error code reported. * @property string $decline_code For card errors resulting from a card issuer * decline, a short string indicating the card issuer's reason for the * decline if they provide one. * @property string $doc_url A URL to more information about the error code * reported. * @property string $message A human-readable message providing more details * about the error. For card errors, these messages can be shown to your * users. * @property string $param If the error is parameter-specific, the parameter * related to the error. For example, you can use this to display a message * near the correct form field. * @property PaymentIntent $payment_intent The PaymentIntent object for errors * returned on a request involving a PaymentIntent. * @property PaymentMethod $payment_method The PaymentMethod object for errors * returned on a request involving a PaymentMethod. * @property string $payment_method_type If the error is specific to the type * of payment method, the payment method type that had a problem. This * field is only populated for invoice-related errors. * @property string $request_log_url A URL to the request log entry in your * dashboard. * @property SetupIntent $setup_intent The SetupIntent object for errors * returned on a request involving a SetupIntent. * @property StripeObject $source The source object for errors returned on a * request involving a source. * @property string $type The type of error returned. One of `api_error`, * `card_error`, `idempotency_error`, or `invalid_request_error`. */ class ErrorObject extends StripeObject { /** * Possible string representations of an error's code. * * @see https://stripe.com/docs/error-codes */ const CODE_ACCOUNT_COUNTRY_INVALID_ADDRESS = 'account_country_invalid_address'; const CODE_ACCOUNT_ERROR_COUNTRY_CHANGE_REQUIRES_ADDITIONAL_STEPS = 'account_error_country_change_requires_additional_steps'; const CODE_ACCOUNT_INFORMATION_MISMATCH = 'account_information_mismatch'; const CODE_ACCOUNT_INVALID = 'account_invalid'; const CODE_ACCOUNT_NUMBER_INVALID = 'account_number_invalid'; const CODE_ACSS_DEBIT_SESSION_INCOMPLETE = 'acss_debit_session_incomplete'; const CODE_ALIPAY_UPGRADE_REQUIRED = 'alipay_upgrade_required'; const CODE_AMOUNT_TOO_LARGE = 'amount_too_large'; const CODE_AMOUNT_TOO_SMALL = 'amount_too_small'; const CODE_API_KEY_EXPIRED = 'api_key_expired'; const CODE_AUTHENTICATION_REQUIRED = 'authentication_required'; const CODE_BALANCE_INSUFFICIENT = 'balance_insufficient'; const CODE_BANK_ACCOUNT_BAD_ROUTING_NUMBERS = 'bank_account_bad_routing_numbers'; const CODE_BANK_ACCOUNT_DECLINED = 'bank_account_declined'; const CODE_BANK_ACCOUNT_EXISTS = 'bank_account_exists'; const CODE_BANK_ACCOUNT_UNUSABLE = 'bank_account_unusable'; const CODE_BANK_ACCOUNT_UNVERIFIED = 'bank_account_unverified'; const CODE_BANK_ACCOUNT_VERIFICATION_FAILED = 'bank_account_verification_failed'; const CODE_BILLING_INVALID_MANDATE = 'billing_invalid_mandate'; const CODE_BITCOIN_UPGRADE_REQUIRED = 'bitcoin_upgrade_required'; const CODE_CARD_DECLINE_RATE_LIMIT_EXCEEDED = 'card_decline_rate_limit_exceeded'; const CODE_CARD_DECLINED = 'card_declined'; const CODE_CARDHOLDER_PHONE_NUMBER_REQUIRED = 'cardholder_phone_number_required'; const CODE_CHARGE_ALREADY_CAPTURED = 'charge_already_captured'; const CODE_CHARGE_ALREADY_REFUNDED = 'charge_already_refunded'; const CODE_CHARGE_DISPUTED = 'charge_disputed'; const CODE_CHARGE_EXCEEDS_SOURCE_LIMIT = 'charge_exceeds_source_limit'; const CODE_CHARGE_EXPIRED_FOR_CAPTURE = 'charge_expired_for_capture'; const CODE_CHARGE_INVALID_PARAMETER = 'charge_invalid_parameter'; const CODE_CLEARING_CODE_UNSUPPORTED = 'clearing_code_unsupported'; const CODE_COUNTRY_CODE_INVALID = 'country_code_invalid'; const CODE_COUNTRY_UNSUPPORTED = 'country_unsupported'; const CODE_COUPON_EXPIRED = 'coupon_expired'; const CODE_CUSTOMER_MAX_PAYMENT_METHODS = 'customer_max_payment_methods'; const CODE_CUSTOMER_MAX_SUBSCRIPTIONS = 'customer_max_subscriptions'; const CODE_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized'; const CODE_EMAIL_INVALID = 'email_invalid'; const CODE_EXPIRED_CARD = 'expired_card'; const CODE_IDEMPOTENCY_KEY_IN_USE = 'idempotency_key_in_use'; const CODE_INCORRECT_ADDRESS = 'incorrect_address'; const CODE_INCORRECT_CVC = 'incorrect_cvc'; const CODE_INCORRECT_NUMBER = 'incorrect_number'; const CODE_INCORRECT_ZIP = 'incorrect_zip'; const CODE_INSTANT_PAYOUTS_LIMIT_EXCEEDED = 'instant_payouts_limit_exceeded'; const CODE_INSTANT_PAYOUTS_UNSUPPORTED = 'instant_payouts_unsupported'; const CODE_INSUFFICIENT_FUNDS = 'insufficient_funds'; const CODE_INTENT_INVALID_STATE = 'intent_invalid_state'; const CODE_INTENT_VERIFICATION_METHOD_MISSING = 'intent_verification_method_missing'; const CODE_INVALID_CARD_TYPE = 'invalid_card_type'; const CODE_INVALID_CHARACTERS = 'invalid_characters'; const CODE_INVALID_CHARGE_AMOUNT = 'invalid_charge_amount'; const CODE_INVALID_CVC = 'invalid_cvc'; const CODE_INVALID_EXPIRY_MONTH = 'invalid_expiry_month'; const CODE_INVALID_EXPIRY_YEAR = 'invalid_expiry_year'; const CODE_INVALID_NUMBER = 'invalid_number'; const CODE_INVALID_SOURCE_USAGE = 'invalid_source_usage'; const CODE_INVOICE_NO_CUSTOMER_LINE_ITEMS = 'invoice_no_customer_line_items'; const CODE_INVOICE_NO_PAYMENT_METHOD_TYPES = 'invoice_no_payment_method_types'; const CODE_INVOICE_NO_SUBSCRIPTION_LINE_ITEMS = 'invoice_no_subscription_line_items'; const CODE_INVOICE_NOT_EDITABLE = 'invoice_not_editable'; const CODE_INVOICE_ON_BEHALF_OF_NOT_EDITABLE = 'invoice_on_behalf_of_not_editable'; const CODE_INVOICE_PAYMENT_INTENT_REQUIRES_ACTION = 'invoice_payment_intent_requires_action'; const CODE_INVOICE_UPCOMING_NONE = 'invoice_upcoming_none'; const CODE_LIVEMODE_MISMATCH = 'livemode_mismatch'; const CODE_LOCK_TIMEOUT = 'lock_timeout'; const CODE_MISSING = 'missing'; const CODE_NO_ACCOUNT = 'no_account'; const CODE_NOT_ALLOWED_ON_STANDARD_ACCOUNT = 'not_allowed_on_standard_account'; const CODE_OUT_OF_INVENTORY = 'out_of_inventory'; const CODE_PARAMETER_INVALID_EMPTY = 'parameter_invalid_empty'; const CODE_PARAMETER_INVALID_INTEGER = 'parameter_invalid_integer'; const CODE_PARAMETER_INVALID_STRING_BLANK = 'parameter_invalid_string_blank'; const CODE_PARAMETER_INVALID_STRING_EMPTY = 'parameter_invalid_string_empty'; const CODE_PARAMETER_MISSING = 'parameter_missing'; const CODE_PARAMETER_UNKNOWN = 'parameter_unknown'; const CODE_PARAMETERS_EXCLUSIVE = 'parameters_exclusive'; const CODE_PAYMENT_INTENT_ACTION_REQUIRED = 'payment_intent_action_required'; const CODE_PAYMENT_INTENT_AUTHENTICATION_FAILURE = 'payment_intent_authentication_failure'; const CODE_PAYMENT_INTENT_INCOMPATIBLE_PAYMENT_METHOD = 'payment_intent_incompatible_payment_method'; const CODE_PAYMENT_INTENT_INVALID_PARAMETER = 'payment_intent_invalid_parameter'; const CODE_PAYMENT_INTENT_KONBINI_REJECTED_CONFIRMATION_NUMBER = 'payment_intent_konbini_rejected_confirmation_number'; const CODE_PAYMENT_INTENT_MANDATE_INVALID = 'payment_intent_mandate_invalid'; const CODE_PAYMENT_INTENT_PAYMENT_ATTEMPT_EXPIRED = 'payment_intent_payment_attempt_expired'; const CODE_PAYMENT_INTENT_PAYMENT_ATTEMPT_FAILED = 'payment_intent_payment_attempt_failed'; const CODE_PAYMENT_INTENT_UNEXPECTED_STATE = 'payment_intent_unexpected_state'; const CODE_PAYMENT_METHOD_BANK_ACCOUNT_ALREADY_VERIFIED = 'payment_method_bank_account_already_verified'; const CODE_PAYMENT_METHOD_BANK_ACCOUNT_BLOCKED = 'payment_method_bank_account_blocked'; const CODE_PAYMENT_METHOD_BILLING_DETAILS_ADDRESS_MISSING = 'payment_method_billing_details_address_missing'; const CODE_PAYMENT_METHOD_CURRENCY_MISMATCH = 'payment_method_currency_mismatch'; const CODE_PAYMENT_METHOD_INVALID_PARAMETER = 'payment_method_invalid_parameter'; const CODE_PAYMENT_METHOD_INVALID_PARAMETER_TESTMODE = 'payment_method_invalid_parameter_testmode'; const CODE_PAYMENT_METHOD_MICRODEPOSIT_FAILED = 'payment_method_microdeposit_failed'; const CODE_PAYMENT_METHOD_MICRODEPOSIT_VERIFICATION_AMOUNTS_INVALID = 'payment_method_microdeposit_verification_amounts_invalid'; const CODE_PAYMENT_METHOD_MICRODEPOSIT_VERIFICATION_AMOUNTS_MISMATCH = 'payment_method_microdeposit_verification_amounts_mismatch'; const CODE_PAYMENT_METHOD_MICRODEPOSIT_VERIFICATION_ATTEMPTS_EXCEEDED = 'payment_method_microdeposit_verification_attempts_exceeded'; const CODE_PAYMENT_METHOD_MICRODEPOSIT_VERIFICATION_DESCRIPTOR_CODE_MISMATCH = 'payment_method_microdeposit_verification_descriptor_code_mismatch'; const CODE_PAYMENT_METHOD_MICRODEPOSIT_VERIFICATION_TIMEOUT = 'payment_method_microdeposit_verification_timeout'; const CODE_PAYMENT_METHOD_PROVIDER_DECLINE = 'payment_method_provider_decline'; const CODE_PAYMENT_METHOD_PROVIDER_TIMEOUT = 'payment_method_provider_timeout'; const CODE_PAYMENT_METHOD_UNACTIVATED = 'payment_method_unactivated'; const CODE_PAYMENT_METHOD_UNEXPECTED_STATE = 'payment_method_unexpected_state'; const CODE_PAYMENT_METHOD_UNSUPPORTED_TYPE = 'payment_method_unsupported_type'; const CODE_PAYOUTS_NOT_ALLOWED = 'payouts_not_allowed'; const CODE_PLATFORM_ACCOUNT_REQUIRED = 'platform_account_required'; const CODE_PLATFORM_API_KEY_EXPIRED = 'platform_api_key_expired'; const CODE_POSTAL_CODE_INVALID = 'postal_code_invalid'; const CODE_PROCESSING_ERROR = 'processing_error'; const CODE_PRODUCT_INACTIVE = 'product_inactive'; const CODE_RATE_LIMIT = 'rate_limit'; const CODE_REFER_TO_CUSTOMER = 'refer_to_customer'; const CODE_REFUND_DISPUTED_PAYMENT = 'refund_disputed_payment'; const CODE_RESOURCE_ALREADY_EXISTS = 'resource_already_exists'; const CODE_RESOURCE_MISSING = 'resource_missing'; const CODE_RETURN_INTENT_ALREADY_PROCESSED = 'return_intent_already_processed'; const CODE_ROUTING_NUMBER_INVALID = 'routing_number_invalid'; const CODE_SECRET_KEY_REQUIRED = 'secret_key_required'; const CODE_SEPA_UNSUPPORTED_ACCOUNT = 'sepa_unsupported_account'; const CODE_SETUP_ATTEMPT_FAILED = 'setup_attempt_failed'; const CODE_SETUP_INTENT_AUTHENTICATION_FAILURE = 'setup_intent_authentication_failure'; const CODE_SETUP_INTENT_INVALID_PARAMETER = 'setup_intent_invalid_parameter'; const CODE_SETUP_INTENT_SETUP_ATTEMPT_EXPIRED = 'setup_intent_setup_attempt_expired'; const CODE_SETUP_INTENT_UNEXPECTED_STATE = 'setup_intent_unexpected_state'; const CODE_SHIPPING_CALCULATION_FAILED = 'shipping_calculation_failed'; const CODE_SKU_INACTIVE = 'sku_inactive'; const CODE_STATE_UNSUPPORTED = 'state_unsupported'; const CODE_TAX_ID_INVALID = 'tax_id_invalid'; const CODE_TAXES_CALCULATION_FAILED = 'taxes_calculation_failed'; const CODE_TERMINAL_LOCATION_COUNTRY_UNSUPPORTED = 'terminal_location_country_unsupported'; const CODE_TESTMODE_CHARGES_ONLY = 'testmode_charges_only'; const CODE_TLS_VERSION_UNSUPPORTED = 'tls_version_unsupported'; const CODE_TOKEN_ALREADY_USED = 'token_already_used'; const CODE_TOKEN_IN_USE = 'token_in_use'; const CODE_TRANSFER_SOURCE_BALANCE_PARAMETERS_MISMATCH = 'transfer_source_balance_parameters_mismatch'; const CODE_TRANSFERS_NOT_ALLOWED = 'transfers_not_allowed'; const CODE_URL_INVALID = 'url_invalid'; /** * Refreshes this object using the provided values. * * @param array $values * @param null|array|string|Util\RequestOptions $opts * @param bool $partial defaults to false */ public function refreshFrom($values, $opts, $partial = false) { // Unlike most other API resources, the API will omit attributes in // error objects when they have a null value. We manually set default // values here to facilitate generic error handling. $values = \array_merge([ 'charge' => null, 'code' => null, 'decline_code' => null, 'doc_url' => null, 'message' => null, 'param' => null, 'payment_intent' => null, 'payment_method' => null, 'setup_intent' => null, 'source' => null, 'type' => null, ], $values); parent::refreshFrom($values, $opts, $partial); } } stripe-php/lib/File.php 0000666 00000007545 15165746005 0011025 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * This is an object representing a file hosted on Stripe's servers. The file may * have been uploaded by yourself using the <a * href="https://stripe.com/docs/api#create_file">create file</a> request (for * example, when uploading dispute evidence) or it may have been created by Stripe * (for example, the results of a <a href="#scheduled_queries">Sigma scheduled * query</a>). * * Related guide: <a href="https://stripe.com/docs/file-upload">File Upload * Guide</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|int $expires_at The time at which the file expires and is no longer available in epoch seconds. * @property null|string $filename A filename for the file, suitable for saving to a filesystem. * @property null|\AmeliaStripe\Collection<\AmeliaStripe\FileLink> $links A list of <a href="https://stripe.com/docs/api#file_links">file links</a> that point at this file. * @property string $purpose The <a href="https://stripe.com/docs/file-upload#uploading-a-file">purpose</a> of the uploaded file. * @property int $size The size in bytes of the file object. * @property null|string $title A user friendly title for the document. * @property null|string $type The type of the file returned (e.g., <code>csv</code>, <code>pdf</code>, <code>jpg</code>, or <code>png</code>). * @property null|string $url The URL from which the file can be downloaded using your live secret API key. */ class File extends ApiResource { const OBJECT_NAME = 'file'; use ApiOperations\All; use ApiOperations\Retrieve; const PURPOSE_ACCOUNT_REQUIREMENT = 'account_requirement'; const PURPOSE_ADDITIONAL_VERIFICATION = 'additional_verification'; const PURPOSE_BUSINESS_ICON = 'business_icon'; const PURPOSE_BUSINESS_LOGO = 'business_logo'; const PURPOSE_CUSTOMER_SIGNATURE = 'customer_signature'; const PURPOSE_DISPUTE_EVIDENCE = 'dispute_evidence'; const PURPOSE_DOCUMENT_PROVIDER_IDENTITY_DOCUMENT = 'document_provider_identity_document'; const PURPOSE_FINANCE_REPORT_RUN = 'finance_report_run'; const PURPOSE_IDENTITY_DOCUMENT = 'identity_document'; const PURPOSE_IDENTITY_DOCUMENT_DOWNLOADABLE = 'identity_document_downloadable'; const PURPOSE_PCI_DOCUMENT = 'pci_document'; const PURPOSE_SELFIE = 'selfie'; const PURPOSE_SIGMA_SCHEDULED_QUERY = 'sigma_scheduled_query'; const PURPOSE_TAX_DOCUMENT_USER_UPLOAD = 'tax_document_user_upload'; const PURPOSE_TERMINAL_READER_SPLASHSCREEN = 'terminal_reader_splashscreen'; // This resource can have two different object names. In latter API // versions, only `file` is used, but since stripe-php may be used with // any API version, we need to support deserializing the older // `file_upload` object into the same class. const OBJECT_NAME_ALT = 'file_upload'; use ApiOperations\Create { create as protected _create; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\File the created file */ public static function create($params = null, $opts = null) { $opts = \AmeliaStripe\Util\RequestOptions::parse($opts); if (null === $opts->apiBase) { $opts->apiBase = Stripe::$apiUploadBase; } // Manually flatten params, otherwise curl's multipart encoder will // choke on nested arrays. $flatParams = \array_column(\AmeliaStripe\Util\Util::flattenParams($params), 1, 0); return static::_create($flatParams, $opts); } } stripe-php/lib/OAuthErrorObject.php 0000666 00000001543 15165746005 0013317 0 ustar 00 <?php namespace AmeliaStripe; /** * Class OAuthErrorObject. * * @property string $error * @property string $error_description */ class OAuthErrorObject extends StripeObject { /** * Refreshes this object using the provided values. * * @param array $values * @param null|array|string|Util\RequestOptions $opts * @param bool $partial defaults to false */ public function refreshFrom($values, $opts, $partial = false) { // Unlike most other API resources, the API will omit attributes in // error objects when they have a null value. We manually set default // values here to facilitate generic error handling. $values = \array_merge([ 'error' => null, 'error_description' => null, ], $values); parent::refreshFrom($values, $opts, $partial); } } stripe-php/lib/Balance.php 0000666 00000004156 15165746005 0011466 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * This is an object representing your Stripe balance. You can retrieve it to see * the balance currently on your Stripe account. * * You can also retrieve the balance history, which contains a list of <a * href="https://stripe.com/docs/reporting/balance-transaction-types">transactions</a> * that contributed to the balance (charges, payouts, and so forth). * * The available and pending amounts for each currency are broken down further by * payment source types. * * Related guide: <a * href="https://stripe.com/docs/connect/account-balances">Understanding Connect * Account Balances</a>. * * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \AmeliaStripe\StripeObject[] $available Funds that are available to be transferred or paid out, whether automatically by Stripe or explicitly via the <a href="https://stripe.com/docs/api#transfers">Transfers API</a> or <a href="https://stripe.com/docs/api#payouts">Payouts API</a>. The available balance for each currency and payment type can be found in the <code>source_types</code> property. * @property \AmeliaStripe\StripeObject[] $connect_reserved Funds held due to negative balances on connected Custom accounts. The connect reserve balance for each currency and payment type can be found in the <code>source_types</code> property. * @property \AmeliaStripe\StripeObject[] $instant_available Funds that can be paid out using Instant Payouts. * @property \AmeliaStripe\StripeObject $issuing * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject[] $pending Funds that are not yet available in the balance, due to the 7-day rolling pay cycle. The pending balance for each currency, and for each payment type, can be found in the <code>source_types</code> property. */ class Balance extends SingletonApiResource { const OBJECT_NAME = 'balance'; use ApiOperations\SingletonRetrieve; } stripe-php/lib/Source.php 0000666 00000020160 15165746005 0011372 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * <code>Source</code> objects allow you to accept a variety of payment methods. * They represent a customer's payment instrument, and can be used with the Stripe * API just like a <code>Card</code> object: once chargeable, they can be charged, * or can be attached to customers. * * Related guides: <a href="https://stripe.com/docs/sources">Sources API</a> and <a * href="https://stripe.com/docs/sources/customers">Sources & Customers</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \AmeliaStripe\StripeObject $ach_credit_transfer * @property \AmeliaStripe\StripeObject $ach_debit * @property \AmeliaStripe\StripeObject $acss_debit * @property \AmeliaStripe\StripeObject $alipay * @property null|int $amount A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount associated with the source. This is the amount for which the source will be chargeable once ready. Required for <code>single_use</code> sources. * @property \AmeliaStripe\StripeObject $au_becs_debit * @property \AmeliaStripe\StripeObject $bancontact * @property \AmeliaStripe\StripeObject $card * @property \AmeliaStripe\StripeObject $card_present * @property string $client_secret The client secret of the source. Used for client-side retrieval using a publishable key. * @property \AmeliaStripe\StripeObject $code_verification * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $currency Three-letter <a href="https://stripe.com/docs/currencies">ISO code for the currency</a> associated with the source. This is the currency for which the source will be chargeable once ready. Required for <code>single_use</code> sources. * @property string $customer The ID of the customer to which this source is attached. This will not be present when the source has not been attached to a customer. * @property \AmeliaStripe\StripeObject $eps * @property string $flow The authentication <code>flow</code> of the source. <code>flow</code> is one of <code>redirect</code>, <code>receiver</code>, <code>code_verification</code>, <code>none</code>. * @property \AmeliaStripe\StripeObject $giropay * @property \AmeliaStripe\StripeObject $ideal * @property \AmeliaStripe\StripeObject $klarna * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property \AmeliaStripe\StripeObject $multibanco * @property null|\AmeliaStripe\StripeObject $owner Information about the owner of the payment instrument that may be used or required by particular source types. * @property \AmeliaStripe\StripeObject $p24 * @property \AmeliaStripe\StripeObject $receiver * @property \AmeliaStripe\StripeObject $redirect * @property \AmeliaStripe\StripeObject $sepa_credit_transfer * @property \AmeliaStripe\StripeObject $sepa_debit * @property \AmeliaStripe\StripeObject $sofort * @property \AmeliaStripe\StripeObject $source_order * @property null|string $statement_descriptor Extra information about a source. This will appear on your customer's statement every time you charge the source. * @property string $status The status of the source, one of <code>canceled</code>, <code>chargeable</code>, <code>consumed</code>, <code>failed</code>, or <code>pending</code>. Only <code>chargeable</code> sources can be used to create a charge. * @property \AmeliaStripe\StripeObject $three_d_secure * @property string $type The <code>type</code> of the source. The <code>type</code> is a payment method, one of <code>ach_credit_transfer</code>, <code>ach_debit</code>, <code>alipay</code>, <code>bancontact</code>, <code>card</code>, <code>card_present</code>, <code>eps</code>, <code>giropay</code>, <code>ideal</code>, <code>multibanco</code>, <code>klarna</code>, <code>p24</code>, <code>sepa_debit</code>, <code>sofort</code>, <code>three_d_secure</code>, or <code>wechat</code>. An additional hash is included on the source with a name matching this value. It contains additional information specific to the <a href="https://stripe.com/docs/sources">payment method</a> used. * @property null|string $usage Either <code>reusable</code> or <code>single_use</code>. Whether this source should be reusable or not. Some source types may or may not be reusable by construction, while others may leave the option at creation. If an incompatible value is passed, an error will be returned. * @property \AmeliaStripe\StripeObject $wechat */ class Source extends ApiResource { const OBJECT_NAME = 'source'; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; const FLOW_CODE_VERIFICATION = 'code_verification'; const FLOW_NONE = 'none'; const FLOW_RECEIVER = 'receiver'; const FLOW_REDIRECT = 'redirect'; const STATUS_CANCELED = 'canceled'; const STATUS_CHARGEABLE = 'chargeable'; const STATUS_CONSUMED = 'consumed'; const STATUS_FAILED = 'failed'; const STATUS_PENDING = 'pending'; const USAGE_REUSABLE = 'reusable'; const USAGE_SINGLE_USE = 'single_use'; use ApiOperations\NestedResource; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\UnexpectedValueException if the source is not attached to a customer * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Source the detached source */ public function detach($params = null, $opts = null) { self::_validateParams($params); $id = $this['id']; if (!$id) { $class = static::class; $msg = "Could not determine which URL to request: {$class} instance " . "has invalid ID: {$id}"; throw new Exception\UnexpectedValueException($msg, null); } if ($this['customer']) { $base = Customer::classUrl(); $parentExtn = \urlencode(Util\Util::utf8($this['customer'])); $extn = \urlencode(Util\Util::utf8($id)); $url = "{$base}/{$parentExtn}/sources/{$extn}"; list($response, $opts) = $this->_request('delete', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } $message = 'This source object does not appear to be currently attached ' . 'to a customer object.'; throw new Exception\UnexpectedValueException($message); } /** * @param string $id * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\SourceTransaction> list of SourceTransactions */ public static function allSourceTransactions($id, $params = null, $opts = null) { $url = static::resourceUrl($id) . '/source_transactions'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Source the verified source */ public function verify($params = null, $opts = null) { $url = $this->instanceUrl() . '/verify'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/Price.php 0000666 00000014200 15165746005 0011172 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Prices define the unit cost, currency, and (optional) billing cycle for both * recurring and one-time purchases of products. <a * href="https://stripe.com/docs/api#products">Products</a> help you track * inventory or provisioning, and prices help you track payment terms. Different * physical goods or levels of service should be represented by products, and * pricing options should be represented by prices. This approach lets you change * prices without having to change your provisioning scheme. * * For example, you might have a single "gold" product that has prices * for $10/month, $100/year, and €9 once. * * Related guides: <a * href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up * a subscription</a>, <a * href="https://stripe.com/docs/billing/invoices/create">create an invoice</a>, * and more about <a * href="https://stripe.com/docs/products-prices/overview">products and prices</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property bool $active Whether the price can be used for new purchases. * @property string $billing_scheme Describes how to compute the price per period. Either <code>per_unit</code> or <code>tiered</code>. <code>per_unit</code> indicates that the fixed amount (specified in <code>unit_amount</code> or <code>unit_amount_decimal</code>) will be charged per unit in <code>quantity</code> (for prices with <code>usage_type=licensed</code>), or per unit of total usage (for prices with <code>usage_type=metered</code>). <code>tiered</code> indicates that the unit pricing will be computed using a tiering strategy as defined using the <code>tiers</code> and <code>tiers_mode</code> attributes. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property \AmeliaStripe\StripeObject $currency_options Prices defined in each available currency option. Each key must be a three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a> and a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|\AmeliaStripe\StripeObject $custom_unit_amount When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|string $lookup_key A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string $nickname A brief description of the price, hidden from customers. * @property string|\AmeliaStripe\Product $product The ID of the product this price is associated with. * @property null|\AmeliaStripe\StripeObject $recurring The recurring components of a price such as <code>interval</code> and <code>usage_type</code>. * @property null|string $tax_behavior Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of <code>inclusive</code>, <code>exclusive</code>, or <code>unspecified</code>. Once specified as either <code>inclusive</code> or <code>exclusive</code>, it cannot be changed. * @property \AmeliaStripe\StripeObject[] $tiers Each element represents a pricing tier. This parameter requires <code>billing_scheme</code> to be set to <code>tiered</code>. See also the documentation for <code>billing_scheme</code>. * @property null|string $tiers_mode Defines if the tiering price should be <code>graduated</code> or <code>volume</code> based. In <code>volume</code>-based tiering, the maximum quantity within a period determines the per unit price. In <code>graduated</code> tiering, pricing can change as the quantity grows. * @property null|\AmeliaStripe\StripeObject $transform_quantity Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with <code>tiers</code>. * @property string $type One of <code>one_time</code> or <code>recurring</code> depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. * @property null|int $unit_amount The unit amount in %s to be charged, represented as a whole integer if possible. Only set if <code>billing_scheme=per_unit</code>. * @property null|string $unit_amount_decimal The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. Only set if <code>billing_scheme=per_unit</code>. */ class Price extends ApiResource { const OBJECT_NAME = 'price'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Search; use ApiOperations\Update; const BILLING_SCHEME_PER_UNIT = 'per_unit'; const BILLING_SCHEME_TIERED = 'tiered'; const TAX_BEHAVIOR_EXCLUSIVE = 'exclusive'; const TAX_BEHAVIOR_INCLUSIVE = 'inclusive'; const TAX_BEHAVIOR_UNSPECIFIED = 'unspecified'; const TIERS_MODE_GRADUATED = 'graduated'; const TIERS_MODE_VOLUME = 'volume'; const TYPE_ONE_TIME = 'one_time'; const TYPE_RECURRING = 'recurring'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SearchResult<Price> the price search results */ public static function search($params = null, $opts = null) { $url = '/v1/prices/search'; return self::_searchResource($url, $params, $opts); } } stripe-php/lib/ApiRequestor.php 0000666 00000045173 15165746005 0012570 0 ustar 00 <?php namespace AmeliaStripe; /** * Class ApiRequestor. */ class ApiRequestor { /** * @var null|string */ private $_apiKey; /** * @var string */ private $_apiBase; /** * @var HttpClient\ClientInterface */ private static $_httpClient; /** * @var HttpClient\StreamingClientInterface */ private static $_streamingHttpClient; /** * @var RequestTelemetry */ private static $requestTelemetry; private static $OPTIONS_KEYS = ['api_key', 'idempotency_key', 'stripe_account', 'stripe_version', 'api_base']; /** * ApiRequestor constructor. * * @param null|string $apiKey * @param null|string $apiBase */ public function __construct($apiKey = null, $apiBase = null) { $this->_apiKey = $apiKey; if (!$apiBase) { $apiBase = Stripe::$apiBase; } $this->_apiBase = $apiBase; } /** * Creates a telemetry json blob for use in 'X-Stripe-Client-Telemetry' headers. * * @static * * @param RequestTelemetry $requestTelemetry * * @return string */ private static function _telemetryJson($requestTelemetry) { $payload = [ 'last_request_metrics' => [ 'request_id' => $requestTelemetry->requestId, 'request_duration_ms' => $requestTelemetry->requestDuration, ], ]; $result = \json_encode($payload); if (false !== $result) { return $result; } Stripe::getLogger()->error('Serializing telemetry payload failed!'); return '{}'; } /** * @static * * @param ApiResource|array|bool|mixed $d * * @return ApiResource|array|mixed|string */ private static function _encodeObjects($d) { if ($d instanceof ApiResource) { return Util\Util::utf8($d->id); } if (true === $d) { return 'true'; } if (false === $d) { return 'false'; } if (\is_array($d)) { $res = []; foreach ($d as $k => $v) { $res[$k] = self::_encodeObjects($v); } return $res; } return Util\Util::utf8($d); } /** * @param string $method * @param string $url * @param null|array $params * @param null|array $headers * * @throws Exception\ApiErrorException * * @return array tuple containing (ApiReponse, API key) */ public function request($method, $url, $params = null, $headers = null) { $params = $params ?: []; $headers = $headers ?: []; list($rbody, $rcode, $rheaders, $myApiKey) = $this->_requestRaw($method, $url, $params, $headers); $json = $this->_interpretResponse($rbody, $rcode, $rheaders); $resp = new ApiResponse($rbody, $rcode, $rheaders, $json); return [$resp, $myApiKey]; } /** * @param string $method * @param string $url * @param callable $readBodyChunkCallable * @param null|array $params * @param null|array $headers * * @throws Exception\ApiErrorException */ public function requestStream($method, $url, $readBodyChunkCallable, $params = null, $headers = null) { $params = $params ?: []; $headers = $headers ?: []; list($rbody, $rcode, $rheaders, $myApiKey) = $this->_requestRawStreaming($method, $url, $params, $headers, $readBodyChunkCallable); if ($rcode >= 300) { $this->_interpretResponse($rbody, $rcode, $rheaders); } } /** * @param string $rbody a JSON string * @param int $rcode * @param array $rheaders * @param array $resp * * @throws Exception\UnexpectedValueException * @throws Exception\ApiErrorException */ public function handleErrorResponse($rbody, $rcode, $rheaders, $resp) { if (!\is_array($resp) || !isset($resp['error'])) { $msg = "Invalid response object from API: {$rbody} " . "(HTTP response code was {$rcode})"; throw new Exception\UnexpectedValueException($msg); } $errorData = $resp['error']; $error = null; if (\is_string($errorData)) { $error = self::_specificOAuthError($rbody, $rcode, $rheaders, $resp, $errorData); } if (!$error) { $error = self::_specificAPIError($rbody, $rcode, $rheaders, $resp, $errorData); } throw $error; } /** * @static * * @param string $rbody * @param int $rcode * @param array $rheaders * @param array $resp * @param array $errorData * * @return Exception\ApiErrorException */ private static function _specificAPIError($rbody, $rcode, $rheaders, $resp, $errorData) { $msg = isset($errorData['message']) ? $errorData['message'] : null; $param = isset($errorData['param']) ? $errorData['param'] : null; $code = isset($errorData['code']) ? $errorData['code'] : null; $type = isset($errorData['type']) ? $errorData['type'] : null; $declineCode = isset($errorData['decline_code']) ? $errorData['decline_code'] : null; switch ($rcode) { case 400: // 'rate_limit' code is deprecated, but left here for backwards compatibility // for API versions earlier than 2015-09-08 if ('rate_limit' === $code) { return Exception\RateLimitException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $param); } if ('idempotency_error' === $type) { return Exception\IdempotencyException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code); } // no break case 404: return Exception\InvalidRequestException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $param); case 401: return Exception\AuthenticationException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code); case 402: return Exception\CardException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $declineCode, $param); case 403: return Exception\PermissionException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code); case 429: return Exception\RateLimitException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $param); default: return Exception\UnknownApiErrorException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code); } } /** * @static * * @param bool|string $rbody * @param int $rcode * @param array $rheaders * @param array $resp * @param string $errorCode * * @return Exception\OAuth\OAuthErrorException */ private static function _specificOAuthError($rbody, $rcode, $rheaders, $resp, $errorCode) { $description = isset($resp['error_description']) ? $resp['error_description'] : $errorCode; switch ($errorCode) { case 'invalid_client': return Exception\OAuth\InvalidClientException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); case 'invalid_grant': return Exception\OAuth\InvalidGrantException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); case 'invalid_request': return Exception\OAuth\InvalidRequestException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); case 'invalid_scope': return Exception\OAuth\InvalidScopeException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); case 'unsupported_grant_type': return Exception\OAuth\UnsupportedGrantTypeException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); case 'unsupported_response_type': return Exception\OAuth\UnsupportedResponseTypeException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); default: return Exception\OAuth\UnknownOAuthErrorException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); } } /** * @static * * @param null|array $appInfo * * @return null|string */ private static function _formatAppInfo($appInfo) { if (null !== $appInfo) { $string = $appInfo['name']; if (null !== $appInfo['version']) { $string .= '/' . $appInfo['version']; } if (null !== $appInfo['url']) { $string .= ' (' . $appInfo['url'] . ')'; } return $string; } return null; } /** * @static * * @param string $disableFunctionsOutput - String value of the 'disable_function' setting, as output by \ini_get('disable_functions') * @param string $functionName - Name of the function we are interesting in seeing whether or not it is disabled * * @return bool */ private static function _isDisabled($disableFunctionsOutput, $functionName) { $disabledFunctions = \explode(',', $disableFunctionsOutput); foreach ($disabledFunctions as $disabledFunction) { if (\trim($disabledFunction) === $functionName) { return true; } } return false; } /** * @static * * @param string $apiKey * @param null $clientInfo * * @return array */ private static function _defaultHeaders($apiKey, $clientInfo = null) { $uaString = 'Stripe/v1 PhpBindings/' . Stripe::VERSION; $langVersion = \PHP_VERSION; $uname_disabled = static::_isDisabled(\ini_get('disable_functions'), 'php_uname'); $uname = $uname_disabled ? '(disabled)' : \php_uname(); $appInfo = Stripe::getAppInfo(); $ua = [ 'bindings_version' => Stripe::VERSION, 'lang' => 'php', 'lang_version' => $langVersion, 'publisher' => 'stripe', 'uname' => $uname, ]; if ($clientInfo) { $ua = \array_merge($clientInfo, $ua); } if (null !== $appInfo) { $uaString .= ' ' . self::_formatAppInfo($appInfo); $ua['application'] = $appInfo; } return [ 'X-Stripe-Client-User-Agent' => \json_encode($ua), 'User-Agent' => $uaString, 'Authorization' => 'Bearer ' . $apiKey, ]; } private function _prepareRequest($method, $url, $params, $headers) { $myApiKey = $this->_apiKey; if (!$myApiKey) { $myApiKey = Stripe::$apiKey; } if (!$myApiKey) { $msg = 'No API key provided. (HINT: set your API key using ' . '"Stripe::setApiKey(<API-KEY>)". You can generate API keys from ' . 'the Stripe web interface. See https://stripe.com/api for ' . 'details, or email support@stripe.com if you have any questions.'; throw new Exception\AuthenticationException($msg); } // Clients can supply arbitrary additional keys to be included in the // X-Stripe-Client-User-Agent header via the optional getUserAgentInfo() // method $clientUAInfo = null; if (\method_exists($this->httpClient(), 'getUserAgentInfo')) { $clientUAInfo = $this->httpClient()->getUserAgentInfo(); } if ($params && \is_array($params)) { $optionKeysInParams = \array_filter( static::$OPTIONS_KEYS, function ($key) use ($params) { return \array_key_exists($key, $params); } ); if (\count($optionKeysInParams) > 0) { $message = \sprintf('Options found in $params: %s. Options should ' . 'be passed in their own array after $params. (HINT: pass an ' . 'empty array to $params if you do not have any.)', \implode(', ', $optionKeysInParams)); \trigger_error($message, \E_USER_WARNING); } } $absUrl = $this->_apiBase . $url; $params = self::_encodeObjects($params); $defaultHeaders = $this->_defaultHeaders($myApiKey, $clientUAInfo); if (Stripe::$apiVersion) { $defaultHeaders['Stripe-Version'] = Stripe::$apiVersion; } if (Stripe::$accountId) { $defaultHeaders['Stripe-Account'] = Stripe::$accountId; } if (Stripe::$enableTelemetry && null !== self::$requestTelemetry) { $defaultHeaders['X-Stripe-Client-Telemetry'] = self::_telemetryJson(self::$requestTelemetry); } $hasFile = false; foreach ($params as $k => $v) { if (\is_resource($v)) { $hasFile = true; $params[$k] = self::_processResourceParam($v); } elseif ($v instanceof \CURLFile) { $hasFile = true; } } if ($hasFile) { $defaultHeaders['Content-Type'] = 'multipart/form-data'; } else { $defaultHeaders['Content-Type'] = 'application/x-www-form-urlencoded'; } $combinedHeaders = \array_merge($defaultHeaders, $headers); $rawHeaders = []; foreach ($combinedHeaders as $header => $value) { $rawHeaders[] = $header . ': ' . $value; } return [$absUrl, $rawHeaders, $params, $hasFile, $myApiKey]; } /** * @param string $method * @param string $url * @param array $params * @param array $headers * * @throws Exception\AuthenticationException * @throws Exception\ApiConnectionException * * @return array */ private function _requestRaw($method, $url, $params, $headers) { list($absUrl, $rawHeaders, $params, $hasFile, $myApiKey) = $this->_prepareRequest($method, $url, $params, $headers); $requestStartMs = Util\Util::currentTimeMillis(); list($rbody, $rcode, $rheaders) = $this->httpClient()->request( $method, $absUrl, $rawHeaders, $params, $hasFile ); if (isset($rheaders['request-id']) && \is_string($rheaders['request-id']) && '' !== $rheaders['request-id']) { self::$requestTelemetry = new RequestTelemetry( $rheaders['request-id'], Util\Util::currentTimeMillis() - $requestStartMs ); } return [$rbody, $rcode, $rheaders, $myApiKey]; } /** * @param string $method * @param string $url * @param array $params * @param array $headers * @param callable $readBodyChunkCallable * * @throws Exception\AuthenticationException * @throws Exception\ApiConnectionException * * @return array */ private function _requestRawStreaming($method, $url, $params, $headers, $readBodyChunkCallable) { list($absUrl, $rawHeaders, $params, $hasFile, $myApiKey) = $this->_prepareRequest($method, $url, $params, $headers); $requestStartMs = Util\Util::currentTimeMillis(); list($rbody, $rcode, $rheaders) = $this->streamingHttpClient()->requestStream( $method, $absUrl, $rawHeaders, $params, $hasFile, $readBodyChunkCallable ); if (isset($rheaders['request-id']) && \is_string($rheaders['request-id']) && '' !== $rheaders['request-id']) { self::$requestTelemetry = new RequestTelemetry( $rheaders['request-id'], Util\Util::currentTimeMillis() - $requestStartMs ); } return [$rbody, $rcode, $rheaders, $myApiKey]; } /** * @param resource $resource * * @throws Exception\InvalidArgumentException * * @return \CURLFile|string */ private function _processResourceParam($resource) { if ('stream' !== \get_resource_type($resource)) { throw new Exception\InvalidArgumentException( 'Attempted to upload a resource that is not a stream' ); } $metaData = \stream_get_meta_data($resource); if ('plainfile' !== $metaData['wrapper_type']) { throw new Exception\InvalidArgumentException( 'Only plainfile resource streams are supported' ); } // We don't have the filename or mimetype, but the API doesn't care return new \CURLFile($metaData['uri']); } /** * @param string $rbody * @param int $rcode * @param array $rheaders * * @throws Exception\UnexpectedValueException * @throws Exception\ApiErrorException * * @return array */ private function _interpretResponse($rbody, $rcode, $rheaders) { $resp = \json_decode($rbody, true); $jsonError = \json_last_error(); if (null === $resp && \JSON_ERROR_NONE !== $jsonError) { $msg = "Invalid response body from API: {$rbody} " . "(HTTP response code was {$rcode}, json_last_error() was {$jsonError})"; throw new Exception\UnexpectedValueException($msg, $rcode); } if ($rcode < 200 || $rcode >= 300) { $this->handleErrorResponse($rbody, $rcode, $rheaders, $resp); } return $resp; } /** * @static * * @param HttpClient\ClientInterface $client */ public static function setHttpClient($client) { self::$_httpClient = $client; } /** * @static * * @param HttpClient\StreamingClientInterface $client */ public static function setStreamingHttpClient($client) { self::$_streamingHttpClient = $client; } /** * @static * * Resets any stateful telemetry data */ public static function resetTelemetry() { self::$requestTelemetry = null; } /** * @return HttpClient\ClientInterface */ private function httpClient() { if (!self::$_httpClient) { self::$_httpClient = HttpClient\CurlClient::instance(); } return self::$_httpClient; } /** * @return HttpClient\StreamingClientInterface */ private function streamingHttpClient() { if (!self::$_streamingHttpClient) { self::$_streamingHttpClient = HttpClient\CurlClient::instance(); } return self::$_streamingHttpClient; } } stripe-php/lib/Apps/Secret.php 0000666 00000006115 15165746005 0012266 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Apps; /** * Secret Store is an API that allows Stripe Apps developers to securely persist * secrets for use by UI Extensions and app backends. * * The primary resource in Secret Store is a <code>secret</code>. Other apps can't * view secrets created by an app. Additionally, secrets are scoped to provide * further permission control. * * All Dashboard users and the app backend share <code>account</code> scoped * secrets. Use the <code>account</code> scope for secrets that don't change * per-user, like a third-party API key. * * A <code>user</code> scoped secret is accessible by the app backend and one * specific Dashboard user. Use the <code>user</code> scope for per-user secrets * like per-user OAuth tokens, where different users might have different * permissions. * * Related guide: <a * href="https://stripe.com/docs/stripe-apps/store-auth-data-custom-objects">Store * data between page reloads</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|int $expires_at The Unix timestamp for the expiry time of the secret, after which the secret deletes. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property string $name A name for the secret that's unique within the scope. * @property null|string $payload The plaintext secret value to be stored. * @property \AmeliaStripe\StripeObject $scope */ class Secret extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'apps.secret'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Apps\Secret the deleted secret */ public static function deleteWhere($params = null, $opts = null) { $url = static::classUrl() . '/delete'; list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Apps\Secret the finded secret */ public static function find($params = null, $opts = null) { $url = static::classUrl() . '/find'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } } stripe-php/lib/LineItem.php 0000666 00000003025 15165746005 0011641 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * A line item. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount_discount Total discount amount applied. If no discounts were applied, defaults to 0. * @property int $amount_subtotal Total before any discounts or taxes are applied. * @property int $amount_tax Total tax amount applied. If no tax was applied, defaults to 0. * @property int $amount_total Total after discounts and taxes. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property string $description An arbitrary string attached to the object. Often useful for displaying to users. Defaults to product name. * @property \AmeliaStripe\StripeObject[] $discounts The discounts applied to the line item. * @property null|\AmeliaStripe\Price $price The price used to generate the line item. * @property string|\AmeliaStripe\Product $product <p>The ID of the product for this line item.</p><p>This will always be the same as <code>price.product</code>.</p> * @property null|int $quantity The quantity of products being purchased. * @property \AmeliaStripe\StripeObject[] $taxes The taxes applied to the line item. */ class LineItem extends ApiResource { const OBJECT_NAME = 'item'; } stripe-php/lib/CreditNoteLineItem.php 0000666 00000004310 15165746005 0013620 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount The integer amount in %s representing the gross amount being credited for this line item, excluding (exclusive) tax and discounts. * @property null|int $amount_excluding_tax The integer amount in %s representing the amount being credited for this line item, excluding all tax and discounts. * @property null|string $description Description of the item being credited. * @property int $discount_amount The integer amount in %s representing the discount being credited for this line item. * @property \AmeliaStripe\StripeObject[] $discount_amounts The amount of discount calculated per discount for this line item * @property string $invoice_line_item ID of the invoice line item being credited * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|int $quantity The number of units of product being credited. * @property \AmeliaStripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item * @property \AmeliaStripe\TaxRate[] $tax_rates The tax rates which apply to the line item. * @property string $type The type of the credit note line item, one of <code>invoice_line_item</code> or <code>custom_line_item</code>. When the type is <code>invoice_line_item</code> there is an additional <code>invoice_line_item</code> property on the resource the value of which is the id of the credited line item on the invoice. * @property null|int $unit_amount The cost of each unit of product being credited. * @property null|string $unit_amount_decimal Same as <code>unit_amount</code>, but contains a decimal value with at most 12 decimal places. * @property null|string $unit_amount_excluding_tax The amount in %s representing the unit amount being credited for this line item, excluding all tax and discounts. */ class CreditNoteLineItem extends ApiResource { const OBJECT_NAME = 'credit_note_line_item'; } stripe-php/lib/Charge.php 0000666 00000032516 15165746005 0011333 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * To charge a credit or a debit card, you create a <code>Charge</code> object. You * can retrieve and refund individual charges as well as list all charges. Charges * are identified by a unique, random ID. * * Related guide: <a * href="https://stripe.com/docs/payments/accept-a-payment-charges">Accept a * payment with the Charges API</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \AmeliaStripe\StripeObject $alternate_statement_descriptors * @property int $amount Amount intended to be collected by this payment. A positive integer representing how much to charge in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a> (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or <a href="https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts">equivalent in charge currency</a>. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). * @property int $amount_captured Amount in %s captured (can be less than the amount attribute on the charge if a partial capture was made). * @property int $amount_refunded Amount in %s refunded (can be less than the amount attribute on the charge if a partial refund was issued). * @property null|string|\AmeliaStripe\StripeObject $application ID of the Connect application that created the charge. * @property null|string|\AmeliaStripe\ApplicationFee $application_fee The application fee (if any) for the charge. <a href="https://stripe.com/docs/connect/direct-charges#collecting-fees">See the Connect documentation</a> for details. * @property null|int $application_fee_amount The amount of the application fee (if any) requested for the charge. <a href="https://stripe.com/docs/connect/direct-charges#collecting-fees">See the Connect documentation</a> for details. * @property string $authorization_code Authorization code on the charge. * @property null|string|\AmeliaStripe\BalanceTransaction $balance_transaction ID of the balance transaction that describes the impact of this charge on your account balance (not including refunds or disputes). * @property \AmeliaStripe\StripeObject $billing_details * @property null|string $calculated_statement_descriptor The full statement descriptor that is passed to card networks, and that is displayed on your customers' credit card and bank statements. Allows you to see what the statement descriptor looks like after the static and dynamic portions are combined. * @property bool $captured If the charge was created without capturing, this Boolean represents whether it is still uncaptured or has since been captured. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string|\AmeliaStripe\Customer $customer ID of the customer this charge is for if one exists. * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|string|\AmeliaStripe\Account $destination ID of an existing, connected Stripe account to transfer funds to if <code>transfer_data</code> was specified in the charge request. * @property null|string|\AmeliaStripe\Dispute $dispute Details about the dispute if the charge has been disputed. * @property bool $disputed Whether the charge has been disputed. * @property null|string|\AmeliaStripe\BalanceTransaction $failure_balance_transaction ID of the balance transaction that describes the reversal of the balance on your account due to payment failure. * @property null|string $failure_code Error code explaining reason for charge failure if available (see <a href="https://stripe.com/docs/api#errors">the errors section</a> for a list of codes). * @property null|string $failure_message Message to user further explaining reason for charge failure if available. * @property null|\AmeliaStripe\StripeObject $fraud_details Information on fraud assessments for the charge. * @property null|string|\AmeliaStripe\Invoice $invoice ID of the invoice this charge is for if one exists. * @property \AmeliaStripe\StripeObject $level3 * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string|\AmeliaStripe\Account $on_behalf_of The account (if any) the charge was made on behalf of without triggering an automatic transfer. See the <a href="https://stripe.com/docs/connect/charges-transfers">Connect documentation</a> for details. * @property null|\AmeliaStripe\StripeObject $outcome Details about whether the payment was accepted, and why. See <a href="https://stripe.com/docs/declines">understanding declines</a> for details. * @property bool $paid <code>true</code> if the charge succeeded, or was successfully authorized for later capture. * @property null|string|\AmeliaStripe\PaymentIntent $payment_intent ID of the PaymentIntent associated with this charge, if one exists. * @property null|string $payment_method ID of the payment method used in this charge. * @property null|\AmeliaStripe\StripeObject $payment_method_details Details about the payment method at the time of the transaction. * @property \AmeliaStripe\StripeObject $radar_options Options to configure Radar. See <a href="https://stripe.com/docs/radar/radar-session">Radar Session</a> for more information. * @property null|string $receipt_email This is the email address that the receipt for this charge was sent to. * @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this charge. This attribute will be <code>null</code> until a receipt has been sent. * @property null|string $receipt_url This is the URL to view the receipt for this charge. The receipt is kept up-to-date to the latest state of the charge, including any refunds. If the charge is for an Invoice, the receipt will be stylized as an Invoice receipt. * @property bool $refunded Whether the charge has been fully refunded. If the charge is only partially refunded, this attribute will still be false. * @property \AmeliaStripe\Collection<\AmeliaStripe\Refund> $refunds A list of refunds that have been applied to the charge. * @property null|string|\AmeliaStripe\Review $review ID of the review associated with this charge if one exists. * @property null|\AmeliaStripe\StripeObject $shipping Shipping information for the charge. * @property null|\AmeliaStripe\Account|\AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source $source This is a legacy field that will be removed in the future. It contains the Source, Card, or BankAccount object used for the charge. For details about the payment method used for this charge, refer to <code>payment_method</code> or <code>payment_method_details</code> instead. * @property null|string|\AmeliaStripe\Transfer $source_transfer The transfer ID which created this charge. Only present if the charge came from another Stripe account. <a href="https://stripe.com/docs/connect/destination-charges">See the Connect documentation</a> for details. * @property null|string $statement_descriptor For card charges, use <code>statement_descriptor_suffix</code> instead. Otherwise, you can use this value as the complete description of a charge on your customers’ statements. Must contain at least one letter, maximum 22 characters. * @property null|string $statement_descriptor_suffix Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor. * @property string $status The status of the payment is either <code>succeeded</code>, <code>pending</code>, or <code>failed</code>. * @property string|\AmeliaStripe\Transfer $transfer ID of the transfer to the <code>destination</code> account (only applicable if the charge was created using the <code>destination</code> parameter). * @property null|\AmeliaStripe\StripeObject $transfer_data An optional dictionary including the account to automatically transfer to as part of a destination charge. <a href="https://stripe.com/docs/connect/destination-charges">See the Connect documentation</a> for details. * @property null|string $transfer_group A string that identifies this transaction as part of a group. See the <a href="https://stripe.com/docs/connect/charges-transfers#transfer-options">Connect documentation</a> for details. */ class Charge extends ApiResource { const OBJECT_NAME = 'charge'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Search; use ApiOperations\Update; const STATUS_FAILED = 'failed'; const STATUS_PENDING = 'pending'; const STATUS_SUCCEEDED = 'succeeded'; /** * Possible string representations of decline codes. * These strings are applicable to the decline_code property of the \AmeliaStripe\Exception\CardException exception. * * @see https://stripe.com/docs/declines/codes */ const DECLINED_AUTHENTICATION_REQUIRED = 'authentication_required'; const DECLINED_APPROVE_WITH_ID = 'approve_with_id'; const DECLINED_CALL_ISSUER = 'call_issuer'; const DECLINED_CARD_NOT_SUPPORTED = 'card_not_supported'; const DECLINED_CARD_VELOCITY_EXCEEDED = 'card_velocity_exceeded'; const DECLINED_CURRENCY_NOT_SUPPORTED = 'currency_not_supported'; const DECLINED_DO_NOT_HONOR = 'do_not_honor'; const DECLINED_DO_NOT_TRY_AGAIN = 'do_not_try_again'; const DECLINED_DUPLICATED_TRANSACTION = 'duplicate_transaction'; const DECLINED_EXPIRED_CARD = 'expired_card'; const DECLINED_FRAUDULENT = 'fraudulent'; const DECLINED_GENERIC_DECLINE = 'generic_decline'; const DECLINED_INCORRECT_NUMBER = 'incorrect_number'; const DECLINED_INCORRECT_CVC = 'incorrect_cvc'; const DECLINED_INCORRECT_PIN = 'incorrect_pin'; const DECLINED_INCORRECT_ZIP = 'incorrect_zip'; const DECLINED_INSUFFICIENT_FUNDS = 'insufficient_funds'; const DECLINED_INVALID_ACCOUNT = 'invalid_account'; const DECLINED_INVALID_AMOUNT = 'invalid_amount'; const DECLINED_INVALID_CVC = 'invalid_cvc'; const DECLINED_INVALID_EXPIRY_YEAR = 'invalid_expiry_year'; const DECLINED_INVALID_NUMBER = 'invalid_number'; const DECLINED_INVALID_PIN = 'invalid_pin'; const DECLINED_ISSUER_NOT_AVAILABLE = 'issuer_not_available'; const DECLINED_LOST_CARD = 'lost_card'; const DECLINED_MERCHANT_BLACKLIST = 'merchant_blacklist'; const DECLINED_NEW_ACCOUNT_INFORMATION_AVAILABLE = 'new_account_information_available'; const DECLINED_NO_ACTION_TAKEN = 'no_action_taken'; const DECLINED_NOT_PERMITTED = 'not_permitted'; const DECLINED_OFFLINE_PIN_REQUIRED = 'offline_pin_required'; const DECLINED_ONLINE_OR_OFFLINE_PIN_REQUIRED = 'online_or_offline_pin_required'; const DECLINED_PICKUP_CARD = 'pickup_card'; const DECLINED_PIN_TRY_EXCEEDED = 'pin_try_exceeded'; const DECLINED_PROCESSING_ERROR = 'processing_error'; const DECLINED_REENTER_TRANSACTION = 'reenter_transaction'; const DECLINED_RESTRICTED_CARD = 'restricted_card'; const DECLINED_REVOCATION_OF_ALL_AUTHORIZATIONS = 'revocation_of_all_authorizations'; const DECLINED_REVOCATION_OF_AUTHORIZATION = 'revocation_of_authorization'; const DECLINED_SECURITY_VIOLATION = 'security_violation'; const DECLINED_SERVICE_NOT_ALLOWED = 'service_not_allowed'; const DECLINED_STOLEN_CARD = 'stolen_card'; const DECLINED_STOP_PAYMENT_ORDER = 'stop_payment_order'; const DECLINED_TESTMODE_DECLINE = 'testmode_decline'; const DECLINED_TRANSACTION_NOT_ALLOWED = 'transaction_not_allowed'; const DECLINED_TRY_AGAIN_LATER = 'try_again_later'; const DECLINED_WITHDRAWAL_COUNT_LIMIT_EXCEEDED = 'withdrawal_count_limit_exceeded'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Charge the captured charge */ public function capture($params = null, $opts = null) { $url = $this->instanceUrl() . '/capture'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SearchResult<Charge> the charge search results */ public static function search($params = null, $opts = null) { $url = '/v1/charges/search'; return self::_searchResource($url, $params, $opts); } } stripe-php/lib/RequestTelemetry.php 0000666 00000001041 15165746005 0013452 0 ustar 00 <?php namespace AmeliaStripe; /** * Class RequestTelemetry. * * Tracks client request telemetry */ class RequestTelemetry { public $requestId; public $requestDuration; /** * Initialize a new telemetry object. * * @param string $requestId the request's request ID * @param int $requestDuration the request's duration in milliseconds */ public function __construct($requestId, $requestDuration) { $this->requestId = $requestId; $this->requestDuration = $requestDuration; } } stripe-php/lib/Account.php 0000666 00000037511 15165746005 0011536 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * This is an object representing a Stripe account. You can retrieve it to see * properties on the account like its current e-mail address or if the account is * enabled yet to make live charges. * * Some properties, marked below, are available only to platforms that want to <a * href="https://stripe.com/docs/connect/accounts">create and manage Express or * Custom accounts</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|\AmeliaStripe\StripeObject $business_profile Business information about the account. * @property null|string $business_type The business type. * @property \AmeliaStripe\StripeObject $capabilities * @property bool $charges_enabled Whether the account can create live charges. * @property \AmeliaStripe\StripeObject $company * @property \AmeliaStripe\StripeObject $controller * @property string $country The account's country. * @property int $created Time at which the account was connected. Measured in seconds since the Unix epoch. * @property string $default_currency Three-letter ISO currency code representing the default currency for the account. This must be a currency that <a href="https://stripe.com/docs/payouts">Stripe supports in the account's country</a>. * @property bool $details_submitted Whether account details have been submitted. Standard accounts cannot receive payouts before this is true. * @property null|string $email An email address associated with the account. You can treat this as metadata: it is not used for authentication or messaging account holders. * @property \AmeliaStripe\Collection<\AmeliaStripe\BankAccount|\AmeliaStripe\Card> $external_accounts External accounts (bank accounts and debit cards) currently attached to this account * @property \AmeliaStripe\StripeObject $future_requirements * @property \AmeliaStripe\Person $individual <p>This is an object representing a person associated with a Stripe account.</p><p>A platform cannot access a Standard or Express account's persons after the account starts onboarding, such as after generating an account link for the account. See the <a href="https://stripe.com/docs/connect/standard-accounts">Standard onboarding</a> or <a href="https://stripe.com/docs/connect/express-accounts">Express onboarding documentation</a> for information about platform pre-filling and account onboarding steps.</p><p>Related guide: <a href="https://stripe.com/docs/connect/identity-verification-api#person-information">Handling Identity Verification with the API</a>.</p> * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property bool $payouts_enabled Whether Stripe can send payouts to this account. * @property \AmeliaStripe\StripeObject $requirements * @property null|\AmeliaStripe\StripeObject $settings Options for customizing how the account functions within Stripe. * @property \AmeliaStripe\StripeObject $tos_acceptance * @property string $type The Stripe account type. Can be <code>standard</code>, <code>express</code>, or <code>custom</code>. */ class Account extends ApiResource { const OBJECT_NAME = 'account'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\NestedResource; use ApiOperations\Update; const BUSINESS_TYPE_COMPANY = 'company'; const BUSINESS_TYPE_GOVERNMENT_ENTITY = 'government_entity'; const BUSINESS_TYPE_INDIVIDUAL = 'individual'; const BUSINESS_TYPE_NON_PROFIT = 'non_profit'; const TYPE_CUSTOM = 'custom'; const TYPE_EXPRESS = 'express'; const TYPE_STANDARD = 'standard'; use ApiOperations\Retrieve { retrieve as protected _retrieve; } public static function getSavedNestedResources() { static $savedNestedResources = null; if (null === $savedNestedResources) { $savedNestedResources = new Util\Set([ 'external_account', 'bank_account', ]); } return $savedNestedResources; } public function instanceUrl() { if (null === $this['id']) { return '/v1/account'; } return parent::instanceUrl(); } /** * @param null|array|string $id the ID of the account to retrieve, or an * options array containing an `id` key * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Account */ public static function retrieve($id = null, $opts = null) { if (!$opts && \is_string($id) && 'sk_' === \substr($id, 0, 3)) { $opts = $id; $id = null; } return self::_retrieve($id, $opts); } public function serializeParameters($force = false) { $update = parent::serializeParameters($force); if (isset($this->_values['legal_entity'])) { $entity = $this['legal_entity']; if (isset($entity->_values['additional_owners'])) { $owners = $entity['additional_owners']; $entityUpdate = isset($update['legal_entity']) ? $update['legal_entity'] : []; $entityUpdate['additional_owners'] = $this->serializeAdditionalOwners($entity, $owners); $update['legal_entity'] = $entityUpdate; } } if (isset($this->_values['individual'])) { $individual = $this['individual']; if (($individual instanceof Person) && !isset($update['individual'])) { $update['individual'] = $individual->serializeParameters($force); } } return $update; } private function serializeAdditionalOwners($legalEntity, $additionalOwners) { if (isset($legalEntity->_originalValues['additional_owners'])) { $originalValue = $legalEntity->_originalValues['additional_owners']; } else { $originalValue = []; } if (($originalValue) && (\count($originalValue) > \count($additionalOwners))) { throw new Exception\InvalidArgumentException( 'You cannot delete an item from an array, you must instead set a new array' ); } $updateArr = []; foreach ($additionalOwners as $i => $v) { $update = ($v instanceof StripeObject) ? $v->serializeParameters() : $v; if ([] !== $update) { if (!$originalValue || !\array_key_exists($i, $originalValue) || ($update !== $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) { $updateArr[$i] = $update; } } } return $updateArr; } /** * @param null|array $clientId * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\StripeObject object containing the response from the API */ public function deauthorize($clientId = null, $opts = null) { $params = [ 'client_id' => $clientId, 'stripe_user_id' => $this->id, ]; return OAuth::deauthorize($params, $opts); } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Account the rejected account */ public function reject($params = null, $opts = null) { $url = $this->instanceUrl() . '/reject'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } const PATH_CAPABILITIES = '/capabilities'; /** * @param string $id the ID of the account on which to retrieve the capabilities * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Capability> the list of capabilities */ public static function allCapabilities($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_CAPABILITIES, $params, $opts); } /** * @param string $id the ID of the account to which the capability belongs * @param string $capabilityId the ID of the capability to retrieve * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Capability */ public static function retrieveCapability($id, $capabilityId, $params = null, $opts = null) { return self::_retrieveNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts); } /** * @param string $id the ID of the account to which the capability belongs * @param string $capabilityId the ID of the capability to update * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Capability */ public static function updateCapability($id, $capabilityId, $params = null, $opts = null) { return self::_updateNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts); } const PATH_EXTERNAL_ACCOUNTS = '/external_accounts'; /** * @param string $id the ID of the account on which to retrieve the external accounts * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\BankAccount|\AmeliaStripe\Card> the list of external accounts (BankAccount or Card) */ public static function allExternalAccounts($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts); } /** * @param string $id the ID of the account on which to create the external account * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card */ public static function createExternalAccount($id, $params = null, $opts = null) { return self::_createNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts); } /** * @param string $id the ID of the account to which the external account belongs * @param string $externalAccountId the ID of the external account to delete * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card */ public static function deleteExternalAccount($id, $externalAccountId, $params = null, $opts = null) { return self::_deleteNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts); } /** * @param string $id the ID of the account to which the external account belongs * @param string $externalAccountId the ID of the external account to retrieve * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card */ public static function retrieveExternalAccount($id, $externalAccountId, $params = null, $opts = null) { return self::_retrieveNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts); } /** * @param string $id the ID of the account to which the external account belongs * @param string $externalAccountId the ID of the external account to update * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card */ public static function updateExternalAccount($id, $externalAccountId, $params = null, $opts = null) { return self::_updateNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts); } const PATH_LOGIN_LINKS = '/login_links'; /** * @param string $id the ID of the account on which to create the login link * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\LoginLink */ public static function createLoginLink($id, $params = null, $opts = null) { return self::_createNestedResource($id, static::PATH_LOGIN_LINKS, $params, $opts); } const PATH_PERSONS = '/persons'; /** * @param string $id the ID of the account on which to retrieve the persons * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Person> the list of persons */ public static function allPersons($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_PERSONS, $params, $opts); } /** * @param string $id the ID of the account on which to create the person * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Person */ public static function createPerson($id, $params = null, $opts = null) { return self::_createNestedResource($id, static::PATH_PERSONS, $params, $opts); } /** * @param string $id the ID of the account to which the person belongs * @param string $personId the ID of the person to delete * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Person */ public static function deletePerson($id, $personId, $params = null, $opts = null) { return self::_deleteNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts); } /** * @param string $id the ID of the account to which the person belongs * @param string $personId the ID of the person to retrieve * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Person */ public static function retrievePerson($id, $personId, $params = null, $opts = null) { return self::_retrieveNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts); } /** * @param string $id the ID of the account to which the person belongs * @param string $personId the ID of the person to update * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Person */ public static function updatePerson($id, $personId, $params = null, $opts = null) { return self::_updateNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts); } } stripe-php/lib/Topup.php 0000666 00000007320 15165746005 0011244 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * To top up your Stripe balance, you create a top-up object. You can retrieve * individual top-ups, as well as list all top-ups. Top-ups are identified by a * unique, random ID. * * Related guide: <a href="https://stripe.com/docs/connect/top-ups">Topping Up your * Platform Account</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Amount transferred. * @property null|string|\AmeliaStripe\BalanceTransaction $balance_transaction ID of the balance transaction that describes the impact of this top-up on your account balance. May not be specified depending on status of top-up. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|int $expected_availability_date Date the funds are expected to arrive in your Stripe account for payouts. This factors in delays like weekends or bank holidays. May not be specified depending on status of top-up. * @property null|string $failure_code Error code explaining reason for top-up failure if available (see <a href="https://stripe.com/docs/api#errors">the errors section</a> for a list of codes). * @property null|string $failure_message Message to user further explaining reason for top-up failure if available. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|\AmeliaStripe\Source $source For most Stripe users, the source of every top-up is a bank account. This hash is then the <a href="https://stripe.com/docs/api#source_object">source object</a> describing that bank account. * @property null|string $statement_descriptor Extra information about a top-up. This will appear on your source's bank statement. It must contain at least one letter. * @property string $status The status of the top-up is either <code>canceled</code>, <code>failed</code>, <code>pending</code>, <code>reversed</code>, or <code>succeeded</code>. * @property null|string $transfer_group A string that identifies this top-up as part of a group. */ class Topup extends ApiResource { const OBJECT_NAME = 'topup'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; const STATUS_CANCELED = 'canceled'; const STATUS_FAILED = 'failed'; const STATUS_PENDING = 'pending'; const STATUS_REVERSED = 'reversed'; const STATUS_SUCCEEDED = 'succeeded'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Topup the canceled topup */ public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/AccountLink.php 0000666 00000001504 15165746005 0012345 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Account Links are the means by which a Connect platform grants a connected * account permission to access Stripe-hosted applications, such as Connect * Onboarding. * * Related guide: <a * href="https://stripe.com/docs/connect/connect-onboarding">Connect * Onboarding</a>. * * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property int $expires_at The timestamp at which this account link will expire. * @property string $url The URL for the account link. */ class AccountLink extends ApiResource { const OBJECT_NAME = 'account_link'; use ApiOperations\Create; } stripe-php/lib/SingletonApiResource.php 0000666 00000001332 15165746005 0014236 0 ustar 00 <?php namespace AmeliaStripe; /** * Class SingletonApiResource. */ abstract class SingletonApiResource extends ApiResource { /** * @return string the endpoint associated with this singleton class */ public static function classUrl() { // Replace dots with slashes for namespaced resources, e.g. if the object's name is // "foo.bar", then its URL will be "/v1/foo/bar". /** @phpstan-ignore-next-line */ $base = \str_replace('.', '/', static::OBJECT_NAME); return "/v1/{$base}"; } /** * @return string the endpoint associated with this singleton API resource */ public function instanceUrl() { return static::classUrl(); } } stripe-php/lib/Treasury/ReceivedDebit.php 0000666 00000005565 15165746005 0014462 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Treasury; /** * ReceivedDebits represent funds pulled from a <a * href="https://stripe.com/docs/api#financial_accounts">FinancialAccount</a>. * These are not initiated from the FinancialAccount. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Amount (in cents) transferred. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|string $failure_code Reason for the failure. A ReceivedDebit might fail because the FinancialAccount doesn't have sufficient funds, is closed, or is frozen. * @property null|string $financial_account The FinancialAccount that funds were pulled from. * @property null|string $hosted_regulatory_receipt_url A <a href="https://stripe.com/docs/treasury/moving-money/regulatory-receipts">hosted transaction receipt</a> URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. * @property \AmeliaStripe\StripeObject $initiating_payment_method_details * @property \AmeliaStripe\StripeObject $linked_flows * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property string $network The network used for the ReceivedDebit. * @property null|\AmeliaStripe\StripeObject $reversal_details Details describing when a ReceivedDebit might be reversed. * @property string $status Status of the ReceivedDebit. ReceivedDebits are created with a status of either <code>succeeded</code> (approved) or <code>failed</code> (declined). The failure reason can be found under the <code>failure_code</code>. * @property null|string|\AmeliaStripe\Treasury\Transaction $transaction The Transaction associated with this object. */ class ReceivedDebit extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'treasury.received_debit'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Retrieve; const FAILURE_CODE_ACCOUNT_CLOSED = 'account_closed'; const FAILURE_CODE_ACCOUNT_FROZEN = 'account_frozen'; const FAILURE_CODE_INSUFFICIENT_FUNDS = 'insufficient_funds'; const FAILURE_CODE_OTHER = 'other'; const NETWORK_ACH = 'ach'; const NETWORK_CARD = 'card'; const NETWORK_STRIPE = 'stripe'; const STATUS_FAILED = 'failed'; const STATUS_SUCCEEDED = 'succeeded'; } stripe-php/lib/Treasury/OutboundTransfer.php 0000666 00000010735 15165746005 0015263 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Treasury; /** * Use OutboundTransfers to transfer funds from a <a * href="https://stripe.com/docs/api#financial_accounts">FinancialAccount</a> to a * PaymentMethod belonging to the same entity. To send funds to a different party, * use <a href="https://stripe.com/docs/api#outbound_payments">OutboundPayments</a> * instead. You can send funds over ACH rails or through a domestic wire transfer * to a user's own external bank account. * * Simulate OutboundTransfer state changes with the * <code>/v1/test_helpers/treasury/outbound_transfers</code> endpoints. These * methods can only be called on test mode objects. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Amount (in cents) transferred. * @property bool $cancelable Returns <code>true</code> if the object can be canceled, and <code>false</code> otherwise. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|string $destination_payment_method The PaymentMethod used as the payment instrument for an OutboundTransfer. * @property \AmeliaStripe\StripeObject $destination_payment_method_details * @property int $expected_arrival_date The date when funds are expected to arrive in the destination account. * @property string $financial_account The FinancialAccount that funds were pulled from. * @property null|string $hosted_regulatory_receipt_url A <a href="https://stripe.com/docs/treasury/moving-money/regulatory-receipts">hosted transaction receipt</a> URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|\AmeliaStripe\StripeObject $returned_details Details about a returned OutboundTransfer. Only set when the status is <code>returned</code>. * @property string $statement_descriptor Information about the OutboundTransfer to be sent to the recipient account. * @property string $status Current status of the OutboundTransfer: <code>processing</code>, <code>failed</code>, <code>canceled</code>, <code>posted</code>, <code>returned</code>. An OutboundTransfer is <code>processing</code> if it has been created and is pending. The status changes to <code>posted</code> once the OutboundTransfer has been "confirmed" and funds have left the account, or to <code>failed</code> or <code>canceled</code>. If an OutboundTransfer fails to arrive at its destination, its status will change to <code>returned</code>. * @property \AmeliaStripe\StripeObject $status_transitions * @property string|\AmeliaStripe\Treasury\Transaction $transaction The Transaction associated with this object. */ class OutboundTransfer extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'treasury.outbound_transfer'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Retrieve; const STATUS_CANCELED = 'canceled'; const STATUS_FAILED = 'failed'; const STATUS_POSTED = 'posted'; const STATUS_PROCESSING = 'processing'; const STATUS_RETURNED = 'returned'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\OutboundTransfer the canceled outbound transfer */ public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/Treasury/CreditReversal.php 0000666 00000004642 15165746005 0014675 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Treasury; /** * You can reverse some <a * href="https://stripe.com/docs/api#received_credits">ReceivedCredits</a> * depending on their network and source flow. Reversing a ReceivedCredit leads to * the creation of a new object known as a CreditReversal. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Amount (in cents) transferred. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property string $financial_account The FinancialAccount to reverse funds from. * @property null|string $hosted_regulatory_receipt_url A <a href="https://stripe.com/docs/treasury/moving-money/regulatory-receipts">hosted transaction receipt</a> URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $network The rails used to reverse the funds. * @property string $received_credit The ReceivedCredit being reversed. * @property string $status Status of the CreditReversal * @property \AmeliaStripe\StripeObject $status_transitions * @property null|string|\AmeliaStripe\Treasury\Transaction $transaction The Transaction associated with this object. */ class CreditReversal extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'treasury.credit_reversal'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Retrieve; const NETWORK_ACH = 'ach'; const NETWORK_STRIPE = 'stripe'; const STATUS_CANCELED = 'canceled'; const STATUS_POSTED = 'posted'; const STATUS_PROCESSING = 'processing'; } stripe-php/lib/Treasury/InboundTransfer.php 0000666 00000010353 15165746005 0015056 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Treasury; /** * Use <a * href="https://stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers">InboundTransfers</a> * to add funds to your <a * href="https://stripe.com/docs/api#financial_accounts">FinancialAccount</a> via a * PaymentMethod that is owned by you. The funds will be transferred via an ACH * debit. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Amount (in cents) transferred. * @property bool $cancelable Returns <code>true</code> if the InboundTransfer is able to be canceled. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|\AmeliaStripe\StripeObject $failure_details Details about this InboundTransfer's failure. Only set when status is <code>failed</code>. * @property string $financial_account The FinancialAccount that received the funds. * @property null|string $hosted_regulatory_receipt_url A <a href="https://stripe.com/docs/treasury/moving-money/regulatory-receipts">hosted transaction receipt</a> URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. * @property \AmeliaStripe\StripeObject $linked_flows * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $origin_payment_method The origin payment method to be debited for an InboundTransfer. * @property null|\AmeliaStripe\StripeObject $origin_payment_method_details Details about the PaymentMethod for an InboundTransfer. * @property null|bool $returned Returns <code>true</code> if the funds for an InboundTransfer were returned after the InboundTransfer went to the <code>succeeded</code> state. * @property string $statement_descriptor Statement descriptor shown when funds are debited from the source. Not all payment networks support <code>statement_descriptor</code>. * @property string $status Status of the InboundTransfer: <code>processing</code>, <code>succeeded</code>, <code>failed</code>, and <code>canceled</code>. An InboundTransfer is <code>processing</code> if it is created and pending. The status changes to <code>succeeded</code> once the funds have been "confirmed" and a <code>transaction</code> is created and posted. The status changes to <code>failed</code> if the transfer fails. * @property \AmeliaStripe\StripeObject $status_transitions * @property null|string|\AmeliaStripe\Treasury\Transaction $transaction The Transaction associated with this object. */ class InboundTransfer extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'treasury.inbound_transfer'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Retrieve; const STATUS_CANCELED = 'canceled'; const STATUS_FAILED = 'failed'; const STATUS_PROCESSING = 'processing'; const STATUS_SUCCEEDED = 'succeeded'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\InboundTransfer the canceled inbound transfer */ public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/Treasury/FinancialAccount.php 0000666 00000007624 15165746005 0015163 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Treasury; /** * Stripe Treasury provides users with a container for money called a * FinancialAccount that is separate from their Payments balance. FinancialAccounts * serve as the source and destination of Treasury’s money movement APIs. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property string[] $active_features The array of paths to active Features in the Features hash. * @property \AmeliaStripe\StripeObject $balance Balance information for the FinancialAccount * @property string $country Two-letter country code (<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>). * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property \AmeliaStripe\Treasury\FinancialAccountFeatures $features Encodes whether a FinancialAccount has access to a particular Feature, with a <code>status</code> enum and associated <code>status_details</code>. Stripe or the platform can control Features via the requested field. * @property \AmeliaStripe\StripeObject[] $financial_addresses The set of credentials that resolve to a FinancialAccount. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string[] $pending_features The array of paths to pending Features in the Features hash. * @property null|\AmeliaStripe\StripeObject $platform_restrictions The set of functionalities that the platform can restrict on the FinancialAccount. * @property string[] $restricted_features The array of paths to restricted Features in the Features hash. * @property string $status The enum specifying what state the account is in. * @property \AmeliaStripe\StripeObject $status_details * @property string[] $supported_currencies The currencies the FinancialAccount can hold a balance in. Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. */ class FinancialAccount extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'treasury.financial_account'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Retrieve; use \AmeliaStripe\ApiOperations\Update; const STATUS_CLOSED = 'closed'; const STATUS_OPEN = 'open'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\FinancialAccount the retrieved financial account */ public function retrieveFeatures($params = null, $opts = null) { $url = $this->instanceUrl() . '/features'; list($response, $opts) = $this->_request('get', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response, $opts); $obj->setLastResponse($response); return $obj; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\FinancialAccount the updated financial account */ public function updateFeatures($params = null, $opts = null) { $url = $this->instanceUrl() . '/features'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/Treasury/DebitReversal.php 0000666 00000004776 15165746005 0014522 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Treasury; /** * You can reverse some <a * href="https://stripe.com/docs/api#received_debits">ReceivedDebits</a> depending * on their network and source flow. Reversing a ReceivedDebit leads to the * creation of a new object known as a DebitReversal. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Amount (in cents) transferred. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string $financial_account The FinancialAccount to reverse funds from. * @property null|string $hosted_regulatory_receipt_url A <a href="https://stripe.com/docs/treasury/moving-money/regulatory-receipts">hosted transaction receipt</a> URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. * @property null|\AmeliaStripe\StripeObject $linked_flows Other flows linked to a DebitReversal. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $network The rails used to reverse the funds. * @property string $received_debit The ReceivedDebit being reversed. * @property string $status Status of the DebitReversal * @property \AmeliaStripe\StripeObject $status_transitions * @property null|string|\AmeliaStripe\Treasury\Transaction $transaction The Transaction associated with this object. */ class DebitReversal extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'treasury.debit_reversal'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Retrieve; const NETWORK_ACH = 'ach'; const NETWORK_CARD = 'card'; const STATUS_FAILED = 'failed'; const STATUS_PROCESSING = 'processing'; const STATUS_SUCCEEDED = 'succeeded'; } stripe-php/lib/Treasury/OutboundPayment.php 0000666 00000011431 15165746005 0015106 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Treasury; /** * Use OutboundPayments to send funds to another party's external bank account or * <a href="https://stripe.com/docs/api#financial_accounts">FinancialAccount</a>. * To send money to an account belonging to the same user, use an <a * href="https://stripe.com/docs/api#outbound_transfers">OutboundTransfer</a>. * * Simulate OutboundPayment state changes with the * <code>/v1/test_helpers/treasury/outbound_payments</code> endpoints. These * methods can only be called on test mode objects. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Amount (in cents) transferred. * @property bool $cancelable Returns <code>true</code> if the object can be canceled, and <code>false</code> otherwise. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string $customer ID of the <a href="https://stripe.com/docs/api/customers">customer</a> to whom an OutboundPayment is sent. * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|string $destination_payment_method The PaymentMethod via which an OutboundPayment is sent. This field can be empty if the OutboundPayment was created using <code>destination_payment_method_data</code>. * @property null|\AmeliaStripe\StripeObject $destination_payment_method_details Details about the PaymentMethod for an OutboundPayment. * @property null|\AmeliaStripe\StripeObject $end_user_details Details about the end user. * @property int $expected_arrival_date The date when funds are expected to arrive in the destination account. * @property string $financial_account The FinancialAccount that funds were pulled from. * @property null|string $hosted_regulatory_receipt_url A <a href="https://stripe.com/docs/treasury/moving-money/regulatory-receipts">hosted transaction receipt</a> URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|\AmeliaStripe\StripeObject $returned_details Details about a returned OutboundPayment. Only set when the status is <code>returned</code>. * @property string $statement_descriptor The description that appears on the receiving end for an OutboundPayment (for example, bank statement for external bank transfer). * @property string $status Current status of the OutboundPayment: <code>processing</code>, <code>failed</code>, <code>posted</code>, <code>returned</code>, <code>canceled</code>. An OutboundPayment is <code>processing</code> if it has been created and is pending. The status changes to <code>posted</code> once the OutboundPayment has been "confirmed" and funds have left the account, or to <code>failed</code> or <code>canceled</code>. If an OutboundPayment fails to arrive at its destination, its status will change to <code>returned</code>. * @property \AmeliaStripe\StripeObject $status_transitions * @property string|\AmeliaStripe\Treasury\Transaction $transaction The Transaction associated with this object. */ class OutboundPayment extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'treasury.outbound_payment'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Retrieve; const STATUS_CANCELED = 'canceled'; const STATUS_FAILED = 'failed'; const STATUS_POSTED = 'posted'; const STATUS_PROCESSING = 'processing'; const STATUS_RETURNED = 'returned'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\OutboundPayment the canceled outbound payment */ public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/Treasury/FinancialAccountFeatures.php 0000666 00000002615 15165746005 0016655 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Treasury; /** * Encodes whether a FinancialAccount has access to a particular Feature, with a * <code>status</code> enum and associated <code>status_details</code>. Stripe or * the platform can control Features via the requested field. * * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \AmeliaStripe\StripeObject $card_issuing Toggle settings for enabling/disabling a feature * @property \AmeliaStripe\StripeObject $deposit_insurance Toggle settings for enabling/disabling a feature * @property \AmeliaStripe\StripeObject $financial_addresses Settings related to Financial Addresses features on a Financial Account * @property \AmeliaStripe\StripeObject $inbound_transfers InboundTransfers contains inbound transfers features for a FinancialAccount. * @property \AmeliaStripe\StripeObject $intra_stripe_flows Toggle settings for enabling/disabling a feature * @property \AmeliaStripe\StripeObject $outbound_payments Settings related to Outbound Payments features on a Financial Account * @property \AmeliaStripe\StripeObject $outbound_transfers OutboundTransfers contains outbound transfers features for a FinancialAccount. */ class FinancialAccountFeatures extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'treasury.financial_account_features'; } stripe-php/lib/Treasury/ReceivedCredit.php 0000666 00000005617 15165746005 0014643 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Treasury; /** * ReceivedCredits represent funds sent to a <a * href="https://stripe.com/docs/api#financial_accounts">FinancialAccount</a> (for * example, via ACH or wire). These money movements are not initiated from the * FinancialAccount. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Amount (in cents) transferred. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|string $failure_code Reason for the failure. A ReceivedCredit might fail because the receiving FinancialAccount is closed or frozen. * @property null|string $financial_account The FinancialAccount that received the funds. * @property null|string $hosted_regulatory_receipt_url A <a href="https://stripe.com/docs/treasury/moving-money/regulatory-receipts">hosted transaction receipt</a> URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. * @property \AmeliaStripe\StripeObject $initiating_payment_method_details * @property \AmeliaStripe\StripeObject $linked_flows * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property string $network The rails used to send the funds. * @property null|\AmeliaStripe\StripeObject $reversal_details Details describing when a ReceivedCredit may be reversed. * @property string $status Status of the ReceivedCredit. ReceivedCredits are created either <code>succeeded</code> (approved) or <code>failed</code> (declined). If a ReceivedCredit is declined, the failure reason can be found in the <code>failure_code</code> field. * @property null|string|\AmeliaStripe\Treasury\Transaction $transaction The Transaction associated with this object. */ class ReceivedCredit extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'treasury.received_credit'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Retrieve; const FAILURE_CODE_ACCOUNT_CLOSED = 'account_closed'; const FAILURE_CODE_ACCOUNT_FROZEN = 'account_frozen'; const FAILURE_CODE_OTHER = 'other'; const NETWORK_ACH = 'ach'; const NETWORK_CARD = 'card'; const NETWORK_STRIPE = 'stripe'; const NETWORK_US_DOMESTIC_WIRE = 'us_domestic_wire'; const STATUS_FAILED = 'failed'; const STATUS_SUCCEEDED = 'succeeded'; } stripe-php/lib/Treasury/TransactionEntry.php 0000666 00000007130 15165746005 0015261 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Treasury; /** * TransactionEntries represent individual units of money movements within a single * <a href="https://stripe.com/docs/api#transactions">Transaction</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \AmeliaStripe\StripeObject $balance_impact Change to a FinancialAccount's balance * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property int $effective_at When the TransactionEntry will impact the FinancialAccount's balance. * @property string $financial_account The FinancialAccount associated with this object. * @property null|string $flow Token of the flow associated with the TransactionEntry. * @property null|\AmeliaStripe\StripeObject $flow_details Details of the flow associated with the TransactionEntry. * @property string $flow_type Type of the flow associated with the TransactionEntry. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property string|\AmeliaStripe\Treasury\Transaction $transaction The Transaction associated with this object. * @property string $type The specific money movement that generated the TransactionEntry. */ class TransactionEntry extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'treasury.transaction_entry'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Retrieve; const FLOW_TYPE_CREDIT_REVERSAL = 'credit_reversal'; const FLOW_TYPE_DEBIT_REVERSAL = 'debit_reversal'; const FLOW_TYPE_INBOUND_TRANSFER = 'inbound_transfer'; const FLOW_TYPE_ISSUING_AUTHORIZATION = 'issuing_authorization'; const FLOW_TYPE_OTHER = 'other'; const FLOW_TYPE_OUTBOUND_PAYMENT = 'outbound_payment'; const FLOW_TYPE_OUTBOUND_TRANSFER = 'outbound_transfer'; const FLOW_TYPE_RECEIVED_CREDIT = 'received_credit'; const FLOW_TYPE_RECEIVED_DEBIT = 'received_debit'; const TYPE_CREDIT_REVERSAL = 'credit_reversal'; const TYPE_CREDIT_REVERSAL_POSTING = 'credit_reversal_posting'; const TYPE_DEBIT_REVERSAL = 'debit_reversal'; const TYPE_INBOUND_TRANSFER = 'inbound_transfer'; const TYPE_INBOUND_TRANSFER_RETURN = 'inbound_transfer_return'; const TYPE_ISSUING_AUTHORIZATION_HOLD = 'issuing_authorization_hold'; const TYPE_ISSUING_AUTHORIZATION_RELEASE = 'issuing_authorization_release'; const TYPE_OTHER = 'other'; const TYPE_OUTBOUND_PAYMENT = 'outbound_payment'; const TYPE_OUTBOUND_PAYMENT_CANCELLATION = 'outbound_payment_cancellation'; const TYPE_OUTBOUND_PAYMENT_FAILURE = 'outbound_payment_failure'; const TYPE_OUTBOUND_PAYMENT_POSTING = 'outbound_payment_posting'; const TYPE_OUTBOUND_PAYMENT_RETURN = 'outbound_payment_return'; const TYPE_OUTBOUND_TRANSFER = 'outbound_transfer'; const TYPE_OUTBOUND_TRANSFER_CANCELLATION = 'outbound_transfer_cancellation'; const TYPE_OUTBOUND_TRANSFER_FAILURE = 'outbound_transfer_failure'; const TYPE_OUTBOUND_TRANSFER_POSTING = 'outbound_transfer_posting'; const TYPE_OUTBOUND_TRANSFER_RETURN = 'outbound_transfer_return'; const TYPE_RECEIVED_CREDIT = 'received_credit'; const TYPE_RECEIVED_DEBIT = 'received_debit'; } stripe-php/lib/Treasury/Transaction.php 0000666 00000005100 15165746005 0014232 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Treasury; /** * Transactions represent changes to a <a * href="https://stripe.com/docs/api#financial_accounts">FinancialAccount's</a> * balance. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Amount (in cents) transferred. * @property \AmeliaStripe\StripeObject $balance_impact Change to a FinancialAccount's balance * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|\AmeliaStripe\Collection<\AmeliaStripe\Treasury\TransactionEntry> $entries A list of TransactionEntries that are part of this Transaction. This cannot be expanded in any list endpoints. * @property string $financial_account The FinancialAccount associated with this object. * @property null|string $flow ID of the flow that created the Transaction. * @property null|\AmeliaStripe\StripeObject $flow_details Details of the flow that created the Transaction. * @property string $flow_type Type of the flow that created the Transaction. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property string $status Status of the Transaction. * @property \AmeliaStripe\StripeObject $status_transitions */ class Transaction extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'treasury.transaction'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Retrieve; const FLOW_TYPE_CREDIT_REVERSAL = 'credit_reversal'; const FLOW_TYPE_DEBIT_REVERSAL = 'debit_reversal'; const FLOW_TYPE_INBOUND_TRANSFER = 'inbound_transfer'; const FLOW_TYPE_ISSUING_AUTHORIZATION = 'issuing_authorization'; const FLOW_TYPE_OTHER = 'other'; const FLOW_TYPE_OUTBOUND_PAYMENT = 'outbound_payment'; const FLOW_TYPE_OUTBOUND_TRANSFER = 'outbound_transfer'; const FLOW_TYPE_RECEIVED_CREDIT = 'received_credit'; const FLOW_TYPE_RECEIVED_DEBIT = 'received_debit'; const STATUS_OPEN = 'open'; const STATUS_POSTED = 'posted'; const STATUS_VOID = 'void'; } stripe-php/lib/Util/Set.php 0000666 00000001472 15165746005 0011607 0 ustar 00 <?php namespace AmeliaStripe\Util; use ArrayIterator; use IteratorAggregate; class Set implements IteratorAggregate { private $_elts; public function __construct($members = []) { $this->_elts = []; foreach ($members as $item) { $this->_elts[$item] = true; } } public function includes($elt) { return isset($this->_elts[$elt]); } public function add($elt) { $this->_elts[$elt] = true; } public function discard($elt) { unset($this->_elts[$elt]); } public function toArray() { return \array_keys($this->_elts); } /** * @return ArrayIterator */ #[\ReturnTypeWillChange] public function getIterator() { return new ArrayIterator($this->toArray()); } } stripe-php/lib/Util/Util.php 0000666 00000016415 15165746005 0011774 0 ustar 00 <?php namespace AmeliaStripe\Util; use AmeliaStripe\StripeObject; abstract class Util { private static $isMbstringAvailable = null; private static $isHashEqualsAvailable = null; /** * Whether the provided array (or other) is a list rather than a dictionary. * A list is defined as an array for which all the keys are consecutive * integers starting at 0. Empty arrays are considered to be lists. * * @param array|mixed $array * * @return bool true if the given object is a list */ public static function isList($array) { if (!\is_array($array)) { return false; } if ([] === $array) { return true; } if (\array_keys($array) !== \range(0, \count($array) - 1)) { return false; } return true; } /** * Converts a response from the Stripe API to the corresponding PHP object. * * @param array $resp the response from the Stripe API * @param array $opts * * @return array|StripeObject */ public static function convertToStripeObject($resp, $opts) { $types = \AmeliaStripe\Util\ObjectTypes::mapping; if (self::isList($resp)) { $mapped = []; foreach ($resp as $i) { $mapped[] = self::convertToStripeObject($i, $opts); } return $mapped; } if (\is_array($resp)) { if (isset($resp['object']) && \is_string($resp['object']) && isset($types[$resp['object']])) { $class = $types[$resp['object']]; } else { $class = \AmeliaStripe\StripeObject::class; } return $class::constructFrom($resp, $opts); } return $resp; } /** * @param mixed|string $value a string to UTF8-encode * * @return mixed|string the UTF8-encoded string, or the object passed in if * it wasn't a string */ public static function utf8($value) { if (null === self::$isMbstringAvailable) { self::$isMbstringAvailable = \function_exists('mb_detect_encoding'); if (!self::$isMbstringAvailable) { \trigger_error('It looks like the mbstring extension is not enabled. ' . 'UTF-8 strings will not properly be encoded. Ask your system ' . 'administrator to enable the mbstring extension, or write to ' . 'support@stripe.com if you have any questions.', \E_USER_WARNING); } } if (\is_string($value) && self::$isMbstringAvailable && 'UTF-8' !== \mb_detect_encoding($value, 'UTF-8', true)) { return \utf8_encode($value); } return $value; } /** * Compares two strings for equality. The time taken is independent of the * number of characters that match. * * @param string $a one of the strings to compare * @param string $b the other string to compare * * @return bool true if the strings are equal, false otherwise */ public static function secureCompare($a, $b) { if (null === self::$isHashEqualsAvailable) { self::$isHashEqualsAvailable = \function_exists('hash_equals'); } if (self::$isHashEqualsAvailable) { return \hash_equals($a, $b); } if (\strlen($a) !== \strlen($b)) { return false; } $result = 0; for ($i = 0; $i < \strlen($a); ++$i) { $result |= \ord($a[$i]) ^ \ord($b[$i]); } return 0 === $result; } /** * Recursively goes through an array of parameters. If a parameter is an instance of * ApiResource, then it is replaced by the resource's ID. * Also clears out null values. * * @param mixed $h * * @return mixed */ public static function objectsToIds($h) { if ($h instanceof \AmeliaStripe\ApiResource) { return $h->id; } if (static::isList($h)) { $results = []; foreach ($h as $v) { $results[] = static::objectsToIds($v); } return $results; } if (\is_array($h)) { $results = []; foreach ($h as $k => $v) { if (null === $v) { continue; } $results[$k] = static::objectsToIds($v); } return $results; } return $h; } /** * @param array $params * * @return string */ public static function encodeParameters($params) { $flattenedParams = self::flattenParams($params); $pieces = []; foreach ($flattenedParams as $param) { list($k, $v) = $param; $pieces[] = self::urlEncode($k) . '=' . self::urlEncode($v); } return \implode('&', $pieces); } /** * @param array $params * @param null|string $parentKey * * @return array */ public static function flattenParams($params, $parentKey = null) { $result = []; foreach ($params as $key => $value) { $calculatedKey = $parentKey ? "{$parentKey}[{$key}]" : $key; if (self::isList($value)) { $result = \array_merge($result, self::flattenParamsList($value, $calculatedKey)); } elseif (\is_array($value)) { $result = \array_merge($result, self::flattenParams($value, $calculatedKey)); } else { \array_push($result, [$calculatedKey, $value]); } } return $result; } /** * @param array $value * @param string $calculatedKey * * @return array */ public static function flattenParamsList($value, $calculatedKey) { $result = []; foreach ($value as $i => $elem) { if (self::isList($elem)) { $result = \array_merge($result, self::flattenParamsList($elem, $calculatedKey)); } elseif (\is_array($elem)) { $result = \array_merge($result, self::flattenParams($elem, "{$calculatedKey}[{$i}]")); } else { \array_push($result, ["{$calculatedKey}[{$i}]", $elem]); } } return $result; } /** * @param string $key a string to URL-encode * * @return string the URL-encoded string */ public static function urlEncode($key) { $s = \urlencode((string) $key); // Don't use strict form encoding by changing the square bracket control // characters back to their literals. This is fine by the server, and // makes these parameter strings easier to read. $s = \str_replace('%5B', '[', $s); return \str_replace('%5D', ']', $s); } public static function normalizeId($id) { if (\is_array($id)) { $params = $id; $id = $params['id']; unset($params['id']); } else { $params = []; } return [$id, $params]; } /** * Returns UNIX timestamp in milliseconds. * * @return int current time in millis */ public static function currentTimeMillis() { return (int) \round(\microtime(true) * 1000); } } stripe-php/lib/Util/RandomGenerator.php 0000666 00000001464 15165746005 0014144 0 ustar 00 <?php namespace AmeliaStripe\Util; /** * A basic random generator. This is in a separate class so we the generator * can be injected as a dependency and replaced with a mock in tests. */ class RandomGenerator { /** * Returns a random value between 0 and $max. * * @param float $max (optional) * * @return float */ public function randFloat($max = 1.0) { return \mt_rand() / \mt_getrandmax() * $max; } /** * Returns a v4 UUID. * * @return string */ public function uuid() { $arr = \array_values(\unpack('N1a/n4b/N1c', \openssl_random_pseudo_bytes(16))); $arr[2] = ($arr[2] & 0x0FFF) | 0x4000; $arr[3] = ($arr[3] & 0x3FFF) | 0x8000; return \vsprintf('%08x-%04x-%04x-%04x-%04x%08x', $arr); } } stripe-php/lib/Util/DefaultLogger.php 0000666 00000001445 15165746005 0013600 0 ustar 00 <?php namespace AmeliaStripe\Util; /** * A very basic implementation of LoggerInterface that has just enough * functionality that it can be the default for this library. */ class DefaultLogger implements LoggerInterface { /** @var int */ public $messageType = 0; /** @var null|string */ public $destination; public function error($message, array $context = []) { if (\count($context) > 0) { throw new \AmeliaStripe\Exception\BadMethodCallException('DefaultLogger does not currently implement context. Please implement if you need it.'); } if (null === $this->destination) { \error_log($message, $this->messageType); } else { \error_log($message, $this->messageType, $this->destination); } } } stripe-php/lib/Util/CaseInsensitiveArray.php 0000666 00000004326 15165746005 0015150 0 ustar 00 <?php namespace AmeliaStripe\Util; /** * CaseInsensitiveArray is an array-like class that ignores case for keys. * * It is used to store HTTP headers. Per RFC 2616, section 4.2: * Each header field consists of a name followed by a colon (":") and the field value. Field names * are case-insensitive. * * In the context of stripe-php, this is useful because the API will return headers with different * case depending on whether HTTP/2 is used or not (with HTTP/2, headers are always in lowercase). */ class CaseInsensitiveArray implements \ArrayAccess, \Countable, \IteratorAggregate { private $container = []; public function __construct($initial_array = []) { $this->container = \array_change_key_case($initial_array, \CASE_LOWER); } /** * @return int */ #[\ReturnTypeWillChange] public function count() { return \count($this->container); } /** * @return \ArrayIterator */ #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->container); } /** * @return void */ #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { $offset = static::maybeLowercase($offset); if (null === $offset) { $this->container[] = $value; } else { $this->container[$offset] = $value; } } /** * @return bool */ #[\ReturnTypeWillChange] public function offsetExists($offset) { $offset = static::maybeLowercase($offset); return isset($this->container[$offset]); } /** * @return void */ #[\ReturnTypeWillChange] public function offsetUnset($offset) { $offset = static::maybeLowercase($offset); unset($this->container[$offset]); } /** * @return mixed */ #[\ReturnTypeWillChange] public function offsetGet($offset) { $offset = static::maybeLowercase($offset); return isset($this->container[$offset]) ? $this->container[$offset] : null; } private static function maybeLowercase($v) { if (\is_string($v)) { return \strtolower($v); } return $v; } } stripe-php/lib/Util/ObjectTypes.php 0000666 00000023235 15165746005 0013310 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Util; class ObjectTypes { /** * @var array Mapping from object types to resource classes */ const mapping = [ \AmeliaStripe\Account::OBJECT_NAME => \AmeliaStripe\Account::class, \AmeliaStripe\AccountLink::OBJECT_NAME => \AmeliaStripe\AccountLink::class, \AmeliaStripe\ApplePayDomain::OBJECT_NAME => \AmeliaStripe\ApplePayDomain::class, \AmeliaStripe\ApplicationFee::OBJECT_NAME => \AmeliaStripe\ApplicationFee::class, \AmeliaStripe\ApplicationFeeRefund::OBJECT_NAME => \AmeliaStripe\ApplicationFeeRefund::class, \AmeliaStripe\Apps\Secret::OBJECT_NAME => \AmeliaStripe\Apps\Secret::class, \AmeliaStripe\Balance::OBJECT_NAME => \AmeliaStripe\Balance::class, \AmeliaStripe\BalanceTransaction::OBJECT_NAME => \AmeliaStripe\BalanceTransaction::class, \AmeliaStripe\BankAccount::OBJECT_NAME => \AmeliaStripe\BankAccount::class, \AmeliaStripe\BillingPortal\Configuration::OBJECT_NAME => \AmeliaStripe\BillingPortal\Configuration::class, \AmeliaStripe\BillingPortal\Session::OBJECT_NAME => \AmeliaStripe\BillingPortal\Session::class, \AmeliaStripe\Capability::OBJECT_NAME => \AmeliaStripe\Capability::class, \AmeliaStripe\Card::OBJECT_NAME => \AmeliaStripe\Card::class, \AmeliaStripe\CashBalance::OBJECT_NAME => \AmeliaStripe\CashBalance::class, \AmeliaStripe\Charge::OBJECT_NAME => \AmeliaStripe\Charge::class, \AmeliaStripe\Checkout\Session::OBJECT_NAME => \AmeliaStripe\Checkout\Session::class, \AmeliaStripe\Collection::OBJECT_NAME => \AmeliaStripe\Collection::class, \AmeliaStripe\CountrySpec::OBJECT_NAME => \AmeliaStripe\CountrySpec::class, \AmeliaStripe\Coupon::OBJECT_NAME => \AmeliaStripe\Coupon::class, \AmeliaStripe\CreditNote::OBJECT_NAME => \AmeliaStripe\CreditNote::class, \AmeliaStripe\CreditNoteLineItem::OBJECT_NAME => \AmeliaStripe\CreditNoteLineItem::class, \AmeliaStripe\Customer::OBJECT_NAME => \AmeliaStripe\Customer::class, \AmeliaStripe\CustomerBalanceTransaction::OBJECT_NAME => \AmeliaStripe\CustomerBalanceTransaction::class, \AmeliaStripe\CustomerCashBalanceTransaction::OBJECT_NAME => \AmeliaStripe\CustomerCashBalanceTransaction::class, \AmeliaStripe\Discount::OBJECT_NAME => \AmeliaStripe\Discount::class, \AmeliaStripe\Dispute::OBJECT_NAME => \AmeliaStripe\Dispute::class, \AmeliaStripe\EphemeralKey::OBJECT_NAME => \AmeliaStripe\EphemeralKey::class, \AmeliaStripe\Event::OBJECT_NAME => \AmeliaStripe\Event::class, \AmeliaStripe\ExchangeRate::OBJECT_NAME => \AmeliaStripe\ExchangeRate::class, \AmeliaStripe\File::OBJECT_NAME => \AmeliaStripe\File::class, \AmeliaStripe\File::OBJECT_NAME_ALT => \AmeliaStripe\File::class, \AmeliaStripe\FileLink::OBJECT_NAME => \AmeliaStripe\FileLink::class, \AmeliaStripe\FinancialConnections\Account::OBJECT_NAME => \AmeliaStripe\FinancialConnections\Account::class, \AmeliaStripe\FinancialConnections\AccountOwner::OBJECT_NAME => \AmeliaStripe\FinancialConnections\AccountOwner::class, \AmeliaStripe\FinancialConnections\AccountOwnership::OBJECT_NAME => \AmeliaStripe\FinancialConnections\AccountOwnership::class, \AmeliaStripe\FinancialConnections\Session::OBJECT_NAME => \AmeliaStripe\FinancialConnections\Session::class, \AmeliaStripe\FundingInstructions::OBJECT_NAME => \AmeliaStripe\FundingInstructions::class, \AmeliaStripe\Identity\VerificationReport::OBJECT_NAME => \AmeliaStripe\Identity\VerificationReport::class, \AmeliaStripe\Identity\VerificationSession::OBJECT_NAME => \AmeliaStripe\Identity\VerificationSession::class, \AmeliaStripe\Invoice::OBJECT_NAME => \AmeliaStripe\Invoice::class, \AmeliaStripe\InvoiceItem::OBJECT_NAME => \AmeliaStripe\InvoiceItem::class, \AmeliaStripe\InvoiceLineItem::OBJECT_NAME => \AmeliaStripe\InvoiceLineItem::class, \AmeliaStripe\Issuing\Authorization::OBJECT_NAME => \AmeliaStripe\Issuing\Authorization::class, \AmeliaStripe\Issuing\Card::OBJECT_NAME => \AmeliaStripe\Issuing\Card::class, \AmeliaStripe\Issuing\CardDetails::OBJECT_NAME => \AmeliaStripe\Issuing\CardDetails::class, \AmeliaStripe\Issuing\Cardholder::OBJECT_NAME => \AmeliaStripe\Issuing\Cardholder::class, \AmeliaStripe\Issuing\Dispute::OBJECT_NAME => \AmeliaStripe\Issuing\Dispute::class, \AmeliaStripe\Issuing\Transaction::OBJECT_NAME => \AmeliaStripe\Issuing\Transaction::class, \AmeliaStripe\LineItem::OBJECT_NAME => \AmeliaStripe\LineItem::class, \AmeliaStripe\LoginLink::OBJECT_NAME => \AmeliaStripe\LoginLink::class, \AmeliaStripe\Mandate::OBJECT_NAME => \AmeliaStripe\Mandate::class, \AmeliaStripe\Order::OBJECT_NAME => \AmeliaStripe\Order::class, \AmeliaStripe\PaymentIntent::OBJECT_NAME => \AmeliaStripe\PaymentIntent::class, \AmeliaStripe\PaymentLink::OBJECT_NAME => \AmeliaStripe\PaymentLink::class, \AmeliaStripe\PaymentMethod::OBJECT_NAME => \AmeliaStripe\PaymentMethod::class, \AmeliaStripe\Payout::OBJECT_NAME => \AmeliaStripe\Payout::class, \AmeliaStripe\Person::OBJECT_NAME => \AmeliaStripe\Person::class, \AmeliaStripe\Plan::OBJECT_NAME => \AmeliaStripe\Plan::class, \AmeliaStripe\Price::OBJECT_NAME => \AmeliaStripe\Price::class, \AmeliaStripe\Product::OBJECT_NAME => \AmeliaStripe\Product::class, \AmeliaStripe\PromotionCode::OBJECT_NAME => \AmeliaStripe\PromotionCode::class, \AmeliaStripe\Quote::OBJECT_NAME => \AmeliaStripe\Quote::class, \AmeliaStripe\Radar\EarlyFraudWarning::OBJECT_NAME => \AmeliaStripe\Radar\EarlyFraudWarning::class, \AmeliaStripe\Radar\ValueList::OBJECT_NAME => \AmeliaStripe\Radar\ValueList::class, \AmeliaStripe\Radar\ValueListItem::OBJECT_NAME => \AmeliaStripe\Radar\ValueListItem::class, \AmeliaStripe\Refund::OBJECT_NAME => \AmeliaStripe\Refund::class, \AmeliaStripe\Reporting\ReportRun::OBJECT_NAME => \AmeliaStripe\Reporting\ReportRun::class, \AmeliaStripe\Reporting\ReportType::OBJECT_NAME => \AmeliaStripe\Reporting\ReportType::class, \AmeliaStripe\Review::OBJECT_NAME => \AmeliaStripe\Review::class, \AmeliaStripe\SearchResult::OBJECT_NAME => \AmeliaStripe\SearchResult::class, \AmeliaStripe\SetupAttempt::OBJECT_NAME => \AmeliaStripe\SetupAttempt::class, \AmeliaStripe\SetupIntent::OBJECT_NAME => \AmeliaStripe\SetupIntent::class, \AmeliaStripe\ShippingRate::OBJECT_NAME => \AmeliaStripe\ShippingRate::class, \AmeliaStripe\Sigma\ScheduledQueryRun::OBJECT_NAME => \AmeliaStripe\Sigma\ScheduledQueryRun::class, \AmeliaStripe\SKU::OBJECT_NAME => \AmeliaStripe\SKU::class, \AmeliaStripe\Source::OBJECT_NAME => \AmeliaStripe\Source::class, \AmeliaStripe\SourceTransaction::OBJECT_NAME => \AmeliaStripe\SourceTransaction::class, \AmeliaStripe\Subscription::OBJECT_NAME => \AmeliaStripe\Subscription::class, \AmeliaStripe\SubscriptionItem::OBJECT_NAME => \AmeliaStripe\SubscriptionItem::class, \AmeliaStripe\SubscriptionSchedule::OBJECT_NAME => \AmeliaStripe\SubscriptionSchedule::class, \AmeliaStripe\TaxCode::OBJECT_NAME => \AmeliaStripe\TaxCode::class, \AmeliaStripe\TaxId::OBJECT_NAME => \AmeliaStripe\TaxId::class, \AmeliaStripe\TaxRate::OBJECT_NAME => \AmeliaStripe\TaxRate::class, \AmeliaStripe\Terminal\Configuration::OBJECT_NAME => \AmeliaStripe\Terminal\Configuration::class, \AmeliaStripe\Terminal\ConnectionToken::OBJECT_NAME => \AmeliaStripe\Terminal\ConnectionToken::class, \AmeliaStripe\Terminal\Location::OBJECT_NAME => \AmeliaStripe\Terminal\Location::class, \AmeliaStripe\Terminal\Reader::OBJECT_NAME => \AmeliaStripe\Terminal\Reader::class, \AmeliaStripe\TestHelpers\TestClock::OBJECT_NAME => \AmeliaStripe\TestHelpers\TestClock::class, \AmeliaStripe\Token::OBJECT_NAME => \AmeliaStripe\Token::class, \AmeliaStripe\Topup::OBJECT_NAME => \AmeliaStripe\Topup::class, \AmeliaStripe\Transfer::OBJECT_NAME => \AmeliaStripe\Transfer::class, \AmeliaStripe\TransferReversal::OBJECT_NAME => \AmeliaStripe\TransferReversal::class, \AmeliaStripe\Treasury\CreditReversal::OBJECT_NAME => \AmeliaStripe\Treasury\CreditReversal::class, \AmeliaStripe\Treasury\DebitReversal::OBJECT_NAME => \AmeliaStripe\Treasury\DebitReversal::class, \AmeliaStripe\Treasury\FinancialAccount::OBJECT_NAME => \AmeliaStripe\Treasury\FinancialAccount::class, \AmeliaStripe\Treasury\FinancialAccountFeatures::OBJECT_NAME => \AmeliaStripe\Treasury\FinancialAccountFeatures::class, \AmeliaStripe\Treasury\InboundTransfer::OBJECT_NAME => \AmeliaStripe\Treasury\InboundTransfer::class, \AmeliaStripe\Treasury\OutboundPayment::OBJECT_NAME => \AmeliaStripe\Treasury\OutboundPayment::class, \AmeliaStripe\Treasury\OutboundTransfer::OBJECT_NAME => \AmeliaStripe\Treasury\OutboundTransfer::class, \AmeliaStripe\Treasury\ReceivedCredit::OBJECT_NAME => \AmeliaStripe\Treasury\ReceivedCredit::class, \AmeliaStripe\Treasury\ReceivedDebit::OBJECT_NAME => \AmeliaStripe\Treasury\ReceivedDebit::class, \AmeliaStripe\Treasury\Transaction::OBJECT_NAME => \AmeliaStripe\Treasury\Transaction::class, \AmeliaStripe\Treasury\TransactionEntry::OBJECT_NAME => \AmeliaStripe\Treasury\TransactionEntry::class, \AmeliaStripe\UsageRecord::OBJECT_NAME => \AmeliaStripe\UsageRecord::class, \AmeliaStripe\UsageRecordSummary::OBJECT_NAME => \AmeliaStripe\UsageRecordSummary::class, \AmeliaStripe\WebhookEndpoint::OBJECT_NAME => \AmeliaStripe\WebhookEndpoint::class, ]; } stripe-php/lib/Util/RequestOptions.php 0000666 00000012347 15165746005 0014063 0 ustar 00 <?php namespace AmeliaStripe\Util; class RequestOptions { /** * @var array<string> a list of headers that should be persisted across requests */ public static $HEADERS_TO_PERSIST = [ 'Stripe-Account', 'Stripe-Version', ]; /** @var array<string, string> */ public $headers; /** @var null|string */ public $apiKey; /** @var null|string */ public $apiBase; /** * @param null|string $key * @param array<string, string> $headers * @param null|string $base */ public function __construct($key = null, $headers = [], $base = null) { $this->apiKey = $key; $this->headers = $headers; $this->apiBase = $base; } /** * @return array<string, string> */ public function __debugInfo() { return [ 'apiKey' => $this->redactedApiKey(), 'headers' => $this->headers, 'apiBase' => $this->apiBase, ]; } /** * Unpacks an options array and merges it into the existing RequestOptions * object. * * @param null|array|RequestOptions|string $options a key => value array * @param bool $strict when true, forbid string form and arbitrary keys in array form * * @return RequestOptions */ public function merge($options, $strict = false) { $other_options = self::parse($options, $strict); if (null === $other_options->apiKey) { $other_options->apiKey = $this->apiKey; } if (null === $other_options->apiBase) { $other_options->apiBase = $this->apiBase; } $other_options->headers = \array_merge($this->headers, $other_options->headers); return $other_options; } /** * Discards all headers that we don't want to persist across requests. */ public function discardNonPersistentHeaders() { foreach ($this->headers as $k => $v) { if (!\in_array($k, self::$HEADERS_TO_PERSIST, true)) { unset($this->headers[$k]); } } } /** * Unpacks an options array into an RequestOptions object. * * @param null|array|RequestOptions|string $options a key => value array * @param bool $strict when true, forbid string form and arbitrary keys in array form * * @throws \AmeliaStripe\Exception\InvalidArgumentException * * @return RequestOptions */ public static function parse($options, $strict = false) { if ($options instanceof self) { return clone $options; } if (null === $options) { return new RequestOptions(null, [], null); } if (\is_string($options)) { if ($strict) { $message = 'Do not pass a string for request options. If you want to set the ' . 'API key, pass an array like ["api_key" => <apiKey>] instead.'; throw new \AmeliaStripe\Exception\InvalidArgumentException($message); } return new RequestOptions($options, [], null); } if (\is_array($options)) { $headers = []; $key = null; $base = null; if (\array_key_exists('api_key', $options)) { $key = $options['api_key']; unset($options['api_key']); } if (\array_key_exists('idempotency_key', $options)) { $headers['Idempotency-Key'] = $options['idempotency_key']; unset($options['idempotency_key']); } if (\array_key_exists('stripe_account', $options)) { $headers['Stripe-Account'] = $options['stripe_account']; unset($options['stripe_account']); } if (\array_key_exists('stripe_version', $options)) { $headers['Stripe-Version'] = $options['stripe_version']; unset($options['stripe_version']); } if (\array_key_exists('api_base', $options)) { $base = $options['api_base']; unset($options['api_base']); } if ($strict && !empty($options)) { $message = 'Got unexpected keys in options array: ' . \implode(', ', \array_keys($options)); throw new \AmeliaStripe\Exception\InvalidArgumentException($message); } return new RequestOptions($key, $headers, $base); } $message = 'The second argument to Stripe API method calls is an ' . 'optional per-request apiKey, which must be a string, or ' . 'per-request options, which must be an array. (HINT: you can set ' . 'a global apiKey by "Stripe::setApiKey(<apiKey>)")'; throw new \AmeliaStripe\Exception\InvalidArgumentException($message); } /** @return string */ private function redactedApiKey() { if (null === $this->apiKey) { return ''; } $pieces = \explode('_', $this->apiKey, 3); $last = \array_pop($pieces); $redactedLast = \strlen($last) > 4 ? (\str_repeat('*', \strlen($last) - 4) . \substr($last, -4)) : $last; $pieces[] = $redactedLast; return \implode('_', $pieces); } } stripe-php/lib/Util/ApiVersion.php 0000666 00000000205 15165746005 0013124 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Util; class ApiVersion { const CURRENT = '2022-08-01'; } stripe-php/lib/Util/LoggerInterface.php 0000666 00000002152 15165746005 0014110 0 ustar 00 <?php namespace AmeliaStripe\Util; /** * Describes a logger instance. * * This is a subset of the interface of the same name in the PSR-3 logger * interface. We guarantee to keep it compatible, but we'd redefined it here so * that we don't have to pull in the extra dependencies for users who don't want * it. * * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md * for the full interface specification. * * The message MUST be a string or object implementing __toString(). * * The message MAY contain placeholders in the form: {foo} where foo * will be replaced by the context data in key "foo". * * The context array can contain arbitrary data, the only assumption that * can be made by implementors is that if an Exception instance is given * to produce a stack trace, it MUST be in a key named "exception". */ interface LoggerInterface { /** * Runtime errors that do not require immediate action but should typically * be logged and monitored. * * @param string $message */ public function error($message, array $context = []); } stripe-php/lib/StripeStreamingClientInterface.php 0000666 00000000364 15165746005 0016236 0 ustar 00 <?php namespace AmeliaStripe; /** * Interface for a Stripe client. */ interface StripeStreamingClientInterface extends BaseStripeClientInterface { public function requestStream($method, $path, $readBodyChunkCallable, $params, $opts); } stripe-php/lib/SKU.php 0000666 00000005406 15165746005 0010602 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Stores representations of <a * href="http://en.wikipedia.org/wiki/Stock_keeping_unit">stock keeping units</a>. * SKUs describe specific product variations, taking into account any combination * of: attributes, currency, and cost. For example, a product may be a T-shirt, * whereas a specific SKU represents the <code>size: large</code>, <code>color: * red</code> version of that shirt. * * Can also be used to manage inventory. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property bool $active Whether the SKU is available for purchase. * @property \AmeliaStripe\StripeObject $attributes A dictionary of attributes and values for the attributes defined by the product. If, for example, a product's attributes are <code>["size", "gender"]</code>, a valid SKU has the following dictionary of attributes: <code>{"size": "Medium", "gender": "Unisex"}</code>. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string $image The URL of an image for this SKU, meant to be displayable to the customer. * @property \AmeliaStripe\StripeObject $inventory * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|\AmeliaStripe\StripeObject $package_dimensions The dimensions of this SKU for shipping purposes. * @property int $price The cost of the item as a positive integer in the smallest currency unit (that is, 100 cents to charge $1.00, or 100 to charge ¥100, Japanese Yen being a zero-decimal currency). * @property string|\AmeliaStripe\Product $product The ID of the product this SKU is associated with. The product must be currently active. * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch. */ class SKU extends ApiResource { const OBJECT_NAME = 'sku'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Update; } stripe-php/lib/LoginLink.php 0000666 00000000660 15165746005 0012023 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $url The URL for the login link. */ class LoginLink extends ApiResource { const OBJECT_NAME = 'login_link'; } stripe-php/lib/BillingPortal/Configuration.php 0000666 00000004264 15165746005 0015512 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\BillingPortal; /** * A portal configuration describes the functionality and behavior of a portal * session. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property bool $active Whether the configuration is active and can be used to create portal sessions. * @property null|string|\AmeliaStripe\StripeObject $application ID of the Connect Application that created the configuration. * @property \AmeliaStripe\StripeObject $business_profile * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $default_return_url The default URL to redirect customers to when they click on the portal's link to return to your website. This can be <a href="https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url">overriden</a> when creating the session. * @property \AmeliaStripe\StripeObject $features * @property bool $is_default Whether the configuration is the default. If <code>true</code>, this configuration can be managed in the Dashboard and portal sessions will use this configuration unless it is overriden when creating the session. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $login_page * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch. */ class Configuration extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'billing_portal.configuration'; use \AmeliaStripe\ApiOperations\All; use \AmeliaStripe\ApiOperations\Create; use \AmeliaStripe\ApiOperations\Retrieve; use \AmeliaStripe\ApiOperations\Update; } stripe-php/lib/BillingPortal/Session.php 0000666 00000005156 15165746005 0014327 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\BillingPortal; /** * The Billing customer portal is a Stripe-hosted UI for subscription and billing * management. * * A portal configuration describes the functionality and features that you want to * provide to your customers through the portal. * * A portal session describes the instantiation of the customer portal for a * particular customer. By visiting the session's URL, the customer can manage * their subscriptions and billing details. For security reasons, sessions are * short-lived and will expire if the customer does not visit the URL. Create * sessions on-demand when customers intend to manage their subscriptions and * billing details. * * Learn more in the <a * href="https://stripe.com/docs/billing/subscriptions/integrating-customer-portal">integration * guide</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property string|\AmeliaStripe\BillingPortal\Configuration $configuration The configuration used by this session, describing the features available. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $customer The ID of the customer for this session. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|string $locale The IETF language tag of the locale Customer Portal is displayed in. If blank or auto, the customer’s <code>preferred_locales</code> or browser’s locale is used. * @property null|string $on_behalf_of The account for which the session was created on behalf of. When specified, only subscriptions and invoices with this <code>on_behalf_of</code> account appear in the portal. For more information, see the <a href="https://stripe.com/docs/connect/charges-transfers#on-behalf-of">docs</a>. Use the <a href="https://stripe.com/docs/api/accounts/object#account_object-settings-branding">Accounts API</a> to modify the <code>on_behalf_of</code> account's branding settings, which the portal displays. * @property null|string $return_url The URL to redirect customers to when they click on the portal's link to return to your website. * @property string $url The short-lived URL of the session that gives customers access to the customer portal. */ class Session extends \AmeliaStripe\ApiResource { const OBJECT_NAME = 'billing_portal.session'; use \AmeliaStripe\ApiOperations\Create; } stripe-php/lib/ApplicationFeeRefund.php 0000666 00000004737 15165746005 0014175 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * <code>Application Fee Refund</code> objects allow you to refund an application * fee that has previously been created but not yet refunded. Funds will be * refunded to the Stripe account from which the fee was originally collected. * * Related guide: <a * href="https://stripe.com/docs/connect/destination-charges#refunding-app-fee">Refunding * Application Fees</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Amount, in %s. * @property null|string|\AmeliaStripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact on your account balance. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property string|\AmeliaStripe\ApplicationFee $fee ID of the application fee that was refunded. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. */ class ApplicationFeeRefund extends ApiResource { const OBJECT_NAME = 'fee_refund'; use ApiOperations\Update { save as protected _save; } /** * @return string the API URL for this Stripe refund */ public function instanceUrl() { $id = $this['id']; $fee = $this['fee']; if (!$id) { throw new Exception\UnexpectedValueException( 'Could not determine which URL to request: ' . "class instance has invalid ID: {$id}", null ); } $id = Util\Util::utf8($id); $fee = Util\Util::utf8($fee); $base = ApplicationFee::classUrl(); $feeExtn = \urlencode($fee); $extn = \urlencode($id); return "{$base}/{$feeExtn}/refunds/{$extn}"; } /** * @param null|array|string $opts * * @return ApplicationFeeRefund the saved refund */ public function save($opts = null) { return $this->_save($opts); } } stripe-php/lib/BaseStripeClientInterface.php 0000666 00000001744 15165746005 0015162 0 ustar 00 <?php namespace AmeliaStripe; /** * Interface for a Stripe client. */ interface BaseStripeClientInterface { /** * Gets the API key used by the client to send requests. * * @return null|string the API key used by the client to send requests */ public function getApiKey(); /** * Gets the client ID used by the client in OAuth requests. * * @return null|string the client ID used by the client in OAuth requests */ public function getClientId(); /** * Gets the base URL for Stripe's API. * * @return string the base URL for Stripe's API */ public function getApiBase(); /** * Gets the base URL for Stripe's OAuth API. * * @return string the base URL for Stripe's OAuth API */ public function getConnectBase(); /** * Gets the base URL for Stripe's Files API. * * @return string the base URL for Stripe's Files API */ public function getFilesBase(); } stripe-php/lib/UsageRecordSummary.php 0000666 00000001470 15165746005 0013716 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string $invoice The invoice in which this usage period has been billed for. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $period * @property string $subscription_item The ID of the subscription item this summary is describing. * @property int $total_usage The total usage within this usage period. */ class UsageRecordSummary extends ApiResource { const OBJECT_NAME = 'usage_record_summary'; } stripe-php/lib/SourceTransaction.php 0000666 00000000644 15165746005 0013605 0 ustar 00 <?php namespace AmeliaStripe; /** * Class SourceTransaction. * * @property string $id * @property string $object * @property \AmeliaStripe\StripeObject $ach_credit_transfer * @property int $amount * @property int $created * @property string $customer_data * @property string $currency * @property string $type */ class SourceTransaction extends ApiResource { const OBJECT_NAME = 'source_transaction'; } stripe-php/lib/StripeClientInterface.php 0000666 00000001134 15165746005 0014360 0 ustar 00 <?php namespace AmeliaStripe; /** * Interface for a Stripe client. */ interface StripeClientInterface extends BaseStripeClientInterface { /** * Sends a request to Stripe's API. * * @param string $method the HTTP method * @param string $path the path of the request * @param array $params the parameters of the request * @param array|\AmeliaStripe\Util\RequestOptions $opts the special modifiers of the request * * @return \AmeliaStripe\StripeObject the object returned by Stripe's API */ public function request($method, $path, $params, $opts); } stripe-php/lib/ApplePayDomain.php 0000666 00000001776 15165746005 0013011 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $domain_name * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. */ class ApplePayDomain extends ApiResource { const OBJECT_NAME = 'apple_pay_domain'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\Retrieve; /** * @return string The class URL for this resource. It needs to be special * cased because it doesn't fit into the standard resource pattern. */ public static function classUrl() { return '/v1/apple_pay/domains'; } } stripe-php/lib/ApplicationFee.php 0000666 00000010405 15165746005 0013016 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property string|\AmeliaStripe\Account $account ID of the Stripe account this fee was taken from. * @property int $amount Amount earned, in %s. * @property int $amount_refunded Amount in %s refunded (can be less than the amount attribute on the fee if a partial refund was issued) * @property string|\AmeliaStripe\StripeObject $application ID of the Connect application that earned the fee. * @property null|string|\AmeliaStripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact of this collected application fee on your account balance (not including refunds). * @property string|\AmeliaStripe\Charge $charge ID of the charge that the application fee was taken from. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|string|\AmeliaStripe\Charge $originating_transaction ID of the corresponding charge on the platform account, if this fee was the result of a charge using the <code>destination</code> parameter. * @property bool $refunded Whether the fee has been fully refunded. If the fee is only partially refunded, this attribute will still be false. * @property \AmeliaStripe\Collection<\AmeliaStripe\StripeObject> $refunds A list of refunds that have been applied to the fee. */ class ApplicationFee extends ApiResource { const OBJECT_NAME = 'application_fee'; use ApiOperations\All; use ApiOperations\NestedResource; use ApiOperations\Retrieve; const PATH_REFUNDS = '/refunds'; /** * @param string $id the ID of the application fee on which to retrieve the fee refunds * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\ApplicationFeeRefund> the list of fee refunds */ public static function allRefunds($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_REFUNDS, $params, $opts); } /** * @param string $id the ID of the application fee on which to create the fee refund * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\ApplicationFeeRefund */ public static function createRefund($id, $params = null, $opts = null) { return self::_createNestedResource($id, static::PATH_REFUNDS, $params, $opts); } /** * @param string $id the ID of the application fee to which the fee refund belongs * @param string $refundId the ID of the fee refund to retrieve * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\ApplicationFeeRefund */ public static function retrieveRefund($id, $refundId, $params = null, $opts = null) { return self::_retrieveNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $opts); } /** * @param string $id the ID of the application fee to which the fee refund belongs * @param string $refundId the ID of the fee refund to update * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\ApplicationFeeRefund */ public static function updateRefund($id, $refundId, $params = null, $opts = null) { return self::_updateNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $opts); } } stripe-php/lib/Dispute.php 0000666 00000012203 15165746005 0011546 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * A dispute occurs when a customer questions your charge with their card issuer. * When this happens, you're given the opportunity to respond to the dispute with * evidence that shows that the charge is legitimate. You can find more information * about the dispute process in our <a href="/docs/disputes">Disputes and Fraud</a> * documentation. * * Related guide: <a href="https://stripe.com/docs/disputes">Disputes and * Fraud</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount Disputed amount. Usually the amount of the charge, but can differ (usually because of currency fluctuation or because only part of the order is disputed). * @property \AmeliaStripe\BalanceTransaction[] $balance_transactions List of zero, one, or two balance transactions that show funds withdrawn and reinstated to your Stripe account as a result of this dispute. * @property string|\AmeliaStripe\Charge $charge ID of the charge that was disputed. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property \AmeliaStripe\StripeObject $evidence * @property \AmeliaStripe\StripeObject $evidence_details * @property bool $is_charge_refundable If true, it is still possible to refund the disputed payment. Once the payment has been fully refunded, no further funds will be withdrawn from your Stripe account as a result of this dispute. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string $network_reason_code Network-dependent reason code for the dispute. * @property null|string|\AmeliaStripe\PaymentIntent $payment_intent ID of the PaymentIntent that was disputed. * @property string $reason Reason given by cardholder for dispute. Possible values are <code>bank_cannot_process</code>, <code>check_returned</code>, <code>credit_not_processed</code>, <code>customer_initiated</code>, <code>debit_not_authorized</code>, <code>duplicate</code>, <code>fraudulent</code>, <code>general</code>, <code>incorrect_account_details</code>, <code>insufficient_funds</code>, <code>product_not_received</code>, <code>product_unacceptable</code>, <code>subscription_canceled</code>, or <code>unrecognized</code>. Read more about <a href="https://stripe.com/docs/disputes/categories">dispute reasons</a>. * @property string $status Current status of dispute. Possible values are <code>warning_needs_response</code>, <code>warning_under_review</code>, <code>warning_closed</code>, <code>needs_response</code>, <code>under_review</code>, <code>charge_refunded</code>, <code>won</code>, or <code>lost</code>. */ class Dispute extends ApiResource { const OBJECT_NAME = 'dispute'; use ApiOperations\All; use ApiOperations\Retrieve; use ApiOperations\Update; const REASON_BANK_CANNOT_PROCESS = 'bank_cannot_process'; const REASON_CHECK_RETURNED = 'check_returned'; const REASON_CREDIT_NOT_PROCESSED = 'credit_not_processed'; const REASON_CUSTOMER_INITIATED = 'customer_initiated'; const REASON_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized'; const REASON_DUPLICATE = 'duplicate'; const REASON_FRAUDULENT = 'fraudulent'; const REASON_GENERAL = 'general'; const REASON_INCORRECT_ACCOUNT_DETAILS = 'incorrect_account_details'; const REASON_INSUFFICIENT_FUNDS = 'insufficient_funds'; const REASON_PRODUCT_NOT_RECEIVED = 'product_not_received'; const REASON_PRODUCT_UNACCEPTABLE = 'product_unacceptable'; const REASON_SUBSCRIPTION_CANCELED = 'subscription_canceled'; const REASON_UNRECOGNIZED = 'unrecognized'; const STATUS_CHARGE_REFUNDED = 'charge_refunded'; const STATUS_LOST = 'lost'; const STATUS_NEEDS_RESPONSE = 'needs_response'; const STATUS_UNDER_REVIEW = 'under_review'; const STATUS_WARNING_CLOSED = 'warning_closed'; const STATUS_WARNING_NEEDS_RESPONSE = 'warning_needs_response'; const STATUS_WARNING_UNDER_REVIEW = 'warning_under_review'; const STATUS_WON = 'won'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Dispute the closed dispute */ public function close($params = null, $opts = null) { $url = $this->instanceUrl() . '/close'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/CreditNote.php 0000666 00000015422 15165746005 0012177 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * Issue a credit note to adjust an invoice's amount after the invoice is * finalized. * * Related guide: <a * href="https://stripe.com/docs/billing/invoices/credit-notes">Credit Notes</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount The integer amount in %s representing the total amount of the credit note, including tax. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property string|\AmeliaStripe\Customer $customer ID of the customer. * @property null|string|\AmeliaStripe\CustomerBalanceTransaction $customer_balance_transaction Customer balance transaction related to this credit note. * @property int $discount_amount The integer amount in %s representing the total amount of discount that was credited. * @property \AmeliaStripe\StripeObject[] $discount_amounts The aggregate amounts calculated per discount for all line items. * @property string|\AmeliaStripe\Invoice $invoice ID of the invoice. * @property \AmeliaStripe\Collection<\AmeliaStripe\CreditNoteLineItem> $lines Line items that make up the credit note * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|string $memo Customer-facing text that appears on the credit note PDF. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $number A unique number that identifies this particular credit note and appears on the PDF of the credit note and its associated invoice. * @property null|int $out_of_band_amount Amount that was credited outside of Stripe. * @property string $pdf The link to download the PDF of the credit note. * @property null|string $reason Reason for issuing this credit note, one of <code>duplicate</code>, <code>fraudulent</code>, <code>order_change</code>, or <code>product_unsatisfactory</code> * @property null|string|\AmeliaStripe\Refund $refund Refund related to this credit note. * @property string $status Status of this credit note, one of <code>issued</code> or <code>void</code>. Learn more about <a href="https://stripe.com/docs/billing/invoices/credit-notes#voiding">voiding credit notes</a>. * @property int $subtotal The integer amount in %s representing the amount of the credit note, excluding exclusive tax and invoice level discounts. * @property null|int $subtotal_excluding_tax The integer amount in %s representing the amount of the credit note, excluding all tax and invoice level discounts. * @property \AmeliaStripe\StripeObject[] $tax_amounts The aggregate amounts calculated per tax rate for all line items. * @property int $total The integer amount in %s representing the total amount of the credit note, including tax and all discount. * @property null|int $total_excluding_tax The integer amount in %s representing the total amount of the credit note, excluding tax, but including discounts. * @property string $type Type of this credit note, one of <code>pre_payment</code> or <code>post_payment</code>. A <code>pre_payment</code> credit note means it was issued when the invoice was open. A <code>post_payment</code> credit note means it was issued when the invoice was paid. * @property null|int $voided_at The time that the credit note was voided. */ class CreditNote extends ApiResource { const OBJECT_NAME = 'credit_note'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\NestedResource; use ApiOperations\Retrieve; use ApiOperations\Update; const REASON_DUPLICATE = 'duplicate'; const REASON_FRAUDULENT = 'fraudulent'; const REASON_ORDER_CHANGE = 'order_change'; const REASON_PRODUCT_UNSATISFACTORY = 'product_unsatisfactory'; const STATUS_ISSUED = 'issued'; const STATUS_VOID = 'void'; const TYPE_POST_PAYMENT = 'post_payment'; const TYPE_PRE_PAYMENT = 'pre_payment'; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CreditNote the previewed credit note */ public static function preview($params = null, $opts = null) { $url = static::classUrl() . '/preview'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\CreditNoteLineItem> list of CreditNoteLineItems */ public static function previewLines($params = null, $opts = null) { $url = static::classUrl() . '/preview/lines'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CreditNote the voided credit note */ public function voidCreditNote($params = null, $opts = null) { $url = $this->instanceUrl() . '/void'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } const PATH_LINES = '/lines'; /** * @param string $id the ID of the credit note on which to retrieve the credit note line items * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\CreditNoteLineItem> the list of credit note line items */ public static function allLines($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_LINES, $params, $opts); } } stripe-php/lib/BankAccount.php 0000666 00000016254 15165746005 0012333 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * These bank accounts are payment methods on <code>Customer</code> objects. * * On the other hand <a * href="https://stripe.com/docs/api#external_accounts">External Accounts</a> are * transfer destinations on <code>Account</code> objects for <a * href="https://stripe.com/docs/connect/custom-accounts">Custom accounts</a>. They * can be bank accounts or debit cards as well, and are documented in the links * above. * * Related guide: <a * href="https://stripe.com/docs/payments/bank-debits-transfers">Bank Debits and * Transfers</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string|\AmeliaStripe\Account $account The ID of the account that the bank account is associated with. * @property null|string $account_holder_name The name of the person or business that owns the bank account. * @property null|string $account_holder_type The type of entity that holds the account. This can be either <code>individual</code> or <code>company</code>. * @property null|string $account_type The bank account type. This can only be <code>checking</code> or <code>savings</code> in most countries. In Japan, this can only be <code>futsu</code> or <code>toza</code>. * @property null|string[] $available_payout_methods A set of available payout methods for this bank account. Only values from this set should be passed as the <code>method</code> when creating a payout. * @property null|string $bank_name Name of the bank associated with the routing number (e.g., <code>WELLS FARGO</code>). * @property string $country Two-letter ISO code representing the country the bank account is located in. * @property string $currency Three-letter <a href="https://stripe.com/docs/payouts">ISO code for the currency</a> paid out to the bank account. * @property null|string|\AmeliaStripe\Customer $customer The ID of the customer that the bank account is associated with. * @property null|bool $default_for_currency Whether this bank account is the default external account for its currency. * @property null|string $fingerprint Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. * @property string $last4 The last four digits of the bank account number. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string $routing_number The routing transit number for the bank account. * @property string $status <p>For bank accounts, possible values are <code>new</code>, <code>validated</code>, <code>verified</code>, <code>verification_failed</code>, or <code>errored</code>. A bank account that hasn't had any activity or validation performed is <code>new</code>. If Stripe can determine that the bank account exists, its status will be <code>validated</code>. Note that there often isn’t enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be <code>verified</code>. If the verification failed for any reason, such as microdeposit failure, the status will be <code>verification_failed</code>. If a transfer sent to this bank account fails, we'll set the status to <code>errored</code> and will not continue to send transfers until the bank details are updated.</p><p>For external accounts, possible values are <code>new</code> and <code>errored</code>. Validations aren't run against external accounts because they're only used for payouts. This means the other statuses don't apply. If a transfer fails, the status is set to <code>errored</code> and transfers are stopped until account details are updated.</p> */ class BankAccount extends ApiResource { const OBJECT_NAME = 'bank_account'; use ApiOperations\Delete; use ApiOperations\Update; /** * Possible string representations of the bank verification status. * * @see https://stripe.com/docs/api/external_account_bank_accounts/object#account_bank_account_object-status */ const STATUS_NEW = 'new'; const STATUS_VALIDATED = 'validated'; const STATUS_VERIFIED = 'verified'; const STATUS_VERIFICATION_FAILED = 'verification_failed'; const STATUS_ERRORED = 'errored'; /** * @return string The instance URL for this resource. It needs to be special * cased because it doesn't fit into the standard resource pattern. */ public function instanceUrl() { if ($this['customer']) { $base = Customer::classUrl(); $parent = $this['customer']; $path = 'sources'; } elseif ($this['account']) { $base = Account::classUrl(); $parent = $this['account']; $path = 'external_accounts'; } else { $msg = 'Bank accounts cannot be accessed without a customer ID or account ID.'; throw new Exception\UnexpectedValueException($msg, null); } $parentExtn = \urlencode(Util\Util::utf8($parent)); $extn = \urlencode(Util\Util::utf8($this['id'])); return "{$base}/{$parentExtn}/{$path}/{$extn}"; } /** * @param array|string $_id * @param null|array|string $_opts * * @throws \AmeliaStripe\Exception\BadMethodCallException */ public static function retrieve($_id, $_opts = null) { $msg = 'Bank accounts cannot be retrieved without a customer ID or ' . 'an account ID. Retrieve a bank account using ' . "`Customer::retrieveSource('customer_id', " . "'bank_account_id')` or `Account::retrieveExternalAccount(" . "'account_id', 'bank_account_id')`."; throw new Exception\BadMethodCallException($msg); } /** * @param string $_id * @param null|array $_params * @param null|array|string $_options * * @throws \AmeliaStripe\Exception\BadMethodCallException */ public static function update($_id, $_params = null, $_options = null) { $msg = 'Bank accounts cannot be updated without a customer ID or an ' . 'account ID. Update a bank account using ' . "`Customer::updateSource('customer_id', 'bank_account_id', " . '$updateParams)` or `Account::updateExternalAccount(' . "'account_id', 'bank_account_id', \$updateParams)`."; throw new Exception\BadMethodCallException($msg); } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return BankAccount the verified bank account */ public function verify($params = null, $opts = null) { $url = $this->instanceUrl() . '/verify'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/SubscriptionSchedule.php 0000666 00000010224 15165746005 0014273 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * A subscription schedule allows you to create and manage the lifecycle of a * subscription by predefining expected changes. * * Related guide: <a * href="https://stripe.com/docs/billing/subscriptions/subscription-schedules">Subscription * Schedules</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string|\AmeliaStripe\StripeObject $application ID of the Connect Application that created the schedule. * @property null|int $canceled_at Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch. * @property null|int $completed_at Time at which the subscription schedule was completed. Measured in seconds since the Unix epoch. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|\AmeliaStripe\StripeObject $current_phase Object representing the start and end dates for the current phase of the subscription schedule, if it is <code>active</code>. * @property string|\AmeliaStripe\Customer $customer ID of the customer who owns the subscription schedule. * @property \AmeliaStripe\StripeObject $default_settings * @property string $end_behavior Behavior of the subscription schedule and underlying subscription when it ends. Possible values are <code>release</code> and <code>cancel</code>. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property null|\AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property \AmeliaStripe\StripeObject[] $phases Configuration for the subscription schedule's phases. * @property null|int $released_at Time at which the subscription schedule was released. Measured in seconds since the Unix epoch. * @property null|string $released_subscription ID of the subscription once managed by the subscription schedule (if it is released). * @property string $status The present status of the subscription schedule. Possible values are <code>not_started</code>, <code>active</code>, <code>completed</code>, <code>released</code>, and <code>canceled</code>. You can read more about the different states in our <a href="https://stripe.com/docs/billing/subscriptions/subscription-schedules">behavior guide</a>. * @property null|string|\AmeliaStripe\Subscription $subscription ID of the subscription managed by the subscription schedule. * @property null|string|\AmeliaStripe\TestHelpers\TestClock $test_clock ID of the test clock this subscription schedule belongs to. */ class SubscriptionSchedule extends ApiResource { const OBJECT_NAME = 'subscription_schedule'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SubscriptionSchedule the canceled subscription schedule */ public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SubscriptionSchedule the released subscription schedule */ public function release($params = null, $opts = null) { $url = $this->instanceUrl() . '/release'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/WebhookEndpoint.php 0000666 00000004423 15165746005 0013235 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * You can configure <a href="https://stripe.com/docs/webhooks/">webhook * endpoints</a> via the API to be notified about events that happen in your Stripe * account or connected accounts. * * Most users configure webhooks from <a * href="https://dashboard.stripe.com/webhooks">the dashboard</a>, which provides a * user interface for registering and testing your webhook endpoints. * * Related guide: <a href="https://stripe.com/docs/webhooks/configure">Setting up * Webhooks</a>. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string $api_version The API version events are rendered as for this webhook endpoint. * @property null|string $application The ID of the associated Connect application. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $description An optional description of what the webhook is used for. * @property string[] $enabled_events The list of events to enable for this endpoint. <code>['*']</code> indicates that all events are enabled, except those that require explicit selection. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $secret The endpoint's secret, used to generate <a href="https://stripe.com/docs/webhooks/signatures">webhook signatures</a>. Only returned at creation. * @property string $status The status of the webhook. It can be <code>enabled</code> or <code>disabled</code>. * @property string $url The URL of the webhook endpoint. */ class WebhookEndpoint extends ApiResource { const OBJECT_NAME = 'webhook_endpoint'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Update; } stripe-php/lib/ApiOperations/Create.php 0000666 00000001526 15165746005 0014117 0 ustar 00 <?php namespace AmeliaStripe\ApiOperations; /** * Trait for creatable resources. Adds a `create()` static method to the class. * * This trait should only be applied to classes that derive from StripeObject. */ trait Create { /** * @param null|array $params * @param null|array|string $options * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return static the created resource */ public static function create($params = null, $options = null) { self::_validateParams($params); $url = static::classUrl(); list($response, $opts) = static::_staticRequest('post', $url, $params, $options); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } } stripe-php/lib/ApiOperations/All.php 0000666 00000002177 15165746005 0013427 0 ustar 00 <?php namespace AmeliaStripe\ApiOperations; /** * Trait for listable resources. Adds a `all()` static method to the class. * * This trait should only be applied to classes that derive from StripeObject. */ trait All { /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection of ApiResources */ public static function all($params = null, $opts = null) { self::_validateParams($params); $url = static::classUrl(); list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); if (!($obj instanceof \AmeliaStripe\Collection)) { throw new \AmeliaStripe\Exception\UnexpectedValueException( 'Expected type ' . \AmeliaStripe\Collection::class . ', got "' . \get_class($obj) . '" instead.' ); } $obj->setLastResponse($response); $obj->setFilters($params); return $obj; } } stripe-php/lib/ApiOperations/Update.php 0000666 00000002676 15165746005 0014145 0 ustar 00 <?php namespace AmeliaStripe\ApiOperations; /** * Trait for updatable resources. Adds an `update()` static method and a * `save()` method to the class. * * This trait should only be applied to classes that derive from StripeObject. */ trait Update { /** * @param string $id the ID of the resource to update * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return static the updated resource */ public static function update($id, $params = null, $opts = null) { self::_validateParams($params); $url = static::resourceUrl($id); list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } /** * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return static the saved resource */ public function save($opts = null) { $params = $this->serializeParameters(); if (\count($params) > 0) { $url = $this->instanceUrl(); list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); } return $this; } } stripe-php/lib/ApiOperations/SingletonRetrieve.php 0000666 00000001427 15165746005 0016364 0 ustar 00 <?php namespace AmeliaStripe\ApiOperations; /** * Trait for retrievable singleton resources. Adds a `retrieve()` static method to the * class. * * This trait should only be applied to classes that derive from SingletonApiResource. */ trait SingletonRetrieve { /** * @param array|string $id the ID of the API resource to retrieve, * or an options array containing an `id` key * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return static */ public static function retrieve($opts = null) { $opts = \AmeliaStripe\Util\RequestOptions::parse($opts); $instance = new static(null, $opts); $instance->refresh(); return $instance; } } stripe-php/lib/ApiOperations/Search.php 0000666 00000002175 15165746005 0014122 0 ustar 00 <?php namespace AmeliaStripe\ApiOperations; /** * Trait for searchable resources. * * This trait should only be applied to classes that derive from StripeObject. */ trait Search { /** * @param string $searchUrl * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SearchResult of ApiResources */ protected static function _searchResource($searchUrl, $params = null, $opts = null) { self::_validateParams($params); list($response, $opts) = static::_staticRequest('get', $searchUrl, $params, $opts); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); if (!($obj instanceof \AmeliaStripe\SearchResult)) { throw new \AmeliaStripe\Exception\UnexpectedValueException( 'Expected type ' . \AmeliaStripe\SearchResult::class . ', got "' . \get_class($obj) . '" instead.' ); } $obj->setLastResponse($response); $obj->setFilters($params); return $obj; } } stripe-php/lib/ApiOperations/Delete.php 0000666 00000001352 15165746005 0014113 0 ustar 00 <?php namespace AmeliaStripe\ApiOperations; /** * Trait for deletable resources. Adds a `delete()` method to the class. * * This trait should only be applied to classes that derive from StripeObject. */ trait Delete { /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return static the deleted resource */ public function delete($params = null, $opts = null) { self::_validateParams($params); $url = $this->instanceUrl(); list($response, $opts) = $this->_request('delete', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } stripe-php/lib/ApiOperations/Retrieve.php 0000666 00000001400 15165746005 0014470 0 ustar 00 <?php namespace AmeliaStripe\ApiOperations; /** * Trait for retrievable resources. Adds a `retrieve()` static method to the * class. * * This trait should only be applied to classes that derive from StripeObject. */ trait Retrieve { /** * @param array|string $id the ID of the API resource to retrieve, * or an options array containing an `id` key * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return static */ public static function retrieve($id, $opts = null) { $opts = \AmeliaStripe\Util\RequestOptions::parse($opts); $instance = new static($id, $opts); $instance->refresh(); return $instance; } } stripe-php/lib/ApiOperations/NestedResource.php 0000666 00000007750 15165746005 0015653 0 ustar 00 <?php namespace AmeliaStripe\ApiOperations; /** * Trait for resources that have nested resources. * * This trait should only be applied to classes that derive from StripeObject. */ trait NestedResource { /** * @param string $method * @param string $url * @param null|array $params * @param null|array|string $options * * @return \AmeliaStripe\StripeObject */ protected static function _nestedResourceOperation($method, $url, $params = null, $options = null) { self::_validateParams($params); list($response, $opts) = static::_staticRequest($method, $url, $params, $options); $obj = \AmeliaStripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } /** * @param string $id * @param string $nestedPath * @param null|string $nestedId * * @return string */ protected static function _nestedResourceUrl($id, $nestedPath, $nestedId = null) { $url = static::resourceUrl($id) . $nestedPath; if (null !== $nestedId) { $url .= "/{$nestedId}"; } return $url; } /** * @param string $id * @param string $nestedPath * @param null|array $params * @param null|array|string $options * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\StripeObject */ protected static function _createNestedResource($id, $nestedPath, $params = null, $options = null) { $url = static::_nestedResourceUrl($id, $nestedPath); return self::_nestedResourceOperation('post', $url, $params, $options); } /** * @param string $id * @param string $nestedPath * @param null|string $nestedId * @param null|array $params * @param null|array|string $options * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\StripeObject */ protected static function _retrieveNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null) { $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId); return self::_nestedResourceOperation('get', $url, $params, $options); } /** * @param string $id * @param string $nestedPath * @param null|string $nestedId * @param null|array $params * @param null|array|string $options * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\StripeObject */ protected static function _updateNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null) { $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId); return self::_nestedResourceOperation('post', $url, $params, $options); } /** * @param string $id * @param string $nestedPath * @param null|string $nestedId * @param null|array $params * @param null|array|string $options * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\StripeObject */ protected static function _deleteNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null) { $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId); return self::_nestedResourceOperation('delete', $url, $params, $options); } /** * @param string $id * @param string $nestedPath * @param null|array $params * @param null|array|string $options * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\StripeObject */ protected static function _allNestedResources($id, $nestedPath, $params = null, $options = null) { $url = static::_nestedResourceUrl($id, $nestedPath); return self::_nestedResourceOperation('get', $url, $params, $options); } } stripe-php/lib/ApiOperations/Request.php 0000666 00000007716 15165746005 0014353 0 ustar 00 <?php namespace AmeliaStripe\ApiOperations; /** * Trait for resources that need to make API requests. * * This trait should only be applied to classes that derive from StripeObject. */ trait Request { /** * @param null|array|mixed $params The list of parameters to validate * * @throws \AmeliaStripe\Exception\InvalidArgumentException if $params exists and is not an array */ protected static function _validateParams($params = null) { if ($params && !\is_array($params)) { $message = 'You must pass an array as the first argument to Stripe API ' . 'method calls. (HINT: an example call to create a charge ' . "would be: \"AmeliaStripe\\Charge::create(['amount' => 100, " . "'currency' => 'usd', 'source' => 'tok_1234'])\")"; throw new \AmeliaStripe\Exception\InvalidArgumentException($message); } } /** * @param string $method HTTP method ('get', 'post', etc.) * @param string $url URL for the request * @param array $params list of parameters for the request * @param null|array|string $options * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return array tuple containing (the JSON response, $options) */ protected function _request($method, $url, $params = [], $options = null) { $opts = $this->_opts->merge($options); list($resp, $options) = static::_staticRequest($method, $url, $params, $opts); $this->setLastResponse($resp); return [$resp->json, $options]; } /** * @param string $method HTTP method ('get', 'post', etc.) * @param string $url URL for the request * @param callable $readBodyChunk function that will receive chunks of data from a successful request body * @param array $params list of parameters for the request * @param null|array|string $options * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails */ protected function _requestStream($method, $url, $readBodyChunk, $params = [], $options = null) { $opts = $this->_opts->merge($options); static::_staticStreamingRequest($method, $url, $readBodyChunk, $params, $opts); } /** * @param string $method HTTP method ('get', 'post', etc.) * @param string $url URL for the request * @param array $params list of parameters for the request * @param null|array|string $options * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return array tuple containing (the JSON response, $options) */ protected static function _staticRequest($method, $url, $params, $options) { $opts = \AmeliaStripe\Util\RequestOptions::parse($options); $baseUrl = isset($opts->apiBase) ? $opts->apiBase : static::baseUrl(); $requestor = new \AmeliaStripe\ApiRequestor($opts->apiKey, $baseUrl); list($response, $opts->apiKey) = $requestor->request($method, $url, $params, $opts->headers); $opts->discardNonPersistentHeaders(); return [$response, $opts]; } /** * @param string $method HTTP method ('get', 'post', etc.) * @param string $url URL for the request * @param callable $readBodyChunk function that will receive chunks of data from a successful request body * @param array $params list of parameters for the request * @param null|array|string $options * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails */ protected static function _staticStreamingRequest($method, $url, $readBodyChunk, $params, $options) { $opts = \AmeliaStripe\Util\RequestOptions::parse($options); $baseUrl = isset($opts->apiBase) ? $opts->apiBase : static::baseUrl(); $requestor = new \AmeliaStripe\ApiRequestor($opts->apiKey, $baseUrl); $requestor->requestStream($method, $url, $readBodyChunk, $params, $opts->headers); } } stripe-php/lib/Capability.php 0000666 00000005724 15165746005 0012224 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * This is an object representing a capability for a Stripe account. * * Related guide: <a * href="https://stripe.com/docs/connect/account-capabilities">Account * capabilities</a>. * * @property string $id The identifier for the capability. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property string|\AmeliaStripe\Account $account The account for which the capability enables functionality. * @property \AmeliaStripe\StripeObject $future_requirements * @property bool $requested Whether the capability has been requested. * @property null|int $requested_at Time at which the capability was requested. Measured in seconds since the Unix epoch. * @property \AmeliaStripe\StripeObject $requirements * @property string $status The status of the capability. Can be <code>active</code>, <code>inactive</code>, <code>pending</code>, or <code>unrequested</code>. */ class Capability extends ApiResource { const OBJECT_NAME = 'capability'; use ApiOperations\Update; const STATUS_ACTIVE = 'active'; const STATUS_INACTIVE = 'inactive'; const STATUS_PENDING = 'pending'; const STATUS_UNREQUESTED = 'unrequested'; /** * @return string the API URL for this Stripe account reversal */ public function instanceUrl() { $id = $this['id']; $account = $this['account']; if (!$id) { throw new Exception\UnexpectedValueException( 'Could not determine which URL to request: ' . "class instance has invalid ID: {$id}", null ); } $id = Util\Util::utf8($id); $account = Util\Util::utf8($account); $base = Account::classUrl(); $accountExtn = \urlencode($account); $extn = \urlencode($id); return "{$base}/{$accountExtn}/capabilities/{$extn}"; } /** * @param array|string $_id * @param null|array|string $_opts * * @throws \AmeliaStripe\Exception\BadMethodCallException */ public static function retrieve($_id, $_opts = null) { $msg = 'Capabilities cannot be retrieved without an account ID. ' . 'Retrieve a capability using `Account::retrieveCapability(' . "'account_id', 'capability_id')`."; throw new Exception\BadMethodCallException($msg); } /** * @param string $_id * @param null|array $_params * @param null|array|string $_options * * @throws \AmeliaStripe\Exception\BadMethodCallException */ public static function update($_id, $_params = null, $_options = null) { $msg = 'Capabilities cannot be updated without an account ID. ' . 'Update a capability using `Account::updateCapability(' . "'account_id', 'capability_id', \$updateParams)`."; throw new Exception\BadMethodCallException($msg); } } stripe-php/lib/InvoiceLineItem.php 0000666 00000006450 15165746005 0013163 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount The amount, in %s. * @property null|int $amount_excluding_tax The integer amount in %s representing the amount for this line item, excluding all tax and discounts. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|\AmeliaStripe\StripeObject[] $discount_amounts The amount of discount calculated per discount for this line item. * @property bool $discountable If true, discounts will apply to this line item. Always false for prorations. * @property null|(string|\AmeliaStripe\Discount)[] $discounts The discounts applied to the invoice line item. Line item discounts are applied before invoice discounts. Use <code>expand[]=discounts</code> to expand each discount. * @property string $invoice_item The ID of the <a href="https://stripe.com/docs/api/invoiceitems">invoice item</a> associated with this line item if any. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property \AmeliaStripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Note that for line items with <code>type=subscription</code> this will reflect the metadata of the subscription that caused the line item to be created. * @property \AmeliaStripe\StripeObject $period * @property null|\AmeliaStripe\Plan $plan The plan of the subscription, if the line item is a subscription or a proration. * @property null|\AmeliaStripe\Price $price The price of the line item. * @property bool $proration Whether this is a proration. * @property null|\AmeliaStripe\StripeObject $proration_details Additional details for proration line items * @property null|int $quantity The quantity of the subscription, if the line item is a subscription or a proration. * @property null|string $subscription The subscription that the invoice item pertains to, if any. * @property string $subscription_item The subscription item that generated this invoice item. Left empty if the line item is not an explicit result of a subscription. * @property \AmeliaStripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item * @property \AmeliaStripe\TaxRate[] $tax_rates The tax rates which apply to the line item. * @property string $type A string identifying the type of the source of this line item, either an <code>invoiceitem</code> or a <code>subscription</code>. * @property null|string $unit_amount_excluding_tax The amount in %s representing the unit amount for this line item, excluding all tax and discounts. */ class InvoiceLineItem extends ApiResource { const OBJECT_NAME = 'line_item'; } stripe-php/lib/RecipientTransfer.php 0000666 00000001650 15165746005 0013564 0 ustar 00 <?php namespace AmeliaStripe; /** * Class RecipientTransfer. * * @property string $id * @property string $object * @property int $amount * @property int $amount_reversed * @property string $balance_transaction * @property string $bank_account * @property string $card * @property int $created * @property string $currency * @property int $date * @property string $description * @property string $destination * @property string $failure_code * @property string $failure_message * @property bool $livemode * @property \AmeliaStripe\StripeObject $metadata * @property string $method * @property string $recipient * @property \AmeliaStripe\Collection $reversals * @property bool $reversed * @property string $source_type * @property string $statement_descriptor * @property string $status * @property string $type */ class RecipientTransfer extends ApiResource { const OBJECT_NAME = 'recipient_transfer'; } stripe-php/lib/StripeObject.php 0000666 00000045534 15165746005 0012543 0 ustar 00 <?php namespace AmeliaStripe; /** * Class StripeObject. */ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable { /** @var Util\RequestOptions */ protected $_opts; /** @var array */ protected $_originalValues; /** @var array */ protected $_values; /** @var Util\Set */ protected $_unsavedValues; /** @var Util\Set */ protected $_transientValues; /** @var null|array */ protected $_retrieveOptions; /** @var null|ApiResponse */ protected $_lastResponse; /** * @return Util\Set Attributes that should not be sent to the API because * they're not updatable (e.g. ID). */ public static function getPermanentAttributes() { static $permanentAttributes = null; if (null === $permanentAttributes) { $permanentAttributes = new Util\Set([ 'id', ]); } return $permanentAttributes; } /** * Additive objects are subobjects in the API that don't have the same * semantics as most subobjects, which are fully replaced when they're set. * * This is best illustrated by example. The `source` parameter sent when * updating a subscription is *not* additive; if we set it: * * source[object]=card&source[number]=123 * * We expect the old `source` object to have been overwritten completely. If * the previous source had an `address_state` key associated with it and we * didn't send one this time, that value of `address_state` is gone. * * By contrast, additive objects are those that will have new data added to * them while keeping any existing data in place. The only known case of its * use is for `metadata`, but it could in theory be more general. As an * example, say we have a `metadata` object that looks like this on the * server side: * * metadata = ["old" => "old_value"] * * If we update the object with `metadata[new]=new_value`, the server side * object now has *both* fields: * * metadata = ["old" => "old_value", "new" => "new_value"] * * This is okay in itself because usually users will want to treat it as * additive: * * $obj->metadata["new"] = "new_value"; * $obj->save(); * * However, in other cases, they may want to replace the entire existing * contents: * * $obj->metadata = ["new" => "new_value"]; * $obj->save(); * * This is where things get a little bit tricky because in order to clear * any old keys that may have existed, we actually have to send an explicit * empty string to the server. So the operation above would have to send * this form to get the intended behavior: * * metadata[old]=&metadata[new]=new_value * * This method allows us to track which parameters are considered additive, * and lets us behave correctly where appropriate when serializing * parameters to be sent. * * @return Util\Set Set of additive parameters */ public static function getAdditiveParams() { static $additiveParams = null; if (null === $additiveParams) { // Set `metadata` as additive so that when it's set directly we remember // to clear keys that may have been previously set by sending empty // values for them. // // It's possible that not every object has `metadata`, but having this // option set when there is no `metadata` field is not harmful. $additiveParams = new Util\Set([ 'metadata', ]); } return $additiveParams; } public function __construct($id = null, $opts = null) { list($id, $this->_retrieveOptions) = Util\Util::normalizeId($id); $this->_opts = Util\RequestOptions::parse($opts); $this->_originalValues = []; $this->_values = []; $this->_unsavedValues = new Util\Set(); $this->_transientValues = new Util\Set(); if (null !== $id) { $this->_values['id'] = $id; } } // Standard accessor magic methods public function __set($k, $v) { if (static::getPermanentAttributes()->includes($k)) { throw new Exception\InvalidArgumentException( "Cannot set {$k} on this object. HINT: you can't set: " . \implode(', ', static::getPermanentAttributes()->toArray()) ); } if ('' === $v) { throw new Exception\InvalidArgumentException( 'You cannot set \'' . $k . '\'to an empty string. ' . 'We interpret empty strings as NULL in requests. ' . 'You may set obj->' . $k . ' = NULL to delete the property' ); } $this->_values[$k] = Util\Util::convertToStripeObject($v, $this->_opts); $this->dirtyValue($this->_values[$k]); $this->_unsavedValues->add($k); } /** * @param mixed $k * * @return bool */ public function __isset($k) { return isset($this->_values[$k]); } public function __unset($k) { unset($this->_values[$k]); $this->_transientValues->add($k); $this->_unsavedValues->discard($k); } public function &__get($k) { // function should return a reference, using $nullval to return a reference to null $nullval = null; if (!empty($this->_values) && \array_key_exists($k, $this->_values)) { return $this->_values[$k]; } if (!empty($this->_transientValues) && $this->_transientValues->includes($k)) { $class = static::class; $attrs = \implode(', ', \array_keys($this->_values)); $message = "Stripe Notice: Undefined property of {$class} instance: {$k}. " . "HINT: The {$k} attribute was set in the past, however. " . 'It was then wiped when refreshing the object ' . "with the result returned by Stripe's API, " . 'probably as a result of a save(). The attributes currently ' . "available on this object are: {$attrs}"; Stripe::getLogger()->error($message); return $nullval; } $class = static::class; Stripe::getLogger()->error("Stripe Notice: Undefined property of {$class} instance: {$k}"); return $nullval; } /** * Magic method for var_dump output. Only works with PHP >= 5.6. * * @return array */ public function __debugInfo() { return $this->_values; } // ArrayAccess methods /** * @return void */ #[\ReturnTypeWillChange] public function offsetSet($k, $v) { $this->{$k} = $v; } /** * @return bool */ #[\ReturnTypeWillChange] public function offsetExists($k) { return \array_key_exists($k, $this->_values); } /** * @return void */ #[\ReturnTypeWillChange] public function offsetUnset($k) { unset($this->{$k}); } /** * @return mixed */ #[\ReturnTypeWillChange] public function offsetGet($k) { return \array_key_exists($k, $this->_values) ? $this->_values[$k] : null; } /** * @return int */ #[\ReturnTypeWillChange] public function count() { return \count($this->_values); } public function keys() { return \array_keys($this->_values); } public function values() { return \array_values($this->_values); } /** * This unfortunately needs to be public to be used in Util\Util. * * @param array $values * @param null|array|string|Util\RequestOptions $opts * * @return static the object constructed from the given values */ public static function constructFrom($values, $opts = null) { $obj = new static(isset($values['id']) ? $values['id'] : null); $obj->refreshFrom($values, $opts); return $obj; } /** * Refreshes this object using the provided values. * * @param array $values * @param null|array|string|Util\RequestOptions $opts * @param bool $partial defaults to false */ public function refreshFrom($values, $opts, $partial = false) { $this->_opts = Util\RequestOptions::parse($opts); $this->_originalValues = self::deepCopy($values); if ($values instanceof StripeObject) { $values = $values->toArray(); } // Wipe old state before setting new. This is useful for e.g. updating a // customer, where there is no persistent card parameter. Mark those values // which don't persist as transient if ($partial) { $removed = new Util\Set(); } else { $removed = new Util\Set(\array_diff(\array_keys($this->_values), \array_keys($values))); } foreach ($removed->toArray() as $k) { unset($this->{$k}); } $this->updateAttributes($values, $opts, false); foreach ($values as $k => $v) { $this->_transientValues->discard($k); $this->_unsavedValues->discard($k); } } /** * Mass assigns attributes on the model. * * @param array $values * @param null|array|string|Util\RequestOptions $opts * @param bool $dirty defaults to true */ public function updateAttributes($values, $opts = null, $dirty = true) { foreach ($values as $k => $v) { // Special-case metadata to always be cast as a StripeObject // This is necessary in case metadata is empty, as PHP arrays do // not differentiate between lists and hashes, and we consider // empty arrays to be lists. if (('metadata' === $k) && (\is_array($v))) { $this->_values[$k] = StripeObject::constructFrom($v, $opts); } else { $this->_values[$k] = Util\Util::convertToStripeObject($v, $opts); } if ($dirty) { $this->dirtyValue($this->_values[$k]); } $this->_unsavedValues->add($k); } } /** * @param bool $force defaults to false * * @return array a recursive mapping of attributes to values for this object, * including the proper value for deleted attributes */ public function serializeParameters($force = false) { $updateParams = []; foreach ($this->_values as $k => $v) { // There are a few reasons that we may want to add in a parameter for // update: // // 1. The `$force` option has been set. // 2. We know that it was modified. // 3. Its value is a StripeObject. A StripeObject may contain modified // values within in that its parent StripeObject doesn't know about. // $original = \array_key_exists($k, $this->_originalValues) ? $this->_originalValues[$k] : null; $unsaved = $this->_unsavedValues->includes($k); if ($force || $unsaved || $v instanceof StripeObject) { $updateParams[$k] = $this->serializeParamsValue( $this->_values[$k], $original, $unsaved, $force, $k ); } } // a `null` that makes it out of `serializeParamsValue` signals an empty // value that we shouldn't appear in the serialized form of the object return \array_filter( $updateParams, function ($v) { return null !== $v; } ); } public function serializeParamsValue($value, $original, $unsaved, $force, $key = null) { // The logic here is that essentially any object embedded in another // object that had a `type` is actually an API resource of a different // type that's been included in the response. These other resources must // be updated from their proper endpoints, and therefore they are not // included when serializing even if they've been modified. // // There are _some_ known exceptions though. // // For example, if the value is unsaved (meaning the user has set it), and // it looks like the API resource is persisted with an ID, then we include // the object so that parameters are serialized with a reference to its // ID. // // Another example is that on save API calls it's sometimes desirable to // update a customer's default source by setting a new card (or other) // object with `->source=` and then saving the customer. The // `saveWithParent` flag to override the default behavior allows us to // handle these exceptions. // // We throw an error if a property was set explicitly but we can't do // anything with it because the integration is probably not working as the // user intended it to. if (null === $value) { return ''; } if (($value instanceof ApiResource) && (!$value->saveWithParent)) { if (!$unsaved) { return null; } if (isset($value->id)) { return $value; } throw new Exception\InvalidArgumentException( "Cannot save property `{$key}` containing an API resource of type " . \get_class($value) . ". It doesn't appear to be persisted and is " . 'not marked as `saveWithParent`.' ); } if (\is_array($value)) { if (Util\Util::isList($value)) { // Sequential array, i.e. a list $update = []; foreach ($value as $v) { $update[] = $this->serializeParamsValue($v, null, true, $force); } // This prevents an array that's unchanged from being resent. if ($update !== $this->serializeParamsValue($original, null, true, $force, $key)) { return $update; } } else { // Associative array, i.e. a map return Util\Util::convertToStripeObject($value, $this->_opts)->serializeParameters(); } } elseif ($value instanceof StripeObject) { $update = $value->serializeParameters($force); if ($original && $unsaved && $key && static::getAdditiveParams()->includes($key)) { $update = \array_merge(self::emptyValues($original), $update); } return $update; } else { return $value; } } /** * @return mixed */ #[\ReturnTypeWillChange] public function jsonSerialize() { return $this->toArray(); } /** * Returns an associative array with the key and values composing the * Stripe object. * * @return array the associative array */ public function toArray() { $maybeToArray = function ($value) { if (null === $value) { return null; } return \is_object($value) && \method_exists($value, 'toArray') ? $value->toArray() : $value; }; return \array_reduce(\array_keys($this->_values), function ($acc, $k) use ($maybeToArray) { if ('_' === \substr((string) $k, 0, 1)) { return $acc; } $v = $this->_values[$k]; if (Util\Util::isList($v)) { $acc[$k] = \array_map($maybeToArray, $v); } else { $acc[$k] = $maybeToArray($v); } return $acc; }, []); } /** * Returns a pretty JSON representation of the Stripe object. * * @return string the JSON representation of the Stripe object */ public function toJSON() { return \json_encode($this->toArray(), \JSON_PRETTY_PRINT); } public function __toString() { $class = static::class; return $class . ' JSON: ' . $this->toJSON(); } /** * Sets all keys within the StripeObject as unsaved so that they will be * included with an update when `serializeParameters` is called. This * method is also recursive, so any StripeObjects contained as values or * which are values in a tenant array are also marked as dirty. */ public function dirty() { $this->_unsavedValues = new Util\Set(\array_keys($this->_values)); foreach ($this->_values as $k => $v) { $this->dirtyValue($v); } } protected function dirtyValue($value) { if (\is_array($value)) { foreach ($value as $v) { $this->dirtyValue($v); } } elseif ($value instanceof StripeObject) { $value->dirty(); } } /** * Produces a deep copy of the given object including support for arrays * and StripeObjects. * * @param mixed $obj */ protected static function deepCopy($obj) { if (\is_array($obj)) { $copy = []; foreach ($obj as $k => $v) { $copy[$k] = self::deepCopy($v); } return $copy; } if ($obj instanceof StripeObject) { return $obj::constructFrom( self::deepCopy($obj->_values), clone $obj->_opts ); } return $obj; } /** * Returns a hash of empty values for all the values that are in the given * StripeObject. * * @param mixed $obj */ public static function emptyValues($obj) { if (\is_array($obj)) { $values = $obj; } elseif ($obj instanceof StripeObject) { $values = $obj->_values; } else { throw new Exception\InvalidArgumentException( 'empty_values got unexpected object type: ' . \get_class($obj) ); } return \array_fill_keys(\array_keys($values), ''); } /** * @return null|ApiResponse The last response from the Stripe API */ public function getLastResponse() { return $this->_lastResponse; } /** * Sets the last response from the Stripe API. * * @param ApiResponse $resp */ public function setLastResponse($resp) { $this->_lastResponse = $resp; } /** * Indicates whether or not the resource has been deleted on the server. * Note that some, but not all, resources can indicate whether they have * been deleted. * * @return bool whether the resource is deleted */ public function isDeleted() { return isset($this->_values['deleted']) ? $this->_values['deleted'] : false; } } stripe-php/lib/Exception/ApiConnectionException.php 0000666 00000000452 15165746005 0016502 0 ustar 00 <?php namespace AmeliaStripe\Exception; /** * ApiConnection is thrown in the event that the SDK can't connect to Stripe's * servers. That can be for a variety of different reasons from a downed * network to a bad TLS certificate. */ class ApiConnectionException extends ApiErrorException { } stripe-php/lib/Exception/UnexpectedValueException.php 0000666 00000000215 15165746005 0017047 0 ustar 00 <?php namespace AmeliaStripe\Exception; class UnexpectedValueException extends \UnexpectedValueException implements ExceptionInterface { } stripe-php/lib/Exception/InvalidArgumentException.php 0000666 00000000215 15165746005 0017037 0 ustar 00 <?php namespace AmeliaStripe\Exception; class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface { } stripe-php/lib/Exception/AuthenticationException.php 0000666 00000000330 15165746005 0016723 0 ustar 00 <?php namespace AmeliaStripe\Exception; /** * AuthenticationException is thrown when invalid credentials are used to * connect to Stripe's servers. */ class AuthenticationException extends ApiErrorException { } stripe-php/lib/Exception/ExceptionInterface.php 0000666 00000000760 15165746005 0015653 0 ustar 00 <?php namespace AmeliaStripe\Exception; // TODO: remove this check once we drop support for PHP 5 if (\interface_exists(\Throwable::class, false)) { /** * The base interface for all Stripe exceptions. */ interface ExceptionInterface extends \Throwable { } } else { /** * The base interface for all Stripe exceptions. */ // phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses interface ExceptionInterface { } // phpcs:enable } stripe-php/lib/Exception/PermissionException.php 0000666 00000000325 15165746005 0016100 0 ustar 00 <?php namespace AmeliaStripe\Exception; /** * PermissionException is thrown in cases where access was attempted on a * resource that wasn't allowed. */ class PermissionException extends ApiErrorException { } stripe-php/lib/Exception/IdempotencyException.php 0000666 00000000307 15165746005 0016230 0 ustar 00 <?php namespace AmeliaStripe\Exception; /** * IdempotencyException is thrown in cases where an idempotency key was used * improperly. */ class IdempotencyException extends ApiErrorException { } stripe-php/lib/Exception/CardException.php 0000666 00000004130 15165746005 0014617 0 ustar 00 <?php namespace AmeliaStripe\Exception; /** * CardException is thrown when a user enters a card that can't be charged for * some reason. */ class CardException extends ApiErrorException { protected $declineCode; protected $stripeParam; /** * Creates a new CardException exception. * * @param string $message the exception message * @param null|int $httpStatus the HTTP status code * @param null|string $httpBody the HTTP body as a string * @param null|array $jsonBody the JSON deserialized body * @param null|array|\AmeliaStripe\Util\CaseInsensitiveArray $httpHeaders the HTTP headers array * @param null|string $stripeCode the Stripe error code * @param null|string $declineCode the decline code * @param null|string $stripeParam the parameter related to the error * * @return CardException */ public static function factory( $message, $httpStatus = null, $httpBody = null, $jsonBody = null, $httpHeaders = null, $stripeCode = null, $declineCode = null, $stripeParam = null ) { $instance = parent::factory($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders, $stripeCode); $instance->setDeclineCode($declineCode); $instance->setStripeParam($stripeParam); return $instance; } /** * Gets the decline code. * * @return null|string */ public function getDeclineCode() { return $this->declineCode; } /** * Sets the decline code. * * @param null|string $declineCode */ public function setDeclineCode($declineCode) { $this->declineCode = $declineCode; } /** * Gets the parameter related to the error. * * @return null|string */ public function getStripeParam() { return $this->stripeParam; } /** * Sets the parameter related to the error. * * @param null|string $stripeParam */ public function setStripeParam($stripeParam) { $this->stripeParam = $stripeParam; } } stripe-php/lib/Exception/SignatureVerificationException.php 0000666 00000003145 15165746005 0020257 0 ustar 00 <?php namespace AmeliaStripe\Exception; /** * SignatureVerificationException is thrown when the signature verification for * a webhook fails. */ class SignatureVerificationException extends \Exception implements ExceptionInterface { protected $httpBody; protected $sigHeader; /** * Creates a new SignatureVerificationException exception. * * @param string $message the exception message * @param null|string $httpBody the HTTP body as a string * @param null|string $sigHeader the `Stripe-Signature` HTTP header * * @return SignatureVerificationException */ public static function factory( $message, $httpBody = null, $sigHeader = null ) { $instance = new static($message); $instance->setHttpBody($httpBody); $instance->setSigHeader($sigHeader); return $instance; } /** * Gets the HTTP body as a string. * * @return null|string */ public function getHttpBody() { return $this->httpBody; } /** * Sets the HTTP body as a string. * * @param null|string $httpBody */ public function setHttpBody($httpBody) { $this->httpBody = $httpBody; } /** * Gets the `Stripe-Signature` HTTP header. * * @return null|string */ public function getSigHeader() { return $this->sigHeader; } /** * Sets the `Stripe-Signature` HTTP header. * * @param null|string $sigHeader */ public function setSigHeader($sigHeader) { $this->sigHeader = $sigHeader; } } stripe-php/lib/Exception/RateLimitException.php 0000666 00000000454 15165746005 0015645 0 ustar 00 <?php namespace AmeliaStripe\Exception; /** * RateLimitException is thrown in cases where an account is putting too much * load on Stripe's API servers (usually by performing too many requests). * Please back off on request rate. */ class RateLimitException extends InvalidRequestException { } stripe-php/lib/Exception/BadMethodCallException.php 0000666 00000000211 15165746005 0016365 0 ustar 00 <?php namespace AmeliaStripe\Exception; class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface { } stripe-php/lib/Exception/ApiErrorException.php 0000666 00000011704 15165746005 0015476 0 ustar 00 <?php namespace AmeliaStripe\Exception; /** * Implements properties and methods common to all (non-SPL) Stripe exceptions. */ abstract class ApiErrorException extends \Exception implements ExceptionInterface { protected $error; protected $httpBody; protected $httpHeaders; protected $httpStatus; protected $jsonBody; protected $requestId; protected $stripeCode; /** * Creates a new API error exception. * * @param string $message the exception message * @param null|int $httpStatus the HTTP status code * @param null|string $httpBody the HTTP body as a string * @param null|array $jsonBody the JSON deserialized body * @param null|array|\AmeliaStripe\Util\CaseInsensitiveArray $httpHeaders the HTTP headers array * @param null|string $stripeCode the Stripe error code * * @return static */ public static function factory( $message, $httpStatus = null, $httpBody = null, $jsonBody = null, $httpHeaders = null, $stripeCode = null ) { $instance = new static($message); $instance->setHttpStatus($httpStatus); $instance->setHttpBody($httpBody); $instance->setJsonBody($jsonBody); $instance->setHttpHeaders($httpHeaders); $instance->setStripeCode($stripeCode); $instance->setRequestId(null); if ($httpHeaders && isset($httpHeaders['Request-Id'])) { $instance->setRequestId($httpHeaders['Request-Id']); } $instance->setError($instance->constructErrorObject()); return $instance; } /** * Gets the Stripe error object. * * @return null|\AmeliaStripe\ErrorObject */ public function getError() { return $this->error; } /** * Sets the Stripe error object. * * @param null|\AmeliaStripe\ErrorObject $error */ public function setError($error) { $this->error = $error; } /** * Gets the HTTP body as a string. * * @return null|string */ public function getHttpBody() { return $this->httpBody; } /** * Sets the HTTP body as a string. * * @param null|string $httpBody */ public function setHttpBody($httpBody) { $this->httpBody = $httpBody; } /** * Gets the HTTP headers array. * * @return null|array|\AmeliaStripe\Util\CaseInsensitiveArray */ public function getHttpHeaders() { return $this->httpHeaders; } /** * Sets the HTTP headers array. * * @param null|array|\AmeliaStripe\Util\CaseInsensitiveArray $httpHeaders */ public function setHttpHeaders($httpHeaders) { $this->httpHeaders = $httpHeaders; } /** * Gets the HTTP status code. * * @return null|int */ public function getHttpStatus() { return $this->httpStatus; } /** * Sets the HTTP status code. * * @param null|int $httpStatus */ public function setHttpStatus($httpStatus) { $this->httpStatus = $httpStatus; } /** * Gets the JSON deserialized body. * * @return null|array<string, mixed> */ public function getJsonBody() { return $this->jsonBody; } /** * Sets the JSON deserialized body. * * @param null|array<string, mixed> $jsonBody */ public function setJsonBody($jsonBody) { $this->jsonBody = $jsonBody; } /** * Gets the Stripe request ID. * * @return null|string */ public function getRequestId() { return $this->requestId; } /** * Sets the Stripe request ID. * * @param null|string $requestId */ public function setRequestId($requestId) { $this->requestId = $requestId; } /** * Gets the Stripe error code. * * Cf. the `CODE_*` constants on {@see \AmeliaStripe\ErrorObject} for possible * values. * * @return null|string */ public function getStripeCode() { return $this->stripeCode; } /** * Sets the Stripe error code. * * @param null|string $stripeCode */ public function setStripeCode($stripeCode) { $this->stripeCode = $stripeCode; } /** * Returns the string representation of the exception. * * @return string */ public function __toString() { $statusStr = (null === $this->getHttpStatus()) ? '' : "(Status {$this->getHttpStatus()}) "; $idStr = (null === $this->getRequestId()) ? '' : "(Request {$this->getRequestId()}) "; return "{$statusStr}{$idStr}{$this->getMessage()}"; } protected function constructErrorObject() { if (null === $this->jsonBody || !\array_key_exists('error', $this->jsonBody)) { return null; } return \AmeliaStripe\ErrorObject::constructFrom($this->jsonBody['error']); } } stripe-php/lib/Exception/UnknownApiErrorException.php 0000666 00000000511 15165746005 0017050 0 ustar 00 <?php namespace AmeliaStripe\Exception; /** * UnknownApiErrorException is thrown when the client library receives an * error from the API it doesn't know about. Receiving this error usually * means that your client library is outdated and should be upgraded. */ class UnknownApiErrorException extends ApiErrorException { } stripe-php/lib/Exception/InvalidRequestException.php 0000666 00000003150 15165746005 0016706 0 ustar 00 <?php namespace AmeliaStripe\Exception; /** * InvalidRequestException is thrown when a request is initiated with invalid * parameters. */ class InvalidRequestException extends ApiErrorException { protected $stripeParam; /** * Creates a new InvalidRequestException exception. * * @param string $message the exception message * @param null|int $httpStatus the HTTP status code * @param null|string $httpBody the HTTP body as a string * @param null|array $jsonBody the JSON deserialized body * @param null|array|\AmeliaStripe\Util\CaseInsensitiveArray $httpHeaders the HTTP headers array * @param null|string $stripeCode the Stripe error code * @param null|string $stripeParam the parameter related to the error * * @return InvalidRequestException */ public static function factory( $message, $httpStatus = null, $httpBody = null, $jsonBody = null, $httpHeaders = null, $stripeCode = null, $stripeParam = null ) { $instance = parent::factory($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders, $stripeCode); $instance->setStripeParam($stripeParam); return $instance; } /** * Gets the parameter related to the error. * * @return null|string */ public function getStripeParam() { return $this->stripeParam; } /** * Sets the parameter related to the error. * * @param null|string $stripeParam */ public function setStripeParam($stripeParam) { $this->stripeParam = $stripeParam; } } stripe-php/lib/Exception/OAuth/InvalidRequestException.php 0000666 00000000365 15165746005 0017733 0 ustar 00 <?php namespace AmeliaStripe\Exception\OAuth; /** * InvalidRequestException is thrown when a code, refresh token, or grant * type parameter is not provided, but was required. */ class InvalidRequestException extends OAuthErrorException { } stripe-php/lib/Exception/OAuth/UnsupportedGrantTypeException.php 0000666 00000000341 15165746005 0021154 0 ustar 00 <?php namespace AmeliaStripe\Exception\OAuth; /** * UnsupportedGrantTypeException is thrown when an unuspported grant type * parameter is specified. */ class UnsupportedGrantTypeException extends OAuthErrorException { } stripe-php/lib/Exception/OAuth/OAuthErrorException.php 0000666 00000000677 15165746005 0017034 0 ustar 00 <?php namespace AmeliaStripe\Exception\OAuth; /** * Implements properties and methods common to all (non-SPL) Stripe OAuth * exceptions. */ abstract class OAuthErrorException extends \AmeliaStripe\Exception\ApiErrorException { protected function constructErrorObject() { if (null === $this->jsonBody) { return null; } return \AmeliaStripe\OAuthErrorObject::constructFrom($this->jsonBody); } } stripe-php/lib/Exception/OAuth/UnknownOAuthErrorException.php 0000666 00000000531 15165746005 0020401 0 ustar 00 <?php namespace AmeliaStripe\Exception\OAuth; /** * UnknownApiErrorException is thrown when the client library receives an * error from the OAuth API it doesn't know about. Receiving this error usually * means that your client library is outdated and should be upgraded. */ class UnknownOAuthErrorException extends OAuthErrorException { } stripe-php/lib/Exception/OAuth/UnsupportedResponseTypeException.php 0000666 00000000352 15165746005 0021701 0 ustar 00 <?php namespace AmeliaStripe\Exception\OAuth; /** * UnsupportedResponseTypeException is thrown when an unsupported response type * parameter is specified. */ class UnsupportedResponseTypeException extends OAuthErrorException { } stripe-php/lib/Exception/OAuth/InvalidScopeException.php 0000666 00000000304 15165746005 0017345 0 ustar 00 <?php namespace AmeliaStripe\Exception\OAuth; /** * InvalidScopeException is thrown when an invalid scope parameter is provided. */ class InvalidScopeException extends OAuthErrorException { } stripe-php/lib/Exception/OAuth/InvalidClientException.php 0000666 00000000540 15165746005 0017514 0 ustar 00 <?php namespace AmeliaStripe\Exception\OAuth; /** * InvalidClientException is thrown when the client_id does not belong to you, * the stripe_user_id does not exist or is not connected to your application, * or the API key mode (live or test mode) does not match the client_id mode. */ class InvalidClientException extends OAuthErrorException { } stripe-php/lib/Exception/OAuth/ExceptionInterface.php 0000666 00000000303 15165746005 0016664 0 ustar 00 <?php namespace AmeliaStripe\Exception\OAuth; /** * The base interface for all Stripe OAuth exceptions. */ interface ExceptionInterface extends \AmeliaStripe\Exception\ExceptionInterface { } stripe-php/lib/Exception/OAuth/InvalidGrantException.php 0000666 00000000615 15165746005 0017354 0 ustar 00 <?php namespace AmeliaStripe\Exception\OAuth; /** * InvalidGrantException is thrown when a specified code doesn't exist, is * expired, has been used, or doesn't belong to you; a refresh token doesn't * exist, or doesn't belong to you; or if an API key's mode (live or test) * doesn't match the mode of a code or refresh token. */ class InvalidGrantException extends OAuthErrorException { } stripe-php/lib/Service/BillingPortal/ConfigurationService.php 0000666 00000004604 15165746005 0020431 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\BillingPortal; class ConfigurationService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of configurations that describe the functionality of the customer * portal. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\BillingPortal\Configuration> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/billing_portal/configurations', $params, $opts); } /** * Creates a configuration that describes the functionality and behavior of a * PortalSession. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BillingPortal\Configuration */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/billing_portal/configurations', $params, $opts); } /** * Retrieves a configuration that describes the functionality of the customer * portal. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BillingPortal\Configuration */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/billing_portal/configurations/%s', $id), $params, $opts); } /** * Updates a configuration that describes the functionality of the customer portal. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BillingPortal\Configuration */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/billing_portal/configurations/%s', $id), $params, $opts); } } stripe-php/lib/Service/BillingPortal/BillingPortalServiceFactory.php 0000666 00000001275 15165746005 0021715 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\BillingPortal; /** * Service factory class for API resources in the BillingPortal namespace. * * @property ConfigurationService $configurations * @property SessionService $sessions */ class BillingPortalServiceFactory extends \AmeliaStripe\Service\AbstractServiceFactory { /** * @var array<string, string> */ private static $classMap = [ 'configurations' => ConfigurationService::class, 'sessions' => SessionService::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } stripe-php/lib/Service/BillingPortal/SessionService.php 0000666 00000001172 15165746005 0017242 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\BillingPortal; class SessionService extends \AmeliaStripe\Service\AbstractService { /** * Creates a session of the customer portal. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BillingPortal\Session */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/billing_portal/sessions', $params, $opts); } } stripe-php/lib/Service/FileLinkService.php 0000666 00000004044 15165746005 0014553 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class FileLinkService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of file links. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\FileLink> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/file_links', $params, $opts); } /** * Creates a new file link object. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\FileLink */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/file_links', $params, $opts); } /** * Retrieves the file link with the given ID. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\FileLink */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/file_links/%s', $id), $params, $opts); } /** * Updates an existing file link object. Expired links can no longer be updated. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\FileLink */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/file_links/%s', $id), $params, $opts); } } stripe-php/lib/Service/WebhookEndpointService.php 0000666 00000006651 15165746005 0016163 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class WebhookEndpointService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of your webhook endpoints. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\WebhookEndpoint> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/webhook_endpoints', $params, $opts); } /** * A webhook endpoint must have a <code>url</code> and a list of * <code>enabled_events</code>. You may optionally specify the Boolean * <code>connect</code> parameter. If set to true, then a Connect webhook endpoint * that notifies the specified <code>url</code> about events from all connected * accounts is created; otherwise an account webhook endpoint that notifies the * specified <code>url</code> only about events from your account is created. You * can also create webhook endpoints in the <a * href="https://dashboard.stripe.com/account/webhooks">webhooks settings</a> * section of the Dashboard. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\WebhookEndpoint */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/webhook_endpoints', $params, $opts); } /** * You can also delete webhook endpoints via the <a * href="https://dashboard.stripe.com/account/webhooks">webhook endpoint * management</a> page of the Stripe dashboard. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\WebhookEndpoint */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/webhook_endpoints/%s', $id), $params, $opts); } /** * Retrieves the webhook endpoint with the given ID. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\WebhookEndpoint */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/webhook_endpoints/%s', $id), $params, $opts); } /** * Updates the webhook endpoint. You may edit the <code>url</code>, the list of * <code>enabled_events</code>, and the status of your endpoint. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\WebhookEndpoint */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/webhook_endpoints/%s', $id), $params, $opts); } } stripe-php/lib/Service/SourceService.php 0000666 00000007215 15165746005 0014321 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class SourceService extends \AmeliaStripe\Service\AbstractService { /** * List source transactions for a given source. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\SourceTransaction> */ public function allSourceTransactions($id, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/sources/%s/source_transactions', $id), $params, $opts); } /** * Creates a new source object. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Source */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/sources', $params, $opts); } /** * Delete a specified source for a given customer. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Source */ public function detach($parentId, $id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts); } /** * Retrieves an existing source object. Supply the unique source ID from a source * creation request and Stripe will return the corresponding up-to-date source * object information. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Source */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/sources/%s', $id), $params, $opts); } /** * Updates the specified source by setting the values of the parameters passed. Any * parameters not provided will be left unchanged. * * This request accepts the <code>metadata</code> and <code>owner</code> as * arguments. It is also possible to update type specific information for selected * payment methods. Please refer to our <a href="/docs/sources">payment method * guides</a> for more detail. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Source */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/sources/%s', $id), $params, $opts); } /** * Verify a given source. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Source */ public function verify($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/sources/%s/verify', $id), $params, $opts); } } stripe-php/lib/Service/TransferService.php 0000666 00000013747 15165746005 0014654 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class TransferService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of existing transfers sent to connected accounts. The transfers * are returned in sorted order, with the most recently created transfers appearing * first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Transfer> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/transfers', $params, $opts); } /** * You can see a list of the reversals belonging to a specific transfer. Note that * the 10 most recent reversals are always available by default on the transfer * object. If you need more than those 10, you can use this API method and the * <code>limit</code> and <code>starting_after</code> parameters to page through * additional reversals. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\TransferReversal> */ public function allReversals($parentId, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/transfers/%s/reversals', $parentId), $params, $opts); } /** * To send funds from your Stripe account to a connected account, you create a new * transfer object. Your <a href="#balance">Stripe balance</a> must be able to * cover the transfer amount, or you’ll receive an “Insufficient Funds” error. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Transfer */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/transfers', $params, $opts); } /** * When you create a new reversal, you must specify a transfer to create it on. * * When reversing transfers, you can optionally reverse part of the transfer. You * can do so as many times as you wish until the entire transfer has been reversed. * * Once entirely reversed, a transfer can’t be reversed again. This method will * return an error when called on an already-reversed transfer, or when trying to * reverse more money than is left on a transfer. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TransferReversal */ public function createReversal($parentId, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/transfers/%s/reversals', $parentId), $params, $opts); } /** * Retrieves the details of an existing transfer. Supply the unique transfer ID * from either a transfer creation request or the transfer list, and Stripe will * return the corresponding transfer information. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Transfer */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/transfers/%s', $id), $params, $opts); } /** * By default, you can see the 10 most recent reversals stored directly on the * transfer object, but you can also retrieve details about a specific reversal * stored on the transfer. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TransferReversal */ public function retrieveReversal($parentId, $id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/transfers/%s/reversals/%s', $parentId, $id), $params, $opts); } /** * Updates the specified transfer by setting the values of the parameters passed. * Any parameters not provided will be left unchanged. * * This request accepts only metadata as an argument. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Transfer */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/transfers/%s', $id), $params, $opts); } /** * Updates the specified reversal by setting the values of the parameters passed. * Any parameters not provided will be left unchanged. * * This request only accepts metadata and description as arguments. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TransferReversal */ public function updateReversal($parentId, $id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/transfers/%s/reversals/%s', $parentId, $id), $params, $opts); } } stripe-php/lib/Service/TaxCodeService.php 0000666 00000002503 15165746005 0014403 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class TaxCodeService extends \AmeliaStripe\Service\AbstractService { /** * A list of <a href="https://stripe.com/docs/tax/tax-categories">all tax codes * available</a> to add to Products in order to allow specific tax calculations. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\TaxCode> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/tax_codes', $params, $opts); } /** * Retrieves the details of an existing tax code. Supply the unique tax code ID and * Stripe will return the corresponding tax code information. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TaxCode */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/tax_codes/%s', $id), $params, $opts); } } stripe-php/lib/Service/PaymentIntentService.php 0000666 00000027420 15165746005 0015660 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class PaymentIntentService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of PaymentIntents. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\PaymentIntent> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/payment_intents', $params, $opts); } /** * Manually reconcile the remaining amount for a customer_balance PaymentIntent. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentIntent */ public function applyCustomerBalance($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/payment_intents/%s/apply_customer_balance', $id), $params, $opts); } /** * A PaymentIntent object can be canceled when it is in one of these statuses: * <code>requires_payment_method</code>, <code>requires_capture</code>, * <code>requires_confirmation</code>, <code>requires_action</code>, or * <code>processing</code>. * * Once canceled, no additional charges will be made by the PaymentIntent and any * operations on the PaymentIntent will fail with an error. For PaymentIntents with * <code>status=’requires_capture’</code>, the remaining * <code>amount_capturable</code> will automatically be refunded. * * You cannot cancel the PaymentIntent for a Checkout Session. <a * href="/docs/api/checkout/sessions/expire">Expire the Checkout Session</a> * instead * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentIntent */ public function cancel($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/payment_intents/%s/cancel', $id), $params, $opts); } /** * Capture the funds of an existing uncaptured PaymentIntent when its status is * <code>requires_capture</code>. * * Uncaptured PaymentIntents will be canceled a set number of days after they are * created (7 by default). * * Learn more about <a href="/docs/payments/capture-later">separate authorization * and capture</a>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentIntent */ public function capture($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/payment_intents/%s/capture', $id), $params, $opts); } /** * Confirm that your customer intends to pay with current or provided payment * method. Upon confirmation, the PaymentIntent will attempt to initiate a payment. * * If the selected payment method requires additional authentication steps, the * PaymentIntent will transition to the <code>requires_action</code> status and * suggest additional actions via <code>next_action</code>. If payment fails, the * PaymentIntent will transition to the <code>requires_payment_method</code> * status. If payment succeeds, the PaymentIntent will transition to the * <code>succeeded</code> status (or <code>requires_capture</code>, if * <code>capture_method</code> is set to <code>manual</code>). * * If the <code>confirmation_method</code> is <code>automatic</code>, payment may * be attempted using our <a * href="/docs/stripe-js/reference#stripe-handle-card-payment">client SDKs</a> and * the PaymentIntent’s <a * href="#payment_intent_object-client_secret">client_secret</a>. After * <code>next_action</code>s are handled by the client, no additional confirmation * is required to complete the payment. * * If the <code>confirmation_method</code> is <code>manual</code>, all payment * attempts must be initiated using a secret key. If any actions are required for * the payment, the PaymentIntent will return to the * <code>requires_confirmation</code> state after those actions are completed. Your * server needs to then explicitly re-confirm the PaymentIntent to initiate the * next payment attempt. Read the <a * href="/docs/payments/payment-intents/web-manual">expanded documentation</a> to * learn more about manual confirmation. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentIntent */ public function confirm($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/payment_intents/%s/confirm', $id), $params, $opts); } /** * Creates a PaymentIntent object. * * After the PaymentIntent is created, attach a payment method and <a * href="/docs/api/payment_intents/confirm">confirm</a> to continue the payment. * You can read more about the different payment flows available via the Payment * Intents API <a href="/docs/payments/payment-intents">here</a>. * * When <code>confirm=true</code> is used during creation, it is equivalent to * creating and confirming the PaymentIntent in the same call. You may use any * parameters available in the <a href="/docs/api/payment_intents/confirm">confirm * API</a> when <code>confirm=true</code> is supplied. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentIntent */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/payment_intents', $params, $opts); } /** * Perform an incremental authorization on an eligible <a * href="/docs/api/payment_intents/object">PaymentIntent</a>. To be eligible, the * PaymentIntent’s status must be <code>requires_capture</code> and <a * href="/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported">incremental_authorization_supported</a> * must be <code>true</code>. * * Incremental authorizations attempt to increase the authorized amount on your * customer’s card to the new, higher <code>amount</code> provided. As with the * initial authorization, incremental authorizations may be declined. A single * PaymentIntent can call this endpoint multiple times to further increase the * authorized amount. * * If the incremental authorization succeeds, the PaymentIntent object is returned * with the updated <a * href="/docs/api/payment_intents/object#payment_intent_object-amount">amount</a>. * If the incremental authorization fails, a <a * href="/docs/error-codes#card-declined">card_declined</a> error is returned, and * no fields on the PaymentIntent or Charge are updated. The PaymentIntent object * remains capturable for the previously authorized amount. * * Each PaymentIntent can have a maximum of 10 incremental authorization attempts, * including declines. Once captured, a PaymentIntent can no longer be incremented. * * Learn more about <a * href="/docs/terminal/features/incremental-authorizations">incremental * authorizations</a>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentIntent */ public function incrementAuthorization($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/payment_intents/%s/increment_authorization', $id), $params, $opts); } /** * Retrieves the details of a PaymentIntent that has previously been created. * * Client-side retrieval using a publishable key is allowed when the * <code>client_secret</code> is provided in the query string. * * When retrieved with a publishable key, only a subset of properties will be * returned. Please refer to the <a href="#payment_intent_object">payment * intent</a> object reference for more details. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentIntent */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/payment_intents/%s', $id), $params, $opts); } /** * Search for PaymentIntents you’ve previously created using Stripe’s <a * href="/docs/search#search-query-language">Search Query Language</a>. Don’t use * search in read-after-write flows where strict consistency is necessary. Under * normal operating conditions, data is searchable in less than a minute. * Occasionally, propagation of new or updated data can be up to an hour behind * during outages. Search functionality is not available to merchants in India. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SearchResult<\AmeliaStripe\PaymentIntent> */ public function search($params = null, $opts = null) { return $this->requestSearchResult('get', '/v1/payment_intents/search', $params, $opts); } /** * Updates properties on a PaymentIntent object without confirming. * * Depending on which properties you update, you may need to confirm the * PaymentIntent again. For example, updating the <code>payment_method</code> will * always require you to confirm the PaymentIntent again. If you prefer to update * and confirm at the same time, we recommend updating properties via the <a * href="/docs/api/payment_intents/confirm">confirm API</a> instead. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentIntent */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/payment_intents/%s', $id), $params, $opts); } /** * Verifies microdeposits on a PaymentIntent object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentIntent */ public function verifyMicrodeposits($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/payment_intents/%s/verify_microdeposits', $id), $params, $opts); } } stripe-php/lib/Service/ApplePayDomainService.php 0000666 00000004027 15165746005 0015722 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class ApplePayDomainService extends \AmeliaStripe\Service\AbstractService { /** * List apple pay domains. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\ApplePayDomain> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/apple_pay/domains', $params, $opts); } /** * Create an apple pay domain. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\ApplePayDomain */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/apple_pay/domains', $params, $opts); } /** * Delete an apple pay domain. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\ApplePayDomain */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/apple_pay/domains/%s', $id), $params, $opts); } /** * Retrieve an apple pay domain. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\ApplePayDomain */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/apple_pay/domains/%s', $id), $params, $opts); } } stripe-php/lib/Service/InvoiceItemService.php 0000666 00000006127 15165746005 0015275 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class InvoiceItemService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of your invoice items. Invoice items are returned sorted by * creation date, with the most recently created invoice items appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\InvoiceItem> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/invoiceitems', $params, $opts); } /** * Creates an item to be added to a draft invoice (up to 250 items per invoice). If * no invoice is specified, the item will be on the next invoice created for the * customer specified. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\InvoiceItem */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/invoiceitems', $params, $opts); } /** * Deletes an invoice item, removing it from an invoice. Deleting invoice items is * only possible when they’re not attached to invoices, or if it’s attached to a * draft invoice. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\InvoiceItem */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/invoiceitems/%s', $id), $params, $opts); } /** * Retrieves the invoice item with the given ID. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\InvoiceItem */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/invoiceitems/%s', $id), $params, $opts); } /** * Updates the amount or description of an invoice item on an upcoming invoice. * Updating an invoice item is only possible before the invoice it’s attached to is * closed. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\InvoiceItem */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/invoiceitems/%s', $id), $params, $opts); } } stripe-php/lib/Service/PromotionCodeService.php 0000666 00000004706 15165746005 0015644 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class PromotionCodeService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of your promotion codes. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\PromotionCode> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/promotion_codes', $params, $opts); } /** * A promotion code points to a coupon. You can optionally restrict the code to a * specific customer, redemption limit, and expiration date. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PromotionCode */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/promotion_codes', $params, $opts); } /** * Retrieves the promotion code with the given ID. In order to retrieve a promotion * code by the customer-facing <code>code</code> use <a * href="/docs/api/promotion_codes/list">list</a> with the desired * <code>code</code>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PromotionCode */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/promotion_codes/%s', $id), $params, $opts); } /** * Updates the specified promotion code by setting the values of the parameters * passed. Most fields are, by design, not editable. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PromotionCode */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/promotion_codes/%s', $id), $params, $opts); } } stripe-php/lib/Service/BalanceService.php 0000666 00000001453 15165746005 0014404 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class BalanceService extends \AmeliaStripe\Service\AbstractService { /** * Retrieves the current account balance, based on the authentication that was used * to make the request. For a sample request, see <a * href="/docs/connect/account-balances#accounting-for-negative-balances">Accounting * for negative balances</a>. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Balance */ public function retrieve($params = null, $opts = null) { return $this->request('get', '/v1/balance', $params, $opts); } } stripe-php/lib/Service/ApplicationFeeService.php 0000666 00000011456 15165746005 0015746 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class ApplicationFeeService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of application fees you’ve previously collected. The application * fees are returned in sorted order, with the most recent fees appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\ApplicationFee> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/application_fees', $params, $opts); } /** * You can see a list of the refunds belonging to a specific application fee. Note * that the 10 most recent refunds are always available by default on the * application fee object. If you need more than those 10, you can use this API * method and the <code>limit</code> and <code>starting_after</code> parameters to * page through additional refunds. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\ApplicationFeeRefund> */ public function allRefunds($parentId, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/application_fees/%s/refunds', $parentId), $params, $opts); } /** * Refunds an application fee that has previously been collected but not yet * refunded. Funds will be refunded to the Stripe account from which the fee was * originally collected. * * You can optionally refund only part of an application fee. You can do so * multiple times, until the entire fee has been refunded. * * Once entirely refunded, an application fee can’t be refunded again. This method * will raise an error when called on an already-refunded application fee, or when * trying to refund more money than is left on an application fee. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\ApplicationFeeRefund */ public function createRefund($parentId, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/application_fees/%s/refunds', $parentId), $params, $opts); } /** * Retrieves the details of an application fee that your account has collected. The * same information is returned when refunding the application fee. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\ApplicationFee */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/application_fees/%s', $id), $params, $opts); } /** * By default, you can see the 10 most recent refunds stored directly on the * application fee object, but you can also retrieve details about a specific * refund stored on the application fee. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\ApplicationFeeRefund */ public function retrieveRefund($parentId, $id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/application_fees/%s/refunds/%s', $parentId, $id), $params, $opts); } /** * Updates the specified application fee refund by setting the values of the * parameters passed. Any parameters not provided will be left unchanged. * * This request only accepts metadata as an argument. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\ApplicationFeeRefund */ public function updateRefund($parentId, $id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/application_fees/%s/refunds/%s', $parentId, $id), $params, $opts); } } stripe-php/lib/Service/QuoteService.php 0000666 00000013714 15165746005 0014157 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class QuoteService extends \AmeliaStripe\Service\AbstractService { /** * Accepts the specified quote. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Quote */ public function accept($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/quotes/%s/accept', $id), $params, $opts); } /** * Returns a list of your quotes. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Quote> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/quotes', $params, $opts); } /** * When retrieving a quote, there is an includable <a * href="https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items"><strong>computed.upfront.line_items</strong></a> * property containing the first handful of those items. There is also a URL where * you can retrieve the full (paginated) list of upfront line items. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\LineItem> */ public function allComputedUpfrontLineItems($id, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/computed_upfront_line_items', $id), $params, $opts); } /** * When retrieving a quote, there is an includable <strong>line_items</strong> * property containing the first handful of those items. There is also a URL where * you can retrieve the full (paginated) list of line items. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\LineItem> */ public function allLineItems($id, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/line_items', $id), $params, $opts); } /** * Cancels the quote. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Quote */ public function cancel($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/quotes/%s/cancel', $id), $params, $opts); } /** * A quote models prices and services for a customer. Default options for * <code>header</code>, <code>description</code>, <code>footer</code>, and * <code>expires_at</code> can be set in the dashboard via the <a * href="https://dashboard.stripe.com/settings/billing/quote">quote template</a>. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Quote */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/quotes', $params, $opts); } /** * Finalizes the quote. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Quote */ public function finalizeQuote($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/quotes/%s/finalize', $id), $params, $opts); } /** * Retrieves the quote with the given ID. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Quote */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/quotes/%s', $id), $params, $opts); } /** * A quote models prices and services for a customer. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Quote */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/quotes/%s', $id), $params, $opts); } /** * Download the PDF for a finalized quote. * * @param string $id * @param callable $readBodyChunkCallable * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails */ public function pdf($id, $readBodyChunkCallable, $params = null, $opts = null) { $opts = \AmeliaStripe\Util\RequestOptions::parse($opts); if (!isset($opts->apiBase)) { $opts->apiBase = $this->getClient()->getFilesBase(); } $this->requestStream('get', $this->buildPath('/v1/quotes/%s/pdf', $id), $readBodyChunkCallable, $params, $opts); } } stripe-php/lib/Service/SubscriptionService.php 0000666 00000014235 15165746005 0015545 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class SubscriptionService extends \AmeliaStripe\Service\AbstractService { /** * By default, returns a list of subscriptions that have not been canceled. In * order to list canceled subscriptions, specify <code>status=canceled</code>. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Subscription> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/subscriptions', $params, $opts); } /** * Cancels a customer’s subscription immediately. The customer will not be charged * again for the subscription. * * Note, however, that any pending invoice items that you’ve created will still be * charged for at the end of the period, unless manually <a * href="#delete_invoiceitem">deleted</a>. If you’ve set the subscription to cancel * at the end of the period, any pending prorations will also be left in place and * collected at the end of the period. But if the subscription is set to cancel * immediately, pending prorations will be removed. * * By default, upon subscription cancellation, Stripe will stop automatic * collection of all finalized invoices for the customer. This is intended to * prevent unexpected payment attempts after the customer has canceled a * subscription. However, you can resume automatic collection of the invoices * manually after subscription cancellation to have us proceed. Or, you could check * for unpaid invoices before allowing the customer to cancel the subscription at * all. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Subscription */ public function cancel($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/subscriptions/%s', $id), $params, $opts); } /** * Creates a new subscription on an existing customer. Each customer can have up to * 500 active or scheduled subscriptions. * * When you create a subscription with * <code>collection_method=charge_automatically</code>, the first invoice is * finalized as part of the request. The <code>payment_behavior</code> parameter * determines the exact behavior of the initial payment. * * To start subscriptions where the first invoice always begins in a * <code>draft</code> status, use <a * href="/docs/billing/subscriptions/subscription-schedules#managing">subscription * schedules</a> instead. Schedules provide the flexibility to model more complex * billing configurations that change over time. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Subscription */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/subscriptions', $params, $opts); } /** * Removes the currently applied discount on a subscription. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Subscription */ public function deleteDiscount($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/subscriptions/%s/discount', $id), $params, $opts); } /** * Retrieves the subscription with the given ID. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Subscription */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/subscriptions/%s', $id), $params, $opts); } /** * Search for subscriptions you’ve previously created using Stripe’s <a * href="/docs/search#search-query-language">Search Query Language</a>. Don’t use * search in read-after-write flows where strict consistency is necessary. Under * normal operating conditions, data is searchable in less than a minute. * Occasionally, propagation of new or updated data can be up to an hour behind * during outages. Search functionality is not available to merchants in India. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SearchResult<\AmeliaStripe\Subscription> */ public function search($params = null, $opts = null) { return $this->requestSearchResult('get', '/v1/subscriptions/search', $params, $opts); } /** * Updates an existing subscription on a customer to match the specified * parameters. When changing plans or quantities, we will optionally prorate the * price we charge next month to make up for any price changes. To preview how the * proration will be calculated, use the <a href="#upcoming_invoice">upcoming * invoice</a> endpoint. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Subscription */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/subscriptions/%s', $id), $params, $opts); } } stripe-php/lib/Service/PaymentLinkService.php 0000666 00000005351 15165746005 0015313 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class PaymentLinkService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of your payment links. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\PaymentLink> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/payment_links', $params, $opts); } /** * When retrieving a payment link, there is an includable * <strong>line_items</strong> property containing the first handful of those * items. There is also a URL where you can retrieve the full (paginated) list of * line items. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\LineItem> */ public function allLineItems($id, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/payment_links/%s/line_items', $id), $params, $opts); } /** * Creates a payment link. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentLink */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/payment_links', $params, $opts); } /** * Retrieve a payment link. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentLink */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/payment_links/%s', $id), $params, $opts); } /** * Updates a payment link. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentLink */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/payment_links/%s', $id), $params, $opts); } } stripe-php/lib/Service/Treasury/ReceivedCreditService.php 0000666 00000002402 15165746005 0017551 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Treasury; class ReceivedCreditService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of ReceivedCredits. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Treasury\ReceivedCredit> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/treasury/received_credits', $params, $opts); } /** * Retrieves the details of an existing ReceivedCredit by passing the unique * ReceivedCredit ID from the ReceivedCredit list. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\ReceivedCredit */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/treasury/received_credits/%s', $id), $params, $opts); } } stripe-php/lib/Service/Treasury/ReceivedDebitService.php 0000666 00000002371 15165746005 0017373 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Treasury; class ReceivedDebitService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of ReceivedDebits. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Treasury\ReceivedDebit> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/treasury/received_debits', $params, $opts); } /** * Retrieves the details of an existing ReceivedDebit by passing the unique * ReceivedDebit ID from the ReceivedDebit list. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\ReceivedDebit */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/treasury/received_debits/%s', $id), $params, $opts); } } stripe-php/lib/Service/Treasury/CreditReversalService.php 0000666 00000003441 15165746005 0017612 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Treasury; class CreditReversalService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of CreditReversals. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Treasury\CreditReversal> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/treasury/credit_reversals', $params, $opts); } /** * Reverses a ReceivedCredit and creates a CreditReversal object. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\CreditReversal */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/treasury/credit_reversals', $params, $opts); } /** * Retrieves the details of an existing CreditReversal by passing the unique * CreditReversal ID from either the CreditReversal creation request or * CreditReversal list. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\CreditReversal */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/treasury/credit_reversals/%s', $id), $params, $opts); } } stripe-php/lib/Service/Treasury/FinancialAccountService.php 0000666 00000006545 15165746005 0020105 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Treasury; class FinancialAccountService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of FinancialAccounts. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Treasury\FinancialAccount> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/treasury/financial_accounts', $params, $opts); } /** * Creates a new FinancialAccount. For now, each connected account can only have * one FinancialAccount. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\FinancialAccount */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/treasury/financial_accounts', $params, $opts); } /** * Retrieves the details of a FinancialAccount. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\FinancialAccount */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/treasury/financial_accounts/%s', $id), $params, $opts); } /** * Retrieves Features information associated with the FinancialAccount. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\FinancialAccount */ public function retrieveFeatures($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/treasury/financial_accounts/%s/features', $id), $params, $opts); } /** * Updates the details of a FinancialAccount. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\FinancialAccount */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/treasury/financial_accounts/%s', $id), $params, $opts); } /** * Updates the Features associated with a FinancialAccount. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\FinancialAccount */ public function updateFeatures($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/treasury/financial_accounts/%s/features', $id), $params, $opts); } } stripe-php/lib/Service/Treasury/DebitReversalService.php 0000666 00000003207 15165746005 0017427 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Treasury; class DebitReversalService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of DebitReversals. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Treasury\DebitReversal> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/treasury/debit_reversals', $params, $opts); } /** * Reverses a ReceivedDebit and creates a DebitReversal object. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\DebitReversal */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/treasury/debit_reversals', $params, $opts); } /** * Retrieves a DebitReversal object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\DebitReversal */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/treasury/debit_reversals/%s', $id), $params, $opts); } } stripe-php/lib/Service/Treasury/TransactionService.php 0000666 00000002250 15165746005 0017156 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Treasury; class TransactionService extends \AmeliaStripe\Service\AbstractService { /** * Retrieves a list of Transaction objects. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Treasury\Transaction> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/treasury/transactions', $params, $opts); } /** * Retrieves the details of an existing Transaction. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\Transaction */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/treasury/transactions/%s', $id), $params, $opts); } } stripe-php/lib/Service/Treasury/TransactionEntryService.php 0000666 00000002275 15165746005 0020207 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Treasury; class TransactionEntryService extends \AmeliaStripe\Service\AbstractService { /** * Retrieves a list of TransactionEntry objects. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Treasury\TransactionEntry> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/treasury/transaction_entries', $params, $opts); } /** * Retrieves a TransactionEntry object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\TransactionEntry */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/treasury/transaction_entries/%s', $id), $params, $opts); } } stripe-php/lib/Service/Treasury/OutboundTransferService.php 0000666 00000004577 15165746005 0020213 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Treasury; class OutboundTransferService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of OutboundTransfers sent from the specified FinancialAccount. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Treasury\OutboundTransfer> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/treasury/outbound_transfers', $params, $opts); } /** * An OutboundTransfer can be canceled if the funds have not yet been paid out. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\OutboundTransfer */ public function cancel($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/treasury/outbound_transfers/%s/cancel', $id), $params, $opts); } /** * Creates an OutboundTransfer. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\OutboundTransfer */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/treasury/outbound_transfers', $params, $opts); } /** * Retrieves the details of an existing OutboundTransfer by passing the unique * OutboundTransfer ID from either the OutboundTransfer creation request or * OutboundTransfer list. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\OutboundTransfer */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/treasury/outbound_transfers/%s', $id), $params, $opts); } } stripe-php/lib/Service/Treasury/TreasuryServiceFactory.php 0000666 00000003124 15165746005 0020040 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Treasury; /** * Service factory class for API resources in the Treasury namespace. * * @property CreditReversalService $creditReversals * @property DebitReversalService $debitReversals * @property FinancialAccountService $financialAccounts * @property InboundTransferService $inboundTransfers * @property OutboundPaymentService $outboundPayments * @property OutboundTransferService $outboundTransfers * @property ReceivedCreditService $receivedCredits * @property ReceivedDebitService $receivedDebits * @property TransactionEntryService $transactionEntries * @property TransactionService $transactions */ class TreasuryServiceFactory extends \AmeliaStripe\Service\AbstractServiceFactory { /** * @var array<string, string> */ private static $classMap = [ 'creditReversals' => CreditReversalService::class, 'debitReversals' => DebitReversalService::class, 'financialAccounts' => FinancialAccountService::class, 'inboundTransfers' => InboundTransferService::class, 'outboundPayments' => OutboundPaymentService::class, 'outboundTransfers' => OutboundTransferService::class, 'receivedCredits' => ReceivedCreditService::class, 'receivedDebits' => ReceivedDebitService::class, 'transactionEntries' => TransactionEntryService::class, 'transactions' => TransactionService::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } stripe-php/lib/Service/Treasury/InboundTransferService.php 0000666 00000004277 15165746005 0020007 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Treasury; class InboundTransferService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of InboundTransfers sent from the specified FinancialAccount. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Treasury\InboundTransfer> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/treasury/inbound_transfers', $params, $opts); } /** * Cancels an InboundTransfer. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\InboundTransfer */ public function cancel($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/treasury/inbound_transfers/%s/cancel', $id), $params, $opts); } /** * Creates an InboundTransfer. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\InboundTransfer */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/treasury/inbound_transfers', $params, $opts); } /** * Retrieves the details of an existing InboundTransfer. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\InboundTransfer */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/treasury/inbound_transfers/%s', $id), $params, $opts); } } stripe-php/lib/Service/Treasury/OutboundPaymentService.php 0000666 00000004476 15165746005 0020042 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Treasury; class OutboundPaymentService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of OutboundPayments sent from the specified FinancialAccount. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Treasury\OutboundPayment> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/treasury/outbound_payments', $params, $opts); } /** * Cancel an OutboundPayment. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\OutboundPayment */ public function cancel($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/treasury/outbound_payments/%s/cancel', $id), $params, $opts); } /** * Creates an OutboundPayment. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\OutboundPayment */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/treasury/outbound_payments', $params, $opts); } /** * Retrieves the details of an existing OutboundPayment by passing the unique * OutboundPayment ID from either the OutboundPayment creation request or * OutboundPayment list. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\OutboundPayment */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/treasury/outbound_payments/%s', $id), $params, $opts); } } stripe-php/lib/Service/Reporting/ReportRunService.php 0000666 00000003421 15165746005 0016765 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Reporting; class ReportRunService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of Report Runs, with the most recent appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Reporting\ReportRun> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/reporting/report_runs', $params, $opts); } /** * Creates a new object and begin running the report. (Certain report types require * a <a href="https://stripe.com/docs/keys#test-live-modes">live-mode API key</a>.). * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Reporting\ReportRun */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/reporting/report_runs', $params, $opts); } /** * Retrieves the details of an existing Report Run. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Reporting\ReportRun */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/reporting/report_runs/%s', $id), $params, $opts); } } stripe-php/lib/Service/Reporting/ReportTypeService.php 0000666 00000002423 15165746005 0017143 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Reporting; class ReportTypeService extends \AmeliaStripe\Service\AbstractService { /** * Returns a full list of Report Types. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Reporting\ReportType> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/reporting/report_types', $params, $opts); } /** * Retrieves the details of a Report Type. (Certain report types require a <a * href="https://stripe.com/docs/keys#test-live-modes">live-mode API key</a>.). * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Reporting\ReportType */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/reporting/report_types/%s', $id), $params, $opts); } } stripe-php/lib/Service/Reporting/ReportingServiceFactory.php 0000666 00000001255 15165746005 0020331 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Reporting; /** * Service factory class for API resources in the Reporting namespace. * * @property ReportRunService $reportRuns * @property ReportTypeService $reportTypes */ class ReportingServiceFactory extends \AmeliaStripe\Service\AbstractServiceFactory { /** * @var array<string, string> */ private static $classMap = [ 'reportRuns' => ReportRunService::class, 'reportTypes' => ReportTypeService::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } stripe-php/lib/Service/TopupService.php 0000666 00000005277 15165746005 0014176 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class TopupService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of top-ups. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Topup> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/topups', $params, $opts); } /** * Cancels a top-up. Only pending top-ups can be canceled. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Topup */ public function cancel($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/topups/%s/cancel', $id), $params, $opts); } /** * Top up the balance of an account. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Topup */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/topups', $params, $opts); } /** * Retrieves the details of a top-up that has previously been created. Supply the * unique top-up ID that was returned from your previous request, and Stripe will * return the corresponding top-up information. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Topup */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/topups/%s', $id), $params, $opts); } /** * Updates the metadata of a top-up. Other top-up details are not editable by * design. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Topup */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/topups/%s', $id), $params, $opts); } } stripe-php/lib/Service/RefundService.php 0000666 00000006066 15165746005 0014307 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class RefundService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of all refunds you’ve previously created. The refunds are * returned in sorted order, with the most recent refunds appearing first. For * convenience, the 10 most recent refunds are always available by default on the * charge object. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Refund> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/refunds', $params, $opts); } /** * Cancels a refund with a status of <code>requires_action</code>. * * Refunds in other states cannot be canceled, and only refunds for payment methods * that require customer action will enter the <code>requires_action</code> state. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Refund */ public function cancel($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/refunds/%s/cancel', $id), $params, $opts); } /** * Create a refund. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Refund */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/refunds', $params, $opts); } /** * Retrieves the details of an existing refund. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Refund */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/refunds/%s', $id), $params, $opts); } /** * Updates the specified refund by setting the values of the parameters passed. Any * parameters not provided will be left unchanged. * * This request only accepts <code>metadata</code> as an argument. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Refund */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/refunds/%s', $id), $params, $opts); } } stripe-php/lib/Service/ChargeService.php 0000666 00000011132 15165746005 0014243 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class ChargeService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of charges you’ve previously created. The charges are returned in * sorted order, with the most recent charges appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Charge> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/charges', $params, $opts); } /** * Capture the payment of an existing, uncaptured, charge. This is the second half * of the two-step payment flow, where first you <a href="#create_charge">created a * charge</a> with the capture option set to false. * * Uncaptured payments expire a set number of days after they are created (<a * href="/docs/charges/placing-a-hold">7 by default</a>). If they are not captured * by that point in time, they will be marked as refunded and will no longer be * capturable. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Charge */ public function capture($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/charges/%s/capture', $id), $params, $opts); } /** * To charge a credit card or other payment source, you create a * <code>Charge</code> object. If your API key is in test mode, the supplied * payment source (e.g., card) won’t actually be charged, although everything else * will occur as if in live mode. (Stripe assumes that the charge would have * completed successfully). * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Charge */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/charges', $params, $opts); } /** * Retrieves the details of a charge that has previously been created. Supply the * unique charge ID that was returned from your previous request, and Stripe will * return the corresponding charge information. The same information is returned * when creating or refunding the charge. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Charge */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/charges/%s', $id), $params, $opts); } /** * Search for charges you’ve previously created using Stripe’s <a * href="/docs/search#search-query-language">Search Query Language</a>. Don’t use * search in read-after-write flows where strict consistency is necessary. Under * normal operating conditions, data is searchable in less than a minute. * Occasionally, propagation of new or updated data can be up to an hour behind * during outages. Search functionality is not available to merchants in India. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SearchResult<\AmeliaStripe\Charge> */ public function search($params = null, $opts = null) { return $this->requestSearchResult('get', '/v1/charges/search', $params, $opts); } /** * Updates the specified charge by setting the values of the parameters passed. Any * parameters not provided will be left unchanged. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Charge */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/charges/%s', $id), $params, $opts); } } stripe-php/lib/Service/SubscriptionItemService.php 0000666 00000013612 15165746005 0016362 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class SubscriptionItemService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of your subscription items for a given subscription. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\SubscriptionItem> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/subscription_items', $params, $opts); } /** * For the specified subscription item, returns a list of summary objects. Each * object in the list provides usage information that’s been summarized from * multiple usage records and over a subscription billing period (e.g., 15 usage * records in the month of September). * * The list is sorted in reverse-chronological order (newest first). The first list * item represents the most current usage period that hasn’t ended yet. Since new * usage records can still be added, the returned summary information for the * subscription item’s ID should be seen as unstable until the subscription billing * period ends. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\UsageRecordSummary> */ public function allUsageRecordSummaries($parentId, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/subscription_items/%s/usage_record_summaries', $parentId), $params, $opts); } /** * Adds a new item to an existing subscription. No existing items will be changed * or replaced. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SubscriptionItem */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/subscription_items', $params, $opts); } /** * Creates a usage record for a specified subscription item and date, and fills it * with a quantity. * * Usage records provide <code>quantity</code> information that Stripe uses to * track how much a customer is using your service. With usage information and the * pricing model set up by the <a * href="https://stripe.com/docs/billing/subscriptions/metered-billing">metered * billing</a> plan, Stripe helps you send accurate invoices to your customers. * * The default calculation for usage is to add up all the <code>quantity</code> * values of the usage records within a billing period. You can change this default * behavior with the billing plan’s <code>aggregate_usage</code> <a * href="/docs/api/plans/create#create_plan-aggregate_usage">parameter</a>. When * there is more than one usage record with the same timestamp, Stripe adds the * <code>quantity</code> values together. In most cases, this is the desired * resolution, however, you can change this behavior with the <code>action</code> * parameter. * * The default pricing model for metered billing is <a * href="/docs/api/plans/object#plan_object-billing_scheme">per-unit pricing</a>. * For finer granularity, you can configure metered billing to have a <a * href="https://stripe.com/docs/billing/subscriptions/tiers">tiered pricing</a> * model. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\UsageRecord */ public function createUsageRecord($parentId, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/subscription_items/%s/usage_records', $parentId), $params, $opts); } /** * Deletes an item from the subscription. Removing a subscription item from a * subscription will not cancel the subscription. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SubscriptionItem */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/subscription_items/%s', $id), $params, $opts); } /** * Retrieves the subscription item with the given ID. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SubscriptionItem */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/subscription_items/%s', $id), $params, $opts); } /** * Updates the plan or quantity of an item on a current subscription. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SubscriptionItem */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/subscription_items/%s', $id), $params, $opts); } } stripe-php/lib/Service/SubscriptionScheduleService.php 0000666 00000010073 15165746005 0017216 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class SubscriptionScheduleService extends \AmeliaStripe\Service\AbstractService { /** * Retrieves the list of your subscription schedules. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\SubscriptionSchedule> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/subscription_schedules', $params, $opts); } /** * Cancels a subscription schedule and its associated subscription immediately (if * the subscription schedule has an active subscription). A subscription schedule * can only be canceled if its status is <code>not_started</code> or * <code>active</code>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SubscriptionSchedule */ public function cancel($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/subscription_schedules/%s/cancel', $id), $params, $opts); } /** * Creates a new subscription schedule object. Each customer can have up to 500 * active or scheduled subscriptions. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SubscriptionSchedule */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/subscription_schedules', $params, $opts); } /** * Releases the subscription schedule immediately, which will stop scheduling of * its phases, but leave any existing subscription in place. A schedule can only be * released if its status is <code>not_started</code> or <code>active</code>. If * the subscription schedule is currently associated with a subscription, releasing * it will remove its <code>subscription</code> property and set the subscription’s * ID to the <code>released_subscription</code> property. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SubscriptionSchedule */ public function release($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/subscription_schedules/%s/release', $id), $params, $opts); } /** * Retrieves the details of an existing subscription schedule. You only need to * supply the unique subscription schedule identifier that was returned upon * subscription schedule creation. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SubscriptionSchedule */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/subscription_schedules/%s', $id), $params, $opts); } /** * Updates an existing subscription schedule. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SubscriptionSchedule */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/subscription_schedules/%s', $id), $params, $opts); } } stripe-php/lib/Service/EventService.php 0000666 00000002725 15165746005 0014143 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class EventService extends \AmeliaStripe\Service\AbstractService { /** * List events, going back up to 30 days. Each event data is rendered according to * Stripe API version at its creation time, specified in <a * href="/docs/api/events/object">event object</a> <code>api_version</code> * attribute (not according to your current Stripe API version or * <code>Stripe-Version</code> header). * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Event> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/events', $params, $opts); } /** * Retrieves the details of an event. Supply the unique identifier of the event, * which you might have received in a webhook. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Event */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/events/%s', $id), $params, $opts); } } stripe-php/lib/Service/CoreServiceFactory.php 0000666 00000014110 15165746005 0015271 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; /** * Service factory class for API resources in the root namespace. * * @property AccountLinkService $accountLinks * @property AccountService $accounts * @property ApplePayDomainService $applePayDomains * @property ApplicationFeeService $applicationFees * @property Apps\AppsServiceFactory $apps * @property BalanceService $balance * @property BalanceTransactionService $balanceTransactions * @property BillingPortal\BillingPortalServiceFactory $billingPortal * @property ChargeService $charges * @property Checkout\CheckoutServiceFactory $checkout * @property CountrySpecService $countrySpecs * @property CouponService $coupons * @property CreditNoteService $creditNotes * @property CustomerService $customers * @property DisputeService $disputes * @property EphemeralKeyService $ephemeralKeys * @property EventService $events * @property ExchangeRateService $exchangeRates * @property FileLinkService $fileLinks * @property FileService $files * @property FinancialConnections\FinancialConnectionsServiceFactory $financialConnections * @property Identity\IdentityServiceFactory $identity * @property InvoiceItemService $invoiceItems * @property InvoiceService $invoices * @property Issuing\IssuingServiceFactory $issuing * @property MandateService $mandates * @property OAuthService $oauth * @property OrderService $orders * @property PaymentIntentService $paymentIntents * @property PaymentLinkService $paymentLinks * @property PaymentMethodService $paymentMethods * @property PayoutService $payouts * @property PlanService $plans * @property PriceService $prices * @property ProductService $products * @property PromotionCodeService $promotionCodes * @property QuoteService $quotes * @property Radar\RadarServiceFactory $radar * @property RefundService $refunds * @property Reporting\ReportingServiceFactory $reporting * @property ReviewService $reviews * @property SetupAttemptService $setupAttempts * @property SetupIntentService $setupIntents * @property ShippingRateService $shippingRates * @property Sigma\SigmaServiceFactory $sigma * @property SkuService $skus * @property SourceService $sources * @property SubscriptionItemService $subscriptionItems * @property SubscriptionService $subscriptions * @property SubscriptionScheduleService $subscriptionSchedules * @property TaxCodeService $taxCodes * @property TaxRateService $taxRates * @property Terminal\TerminalServiceFactory $terminal * @property TestHelpers\TestHelpersServiceFactory $testHelpers * @property TokenService $tokens * @property TopupService $topups * @property TransferService $transfers * @property Treasury\TreasuryServiceFactory $treasury * @property WebhookEndpointService $webhookEndpoints */ class CoreServiceFactory extends \AmeliaStripe\Service\AbstractServiceFactory { /** * @var array<string, string> */ private static $classMap = [ 'accountLinks' => AccountLinkService::class, 'accounts' => AccountService::class, 'applePayDomains' => ApplePayDomainService::class, 'applicationFees' => ApplicationFeeService::class, 'apps' => Apps\AppsServiceFactory::class, 'balance' => BalanceService::class, 'balanceTransactions' => BalanceTransactionService::class, 'billingPortal' => BillingPortal\BillingPortalServiceFactory::class, 'charges' => ChargeService::class, 'checkout' => Checkout\CheckoutServiceFactory::class, 'countrySpecs' => CountrySpecService::class, 'coupons' => CouponService::class, 'creditNotes' => CreditNoteService::class, 'customers' => CustomerService::class, 'disputes' => DisputeService::class, 'ephemeralKeys' => EphemeralKeyService::class, 'events' => EventService::class, 'exchangeRates' => ExchangeRateService::class, 'fileLinks' => FileLinkService::class, 'files' => FileService::class, 'financialConnections' => FinancialConnections\FinancialConnectionsServiceFactory::class, 'identity' => Identity\IdentityServiceFactory::class, 'invoiceItems' => InvoiceItemService::class, 'invoices' => InvoiceService::class, 'issuing' => Issuing\IssuingServiceFactory::class, 'mandates' => MandateService::class, 'oauth' => OAuthService::class, 'orders' => OrderService::class, 'paymentIntents' => PaymentIntentService::class, 'paymentLinks' => PaymentLinkService::class, 'paymentMethods' => PaymentMethodService::class, 'payouts' => PayoutService::class, 'plans' => PlanService::class, 'prices' => PriceService::class, 'products' => ProductService::class, 'promotionCodes' => PromotionCodeService::class, 'quotes' => QuoteService::class, 'radar' => Radar\RadarServiceFactory::class, 'refunds' => RefundService::class, 'reporting' => Reporting\ReportingServiceFactory::class, 'reviews' => ReviewService::class, 'setupAttempts' => SetupAttemptService::class, 'setupIntents' => SetupIntentService::class, 'shippingRates' => ShippingRateService::class, 'sigma' => Sigma\SigmaServiceFactory::class, 'skus' => SkuService::class, 'sources' => SourceService::class, 'subscriptionItems' => SubscriptionItemService::class, 'subscriptions' => SubscriptionService::class, 'subscriptionSchedules' => SubscriptionScheduleService::class, 'taxCodes' => TaxCodeService::class, 'taxRates' => TaxRateService::class, 'terminal' => Terminal\TerminalServiceFactory::class, 'testHelpers' => TestHelpers\TestHelpersServiceFactory::class, 'tokens' => TokenService::class, 'topups' => TopupService::class, 'transfers' => TransferService::class, 'treasury' => Treasury\TreasuryServiceFactory::class, 'webhookEndpoints' => WebhookEndpointService::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } stripe-php/lib/Service/Terminal/ConnectionTokenService.php 0000666 00000001477 15165746005 0017740 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Terminal; class ConnectionTokenService extends \AmeliaStripe\Service\AbstractService { /** * To connect to a reader the Stripe Terminal SDK needs to retrieve a short-lived * connection token from Stripe, proxied through your server. On your backend, add * an endpoint that creates and returns a connection token. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\ConnectionToken */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/terminal/connection_tokens', $params, $opts); } } stripe-php/lib/Service/Terminal/ReaderService.php 0000666 00000011444 15165746005 0016035 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Terminal; class ReaderService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of <code>Reader</code> objects. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Terminal\Reader> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/terminal/readers', $params, $opts); } /** * Cancels the current reader action. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Reader */ public function cancelAction($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/terminal/readers/%s/cancel_action', $id), $params, $opts); } /** * Creates a new <code>Reader</code> object. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Reader */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/terminal/readers', $params, $opts); } /** * Deletes a <code>Reader</code> object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Reader */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/terminal/readers/%s', $id), $params, $opts); } /** * Initiates a payment flow on a Reader. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Reader */ public function processPaymentIntent($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/terminal/readers/%s/process_payment_intent', $id), $params, $opts); } /** * Initiates a setup intent flow on a Reader. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Reader */ public function processSetupIntent($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/terminal/readers/%s/process_setup_intent', $id), $params, $opts); } /** * Retrieves a <code>Reader</code> object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Reader */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/terminal/readers/%s', $id), $params, $opts); } /** * Sets reader display to show cart details. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Reader */ public function setReaderDisplay($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/terminal/readers/%s/set_reader_display', $id), $params, $opts); } /** * Updates a <code>Reader</code> object by setting the values of the parameters * passed. Any parameters not provided will be left unchanged. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Reader */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/terminal/readers/%s', $id), $params, $opts); } } stripe-php/lib/Service/Terminal/LocationService.php 0000666 00000005604 15165746005 0016404 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Terminal; class LocationService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of <code>Location</code> objects. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Terminal\Location> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/terminal/locations', $params, $opts); } /** * Creates a new <code>Location</code> object. For further details, including which * address fields are required in each country, see the <a * href="/docs/terminal/fleet/locations">Manage locations</a> guide. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Location */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/terminal/locations', $params, $opts); } /** * Deletes a <code>Location</code> object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Location */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/terminal/locations/%s', $id), $params, $opts); } /** * Retrieves a <code>Location</code> object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Location */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/terminal/locations/%s', $id), $params, $opts); } /** * Updates a <code>Location</code> object by setting the values of the parameters * passed. Any parameters not provided will be left unchanged. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Location */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/terminal/locations/%s', $id), $params, $opts); } } stripe-php/lib/Service/Terminal/ConfigurationService.php 0000666 00000005301 15165746005 0017435 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Terminal; class ConfigurationService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of <code>Configuration</code> objects. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Terminal\Configuration> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/terminal/configurations', $params, $opts); } /** * Creates a new <code>Configuration</code> object. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Configuration */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/terminal/configurations', $params, $opts); } /** * Deletes a <code>Configuration</code> object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Configuration */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/terminal/configurations/%s', $id), $params, $opts); } /** * Retrieves a <code>Configuration</code> object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Configuration */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/terminal/configurations/%s', $id), $params, $opts); } /** * Updates a new <code>Configuration</code> object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Configuration */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/terminal/configurations/%s', $id), $params, $opts); } } stripe-php/lib/Service/Terminal/TerminalServiceFactory.php 0000666 00000001564 15165746005 0017740 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Terminal; /** * Service factory class for API resources in the Terminal namespace. * * @property ConfigurationService $configurations * @property ConnectionTokenService $connectionTokens * @property LocationService $locations * @property ReaderService $readers */ class TerminalServiceFactory extends \AmeliaStripe\Service\AbstractServiceFactory { /** * @var array<string, string> */ private static $classMap = [ 'configurations' => ConfigurationService::class, 'connectionTokens' => ConnectionTokenService::class, 'locations' => LocationService::class, 'readers' => ReaderService::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } stripe-php/lib/Service/Apps/SecretService.php 0000666 00000003755 15165746005 0015216 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Apps; class SecretService extends \AmeliaStripe\Service\AbstractService { /** * List all secrets stored on the given scope. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Apps\Secret> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/apps/secrets', $params, $opts); } /** * Create or replace a secret in the secret store. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Apps\Secret */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/apps/secrets', $params, $opts); } /** * Deletes a secret from the secret store by name and scope. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Apps\Secret */ public function deleteWhere($params = null, $opts = null) { return $this->request('post', '/v1/apps/secrets/delete', $params, $opts); } /** * Finds a secret in the secret store by name and scope. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Apps\Secret */ public function find($params = null, $opts = null) { return $this->request('get', '/v1/apps/secrets/find', $params, $opts); } } stripe-php/lib/Service/Apps/AppsServiceFactory.php 0000666 00000001063 15165746005 0016212 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Apps; /** * Service factory class for API resources in the Apps namespace. * * @property SecretService $secrets */ class AppsServiceFactory extends \AmeliaStripe\Service\AbstractServiceFactory { /** * @var array<string, string> */ private static $classMap = [ 'secrets' => SecretService::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } stripe-php/lib/Service/ReviewService.php 0000666 00000003505 15165746005 0014320 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class ReviewService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of <code>Review</code> objects that have <code>open</code> set to * <code>true</code>. The objects are sorted in descending order by creation date, * with the most recently created object appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Review> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/reviews', $params, $opts); } /** * Approves a <code>Review</code> object, closing it and removing it from the list * of reviews. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Review */ public function approve($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/reviews/%s/approve', $id), $params, $opts); } /** * Retrieves a <code>Review</code> object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Review */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/reviews/%s', $id), $params, $opts); } } stripe-php/lib/Service/OrderService.php 0000666 00000011570 15165746005 0014133 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class OrderService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of your orders. The orders are returned sorted by creation date, * with the most recently created orders appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Order> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/orders', $params, $opts); } /** * When retrieving an order, there is an includable <strong>line_items</strong> * property containing the first handful of those items. There is also a URL where * you can retrieve the full (paginated) list of line items. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\LineItem> */ public function allLineItems($id, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/orders/%s/line_items', $id), $params, $opts); } /** * Cancels the order as well as the payment intent if one is attached. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Order */ public function cancel($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/orders/%s/cancel', $id), $params, $opts); } /** * Creates a new <code>open</code> order object. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Order */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/orders', $params, $opts); } /** * Reopens a <code>submitted</code> order. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Order */ public function reopen($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/orders/%s/reopen', $id), $params, $opts); } /** * Retrieves the details of an existing order. Supply the unique order ID from * either an order creation request or the order list, and Stripe will return the * corresponding order information. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Order */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/orders/%s', $id), $params, $opts); } /** * Submitting an Order transitions the status to <code>processing</code> and * creates a PaymentIntent object so the order can be paid. If the Order has an * <code>amount_total</code> of 0, no PaymentIntent object will be created. Once * the order is submitted, its contents cannot be changed, unless the <a * href="#reopen_order">reopen</a> method is called. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Order */ public function submit($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/orders/%s/submit', $id), $params, $opts); } /** * Updates the specific order by setting the values of the parameters passed. Any * parameters not provided will be left unchanged. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Order */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/orders/%s', $id), $params, $opts); } } stripe-php/lib/Service/PaymentMethodService.php 0000666 00000012421 15165746005 0015632 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class PaymentMethodService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of PaymentMethods attached to the StripeAccount. For listing a * customer’s payment methods, you should use <a * href="/docs/api/payment_methods/customer_list">List a Customer’s * PaymentMethods</a>. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\PaymentMethod> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/payment_methods', $params, $opts); } /** * Attaches a PaymentMethod object to a Customer. * * To attach a new PaymentMethod to a customer for future payments, we recommend * you use a <a href="/docs/api/setup_intents">SetupIntent</a> or a PaymentIntent * with <a * href="/docs/api/payment_intents/create#create_payment_intent-setup_future_usage">setup_future_usage</a>. * These approaches will perform any necessary steps to set up the PaymentMethod * for future payments. Using the <code>/v1/payment_methods/:id/attach</code> * endpoint without first using a SetupIntent or PaymentIntent with * <code>setup_future_usage</code> does not optimize the PaymentMethod for future * use, which makes later declines and payment friction more likely. See <a * href="/docs/payments/payment-intents#future-usage">Optimizing cards for future * payments</a> for more information about setting up future payments. * * To use this PaymentMethod as the default for invoice or subscription payments, * set <a * href="/docs/api/customers/update#update_customer-invoice_settings-default_payment_method"><code>invoice_settings.default_payment_method</code></a>, * on the Customer to the PaymentMethod’s ID. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentMethod */ public function attach($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/payment_methods/%s/attach', $id), $params, $opts); } /** * Creates a PaymentMethod object. Read the <a * href="/docs/stripe-js/reference#stripe-create-payment-method">Stripe.js * reference</a> to learn how to create PaymentMethods via Stripe.js. * * Instead of creating a PaymentMethod directly, we recommend using the <a * href="/docs/payments/accept-a-payment">PaymentIntents</a> API to accept a * payment immediately or the <a * href="/docs/payments/save-and-reuse">SetupIntent</a> API to collect payment * method details ahead of a future payment. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentMethod */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/payment_methods', $params, $opts); } /** * Detaches a PaymentMethod object from a Customer. After a PaymentMethod is * detached, it can no longer be used for a payment or re-attached to a Customer. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentMethod */ public function detach($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/payment_methods/%s/detach', $id), $params, $opts); } /** * Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a * payment method attached to a Customer, you should use <a * href="/docs/api/payment_methods/customer">Retrieve a Customer’s * PaymentMethods</a>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentMethod */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/payment_methods/%s', $id), $params, $opts); } /** * Updates a PaymentMethod object. A PaymentMethod must be attached a customer to * be updated. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\PaymentMethod */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/payment_methods/%s', $id), $params, $opts); } } stripe-php/lib/Service/OAuthService.php 0000666 00000011555 15165746005 0014103 0 ustar 00 <?php namespace AmeliaStripe\Service; class OAuthService extends \AmeliaStripe\Service\AbstractService { /** * Sends a request to Stripe's Connect API. * * @param string $method the HTTP method * @param string $path the path of the request * @param array $params the parameters of the request * @param array|\AmeliaStripe\Util\RequestOptions $opts the special modifiers of the request * * @return \AmeliaStripe\StripeObject the object returned by Stripe's Connect API */ protected function requestConnect($method, $path, $params, $opts) { $opts = $this->_parseOpts($opts); $opts->apiBase = $this->_getBase($opts); return $this->request($method, $path, $params, $opts); } /** * Generates a URL to Stripe's OAuth form. * * @param null|array $params * @param null|array $opts * * @return string the URL to Stripe's OAuth form */ public function authorizeUrl($params = null, $opts = null) { $params = $params ?: []; $opts = $this->_parseOpts($opts); $base = $this->_getBase($opts); $params['client_id'] = $this->_getClientId($params); if (!\array_key_exists('response_type', $params)) { $params['response_type'] = 'code'; } $query = \AmeliaStripe\Util\Util::encodeParameters($params); return $base . '/oauth/authorize?' . $query; } /** * Use an authoriztion code to connect an account to your platform and * fetch the user's credentials. * * @param null|array $params * @param null|array $opts * * @throws \AmeliaStripe\Exception\OAuth\OAuthErrorException if the request fails * * @return \AmeliaStripe\StripeObject object containing the response from the API */ public function token($params = null, $opts = null) { $params = $params ?: []; $params['client_secret'] = $this->_getClientSecret($params); return $this->requestConnect('post', '/oauth/token', $params, $opts); } /** * Disconnects an account from your platform. * * @param null|array $params * @param null|array $opts * * @throws \AmeliaStripe\Exception\OAuth\OAuthErrorException if the request fails * * @return \AmeliaStripe\StripeObject object containing the response from the API */ public function deauthorize($params = null, $opts = null) { $params = $params ?: []; $params['client_id'] = $this->_getClientId($params); return $this->requestConnect('post', '/oauth/deauthorize', $params, $opts); } private function _getClientId($params = null) { $clientId = ($params && \array_key_exists('client_id', $params)) ? $params['client_id'] : null; if (null === $clientId) { $clientId = $this->client->getClientId(); } if (null === $clientId) { $msg = 'No client_id provided. (HINT: set your client_id using ' . '`new \AmeliaStripe\StripeClient([clientId => <CLIENT-ID> ])`)". You can find your client_ids ' . 'in your Stripe dashboard at ' . 'https://dashboard.stripe.com/account/applications/settings, ' . 'after registering your account as a platform. See ' . 'https://stripe.com/docs/connect/standard-accounts for details, ' . 'or email support@stripe.com if you have any questions.'; throw new \AmeliaStripe\Exception\AuthenticationException($msg); } return $clientId; } private function _getClientSecret($params = null) { if (\array_key_exists('client_secret', $params)) { return $params['client_secret']; } return $this->client->getApiKey(); } /** * @param array|\AmeliaStripe\Util\RequestOptions $opts the special modifiers of the request * * @throws \AmeliaStripe\Exception\InvalidArgumentException * * @return \AmeliaStripe\Util\RequestOptions */ private function _parseOpts($opts) { if (\is_array($opts)) { if (\array_key_exists('connect_base', $opts)) { // Throw an exception for the convenience of anybody migrating to // \AmeliaStripe\Service\OAuthService from \AmeliaStripe\OAuth, where `connect_base` // was the name of the parameter that behaves as `api_base` does here. throw new \AmeliaStripe\Exception\InvalidArgumentException('Use `api_base`, not `connect_base`'); } } return \AmeliaStripe\Util\RequestOptions::parse($opts); } /** * @param \AmeliaStripe\Util\RequestOptions $opts * * @return string */ private function _getBase($opts) { return isset($opts->apiBase) ? $opts->apiBase : $this->client->getConnectBase(); } } stripe-php/lib/Service/MandateService.php 0000666 00000001172 15165746005 0014426 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class MandateService extends \AmeliaStripe\Service\AbstractService { /** * Retrieves a Mandate object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Mandate */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/mandates/%s', $id), $params, $opts); } } stripe-php/lib/Service/Issuing/CardholderService.php 0000666 00000004663 15165746005 0016555 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Issuing; class CardholderService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of Issuing <code>Cardholder</code> objects. The objects are * sorted in descending order by creation date, with the most recently created * object appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Issuing\Cardholder> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/issuing/cardholders', $params, $opts); } /** * Creates a new Issuing <code>Cardholder</code> object that can be issued cards. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Cardholder */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/issuing/cardholders', $params, $opts); } /** * Retrieves an Issuing <code>Cardholder</code> object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Cardholder */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/issuing/cardholders/%s', $id), $params, $opts); } /** * Updates the specified Issuing <code>Cardholder</code> object by setting the * values of the parameters passed. Any parameters not provided will be left * unchanged. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Cardholder */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/issuing/cardholders/%s', $id), $params, $opts); } } stripe-php/lib/Service/Issuing/CardService.php 0000666 00000004502 15165746005 0015347 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Issuing; class CardService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of Issuing <code>Card</code> objects. The objects are sorted in * descending order by creation date, with the most recently created object * appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Issuing\Card> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/issuing/cards', $params, $opts); } /** * Creates an Issuing <code>Card</code> object. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Card */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/issuing/cards', $params, $opts); } /** * Retrieves an Issuing <code>Card</code> object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Card */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/issuing/cards/%s', $id), $params, $opts); } /** * Updates the specified Issuing <code>Card</code> object by setting the values of * the parameters passed. Any parameters not provided will be left unchanged. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Card */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/issuing/cards/%s', $id), $params, $opts); } } stripe-php/lib/Service/Issuing/IssuingServiceFactory.php 0000666 00000001664 15165746005 0017455 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Issuing; /** * Service factory class for API resources in the Issuing namespace. * * @property AuthorizationService $authorizations * @property CardholderService $cardholders * @property CardService $cards * @property DisputeService $disputes * @property TransactionService $transactions */ class IssuingServiceFactory extends \AmeliaStripe\Service\AbstractServiceFactory { /** * @var array<string, string> */ private static $classMap = [ 'authorizations' => AuthorizationService::class, 'cardholders' => CardholderService::class, 'cards' => CardService::class, 'disputes' => DisputeService::class, 'transactions' => TransactionService::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } stripe-php/lib/Service/Issuing/DisputeService.php 0000666 00000007114 15165746005 0016115 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Issuing; class DisputeService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of Issuing <code>Dispute</code> objects. The objects are sorted * in descending order by creation date, with the most recently created object * appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Issuing\Dispute> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/issuing/disputes', $params, $opts); } /** * Creates an Issuing <code>Dispute</code> object. Individual pieces of evidence * within the <code>evidence</code> object are optional at this point. Stripe only * validates that required evidence is present during submission. Refer to <a * href="/docs/issuing/purchases/disputes#dispute-reasons-and-evidence">Dispute * reasons and evidence</a> for more details about evidence requirements. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Dispute */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/issuing/disputes', $params, $opts); } /** * Retrieves an Issuing <code>Dispute</code> object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Dispute */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/issuing/disputes/%s', $id), $params, $opts); } /** * Submits an Issuing <code>Dispute</code> to the card network. Stripe validates * that all evidence fields required for the dispute’s reason are present. For more * details, see <a * href="/docs/issuing/purchases/disputes#dispute-reasons-and-evidence">Dispute * reasons and evidence</a>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Dispute */ public function submit($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/issuing/disputes/%s/submit', $id), $params, $opts); } /** * Updates the specified Issuing <code>Dispute</code> object by setting the values * of the parameters passed. Any parameters not provided will be left unchanged. * Properties on the <code>evidence</code> object can be unset by passing in an * empty string. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Dispute */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/issuing/disputes/%s', $id), $params, $opts); } } stripe-php/lib/Service/Issuing/TransactionService.php 0000666 00000003712 15165746005 0016765 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Issuing; class TransactionService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of Issuing <code>Transaction</code> objects. The objects are * sorted in descending order by creation date, with the most recently created * object appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Issuing\Transaction> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/issuing/transactions', $params, $opts); } /** * Retrieves an Issuing <code>Transaction</code> object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Transaction */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/issuing/transactions/%s', $id), $params, $opts); } /** * Updates the specified Issuing <code>Transaction</code> object by setting the * values of the parameters passed. Any parameters not provided will be left * unchanged. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Transaction */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/issuing/transactions/%s', $id), $params, $opts); } } stripe-php/lib/Service/Issuing/AuthorizationService.php 0000666 00000006614 15165746005 0017344 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Issuing; class AuthorizationService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of Issuing <code>Authorization</code> objects. The objects are * sorted in descending order by creation date, with the most recently created * object appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Issuing\Authorization> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/issuing/authorizations', $params, $opts); } /** * Approves a pending Issuing <code>Authorization</code> object. This request * should be made within the timeout window of the <a * href="/docs/issuing/controls/real-time-authorizations">real-time * authorization</a> flow. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Authorization */ public function approve($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/issuing/authorizations/%s/approve', $id), $params, $opts); } /** * Declines a pending Issuing <code>Authorization</code> object. This request * should be made within the timeout window of the <a * href="/docs/issuing/controls/real-time-authorizations">real time * authorization</a> flow. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Authorization */ public function decline($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/issuing/authorizations/%s/decline', $id), $params, $opts); } /** * Retrieves an Issuing <code>Authorization</code> object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Authorization */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/issuing/authorizations/%s', $id), $params, $opts); } /** * Updates the specified Issuing <code>Authorization</code> object by setting the * values of the parameters passed. Any parameters not provided will be left * unchanged. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Authorization */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/issuing/authorizations/%s', $id), $params, $opts); } } stripe-php/lib/Service/PriceService.php 0000666 00000006020 15165746005 0014114 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class PriceService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of your prices. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Price> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/prices', $params, $opts); } /** * Creates a new price for an existing product. The price can be recurring or * one-time. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Price */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/prices', $params, $opts); } /** * Retrieves the price with the given ID. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Price */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/prices/%s', $id), $params, $opts); } /** * Search for prices you’ve previously created using Stripe’s <a * href="/docs/search#search-query-language">Search Query Language</a>. Don’t use * search in read-after-write flows where strict consistency is necessary. Under * normal operating conditions, data is searchable in less than a minute. * Occasionally, propagation of new or updated data can be up to an hour behind * during outages. Search functionality is not available to merchants in India. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SearchResult<\AmeliaStripe\Price> */ public function search($params = null, $opts = null) { return $this->requestSearchResult('get', '/v1/prices/search', $params, $opts); } /** * Updates the specified price by setting the values of the parameters passed. Any * parameters not provided are left unchanged. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Price */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/prices/%s', $id), $params, $opts); } } stripe-php/lib/Service/SkuService.php 0000666 00000006036 15165746005 0013623 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class SkuService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of your SKUs. The SKUs are returned sorted by creation date, with * the most recently created SKUs appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\SKU> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/skus', $params, $opts); } /** * Creates a new SKU associated with a product. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SKU */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/skus', $params, $opts); } /** * Delete a SKU. Deleting a SKU is only possible until it has been used in an * order. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SKU */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/skus/%s', $id), $params, $opts); } /** * Retrieves the details of an existing SKU. Supply the unique SKU identifier from * either a SKU creation request or from the product, and Stripe will return the * corresponding SKU information. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SKU */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/skus/%s', $id), $params, $opts); } /** * Updates the specific SKU by setting the values of the parameters passed. Any * parameters not provided will be left unchanged. * * Note that a SKU’s <code>attributes</code> are not editable. Instead, you would * need to deactivate the existing SKU and create a new one with the new attribute * values. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SKU */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/skus/%s', $id), $params, $opts); } } stripe-php/lib/Service/FileService.php 0000666 00000004207 15165746005 0013736 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class FileService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of the files that your account has access to. The files are * returned sorted by creation date, with the most recently created files appearing * first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\File> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/files', $params, $opts); } /** * Retrieves the details of an existing file object. Supply the unique file ID from * a file, and Stripe will return the corresponding file object. To access file * contents, see the <a href="/docs/file-upload#download-file-contents">File Upload * Guide</a>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\File */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/files/%s', $id), $params, $opts); } /** * Create a file. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @return \AmeliaStripe\File */ public function create($params = null, $opts = null) { $opts = \AmeliaStripe\Util\RequestOptions::parse($opts); if (!isset($opts->apiBase)) { $opts->apiBase = $this->getClient()->getFilesBase(); } // Manually flatten params, otherwise curl's multipart encoder will // choke on nested null|arrays. $flatParams = \array_column(\AmeliaStripe\Util\Util::flattenParams($params), 1, 0); return $this->request('post', '/v1/files', $flatParams, $opts); } } stripe-php/lib/Service/Identity/VerificationReportService.php 0000666 00000002273 15165746005 0020467 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Identity; class VerificationReportService extends \AmeliaStripe\Service\AbstractService { /** * List all verification reports. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Identity\VerificationReport> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/identity/verification_reports', $params, $opts); } /** * Retrieves an existing VerificationReport. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Identity\VerificationReport */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/identity/verification_reports/%s', $id), $params, $opts); } } stripe-php/lib/Service/Identity/VerificationSessionService.php 0000666 00000013261 15165746005 0020636 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Identity; class VerificationSessionService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of VerificationSessions. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Identity\VerificationSession> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/identity/verification_sessions', $params, $opts); } /** * A VerificationSession object can be canceled when it is in * <code>requires_input</code> <a * href="/docs/identity/how-sessions-work">status</a>. * * Once canceled, future submission attempts are disabled. This cannot be undone. * <a href="/docs/identity/verification-sessions#cancel">Learn more</a>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Identity\VerificationSession */ public function cancel($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/identity/verification_sessions/%s/cancel', $id), $params, $opts); } /** * Creates a VerificationSession object. * * After the VerificationSession is created, display a verification modal using the * session <code>client_secret</code> or send your users to the session’s * <code>url</code>. * * If your API key is in test mode, verification checks won’t actually process, * though everything else will occur as if in live mode. * * Related guide: <a href="/docs/identity/verify-identity-documents">Verify your * users’ identity documents</a>. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Identity\VerificationSession */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/identity/verification_sessions', $params, $opts); } /** * Redact a VerificationSession to remove all collected information from Stripe. * This will redact the VerificationSession and all objects related to it, * including VerificationReports, Events, request logs, etc. * * A VerificationSession object can be redacted when it is in * <code>requires_input</code> or <code>verified</code> <a * href="/docs/identity/how-sessions-work">status</a>. Redacting a * VerificationSession in <code>requires_action</code> state will automatically * cancel it. * * The redaction process may take up to four days. When the redaction process is in * progress, the VerificationSession’s <code>redaction.status</code> field will be * set to <code>processing</code>; when the process is finished, it will change to * <code>redacted</code> and an <code>identity.verification_session.redacted</code> * event will be emitted. * * Redaction is irreversible. Redacted objects are still accessible in the Stripe * API, but all the fields that contain personal data will be replaced by the * string <code>[redacted]</code> or a similar placeholder. The * <code>metadata</code> field will also be erased. Redacted objects cannot be * updated or used for any purpose. * * <a href="/docs/identity/verification-sessions#redact">Learn more</a>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Identity\VerificationSession */ public function redact($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/identity/verification_sessions/%s/redact', $id), $params, $opts); } /** * Retrieves the details of a VerificationSession that was previously created. * * When the session status is <code>requires_input</code>, you can use this method * to retrieve a valid <code>client_secret</code> or <code>url</code> to allow * re-submission. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Identity\VerificationSession */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/identity/verification_sessions/%s', $id), $params, $opts); } /** * Updates a VerificationSession object. * * When the session status is <code>requires_input</code>, you can use this method * to update the verification check and options. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Identity\VerificationSession */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/identity/verification_sessions/%s', $id), $params, $opts); } } stripe-php/lib/Service/Identity/IdentityServiceFactory.php 0000666 00000001362 15165746005 0017770 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Identity; /** * Service factory class for API resources in the Identity namespace. * * @property VerificationReportService $verificationReports * @property VerificationSessionService $verificationSessions */ class IdentityServiceFactory extends \AmeliaStripe\Service\AbstractServiceFactory { /** * @var array<string, string> */ private static $classMap = [ 'verificationReports' => VerificationReportService::class, 'verificationSessions' => VerificationSessionService::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } stripe-php/lib/Service/AbstractServiceFactory.php 0000666 00000002734 15165746005 0016155 0 ustar 00 <?php namespace AmeliaStripe\Service; /** * Abstract base class for all service factories used to expose service * instances through {@link \AmeliaStripe\StripeClient}. * * Service factories serve two purposes: * * 1. Expose properties for all services through the `__get()` magic method. * 2. Lazily initialize each service instance the first time the property for * a given service is used. */ abstract class AbstractServiceFactory { /** @var \AmeliaStripe\StripeClientInterface */ private $client; /** @var array<string, AbstractService|AbstractServiceFactory> */ private $services; /** * @param \AmeliaStripe\StripeClientInterface $client */ public function __construct($client) { $this->client = $client; $this->services = []; } /** * @param string $name * * @return null|string */ abstract protected function getServiceClass($name); /** * @param string $name * * @return null|AbstractService|AbstractServiceFactory */ public function __get($name) { $serviceClass = $this->getServiceClass($name); if (null !== $serviceClass) { if (!\array_key_exists($name, $this->services)) { $this->services[$name] = new $serviceClass($this->client); } return $this->services[$name]; } \trigger_error('Undefined property: ' . static::class . '::$' . $name); return null; } } stripe-php/lib/Service/TokenService.php 0000666 00000002426 15165746005 0014140 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class TokenService extends \AmeliaStripe\Service\AbstractService { /** * Creates a single-use token that represents a bank account’s details. This token * can be used with any API method in place of a bank account dictionary. This * token can be used only once, by attaching it to a <a href="#accounts">Custom * account</a>. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Token */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/tokens', $params, $opts); } /** * Retrieves the token with the given ID. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Token */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/tokens/%s', $id), $params, $opts); } } stripe-php/lib/Service/PlanService.php 0000666 00000005504 15165746005 0013752 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class PlanService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of your plans. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Plan> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/plans', $params, $opts); } /** * You can now model subscriptions more flexibly using the <a href="#prices">Prices * API</a>. It replaces the Plans API and is backwards compatible to simplify your * migration. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Plan */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/plans', $params, $opts); } /** * Deleting plans means new subscribers can’t be added. Existing subscribers aren’t * affected. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Plan */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/plans/%s', $id), $params, $opts); } /** * Retrieves the plan with the given ID. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Plan */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/plans/%s', $id), $params, $opts); } /** * Updates the specified plan by setting the values of the parameters passed. Any * parameters not provided are left unchanged. By design, you cannot change a * plan’s ID, amount, currency, or billing cycle. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Plan */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/plans/%s', $id), $params, $opts); } } stripe-php/lib/Service/ExchangeRateService.php 0000666 00000002447 15165746005 0015421 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class ExchangeRateService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of objects that contain the rates at which foreign currencies are * converted to one another. Only shows the currencies for which Stripe supports. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\ExchangeRate> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/exchange_rates', $params, $opts); } /** * Retrieves the exchange rates from the given currency to every supported * currency. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\ExchangeRate */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/exchange_rates/%s', $id), $params, $opts); } } stripe-php/lib/Service/CouponService.php 0000666 00000007330 15165746005 0014322 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class CouponService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of your coupons. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Coupon> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/coupons', $params, $opts); } /** * You can create coupons easily via the <a * href="https://dashboard.stripe.com/coupons">coupon management</a> page of the * Stripe dashboard. Coupon creation is also accessible via the API if you need to * create coupons on the fly. * * A coupon has either a <code>percent_off</code> or an <code>amount_off</code> and * <code>currency</code>. If you set an <code>amount_off</code>, that amount will * be subtracted from any invoice’s subtotal. For example, an invoice with a * subtotal of <currency>100</currency> will have a final total of * <currency>0</currency> if a coupon with an <code>amount_off</code> of * <amount>200</amount> is applied to it and an invoice with a subtotal of * <currency>300</currency> will have a final total of <currency>100</currency> if * a coupon with an <code>amount_off</code> of <amount>200</amount> is applied to * it. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Coupon */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/coupons', $params, $opts); } /** * You can delete coupons via the <a * href="https://dashboard.stripe.com/coupons">coupon management</a> page of the * Stripe dashboard. However, deleting a coupon does not affect any customers who * have already applied the coupon; it means that new customers can’t redeem the * coupon. You can also delete coupons via the API. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Coupon */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/coupons/%s', $id), $params, $opts); } /** * Retrieves the coupon with the given ID. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Coupon */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/coupons/%s', $id), $params, $opts); } /** * Updates the metadata of a coupon. Other coupon details (currency, duration, * amount_off) are, by design, not editable. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Coupon */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/coupons/%s', $id), $params, $opts); } } stripe-php/lib/Service/EphemeralKeyService.php 0000666 00000002477 15165746005 0015441 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class EphemeralKeyService extends \AmeliaStripe\Service\AbstractService { /** * Invalidates a short-lived API key for a given resource. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\EphemeralKey */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/ephemeral_keys/%s', $id), $params, $opts); } /** * Creates a short-lived API key for a given resource. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\EphemeralKey */ public function create($params = null, $opts = null) { if (!$opts || !isset($opts['stripe_version'])) { throw new \AmeliaStripe\Exception\InvalidArgumentException('stripe_version must be specified to create an ephemeral key'); } return $this->request('post', '/v1/ephemeral_keys', $params, $opts); } } stripe-php/lib/Service/Sigma/ScheduledQueryRunService.php 0000666 00000002271 15165746005 0017531 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Sigma; class ScheduledQueryRunService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of scheduled query runs. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Sigma\ScheduledQueryRun> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/sigma/scheduled_query_runs', $params, $opts); } /** * Retrieves the details of an scheduled query run. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Sigma\ScheduledQueryRun */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/sigma/scheduled_query_runs/%s', $id), $params, $opts); } } stripe-php/lib/Service/Sigma/SigmaServiceFactory.php 0000666 00000001142 15165746005 0016502 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Sigma; /** * Service factory class for API resources in the Sigma namespace. * * @property ScheduledQueryRunService $scheduledQueryRuns */ class SigmaServiceFactory extends \AmeliaStripe\Service\AbstractServiceFactory { /** * @var array<string, string> */ private static $classMap = [ 'scheduledQueryRuns' => ScheduledQueryRunService::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } stripe-php/lib/Service/ShippingRateService.php 0000666 00000004072 15165746005 0015454 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class ShippingRateService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of your shipping rates. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\ShippingRate> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/shipping_rates', $params, $opts); } /** * Creates a new shipping rate object. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\ShippingRate */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/shipping_rates', $params, $opts); } /** * Returns the shipping rate object with the given ID. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\ShippingRate */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/shipping_rates/%s', $id), $params, $opts); } /** * Updates an existing shipping rate object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\ShippingRate */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/shipping_rates/%s', $id), $params, $opts); } } stripe-php/lib/Service/AbstractService.php 0000666 00000005425 15165746005 0014625 0 ustar 00 <?php namespace AmeliaStripe\Service; /** * Abstract base class for all services. */ abstract class AbstractService { /** * @var \AmeliaStripe\StripeClientInterface */ protected $client; /** * @var \AmeliaStripe\StripeStreamingClientInterface */ protected $streamingClient; /** * Initializes a new instance of the {@link AbstractService} class. * * @param \AmeliaStripe\StripeClientInterface $client */ public function __construct($client) { $this->client = $client; $this->streamingClient = $client; } /** * Gets the client used by this service to send requests. * * @return \AmeliaStripe\StripeClientInterface */ public function getClient() { return $this->client; } /** * Gets the client used by this service to send requests. * * @return \AmeliaStripe\StripeStreamingClientInterface */ public function getStreamingClient() { return $this->streamingClient; } /** * Translate null values to empty strings. For service methods, * we interpret null as a request to unset the field, which * corresponds to sending an empty string for the field to the * API. * * @param null|array $params */ private static function formatParams($params) { if (null === $params) { return null; } \array_walk_recursive($params, function (&$value, $key) { if (null === $value) { $value = ''; } }); return $params; } protected function request($method, $path, $params, $opts) { return $this->getClient()->request($method, $path, static::formatParams($params), $opts); } protected function requestStream($method, $path, $readBodyChunkCallable, $params, $opts) { return $this->getStreamingClient()->requestStream($method, $path, $readBodyChunkCallable, static::formatParams($params), $opts); } protected function requestCollection($method, $path, $params, $opts) { return $this->getClient()->requestCollection($method, $path, static::formatParams($params), $opts); } protected function requestSearchResult($method, $path, $params, $opts) { return $this->getClient()->requestSearchResult($method, $path, static::formatParams($params), $opts); } protected function buildPath($basePath, ...$ids) { foreach ($ids as $id) { if (null === $id || '' === \trim($id)) { $msg = 'The resource ID cannot be null or whitespace.'; throw new \AmeliaStripe\Exception\InvalidArgumentException($msg); } } return \sprintf($basePath, ...\array_map('\urlencode', $ids)); } } stripe-php/lib/Service/ProductService.php 0000666 00000007670 15165746005 0014506 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class ProductService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of your products. The products are returned sorted by creation * date, with the most recently created products appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Product> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/products', $params, $opts); } /** * Creates a new product object. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Product */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/products', $params, $opts); } /** * Delete a product. Deleting a product is only possible if it has no prices * associated with it. Additionally, deleting a product with <code>type=good</code> * is only possible if it has no SKUs associated with it. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Product */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/products/%s', $id), $params, $opts); } /** * Retrieves the details of an existing product. Supply the unique product ID from * either a product creation request or the product list, and Stripe will return * the corresponding product information. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Product */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/products/%s', $id), $params, $opts); } /** * Search for products you’ve previously created using Stripe’s <a * href="/docs/search#search-query-language">Search Query Language</a>. Don’t use * search in read-after-write flows where strict consistency is necessary. Under * normal operating conditions, data is searchable in less than a minute. * Occasionally, propagation of new or updated data can be up to an hour behind * during outages. Search functionality is not available to merchants in India. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SearchResult<\AmeliaStripe\Product> */ public function search($params = null, $opts = null) { return $this->requestSearchResult('get', '/v1/products/search', $params, $opts); } /** * Updates the specific product by setting the values of the parameters passed. Any * parameters not provided will be left unchanged. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Product */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/products/%s', $id), $params, $opts); } } stripe-php/lib/Service/DisputeService.php 0000666 00000005633 15165746005 0014500 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class DisputeService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of your disputes. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Dispute> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/disputes', $params, $opts); } /** * Closing the dispute for a charge indicates that you do not have any evidence to * submit and are essentially dismissing the dispute, acknowledging it as lost. * * The status of the dispute will change from <code>needs_response</code> to * <code>lost</code>. <em>Closing a dispute is irreversible</em>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Dispute */ public function close($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/disputes/%s/close', $id), $params, $opts); } /** * Retrieves the dispute with the given ID. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Dispute */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/disputes/%s', $id), $params, $opts); } /** * When you get a dispute, contacting your customer is always the best first step. * If that doesn’t work, you can submit evidence to help us resolve the dispute in * your favor. You can do this in your <a * href="https://dashboard.stripe.com/disputes">dashboard</a>, but if you prefer, * you can use the API to submit evidence programmatically. * * Depending on your dispute type, different evidence fields will give you a better * chance of winning your dispute. To figure out which evidence fields to provide, * see our <a href="/docs/disputes/categories">guide to dispute types</a>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Dispute */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/disputes/%s', $id), $params, $opts); } } stripe-php/lib/Service/CountrySpecService.php 0000666 00000002210 15165746005 0015325 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class CountrySpecService extends \AmeliaStripe\Service\AbstractService { /** * Lists all Country Spec objects available in the API. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\CountrySpec> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/country_specs', $params, $opts); } /** * Returns a Country Spec for a given Country code. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CountrySpec */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/country_specs/%s', $id), $params, $opts); } } stripe-php/lib/Service/SetupAttemptService.php 0000666 00000001235 15165746005 0015514 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class SetupAttemptService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of SetupAttempts associated with a provided SetupIntent. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\SetupAttempt> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/setup_attempts', $params, $opts); } } stripe-php/lib/Service/InvoiceService.php 0000666 00000027120 15165746005 0014452 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class InvoiceService extends \AmeliaStripe\Service\AbstractService { /** * You can list all invoices, or list the invoices for a specific customer. The * invoices are returned sorted by creation date, with the most recently created * invoices appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Invoice> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/invoices', $params, $opts); } /** * When retrieving an invoice, you’ll get a <strong>lines</strong> property * containing the total count of line items and the first handful of those items. * There is also a URL where you can retrieve the full (paginated) list of line * items. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\InvoiceLineItem> */ public function allLines($parentId, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/invoices/%s/lines', $parentId), $params, $opts); } /** * This endpoint creates a draft invoice for a given customer. The invoice remains * a draft until you <a href="#finalize_invoice">finalize</a> the invoice, which * allows you to <a href="#pay_invoice">pay</a> or <a href="#send_invoice">send</a> * the invoice to your customers. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Invoice */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/invoices', $params, $opts); } /** * Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to * delete invoices that are no longer in a draft state will fail; once an invoice * has been finalized or if an invoice is for a subscription, it must be <a * href="#void_invoice">voided</a>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Invoice */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/invoices/%s', $id), $params, $opts); } /** * Stripe automatically finalizes drafts before sending and attempting payment on * invoices. However, if you’d like to finalize a draft invoice manually, you can * do so using this method. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Invoice */ public function finalizeInvoice($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/invoices/%s/finalize', $id), $params, $opts); } /** * Marking an invoice as uncollectible is useful for keeping track of bad debts * that can be written off for accounting purposes. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Invoice */ public function markUncollectible($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/invoices/%s/mark_uncollectible', $id), $params, $opts); } /** * Stripe automatically creates and then attempts to collect payment on invoices * for customers on subscriptions according to your <a * href="https://dashboard.stripe.com/account/billing/automatic">subscriptions * settings</a>. However, if you’d like to attempt payment on an invoice out of the * normal collection schedule or for some other reason, you can do so. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Invoice */ public function pay($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/invoices/%s/pay', $id), $params, $opts); } /** * Retrieves the invoice with the given ID. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Invoice */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/invoices/%s', $id), $params, $opts); } /** * Search for invoices you’ve previously created using Stripe’s <a * href="/docs/search#search-query-language">Search Query Language</a>. Don’t use * search in read-after-write flows where strict consistency is necessary. Under * normal operating conditions, data is searchable in less than a minute. * Occasionally, propagation of new or updated data can be up to an hour behind * during outages. Search functionality is not available to merchants in India. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SearchResult<\AmeliaStripe\Invoice> */ public function search($params = null, $opts = null) { return $this->requestSearchResult('get', '/v1/invoices/search', $params, $opts); } /** * Stripe will automatically send invoices to customers according to your <a * href="https://dashboard.stripe.com/account/billing/automatic">subscriptions * settings</a>. However, if you’d like to manually send an invoice to your * customer out of the normal schedule, you can do so. When sending invoices that * have already been paid, there will be no reference to the payment in the email. * * Requests made in test-mode result in no emails being sent, despite sending an * <code>invoice.sent</code> event. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Invoice */ public function sendInvoice($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/invoices/%s/send', $id), $params, $opts); } /** * At any time, you can preview the upcoming invoice for a customer. This will show * you all the charges that are pending, including subscription renewal charges, * invoice item charges, etc. It will also show you any discounts that are * applicable to the invoice. * * Note that when you are viewing an upcoming invoice, you are simply viewing a * preview – the invoice has not yet been created. As such, the upcoming invoice * will not show up in invoice listing calls, and you cannot use the API to pay or * edit the invoice. If you want to change the amount that your customer will be * billed, you can add, remove, or update pending invoice items, or update the * customer’s discount. * * You can preview the effects of updating a subscription, including a preview of * what proration will take place. To ensure that the actual proration is * calculated exactly the same as the previewed proration, you should pass a * <code>proration_date</code> parameter when doing the actual subscription update. * The value passed in should be the same as the * <code>subscription_proration_date</code> returned on the upcoming invoice * resource. The recommended way to get only the prorations being previewed is to * consider only proration line items where <code>period[start]</code> is equal to * the <code>subscription_proration_date</code> on the upcoming invoice resource. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Invoice */ public function upcoming($params = null, $opts = null) { return $this->request('get', '/v1/invoices/upcoming', $params, $opts); } /** * When retrieving an upcoming invoice, you’ll get a <strong>lines</strong> * property containing the total count of line items and the first handful of those * items. There is also a URL where you can retrieve the full (paginated) list of * line items. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\InvoiceLineItem> */ public function upcomingLines($params = null, $opts = null) { return $this->requestCollection('get', '/v1/invoices/upcoming/lines', $params, $opts); } /** * Draft invoices are fully editable. Once an invoice is <a * href="/docs/billing/invoices/workflow#finalized">finalized</a>, monetary values, * as well as <code>collection_method</code>, become uneditable. * * If you would like to stop the Stripe Billing engine from automatically * finalizing, reattempting payments on, sending reminders for, or <a * href="/docs/billing/invoices/reconciliation">automatically reconciling</a> * invoices, pass <code>auto_advance=false</code>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Invoice */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/invoices/%s', $id), $params, $opts); } /** * Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is * similar to <a href="#delete_invoice">deletion</a>, however it only applies to * finalized invoices and maintains a papertrail where the invoice can still be * found. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Invoice */ public function voidInvoice($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/invoices/%s/void', $id), $params, $opts); } } stripe-php/lib/Service/SetupIntentService.php 0000666 00000012040 15165746005 0015333 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class SetupIntentService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of SetupIntents. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\SetupIntent> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/setup_intents', $params, $opts); } /** * A SetupIntent object can be canceled when it is in one of these statuses: * <code>requires_payment_method</code>, <code>requires_confirmation</code>, or * <code>requires_action</code>. * * Once canceled, setup is abandoned and any operations on the SetupIntent will * fail with an error. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SetupIntent */ public function cancel($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/setup_intents/%s/cancel', $id), $params, $opts); } /** * Confirm that your customer intends to set up the current or provided payment * method. For example, you would confirm a SetupIntent when a customer hits the * “Save” button on a payment method management page on your website. * * If the selected payment method does not require any additional steps from the * customer, the SetupIntent will transition to the <code>succeeded</code> status. * * Otherwise, it will transition to the <code>requires_action</code> status and * suggest additional actions via <code>next_action</code>. If setup fails, the * SetupIntent will transition to the <code>requires_payment_method</code> status. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SetupIntent */ public function confirm($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/setup_intents/%s/confirm', $id), $params, $opts); } /** * Creates a SetupIntent object. * * After the SetupIntent is created, attach a payment method and <a * href="/docs/api/setup_intents/confirm">confirm</a> to collect any required * permissions to charge the payment method later. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SetupIntent */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/setup_intents', $params, $opts); } /** * Retrieves the details of a SetupIntent that has previously been created. * * Client-side retrieval using a publishable key is allowed when the * <code>client_secret</code> is provided in the query string. * * When retrieved with a publishable key, only a subset of properties will be * returned. Please refer to the <a href="#setup_intent_object">SetupIntent</a> * object reference for more details. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SetupIntent */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/setup_intents/%s', $id), $params, $opts); } /** * Updates a SetupIntent object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SetupIntent */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/setup_intents/%s', $id), $params, $opts); } /** * Verifies microdeposits on a SetupIntent object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SetupIntent */ public function verifyMicrodeposits($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/setup_intents/%s/verify_microdeposits', $id), $params, $opts); } } stripe-php/lib/Service/Radar/ValueListService.php 0000666 00000006071 15165746005 0016021 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Radar; class ValueListService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of <code>ValueList</code> objects. The objects are sorted in * descending order by creation date, with the most recently created object * appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Radar\ValueList> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/radar/value_lists', $params, $opts); } /** * Creates a new <code>ValueList</code> object, which can then be referenced in * rules. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Radar\ValueList */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/radar/value_lists', $params, $opts); } /** * Deletes a <code>ValueList</code> object, also deleting any items contained * within the value list. To be deleted, a value list must not be referenced in any * rules. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Radar\ValueList */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/radar/value_lists/%s', $id), $params, $opts); } /** * Retrieves a <code>ValueList</code> object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Radar\ValueList */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/radar/value_lists/%s', $id), $params, $opts); } /** * Updates a <code>ValueList</code> object by setting the values of the parameters * passed. Any parameters not provided will be left unchanged. Note that * <code>item_type</code> is immutable. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Radar\ValueList */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/radar/value_lists/%s', $id), $params, $opts); } } stripe-php/lib/Service/Radar/ValueListItemService.php 0000666 00000004604 15165746005 0016640 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Radar; class ValueListItemService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of <code>ValueListItem</code> objects. The objects are sorted in * descending order by creation date, with the most recently created object * appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Radar\ValueListItem> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/radar/value_list_items', $params, $opts); } /** * Creates a new <code>ValueListItem</code> object, which is added to the specified * parent value list. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Radar\ValueListItem */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/radar/value_list_items', $params, $opts); } /** * Deletes a <code>ValueListItem</code> object, removing it from its parent value * list. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Radar\ValueListItem */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/radar/value_list_items/%s', $id), $params, $opts); } /** * Retrieves a <code>ValueListItem</code> object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Radar\ValueListItem */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/radar/value_list_items/%s', $id), $params, $opts); } } stripe-php/lib/Service/Radar/EarlyFraudWarningService.php 0000666 00000002553 15165746005 0017476 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Radar; class EarlyFraudWarningService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of early fraud warnings. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Radar\EarlyFraudWarning> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/radar/early_fraud_warnings', $params, $opts); } /** * Retrieves the details of an early fraud warning that has previously been * created. * * Please refer to the <a href="#early_fraud_warning_object">early fraud * warning</a> object reference for more details. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Radar\EarlyFraudWarning */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/radar/early_fraud_warnings/%s', $id), $params, $opts); } } stripe-php/lib/Service/Radar/RadarServiceFactory.php 0000666 00000001450 15165746005 0016466 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Radar; /** * Service factory class for API resources in the Radar namespace. * * @property EarlyFraudWarningService $earlyFraudWarnings * @property ValueListItemService $valueListItems * @property ValueListService $valueLists */ class RadarServiceFactory extends \AmeliaStripe\Service\AbstractServiceFactory { /** * @var array<string, string> */ private static $classMap = [ 'earlyFraudWarnings' => EarlyFraudWarningService::class, 'valueListItems' => ValueListItemService::class, 'valueLists' => ValueListService::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } stripe-php/lib/Service/Checkout/SessionService.php 0000666 00000005772 15165746005 0016257 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Checkout; class SessionService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of Checkout Sessions. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Checkout\Session> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/checkout/sessions', $params, $opts); } /** * When retrieving a Checkout Session, there is an includable * <strong>line_items</strong> property containing the first handful of those * items. There is also a URL where you can retrieve the full (paginated) list of * line items. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\LineItem> */ public function allLineItems($id, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/checkout/sessions/%s/line_items', $id), $params, $opts); } /** * Creates a Session object. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Checkout\Session */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/checkout/sessions', $params, $opts); } /** * A Session can be expired when it is in one of these statuses: <code>open</code>. * * After it expires, a customer can’t complete a Session and customers loading the * Session see a message saying the Session is expired. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Checkout\Session */ public function expire($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/checkout/sessions/%s/expire', $id), $params, $opts); } /** * Retrieves a Session object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Checkout\Session */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/checkout/sessions/%s', $id), $params, $opts); } } stripe-php/lib/Service/Checkout/CheckoutServiceFactory.php 0000666 00000001103 15165746005 0017711 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\Checkout; /** * Service factory class for API resources in the Checkout namespace. * * @property SessionService $sessions */ class CheckoutServiceFactory extends \AmeliaStripe\Service\AbstractServiceFactory { /** * @var array<string, string> */ private static $classMap = [ 'sessions' => SessionService::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } stripe-php/lib/Service/AccountService.php 0000666 00000033352 15165746005 0014456 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class AccountService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of accounts connected to your platform via <a * href="/docs/connect">Connect</a>. If you’re not a platform, the list is empty. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Account> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/accounts', $params, $opts); } /** * Returns a list of capabilities associated with the account. The capabilities are * returned sorted by creation date, with the most recent capability appearing * first. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Capability> */ public function allCapabilities($parentId, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/accounts/%s/capabilities', $parentId), $params, $opts); } /** * List external accounts for an account. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\BankAccount|\AmeliaStripe\Card> */ public function allExternalAccounts($parentId, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/accounts/%s/external_accounts', $parentId), $params, $opts); } /** * Returns a list of people associated with the account’s legal entity. The people * are returned sorted by creation date, with the most recent people appearing * first. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Person> */ public function allPersons($parentId, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/accounts/%s/persons', $parentId), $params, $opts); } /** * With <a href="/docs/connect">Connect</a>, you can create Stripe accounts for * your users. To do this, you’ll first need to <a * href="https://dashboard.stripe.com/account/applications/settings">register your * platform</a>. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Account */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/accounts', $params, $opts); } /** * Create an external account for a given account. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card */ public function createExternalAccount($parentId, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/accounts/%s/external_accounts', $parentId), $params, $opts); } /** * Creates a single-use login link for an Express account to access their Stripe * dashboard. * * <strong>You may only create login links for <a * href="/docs/connect/express-accounts">Express accounts</a> connected to your * platform</strong>. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\LoginLink */ public function createLoginLink($parentId, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/accounts/%s/login_links', $parentId), $params, $opts); } /** * Creates a new person. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Person */ public function createPerson($parentId, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/accounts/%s/persons', $parentId), $params, $opts); } /** * With <a href="/docs/connect">Connect</a>, you can delete accounts you manage. * * Accounts created using test-mode keys can be deleted at any time. Standard * accounts created using live-mode keys cannot be deleted. Custom or Express * accounts created using live-mode keys can only be deleted once all balances are * zero. * * If you want to delete your own account, use the <a * href="https://dashboard.stripe.com/account">account information tab in your * account settings</a> instead. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Account */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/accounts/%s', $id), $params, $opts); } /** * Delete a specified external account for a given account. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card */ public function deleteExternalAccount($parentId, $id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/accounts/%s/external_accounts/%s', $parentId, $id), $params, $opts); } /** * Deletes an existing person’s relationship to the account’s legal entity. Any * person with a relationship for an account can be deleted through the API, except * if the person is the <code>account_opener</code>. If your integration is using * the <code>executive</code> parameter, you cannot delete the only verified * <code>executive</code> on file. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Person */ public function deletePerson($parentId, $id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/accounts/%s/persons/%s', $parentId, $id), $params, $opts); } /** * With <a href="/docs/connect">Connect</a>, you may flag accounts as suspicious. * * Test-mode Custom and Express accounts can be rejected at any time. Accounts * created using live-mode keys may only be rejected once all balances are zero. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Account */ public function reject($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/accounts/%s/reject', $id), $params, $opts); } /** * Retrieves information about the specified Account Capability. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Capability */ public function retrieveCapability($parentId, $id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/accounts/%s/capabilities/%s', $parentId, $id), $params, $opts); } /** * Retrieve a specified external account for a given account. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card */ public function retrieveExternalAccount($parentId, $id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/accounts/%s/external_accounts/%s', $parentId, $id), $params, $opts); } /** * Retrieves an existing person. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Person */ public function retrievePerson($parentId, $id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/accounts/%s/persons/%s', $parentId, $id), $params, $opts); } /** * Updates a <a href="/docs/connect/accounts">connected account</a> by setting the * values of the parameters passed. Any parameters not provided are left unchanged. * Most parameters can be changed only for Custom accounts. (These are marked * <strong>Custom Only</strong> below.) Parameters marked <strong>Custom and * Express</strong> are not supported for Standard accounts. * * To update your own account, use the <a * href="https://dashboard.stripe.com/account">Dashboard</a>. Refer to our <a * href="/docs/connect/updating-accounts">Connect</a> documentation to learn more * about updating accounts. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Account */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/accounts/%s', $id), $params, $opts); } /** * Updates an existing Account Capability. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Capability */ public function updateCapability($parentId, $id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/accounts/%s/capabilities/%s', $parentId, $id), $params, $opts); } /** * Updates the metadata, account holder name, account holder type of a bank account * belonging to a <a href="/docs/connect/custom-accounts">Custom account</a>, and * optionally sets it as the default for its currency. Other bank account details * are not editable by design. * * You can re-enable a disabled bank account by performing an update call without * providing any arguments or changes. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card */ public function updateExternalAccount($parentId, $id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/accounts/%s/external_accounts/%s', $parentId, $id), $params, $opts); } /** * Updates an existing person. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Person */ public function updatePerson($parentId, $id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/accounts/%s/persons/%s', $parentId, $id), $params, $opts); } /** * Retrieves the details of an account. * * @param null|string $id * @param null|array $params * @param null|array|StripeUtilRequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Account */ public function retrieve($id = null, $params = null, $opts = null) { if (null === $id) { return $this->request('get', '/v1/account', $params, $opts); } return $this->request('get', $this->buildPath('/v1/accounts/%s', $id), $params, $opts); } } stripe-php/lib/Service/PayoutService.php 0000666 00000011320 15165746005 0014332 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class PayoutService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of existing payouts sent to third-party bank accounts or that * Stripe has sent you. The payouts are returned in sorted order, with the most * recently created payouts appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Payout> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/payouts', $params, $opts); } /** * A previously created payout can be canceled if it has not yet been paid out. * Funds will be refunded to your available balance. You may not cancel automatic * Stripe payouts. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Payout */ public function cancel($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/payouts/%s/cancel', $id), $params, $opts); } /** * To send funds to your own bank account, you create a new payout object. Your <a * href="#balance">Stripe balance</a> must be able to cover the payout amount, or * you’ll receive an “Insufficient Funds” error. * * If your API key is in test mode, money won’t actually be sent, though everything * else will occur as if in live mode. * * If you are creating a manual payout on a Stripe account that uses multiple * payment source types, you’ll need to specify the source type balance that the * payout should draw from. The <a href="#balance_object">balance object</a> * details available and pending amounts by source type. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Payout */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/payouts', $params, $opts); } /** * Retrieves the details of an existing payout. Supply the unique payout ID from * either a payout creation request or the payout list, and Stripe will return the * corresponding payout information. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Payout */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/payouts/%s', $id), $params, $opts); } /** * Reverses a payout by debiting the destination bank account. Only payouts for * connected accounts to US bank accounts may be reversed at this time. If the * payout is in the <code>pending</code> status, * <code>/v1/payouts/:id/cancel</code> should be used instead. * * By requesting a reversal via <code>/v1/payouts/:id/reverse</code>, you confirm * that the authorized signatory of the selected bank account has authorized the * debit on the bank account and that no other authorization is required. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Payout */ public function reverse($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/payouts/%s/reverse', $id), $params, $opts); } /** * Updates the specified payout by setting the values of the parameters passed. Any * parameters not provided will be left unchanged. This request accepts only the * metadata as arguments. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Payout */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/payouts/%s', $id), $params, $opts); } } stripe-php/lib/Service/BalanceTransactionService.php 0000666 00000003140 15165746005 0016605 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class BalanceTransactionService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of transactions that have contributed to the Stripe account * balance (e.g., charges, transfers, and so forth). The transactions are returned * in sorted order, with the most recent transactions appearing first. * * Note that this endpoint was previously called “Balance history” and used the * path <code>/v1/balance/history</code>. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\BalanceTransaction> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/balance_transactions', $params, $opts); } /** * Retrieves the balance transaction with the given ID. * * Note that this endpoint previously used the path * <code>/v1/balance/history/:id</code>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BalanceTransaction */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/balance_transactions/%s', $id), $params, $opts); } } stripe-php/lib/Service/AccountLinkService.php 0000666 00000001354 15165746005 0015271 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class AccountLinkService extends \AmeliaStripe\Service\AbstractService { /** * Creates an AccountLink object that includes a single-use Stripe URL that the * platform can redirect their user to in order to take them through the Connect * Onboarding flow. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\AccountLink */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/account_links', $params, $opts); } } stripe-php/lib/Service/FinancialConnections/FinancialConnectionsServiceFactory.php 0000666 00000001272 15165746005 0024564 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\FinancialConnections; /** * Service factory class for API resources in the FinancialConnections namespace. * * @property AccountService $accounts * @property SessionService $sessions */ class FinancialConnectionsServiceFactory extends \AmeliaStripe\Service\AbstractServiceFactory { /** * @var array<string, string> */ private static $classMap = [ 'accounts' => AccountService::class, 'sessions' => SessionService::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } stripe-php/lib/Service/FinancialConnections/SessionService.php 0000666 00000002536 15165746005 0020574 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\FinancialConnections; class SessionService extends \AmeliaStripe\Service\AbstractService { /** * To launch the Financial Connections authorization flow, create a * <code>Session</code>. The session’s <code>client_secret</code> can be used to * launch the flow using Stripe.js. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\FinancialConnections\Session */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/financial_connections/sessions', $params, $opts); } /** * Retrieves the details of a Financial Connections <code>Session</code>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\FinancialConnections\Session */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/financial_connections/sessions/%s', $id), $params, $opts); } } stripe-php/lib/Service/FinancialConnections/AccountService.php 0000666 00000006137 15165746005 0020546 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\FinancialConnections; class AccountService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of Financial Connections <code>Account</code> objects. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\FinancialConnections\Account> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/financial_connections/accounts', $params, $opts); } /** * Lists all owners for a given <code>Account</code>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\FinancialConnections\AccountOwner> */ public function allOwners($id, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/financial_connections/accounts/%s/owners', $id), $params, $opts); } /** * Disables your access to a Financial Connections <code>Account</code>. You will * no longer be able to access data associated with the account (e.g. balances, * transactions). * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\FinancialConnections\Account */ public function disconnect($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/financial_connections/accounts/%s/disconnect', $id), $params, $opts); } /** * Refreshes the data associated with a Financial Connections <code>Account</code>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\FinancialConnections\Account */ public function refresh($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/financial_connections/accounts/%s/refresh', $id), $params, $opts); } /** * Retrieves the details of an Financial Connections <code>Account</code>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\FinancialConnections\Account */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/financial_connections/accounts/%s', $id), $params, $opts); } } stripe-php/lib/Service/TaxRateService.php 0000666 00000004125 15165746005 0014426 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class TaxRateService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of your tax rates. Tax rates are returned sorted by creation * date, with the most recently created tax rates appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\TaxRate> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/tax_rates', $params, $opts); } /** * Creates a new tax rate. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TaxRate */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/tax_rates', $params, $opts); } /** * Retrieves a tax rate with the given ID. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TaxRate */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/tax_rates/%s', $id), $params, $opts); } /** * Updates an existing tax rate. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TaxRate */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/tax_rates/%s', $id), $params, $opts); } } stripe-php/lib/Service/CreditNoteService.php 0000666 00000013335 15165746005 0015121 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class CreditNoteService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of credit notes. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\CreditNote> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/credit_notes', $params, $opts); } /** * When retrieving a credit note, you’ll get a <strong>lines</strong> property * containing the the first handful of those items. There is also a URL where you * can retrieve the full (paginated) list of line items. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\CreditNoteLineItem> */ public function allLines($parentId, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/credit_notes/%s/lines', $parentId), $params, $opts); } /** * Issue a credit note to adjust the amount of a finalized invoice. For a * <code>status=open</code> invoice, a credit note reduces its * <code>amount_due</code>. For a <code>status=paid</code> invoice, a credit note * does not affect its <code>amount_due</code>. Instead, it can result in any * combination of the following:. * * <ul> <li>Refund: create a new refund (using <code>refund_amount</code>) or link * an existing refund (using <code>refund</code>).</li> <li>Customer balance * credit: credit the customer’s balance (using <code>credit_amount</code>) which * will be automatically applied to their next invoice when it’s finalized.</li> * <li>Outside of Stripe credit: record the amount that is or will be credited * outside of Stripe (using <code>out_of_band_amount</code>).</li> </ul> * * For post-payment credit notes the sum of the refund, credit and outside of * Stripe amounts must equal the credit note total. * * You may issue multiple credit notes for an invoice. Each credit note will * increment the invoice’s <code>pre_payment_credit_notes_amount</code> or * <code>post_payment_credit_notes_amount</code> depending on its * <code>status</code> at the time of credit note creation. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CreditNote */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/credit_notes', $params, $opts); } /** * Get a preview of a credit note without creating it. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CreditNote */ public function preview($params = null, $opts = null) { return $this->request('get', '/v1/credit_notes/preview', $params, $opts); } /** * When retrieving a credit note preview, you’ll get a <strong>lines</strong> * property containing the first handful of those items. This URL you can retrieve * the full (paginated) list of line items. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\CreditNoteLineItem> */ public function previewLines($params = null, $opts = null) { return $this->requestCollection('get', '/v1/credit_notes/preview/lines', $params, $opts); } /** * Retrieves the credit note object with the given identifier. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CreditNote */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/credit_notes/%s', $id), $params, $opts); } /** * Updates an existing credit note. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CreditNote */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/credit_notes/%s', $id), $params, $opts); } /** * Marks a credit note as void. Learn more about <a * href="/docs/billing/invoices/credit-notes#voiding">voiding credit notes</a>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CreditNote */ public function voidCreditNote($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/credit_notes/%s/void', $id), $params, $opts); } } stripe-php/lib/Service/CustomerService.php 0000666 00000044304 15165746005 0014662 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service; class CustomerService extends \AmeliaStripe\Service\AbstractService { /** * Returns a list of your customers. The customers are returned sorted by creation * date, with the most recent customers appearing first. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\Customer> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/customers', $params, $opts); } /** * Returns a list of transactions that updated the customer’s <a * href="/docs/billing/customer/balance">balances</a>. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\CustomerBalanceTransaction> */ public function allBalanceTransactions($parentId, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/balance_transactions', $parentId), $params, $opts); } /** * Returns a list of transactions that modified the customer’s <a * href="/docs/payments/customer-balance">cash balance</a>. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\CustomerCashBalanceTransaction> */ public function allCashBalanceTransactions($parentId, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/cash_balance_transactions', $parentId), $params, $opts); } /** * Returns a list of PaymentMethods for a given Customer. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\PaymentMethod> */ public function allPaymentMethods($id, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/payment_methods', $id), $params, $opts); } /** * List sources for a specified customer. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source> */ public function allSources($parentId, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/sources', $parentId), $params, $opts); } /** * Returns a list of tax IDs for a customer. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\TaxId> */ public function allTaxIds($parentId, $params = null, $opts = null) { return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/tax_ids', $parentId), $params, $opts); } /** * Creates a new customer object. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Customer */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/customers', $params, $opts); } /** * Creates an immutable transaction that updates the customer’s credit <a * href="/docs/billing/customer/balance">balance</a>. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CustomerBalanceTransaction */ public function createBalanceTransaction($parentId, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/customers/%s/balance_transactions', $parentId), $params, $opts); } /** * Retrieve funding instructions for a customer cash balance. If funding * instructions do not yet exist for the customer, new funding instructions will be * created. If funding instructions have already been created for a given customer, * the same funding instructions will be retrieved. In other words, we will return * the same funding instructions each time. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Customer */ public function createFundingInstructions($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/customers/%s/funding_instructions', $id), $params, $opts); } /** * When you create a new credit card, you must specify a customer or recipient on * which to create it. * * If the card’s owner has no default card, then the new card will become the * default. However, if the owner already has a default, then it will not change. * To change the default, you should <a href="/docs/api#update_customer">update the * customer</a> to have a new <code>default_source</code>. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source */ public function createSource($parentId, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/customers/%s/sources', $parentId), $params, $opts); } /** * Creates a new <code>TaxID</code> object for a customer. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TaxId */ public function createTaxId($parentId, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/customers/%s/tax_ids', $parentId), $params, $opts); } /** * Permanently deletes a customer. It cannot be undone. Also immediately cancels * any active subscriptions on the customer. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Customer */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/customers/%s', $id), $params, $opts); } /** * Removes the currently applied discount on a customer. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Customer */ public function deleteDiscount($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/customers/%s/discount', $id), $params, $opts); } /** * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source */ public function deleteSource($parentId, $id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts); } /** * Deletes an existing <code>TaxID</code> object. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TaxId */ public function deleteTaxId($parentId, $id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/customers/%s/tax_ids/%s', $parentId, $id), $params, $opts); } /** * Retrieves a Customer object. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Customer */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/customers/%s', $id), $params, $opts); } /** * Retrieves a specific customer balance transaction that updated the customer’s <a * href="/docs/billing/customer/balance">balances</a>. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CustomerBalanceTransaction */ public function retrieveBalanceTransaction($parentId, $id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/customers/%s/balance_transactions/%s', $parentId, $id), $params, $opts); } /** * Retrieves a customer’s cash balance. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CashBalance */ public function retrieveCashBalance($parentId, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/customers/%s/cash_balance', $parentId), $params, $opts); } /** * Retrieves a specific cash balance transaction, which updated the customer’s <a * href="/docs/payments/customer-balance">cash balance</a>. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CustomerCashBalanceTransaction */ public function retrieveCashBalanceTransaction($parentId, $id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/customers/%s/cash_balance_transactions/%s', $parentId, $id), $params, $opts); } /** * Retrieves a PaymentMethod object for a given Customer. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Customer */ public function retrievePaymentMethod($parentId, $id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/customers/%s/payment_methods/%s', $parentId, $id), $params, $opts); } /** * Retrieve a specified source for a given customer. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source */ public function retrieveSource($parentId, $id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts); } /** * Retrieves the <code>TaxID</code> object with the given identifier. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TaxId */ public function retrieveTaxId($parentId, $id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/customers/%s/tax_ids/%s', $parentId, $id), $params, $opts); } /** * Search for customers you’ve previously created using Stripe’s <a * href="/docs/search#search-query-language">Search Query Language</a>. Don’t use * search in read-after-write flows where strict consistency is necessary. Under * normal operating conditions, data is searchable in less than a minute. * Occasionally, propagation of new or updated data can be up to an hour behind * during outages. Search functionality is not available to merchants in India. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\SearchResult<\AmeliaStripe\Customer> */ public function search($params = null, $opts = null) { return $this->requestSearchResult('get', '/v1/customers/search', $params, $opts); } /** * Updates the specified customer by setting the values of the parameters passed. * Any parameters not provided will be left unchanged. For example, if you pass the * <strong>source</strong> parameter, that becomes the customer’s active source * (e.g., a card) to be used for all charges in the future. When you update a * customer to a new valid card source by passing the <strong>source</strong> * parameter: for each of the customer’s current subscriptions, if the subscription * bills automatically and is in the <code>past_due</code> state, then the latest * open invoice for the subscription with automatic collection enabled will be * retried. This retry will not count as an automatic retry, and will not affect * the next regularly scheduled payment for the invoice. Changing the * <strong>default_source</strong> for a customer will not trigger this behavior. * * This request accepts mostly the same arguments as the customer creation call. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Customer */ public function update($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/customers/%s', $id), $params, $opts); } /** * Most credit balance transaction fields are immutable, but you may update its * <code>description</code> and <code>metadata</code>. * * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CustomerBalanceTransaction */ public function updateBalanceTransaction($parentId, $id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/customers/%s/balance_transactions/%s', $parentId, $id), $params, $opts); } /** * Changes the settings on a customer’s cash balance. * * @param string $parentId * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\CashBalance */ public function updateCashBalance($parentId, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/customers/%s/cash_balance', $parentId), $params, $opts); } /** * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source */ public function updateSource($parentId, $id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts); } /** * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\BankAccount|\AmeliaStripe\Card|\AmeliaStripe\Source */ public function verifySource($parentId, $id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/customers/%s/sources/%s/verify', $parentId, $id), $params, $opts); } } stripe-php/lib/Service/TestHelpers/Issuing/CardService.php 0000666 00000005041 15165746005 0017610 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\TestHelpers\Issuing; class CardService extends \AmeliaStripe\Service\AbstractService { /** * Updates the shipping status of the specified Issuing <code>Card</code> object to * <code>delivered</code>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Card */ public function deliverCard($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/issuing/cards/%s/shipping/deliver', $id), $params, $opts); } /** * Updates the shipping status of the specified Issuing <code>Card</code> object to * <code>failure</code>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Card */ public function failCard($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/issuing/cards/%s/shipping/fail', $id), $params, $opts); } /** * Updates the shipping status of the specified Issuing <code>Card</code> object to * <code>returned</code>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Card */ public function returnCard($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/issuing/cards/%s/shipping/return', $id), $params, $opts); } /** * Updates the shipping status of the specified Issuing <code>Card</code> object to * <code>shipped</code>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Issuing\Card */ public function shipCard($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/issuing/cards/%s/shipping/ship', $id), $params, $opts); } } stripe-php/lib/Service/TestHelpers/Issuing/IssuingServiceFactory.php 0000666 00000001100 15165746005 0021700 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\TestHelpers\Issuing; /** * Service factory class for API resources in the Issuing namespace. * * @property CardService $cards */ class IssuingServiceFactory extends \AmeliaStripe\Service\AbstractServiceFactory { /** * @var array<string, string> */ private static $classMap = [ 'cards' => CardService::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } stripe-php/lib/Service/TestHelpers/Treasury/OutboundTransferService.php 0000666 00000004303 15165746005 0022440 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\TestHelpers\Treasury; class OutboundTransferService extends \AmeliaStripe\Service\AbstractService { /** * Transitions a test mode created OutboundTransfer to the <code>failed</code> * status. The OutboundTransfer must already be in the <code>processing</code> * state. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\OutboundTransfer */ public function fail($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/treasury/outbound_transfers/%s/fail', $id), $params, $opts); } /** * Transitions a test mode created OutboundTransfer to the <code>posted</code> * status. The OutboundTransfer must already be in the <code>processing</code> * state. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\OutboundTransfer */ public function post($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/treasury/outbound_transfers/%s/post', $id), $params, $opts); } /** * Transitions a test mode created OutboundTransfer to the <code>returned</code> * status. The OutboundTransfer must already be in the <code>processing</code> * state. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\OutboundTransfer */ public function returnOutboundTransfer($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/treasury/outbound_transfers/%s/return', $id), $params, $opts); } } stripe-php/lib/Service/TestHelpers/Treasury/ReceivedCreditService.php 0000666 00000001450 15165746005 0022015 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\TestHelpers\Treasury; class ReceivedCreditService extends \AmeliaStripe\Service\AbstractService { /** * Use this endpoint to simulate a test mode ReceivedCredit initiated by a third * party. In live mode, you can’t directly create ReceivedCredits initiated by * third parties. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\ReceivedCredit */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/test_helpers/treasury/received_credits', $params, $opts); } } stripe-php/lib/Service/TestHelpers/Treasury/InboundTransferService.php 0000666 00000004321 15165746005 0022237 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\TestHelpers\Treasury; class InboundTransferService extends \AmeliaStripe\Service\AbstractService { /** * Transitions a test mode created InboundTransfer to the <code>failed</code> * status. The InboundTransfer must already be in the <code>processing</code> * state. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\InboundTransfer */ public function fail($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/treasury/inbound_transfers/%s/fail', $id), $params, $opts); } /** * Marks the test mode InboundTransfer object as returned and links the * InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the * <code>succeeded</code> state. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\InboundTransfer */ public function returnInboundTransfer($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/treasury/inbound_transfers/%s/return', $id), $params, $opts); } /** * Transitions a test mode created InboundTransfer to the <code>succeeded</code> * status. The InboundTransfer must already be in the <code>processing</code> * state. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\InboundTransfer */ public function succeed($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/treasury/inbound_transfers/%s/succeed', $id), $params, $opts); } } stripe-php/lib/Service/TestHelpers/Treasury/TreasuryServiceFactory.php 0000666 00000002063 15165746005 0022303 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\TestHelpers\Treasury; /** * Service factory class for API resources in the Treasury namespace. * * @property InboundTransferService $inboundTransfers * @property OutboundPaymentService $outboundPayments * @property OutboundTransferService $outboundTransfers * @property ReceivedCreditService $receivedCredits * @property ReceivedDebitService $receivedDebits */ class TreasuryServiceFactory extends \AmeliaStripe\Service\AbstractServiceFactory { /** * @var array<string, string> */ private static $classMap = [ 'inboundTransfers' => InboundTransferService::class, 'outboundPayments' => OutboundPaymentService::class, 'outboundTransfers' => OutboundTransferService::class, 'receivedCredits' => ReceivedCreditService::class, 'receivedDebits' => ReceivedDebitService::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } stripe-php/lib/Service/TestHelpers/Treasury/OutboundPaymentService.php 0000666 00000004265 15165746005 0022300 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\TestHelpers\Treasury; class OutboundPaymentService extends \AmeliaStripe\Service\AbstractService { /** * Transitions a test mode created OutboundPayment to the <code>failed</code> * status. The OutboundPayment must already be in the <code>processing</code> * state. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\OutboundPayment */ public function fail($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/treasury/outbound_payments/%s/fail', $id), $params, $opts); } /** * Transitions a test mode created OutboundPayment to the <code>posted</code> * status. The OutboundPayment must already be in the <code>processing</code> * state. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\OutboundPayment */ public function post($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/treasury/outbound_payments/%s/post', $id), $params, $opts); } /** * Transitions a test mode created OutboundPayment to the <code>returned</code> * status. The OutboundPayment must already be in the <code>processing</code> * state. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\OutboundPayment */ public function returnOutboundPayment($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/treasury/outbound_payments/%s/return', $id), $params, $opts); } } stripe-php/lib/Service/TestHelpers/Treasury/ReceivedDebitService.php 0000666 00000001443 15165746005 0021634 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\TestHelpers\Treasury; class ReceivedDebitService extends \AmeliaStripe\Service\AbstractService { /** * Use this endpoint to simulate a test mode ReceivedDebit initiated by a third * party. In live mode, you can’t directly create ReceivedDebits initiated by third * parties. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Treasury\ReceivedDebit */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/test_helpers/treasury/received_debits', $params, $opts); } } stripe-php/lib/Service/TestHelpers/RefundService.php 0000666 00000001271 15165746005 0016542 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\TestHelpers; class RefundService extends \AmeliaStripe\Service\AbstractService { /** * Expire a refund with a status of <code>requires_action</code>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Refund */ public function expire($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/refunds/%s/expire', $id), $params, $opts); } } stripe-php/lib/Service/TestHelpers/TestClockService.php 0000666 00000005371 15165746005 0017217 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\TestHelpers; class TestClockService extends \AmeliaStripe\Service\AbstractService { /** * Starts advancing a test clock to a specified time in the future. Advancement is * done when status changes to <code>Ready</code>. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TestHelpers\TestClock */ public function advance($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/test_clocks/%s/advance', $id), $params, $opts); } /** * Returns a list of your test clocks. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Collection<\AmeliaStripe\TestHelpers\TestClock> */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/test_helpers/test_clocks', $params, $opts); } /** * Creates a new test clock that can be attached to new customers and quotes. * * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TestHelpers\TestClock */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/test_helpers/test_clocks', $params, $opts); } /** * Deletes a test clock. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TestHelpers\TestClock */ public function delete($id, $params = null, $opts = null) { return $this->request('delete', $this->buildPath('/v1/test_helpers/test_clocks/%s', $id), $params, $opts); } /** * Retrieves a test clock. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\TestHelpers\TestClock */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/test_helpers/test_clocks/%s', $id), $params, $opts); } } stripe-php/lib/Service/TestHelpers/Terminal/ReaderService.php 0000666 00000001502 15165746005 0020271 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\TestHelpers\Terminal; class ReaderService extends \AmeliaStripe\Service\AbstractService { /** * Presents a payment method on a simulated reader. Can be used to simulate * accepting a payment, saving a card or refunding a transaction. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Terminal\Reader */ public function presentPaymentMethod($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/terminal/readers/%s/present_payment_method', $id), $params, $opts); } } stripe-php/lib/Service/TestHelpers/Terminal/TerminalServiceFactory.php 0000666 00000001113 15165746005 0022170 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\TestHelpers\Terminal; /** * Service factory class for API resources in the Terminal namespace. * * @property ReaderService $readers */ class TerminalServiceFactory extends \AmeliaStripe\Service\AbstractServiceFactory { /** * @var array<string, string> */ private static $classMap = [ 'readers' => ReaderService::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } stripe-php/lib/Service/TestHelpers/CustomerService.php 0000666 00000001277 15165746005 0017126 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\TestHelpers; class CustomerService extends \AmeliaStripe\Service\AbstractService { /** * Create an incoming testmode bank transfer. * * @param string $id * @param null|array $params * @param null|array|\AmeliaStripe\Util\RequestOptions $opts * * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\Customer */ public function fundCashBalance($id, $params = null, $opts = null) { return $this->request('post', $this->buildPath('/v1/test_helpers/customers/%s/fund_cash_balance', $id), $params, $opts); } } stripe-php/lib/Service/TestHelpers/TestHelpersServiceFactory.php 0000666 00000002123 15165746005 0021106 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe\Service\TestHelpers; /** * Service factory class for API resources in the TestHelpers namespace. * * @property CustomerService $customers * @property Issuing\IssuingServiceFactory $issuing * @property RefundService $refunds * @property Terminal\TerminalServiceFactory $terminal * @property TestClockService $testClocks * @property Treasury\TreasuryServiceFactory $treasury */ class TestHelpersServiceFactory extends \AmeliaStripe\Service\AbstractServiceFactory { /** * @var array<string, string> */ private static $classMap = [ 'customers' => CustomerService::class, 'issuing' => Issuing\IssuingServiceFactory::class, 'refunds' => RefundService::class, 'terminal' => Terminal\TerminalServiceFactory::class, 'testClocks' => TestClockService::class, 'treasury' => Treasury\TreasuryServiceFactory::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } stripe-php/lib/EphemeralKey.php 0000666 00000003043 15165746005 0012506 0 ustar 00 <?php // File generated from our OpenAPI spec namespace AmeliaStripe; /** * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property int $expires Time at which the key will expire. Measured in seconds since the Unix epoch. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. * @property string $secret The key's secret. You can use this value to make authorized requests to the Stripe API. */ class EphemeralKey extends ApiResource { const OBJECT_NAME = 'ephemeral_key'; use ApiOperations\Create { create as protected _create; } use ApiOperations\Delete; /** * @param null|array $params * @param null|array|string $opts * * @throws \AmeliaStripe\Exception\InvalidArgumentException if stripe_version is missing * @throws \AmeliaStripe\Exception\ApiErrorException if the request fails * * @return \AmeliaStripe\EphemeralKey the created key */ public static function create($params = null, $opts = null) { if (!$opts || !isset($opts['stripe_version'])) { throw new Exception\InvalidArgumentException('stripe_version must be specified to create an ephemeral key'); } return self::_create($params, $opts); } } stripe-php/VERSION 0000666 00000000006 15165746005 0007720 0 ustar 00 9.7.0 stripe-php/build.php 0000666 00000001200 15165746005 0010455 0 ustar 00 #!/usr/bin/env php <?php \chdir(__DIR__); $autoload = (int) $argv[1]; $returnStatus = null; if (!$autoload) { // Modify composer to not autoload Stripe $composer = \json_decode(\file_get_contents('composer.json'), true); unset($composer['autoload'], $composer['autoload-dev']); \file_put_contents('composer.json', \json_encode($composer, \JSON_PRETTY_PRINT)); } \passthru('composer update', $returnStatus); if (0 !== $returnStatus) { exit(1); } $config = $autoload ? 'phpunit.xml' : 'phpunit.no_autoload.xml'; \passthru("./vendor/bin/phpunit -c {$config}", $returnStatus); if (0 !== $returnStatus) { exit(1); } stripe-php/LICENSE 0000666 00000002113 15165746005 0007656 0 ustar 00 The MIT License Copyright (c) 2010-2019 Stripe, Inc. (https://stripe.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. stripe-php/CHANGELOG.md 0000666 00000230340 15165746005 0010467 0 ustar 00 # Changelog ## 9.7.0 - 2022-10-13 * [#1376](https://github.com/stripe/stripe-php/pull/1376) API Updates * Add support for `network_data` on `Issuing.Authorization` * [#1374](https://github.com/stripe/stripe-php/pull/1374) Add request_log_url on ErrorObject * [#1370](https://github.com/stripe/stripe-php/pull/1370) API Updates * Add support for `created` on `Checkout.Session` ## 9.6.0 - 2022-09-15 * [#1365](https://github.com/stripe/stripe-php/pull/1365) API Updates * Add support for `from_invoice` and `latest_revision` on `Invoice` * Add support for new value `pix` on enum `PaymentLink.payment_method_types[]` * Add support for `pix` on `PaymentMethod` * Add support for new value `pix` on enum `PaymentMethod.type` * Add support for `created` on `Treasury.CreditReversal` and `Treasury.DebitReversal` ## 9.5.0 - 2022-09-06 * [#1364](https://github.com/stripe/stripe-php/pull/1364) API Updates * Add support for new value `terminal_reader_splashscreen` on enum `File.purpose` * [#1363](https://github.com/stripe/stripe-php/pull/1363) chore: Update PHP tests to handle search methods. ## 9.4.0 - 2022-08-26 * [#1362](https://github.com/stripe/stripe-php/pull/1362) API Updates * Add support for `login_page` on `BillingPortal.Configuration` * [#1360](https://github.com/stripe/stripe-php/pull/1360) Add test coverage using Coveralls * [#1361](https://github.com/stripe/stripe-php/pull/1361) fix: Fix type hints for error objects. * Update `Invoice.last_finalization_error`, `PaymentIntent.last_payment_error`, `SetupAttempt.setup_error` and `SetupIntent.setup_error` type to be `StripeObject`. * Addresses https://github.com/stripe/stripe-php/issues/1353. The library today does not actually return a `ErrorObject` for these fields, so the type annotation was incorrect. * [#1356](https://github.com/stripe/stripe-php/pull/1356) Add beta readme.md section ## 9.3.0 - 2022-08-23 * [#1355](https://github.com/stripe/stripe-php/pull/1355) API Updates * Change type of `Treasury.OutboundTransfer.destination_payment_method` from `string` to `string | null` * Change the return type of `CustomerService.fundCashBalance` test helper from `CustomerBalanceTransaction` to `CustomerCashBalanceTransaction`. * This would generally be considered a breaking change, but we've worked with all existing users to migrate and are comfortable releasing this as a minor as it is solely a test helper method. This was essentially broken prior to this change. ## 9.2.0 - 2022-08-19 * [#1352](https://github.com/stripe/stripe-php/pull/1352) API Updates * Add support for new resource `CustomerCashBalanceTransaction` * Add support for `currency` on `PaymentLink` * Add constant for `customer_cash_balance_transaction.created` webhook event. * [#1351](https://github.com/stripe/stripe-php/pull/1351) Add a support section to the readme * [#1304](https://github.com/stripe/stripe-php/pull/1304) Allow passing PSR-3 loggers to setLogger as they are compatible ## 9.1.0 - 2022-08-11 * [#1348](https://github.com/stripe/stripe-php/pull/1348) API Updates * Add support for `payment_method_collection` on `Checkout.Session` and `PaymentLink` * [#1346](https://github.com/stripe/stripe-php/pull/1346) API Updates * Add support for `expires_at` on `Apps.Secret` ## 9.0.0 - 2022-08-02 Breaking changes that arose during code generation of the library that we postponed for the next major version. For changes to the SDK, read more detailed description at https://github.com/stripe/stripe-php/wiki/Migration-guide-for-v9. For changes to the Stripe products, read more at https://stripe.com/docs/upgrades#2022-08-01. "⚠️" symbol highlights breaking changes. * [#1344](https://github.com/stripe/stripe-php/pull/1344) API Updates * [#1337](https://github.com/stripe/stripe-php/pull/1337) API Updates * [#1273](https://github.com/stripe/stripe-php/pull/1273) Add some PHPDoc return types and fixes * [#1341](https://github.com/stripe/stripe-php/pull/1341) Next major release changes ### Added * Add `alternate_statement_descriptors`, `authorization_code`, and `level3` properties to `Charge` resource. * Add `previewLines` method to `CreditNote` resource. * Add `transfer_data` property to `Subscription` resource. * Add `SOURCE_TYPE_FPX` constant to `Transfer` resource. * Add new error code constants to `ErrorObject`. * Add support for `shipping_cost` and `shipping_details` on `Checkout.Session` ### ⚠️ Changed * Updated certificate bundle ([#1314](https://github.com/stripe/stripe-php/pull/1314)) * Add `params` parameter to `close` method in `Dispute` resource. ### ⚠️ Removed * Remove deprecated `AlipayAccount`, `BitcoinReceiver`, `BitcoinTransaction`, `Recipient`, `RecipientTransfer`, and `ThreeDSecure` resources. * Remove `CAPABILITY_CARD_PAYMENTS`, `CAPABILITY_LEGACY_PAYMENTS`, `CAPABILITY_PLATFORM_PAYMENTS`, `CAPABILITY_TRANSFERS`, `CAPABILITY_STATUS_ACTIVE`, `CAPABILITY_STATUS_INACTIVE`, and `CAPABILITY_STATUS_PENDING` constants from `Account` resource. Please use up-to-date values from https://stripe.com/docs/connect/account-capabilities. * Remove `AssociatedObjects` array property from `EphemeralKey` resource. The field was undocumented and unsupported. * Remove `details` method from `Card` resource. The endpoint was deprecated and no longer exists. * Remove `recipient` property from `Card` resource. The property was deprecated. * Remove ability to list `Card` resources for a particular `Recipient`. * Remove `sources` property from `Card` resource. The property was deprecated. * Remove `FAILURE_REASON` constant from `Refund` resource. The value was deprecated. * Remove `Recipient` resource. The resource was deprecated. * Remove `OrderItem` resource. The resource was deprecated. * Remove `all` method from `LineItem`. * Remove `cancel` method from `Transfer` and `TransferService`. This method is deprecated. * Remove `allTransactions` method from `SourceService` service. Please use `allSourceTransactions` method instead. * Remove `persons` method from `Account` resource. Please use `allPersons` method instead. * Remove `sourceTransactions` method from `Source` resource. Please use `allSourceTransactions` method instead. * Remove `usageRecordSummaries` method from `SubscriptionItem` resource. Please use `allUsageRecordSummaries` method instead. * Remove `SOURCE_TYPE_ALIPAY_ACCOUNT` and `SOURCE_TYPE_FINANCING` constants from `Transfer` resource. The values were deprecated and are no longer in use. * Remove deprecated error code constants from `ErrorObject`: `CODE_ACCOUNT_ALREADY_EXISTS`, `CODE_ORDER_CREATION_FAILED`, `CODE_ORDER_REQUIRED_SETTINGS`, `CODE_ORDER_STATUS_INVALID`, `CODE_ORDER_UPSTREAM_TIMEOUT`, and `CODE_UPSTREAM_ORDER_CREATION_FAILED`. * Remove deprecated event constants from `Webhook`: `ISSUER_FRAUD_RECORD_CREATED`, ` ORDER_PAYMENT_FAILED`, `ORDER_PAYMENT_SUCCEEDED`, `ORDER_UPDATED`, `ORDER_RETURN_CREATED`, `PAYMENT_METHOD_CARD_AUTOMATICALLY_UPDATED`, `PING`, `PROMOTION_CODE_DELETED`, and `TREASURY_RECEIVED_CREDIT_REVERSED`. The events are deprecated and no longer sent by Stripe. ## 8.12.0 - 2022-07-25 * [#1332](https://github.com/stripe/stripe-php/pull/1332) API Updates * Add support for `default_currency` and `invoice_credit_balance` on `Customer` ## 8.11.0 - 2022-07-18 * [#1324](https://github.com/stripe/stripe-php/pull/1324) API Updates * Add support for new value `blik` on enum `PaymentLink.payment_method_types[]` * Add support for `blik` on `PaymentMethod` * Add support for new value `blik` on enum `PaymentMethod.type` * Add `Invoice.upcomingLines` method. * Add `SourceService.allSourceTransactions` method. * [#1322](https://github.com/stripe/stripe-php/pull/1322) API Updates * Change type of `source_type` on `Transfer` from nullable string to string (comment-only change) ## 8.10.0 - 2022-07-07 * [#1319](https://github.com/stripe/stripe-php/pull/1319) API Updates * Add support for `currency_options` on `Coupon` and `Price` * Add support for `currency` on `Subscription` * [#1318](https://github.com/stripe/stripe-php/pull/1318) API Updates * Add support for new values financial_connections.account.created, financial_connections.account.deactivated, financial_connections.account.disconnected, financial_connections.account.reactivated, and financial_connections.account.refreshed_balance on `Event`. ## 8.9.0 - 2022-06-29 * [#1316](https://github.com/stripe/stripe-php/pull/1316) API Updates * Add support for `deliver_card`, `fail_card`, `return_card`, and `ship_card` test helper methods on resource `Issuing.Card` * Add support for `subtotal_excluding_tax` on `CreditNote` and `Invoice` * Add support for `amount_excluding_tax` and `unit_amount_excluding_tax` on `CreditNoteLineItem` and `InvoiceLineItem` * Add support for `total_excluding_tax` on `Invoice` * Change type of `PaymentLink.payment_method_types[]` from `literal('card')` to `enum` * Add support for `promptpay` on `PaymentMethod` * Add support for new value `promptpay` on enum `PaymentMethod.type` * Add support for `hosted_regulatory_receipt_url` and `reversal_details` on `Treasury.ReceivedCredit` and `Treasury.ReceivedDebit` ## 8.8.0 - 2022-06-23 * [#1302](https://github.com/stripe/stripe-php/pull/1302) API Updates * Add support for `custom_unit_amount` on `Price` * [#1301](https://github.com/stripe/stripe-php/pull/1301) API Updates Documentation updates. ## 8.7.0 - 2022-06-17 * [#1306](https://github.com/stripe/stripe-php/pull/1306) API Updates * Add support for `fund_cash_balance` test helper method on resource `Customer` * Add support for `total_excluding_tax` on `CreditNote` * Add support for `rendering_options` on `Invoice` * [#1307](https://github.com/stripe/stripe-php/pull/1307) Support updating pre-release versions * [#1305](https://github.com/stripe/stripe-php/pull/1305) Trigger workflows on beta branches * [#1302](https://github.com/stripe/stripe-php/pull/1302) API Updates * Add support for `custom_unit_amount` on `Price` * [#1301](https://github.com/stripe/stripe-php/pull/1301) API Updates Documentation updates. ## 8.6.0 - 2022-06-08 * [#1300](https://github.com/stripe/stripe-php/pull/1300) API Updates * Add support for `attach_to_self` and `flow_directions` on `SetupAttempt` ## 8.5.0 - 2022-06-01 * [#1298](https://github.com/stripe/stripe-php/pull/1298) API Updates * Add support for `radar_options` on `Charge` and `PaymentMethod` * Add support for new value `simulated_wisepos_e` on enum `Terminal.Reader.device_type` ## 8.4.0 - 2022-05-26 * [#1296](https://github.com/stripe/stripe-php/pull/1296) API Updates * Add support for `persons` method on resource `Account` * Add support for `balance_transactions` method on resource `Customer` * Add support for `id_number_secondary_provided` on `Person` * [#1295](https://github.com/stripe/stripe-php/pull/1295) API Updates ## 8.3.0 - 2022-05-23 * [#1294](https://github.com/stripe/stripe-php/pull/1294) API Updates * Add support for new resource `Apps.Secret` * Add support for `affirm` and `link` on `PaymentMethod` * Add support for new values `affirm` and `link` on enum `PaymentMethod.type` * [#1289](https://github.com/stripe/stripe-php/pull/1289) fix: Update RequestOptions#redactedApiKey to stop exploding null. ## 8.2.0 - 2022-05-19 * [#1286](https://github.com/stripe/stripe-php/pull/1286) API Updates * Add support for new resources `Treasury.CreditReversal`, `Treasury.DebitReversal`, `Treasury.FinancialAccountFeatures`, `Treasury.FinancialAccount`, `Treasury.FlowDetails`, `Treasury.InboundTransfer`, `Treasury.OutboundPayment`, `Treasury.OutboundTransfer`, `Treasury.ReceivedCredit`, `Treasury.ReceivedDebit`, `Treasury.TransactionEntry`, and `Treasury.Transaction` * Add support for `retrieve_payment_method` method on resource `Customer` * Add support for `all` and `list_owners` methods on resource `FinancialConnections.Account` * Add support for `treasury` on `Issuing.Authorization`, `Issuing.Dispute`, and `Issuing.Transaction` * Add support for `financial_account` on `Issuing.Card` * Add support for `client_secret` on `Order` * Add support for `attach_to_self` and `flow_directions` on `SetupIntent` ## 8.1.0 - 2022-05-11 * [#1284](https://github.com/stripe/stripe-php/pull/1284) API Updates * Add support for `consent_collection`, `customer_creation`, `payment_intent_data`, `shipping_options`, `submit_type`, and `tax_id_collection` on `PaymentLink` * Add support for `description` on `Subscription` ## 8.0.0 - 2022-05-09 * [#1283](https://github.com/stripe/stripe-php/pull/1283) Major version release of v8.0.0. The [migration guide](https://github.com/stripe/stripe-php/wiki/Migration-Guide-for-v8) contains more information. (⚠️ = breaking changes): * ⚠️ Replace the legacy `Order` API with the new `Order` API. * Resource modified: `Order`. * New methods: `cancel`, `list_line_items`, `reopen`, and `submit` * Removed methods: `pay` and `return_order` * Removed resources: `OrderItem` and `OrderReturn` * Removed references from other resources: `Charge.order` * ⚠️ Rename `\FinancialConnections\Account.refresh` method to `\FinancialConnections\Account.refresh_account` * Add support for `amount_discount`, `amount_tax`, and `product` on `LineItem` ## 7.128.0 - 2022-05-05 * [#1282](https://github.com/stripe/stripe-php/pull/1282) API Updates * Add support for `default_price` on `Product` * Add support for `instructions_email` on `Refund` ## 7.127.0 - 2022-05-05 * [#1281](https://github.com/stripe/stripe-php/pull/1281) API Updates * Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session` * [#1278](https://github.com/stripe/stripe-php/pull/1278) Pin setup-php action version. * [#1277](https://github.com/stripe/stripe-php/pull/1277) API Updates * Add support for `registered_address` on `Person` ## 7.126.0 - 2022-05-03 * [#1276](https://github.com/stripe/stripe-php/pull/1276) API Updates * Add support for new resource `CashBalance` * Change type of `BillingPortal.Configuration.application` from `$Application` to `deletable($Application)` * Add support for `cash_balance` on `Customer` * Add support for `application` on `Invoice`, `Quote`, `SubscriptionSchedule`, and `Subscription` * Add support for new value `eu_oss_vat` on enum `TaxId.type` * [#1274](https://github.com/stripe/stripe-php/pull/1274) Fix PHPDoc on Discount for nullable properties * [#1272](https://github.com/stripe/stripe-php/pull/1272) Allow users to pass a custom IPRESOLVE cURL option. ## 7.125.0 - 2022-04-21 * [#1270](https://github.com/stripe/stripe-php/pull/1270) API Updates * Add support for `expire` test helper method on resource `Refund` ## 7.124.0 - 2022-04-18 * [#1265](https://github.com/stripe/stripe-php/pull/1265) API Updates * Add support for new resources `FundingInstructions` and `Terminal.Configuration` * Add support for `create_funding_instructions` method on resource `Customer` * Add support for `amount_details` on `PaymentIntent` * Add support for `customer_balance` on `PaymentMethod` * Add support for new value `customer_balance` on enum `PaymentMethod.type` * Add support for `configuration_overrides` on `Terminal.Location` ## 7.123.0 - 2022-04-13 * [#1263](https://github.com/stripe/stripe-php/pull/1263) API Updates * Add support for `increment_authorization` method on resource `PaymentIntent` * [#1262](https://github.com/stripe/stripe-php/pull/1262) Add support for updating the version of the repo * [#1230](https://github.com/stripe/stripe-php/pull/1230) Add PHPDoc return types * [#1242](https://github.com/stripe/stripe-php/pull/1242) Fix some PHPDoc in tests ## 7.122.0 - 2022-04-08 * [#1261](https://github.com/stripe/stripe-php/pull/1261) API Updates * Add support for `apply_customer_balance` method on resource `PaymentIntent` * [#1259](https://github.com/stripe/stripe-php/pull/1259) API Updates * Add `payment_intent.partially_funded`, `terminal.reader.action_failed`, and `terminal.reader.action_succeeded` events. ## 7.121.0 - 2022-03-30 * [#1258](https://github.com/stripe/stripe-php/pull/1258) API Updates * Add support for `cancel_action`, `process_payment_intent`, `process_setup_intent`, and `set_reader_display` methods on resource `Terminal.Reader` * Add support for `action` on `Terminal.Reader` ## 7.120.0 - 2022-03-29 * [#1257](https://github.com/stripe/stripe-php/pull/1257) API Updates * Add support for Search API * Add support for `search` method on resources `Charge`, `Customer`, `Invoice`, `PaymentIntent`, `Price`, `Product`, and `Subscription` ## 7.119.0 - 2022-03-25 * [#1256](https://github.com/stripe/stripe-php/pull/1256) API Updates * Add support for PayNow and US Bank Accounts Debits payments * Add support for `paynow` and `us_bank_account` on `PaymentMethod` * Add support for new values `paynow` and `us_bank_account` on enum `PaymentMethod.type` * Add support for `failure_balance_transaction` on `Charge` ## 7.118.0 - 2022-03-23 * [#1255](https://github.com/stripe/stripe-php/pull/1255) API Updates * Add support for `cancel` method on resource `Refund` * Add support for new values `bg_uic`, `hu_tin`, and `si_tin` on enum `TaxId.type` * Add `test_helpers.test_clock.advancing`, `test_helpers.test_clock.created`, `test_helpers.test_clock.deleted`, `test_helpers.test_clock.internal_failure`, and `test_helpers.test_clock.ready` events. ## 7.117.0 - 2022-03-18 * [#1254](https://github.com/stripe/stripe-php/pull/1254) API Updates * Add support for `status` on `Card` * [#1251](https://github.com/stripe/stripe-php/pull/1251) Add support for SearchResult objects. * [#1249](https://github.com/stripe/stripe-php/pull/1249) Add missing constant for payment_behavior ## 7.116.0 - 2022-03-02 * [#1248](https://github.com/stripe/stripe-php/pull/1248) API Updates * Add support for `proration_details` on `InvoiceLineItem` ## 7.115.0 - 2022-03-01 * [#1245](https://github.com/stripe/stripe-php/pull/1245) [#1247](https://github.com/stripe/stripe-php/pull/1247) API Updates * Add support for new resource `TestHelpers.TestClock` * Add support for `test_clock` on `Customer`, `Invoice`, `InvoiceItem`, `Quote`, `Subscription`, and `SubscriptionSchedule` * Add support for `next_action` on `Refund` * Add support for `konbini` on `PaymentMethod` * [#1244](https://github.com/stripe/stripe-php/pull/1244) API Updates * Add support for new values `bbpos_wisepad3` and `stripe_m2` on enum `Terminal.Reader.device_type` ## 7.114.0 - 2022-02-15 * [#1243](https://github.com/stripe/stripe-php/pull/1243) Add test * [#1240](https://github.com/stripe/stripe-php/pull/1240) API Updates * Add support for `verify_microdeposits` method on resources `PaymentIntent` and `SetupIntent` * [#1241](https://github.com/stripe/stripe-php/pull/1241) Add generic parameter to \Stripe\Collection usages ## 7.113.0 - 2022-02-03 * [#1239](https://github.com/stripe/stripe-php/pull/1239) API Updates * Add `REASON_EXPIRED_UNCAPTURED_CHARGE` enum value on `Refund`. ## 7.112.0 - 2022-01-25 * [#1235](https://github.com/stripe/stripe-php/pull/1235) API Updates * Add support for `phone_number_collection` on `PaymentLink` * Add support for new value `is_vat` on enum `TaxId.type` ## 7.111.0 - 2022-01-20 * [#1233](https://github.com/stripe/stripe-php/pull/1233) API Updates * Add support for new resource `PaymentLink` * Add support for `payment_link` on `Checkout.Session` ## 7.110.0 - 2022-01-13 * [#1232](https://github.com/stripe/stripe-php/pull/1232) API Updates * Add support for `paid_out_of_band` on `Invoice` ## 7.109.0 - 2022-01-12 * [#1231](https://github.com/stripe/stripe-php/pull/1231) API Updates * Add support for `customer_creation` on `Checkout.Session` * [#1227](https://github.com/stripe/stripe-php/pull/1227) Update docs URLs ## 7.108.0 - 2021-12-22 * [#1226](https://github.com/stripe/stripe-php/pull/1226) Upgrade php-cs-fixer to 3.4.0. * [#1222](https://github.com/stripe/stripe-php/pull/1222) API Updates * Add support for `processing` on `PaymentIntent` * [#1220](https://github.com/stripe/stripe-php/pull/1220) API Updates ## 7.107.0 - 2021-12-09 * [#1219](https://github.com/stripe/stripe-php/pull/1219) API Updates * Add support for `metadata` on `BillingPortal.Configuration` * Add support for `wallets` on `Issuing.Card` ## 7.106.0 - 2021-12-09 * [#1218](https://github.com/stripe/stripe-php/pull/1218) API Updates * Add support for new values `ge_vat` and `ua_vat` on enum `TaxId.type` * [#1216](https://github.com/stripe/stripe-php/pull/1216) Fix namespaced classes in @return PHPDoc. * [#1214](https://github.com/stripe/stripe-php/pull/1214) Announce PHP8 support in CHANGELOG.md ## 7.105.0 - 2021-12-06 * [#1213](https://github.com/stripe/stripe-php/pull/1213) PHP 8.1 missing ReturnTypeWillChange annotations. * As of this version, PHP 8.1 is officially supported. ## 7.104.0 - 2021-12-01 * [#1211](https://github.com/stripe/stripe-php/pull/1211) PHPStan compatibility with PHP8.x * [#1209](https://github.com/stripe/stripe-php/pull/1209) PHPUnit compatibility with PHP 8.x ## 7.103.0 - 2021-11-19 * [#1206](https://github.com/stripe/stripe-php/pull/1206) API Updates * Add support for new value `jct` on enum `TaxRate.tax_type` ## 7.102.0 - 2021-11-17 * [#1205](https://github.com/stripe/stripe-php/pull/1205) API Updates * Add support for `automatic_payment_methods` on `PaymentIntent` ## 7.101.0 - 2021-11-16 * [#1203](https://github.com/stripe/stripe-php/pull/1203) API Updates * Add support for new resource `ShippingRate` * Add support for `shipping_options` and `shipping_rate` on `Checkout.Session` * Add support for `expire` method on resource `Checkout.Session` * Add support for `status` on `Checkout.Session` ## 7.100.0 - 2021-10-11 * [#1190](https://github.com/stripe/stripe-php/pull/1190) API Updates * Add support for `klarna` on `PaymentMethod`. ## 7.99.0 - 2021-10-11 * [#1188](https://github.com/stripe/stripe-php/pull/1188) API Updates * Add support for `list_payment_methods` method on resource `Customer` ## 7.98.0 - 2021-10-07 * [#1187](https://github.com/stripe/stripe-php/pull/1187) API Updates * Add support for `phone_number_collection` on `Checkout.Session` * Add support for new value `customer_id` on enum `Radar.ValueList.item_type` * Add support for new value `bbpos_wisepos_e` on enum `Terminal.Reader.device_type` ## 7.97.0 - 2021-09-16 * [#1181](https://github.com/stripe/stripe-php/pull/1181) API Updates * Add support for `full_name_aliases` on `Person` ## 7.96.0 - 2021-09-15 * [#1178](https://github.com/stripe/stripe-php/pull/1178) API Updates * Add support for livemode on Reporting.ReportType * Add support for new value `rst` on enum `TaxRate.tax_type` ## 7.95.0 - 2021-09-01 * [#1177](https://github.com/stripe/stripe-php/pull/1177) API Updates * Add support for `future_requirements` on `Account`, `Capability`, and `Person` * Add support for `after_expiration`, `consent`, `consent_collection`, `expires_at`, and `recovered_from` on `Checkout.Session` ## 7.94.0 - 2021-08-19 * [#1173](https://github.com/stripe/stripe-php/pull/1173) API Updates * Add support for new value `fil` on enum `Checkout.Session.locale` * Add support for new value `au_arn` on enum `TaxId.type` ## 7.93.0 - 2021-08-11 * [#1172](https://github.com/stripe/stripe-php/pull/1172) API Updates * Add support for `locale` on `BillingPortal.Session` * [#1171](https://github.com/stripe/stripe-php/pull/1171) Fix typo in docblock `CurlClient::executeStreamingRequestWithRetries` ## 7.92.0 - 2021-07-28 * [#1167](https://github.com/stripe/stripe-php/pull/1167) API Updates * Add support for `account_type` on `BankAccount` * Add support for new value `redacted` on enum `Review.closed_reason` ## 7.91.0 - 2021-07-22 * [#1164](https://github.com/stripe/stripe-php/pull/1164) API Updates * Add support for new values `hr`, `ko`, and `vi` on enum `Checkout.Session.locale` * Add support for `payment_settings` on `Subscription` ## 7.90.0 - 2021-07-20 * [#1163](https://github.com/stripe/stripe-php/pull/1163) API Updates * Add support for `wallet` on `Issuing.Transaction` * [#1160](https://github.com/stripe/stripe-php/pull/1160) Remove unused API error types from docs. ## 7.89.0 - 2021-07-14 * [#1158](https://github.com/stripe/stripe-php/pull/1158) API Updates * Add support for `list_computed_upfront_line_items` method on resource `Quote` * [#1157](https://github.com/stripe/stripe-php/pull/1157) Improve readme for old PHP versions ## 7.88.0 - 2021-07-09 * [#1152](https://github.com/stripe/stripe-php/pull/1152) API Updates * Add support for new resource `Quote` * Add support for `quote` on `Invoice` * Add support for new value `quote_accept` on enum `Invoice.billing_reason` * [#1155](https://github.com/stripe/stripe-php/pull/1155) Add streaming methods to Service infra * Add support for `setStreamingHttpClient` and `streamingHttpClient` to `ApiRequestor` * Add support for `getStreamingClient` and `requestStream` to `AbstractService` * Add support for `requestStream` to `BaseStripeClient` * `\Stripe\RequestOptions::parse` now clones its input if it is already a `RequestOptions` object, to prevent accidental mutation. * [#1151](https://github.com/stripe/stripe-php/pull/1151) Add `mode` constants into Checkout\Session ## 7.87.0 - 2021-06-30 * [#1149](https://github.com/stripe/stripe-php/pull/1149) API Updates * Add support for `wechat_pay` on `PaymentMethod` * [#1143](https://github.com/stripe/stripe-php/pull/1143) Streaming requests * [#1138](https://github.com/stripe/stripe-php/pull/1138) Deprecate travis ## 7.86.0 - 2021-06-25 * [#1145](https://github.com/stripe/stripe-php/pull/1145) API Updates * Add support for `boleto` on `PaymentMethod`. * Add support for `il_vat` as a member of the `TaxID.Type` enum. ## 7.85.0 - 2021-06-18 * [#1142](https://github.com/stripe/stripe-php/pull/1142) API Updates * Add support for new TaxId types: `ca_pst_mb`, `ca_pst_bc`, `ca_gst_hst`, and `ca_pst_sk`. ## 7.84.0 - 2021-06-16 * [#1141](https://github.com/stripe/stripe-php/pull/1141) Update PHPDocs * Add support for `url` on `Checkout\Session` ## 7.83.0 - 2021-06-07 * [#1140](https://github.com/stripe/stripe-php/pull/1140) API Updates * Added support for `tax_id_collection` on `Checkout\Session` and `Checkout\Session#create` * Update `Location` to be expandable on `Terminal\Reader` ## 7.82.0 - 2021-06-04 * [#1136](https://github.com/stripe/stripe-php/pull/1136) Update PHPDocs * Add support for `controller` on `Account`. ## 7.81.0 - 2021-06-04 * [#1135](https://github.com/stripe/stripe-php/pull/1135) API Updates * Add support for new resource `TaxCode` * Add support for `automatic_tax` `Invoice` and`Checkout.Session`. * Add support for `tax_behavior` on `Price` * Add support for `tax_code` on `Product` * Add support for `tax` on `Customer` * Add support for `tax_type` enum on `TaxRate` ## 7.80.0 - 2021-05-26 * [#1130](https://github.com/stripe/stripe-php/pull/1130) Update PHPDocs ## 7.79.0 - 2021-05-19 * [#1126](https://github.com/stripe/stripe-php/pull/1126) API Updates * Added support for new resource `Identity.VerificationReport` * Added support for new resource `Identity.VerificationSession` * `File#list.purpose` and `File.purpose` added new enum members: `identity_document_downloadable` and `selfie`. ## 7.78.0 - 2021-05-05 * [#1120](https://github.com/stripe/stripe-php/pull/1120) Update PHPDocs * Add support for `Radar.EarlyFraudWarning.payment_intent` ## 7.77.0 - 2021-04-12 * [#1110](https://github.com/stripe/stripe-php/pull/1110) Update PHPDocs * Add support for `acss_debit` on `PaymentMethod` * Add support for `payment_method_options` on `Checkout\Session` * [#1107](https://github.com/stripe/stripe-php/pull/1107) Remove duplicate object phpdoc ## 7.76.0 - 2021-03-22 * [#1100](https://github.com/stripe/stripe-php/pull/1100) Update PHPDocs * Added support for `amount_shipping` on `Checkout.Session.total_details` * [#1088](https://github.com/stripe/stripe-php/pull/1088) Make possibility to extend CurlClient ## 7.75.0 - 2021-02-22 * [#1094](https://github.com/stripe/stripe-php/pull/1094) Add support for Billing Portal Configuration API ## 7.74.0 - 2021-02-17 * [#1093](https://github.com/stripe/stripe-php/pull/1093) Update PHPDocs * Add support for on_behalf_of to Invoice ## 7.73.0 - 2021-02-16 * [#1091](https://github.com/stripe/stripe-php/pull/1091) Update PHPDocs * Add support for `afterpay_clearpay` on `PaymentMethod`. ## 7.72.0 - 2021-02-08 * [#1089](https://github.com/stripe/stripe-php/pull/1089) Update PHPDocs * Add support for `afterpay_clearpay_payments` on `Account.capabilities` * Add support for `payment_settings` on `Invoice` ## 7.71.0 - 2021-02-05 * [#1087](https://github.com/stripe/stripe-php/pull/1087) Update PHPDocs * [#1086](https://github.com/stripe/stripe-php/pull/1086) Update CA cert bundle URL ## 7.70.0 - 2021-02-03 * [#1085](https://github.com/stripe/stripe-php/pull/1085) Update PHPDocs * Add support for `nationality` on `Person` * Add member `gb_vat` of `TaxID` enum ## 7.69.0 - 2021-01-21 * [#1079](https://github.com/stripe/stripe-php/pull/1079) Update PHPDocs ## 7.68.0 - 2021-01-14 * [#1063](https://github.com/stripe/stripe-php/pull/1063) Multiple API changes * [#1061](https://github.com/stripe/stripe-php/pull/1061) Bump phpDocumentor to 3.0.0 ## 7.67.0 - 2020-12-09 * [#1060](https://github.com/stripe/stripe-php/pull/1060) Improve PHPDocs for `Discount` * [#1059](https://github.com/stripe/stripe-php/pull/1059) Upgrade PHPStan to 0.12.59 * [#1057](https://github.com/stripe/stripe-php/pull/1057) Bump PHP-CS-Fixer and update code ## 7.66.1 - 2020-12-01 * [#1054](https://github.com/stripe/stripe-php/pull/1054) Improve error message for invalid keys in StripeClient ## 7.66.0 - 2020-11-24 * [#1053](https://github.com/stripe/stripe-php/pull/1053) Update PHPDocs ## 7.65.0 - 2020-11-19 * [#1050](https://github.com/stripe/stripe-php/pull/1050) Added constants for `proration_behavior` on `Subscription` ## 7.64.0 - 2020-11-18 * [#1049](https://github.com/stripe/stripe-php/pull/1049) Update PHPDocs ## 7.63.0 - 2020-11-17 * [#1048](https://github.com/stripe/stripe-php/pull/1048) Update PHPDocs * [#1046](https://github.com/stripe/stripe-php/pull/1046) Force IPv4 resolving ## 7.62.0 - 2020-11-09 * [#1041](https://github.com/stripe/stripe-php/pull/1041) Add missing constants on `Event` * [#1038](https://github.com/stripe/stripe-php/pull/1038) Update PHPDocs ## 7.61.0 - 2020-10-20 * [#1030](https://github.com/stripe/stripe-php/pull/1030) Add support for `jp_rn` and `ru_kpp` as a `type` on `TaxId` ## 7.60.0 - 2020-10-15 * [#1027](https://github.com/stripe/stripe-php/pull/1027) Warn if opts are in params ## 7.58.0 - 2020-10-14 * [#1026](https://github.com/stripe/stripe-php/pull/1026) Add support for the Payout Reverse API ## 7.57.0 - 2020-09-29 * [#1020](https://github.com/stripe/stripe-php/pull/1020) Add support for the `SetupAttempt` resource and List API ## 7.56.0 - 2020-09-25 * [#1019](https://github.com/stripe/stripe-php/pull/1019) Update PHPDocs ## 7.55.0 - 2020-09-24 * [#1018](https://github.com/stripe/stripe-php/pull/1018) Multiple API changes * Updated PHPDocs * Added `TYPE_CONTRIBUTION` as a constant on `BalanceTransaction` ## 7.54.0 - 2020-09-23 * [#1017](https://github.com/stripe/stripe-php/pull/1017) Updated PHPDoc ## 7.53.1 - 2020-09-22 * [#1015](https://github.com/stripe/stripe-php/pull/1015) Bugfix: don't error on systems with php_uname in disablefunctions with whitespace ## 7.53.0 - 2020-09-21 * [#1016](https://github.com/stripe/stripe-php/pull/1016) Updated PHPDocs ## 7.52.0 - 2020-09-08 * [#1010](https://github.com/stripe/stripe-php/pull/1010) Update PHPDocs ## 7.51.0 - 2020-09-02 * [#1007](https://github.com/stripe/stripe-php/pull/1007) Multiple API changes * Add support for the Issuing Dispute Submit API * Add constants for `payment_status` on Checkout `Session` * [#1003](https://github.com/stripe/stripe-php/pull/1003) Add trim to getSignatures to allow for leading whitespace. ## 7.50.0 - 2020-08-28 * [#1005](https://github.com/stripe/stripe-php/pull/1005) Updated PHPDocs ## 7.49.0 - 2020-08-19 * [#998](https://github.com/stripe/stripe-php/pull/998) PHPDocs updated ## 7.48.0 - 2020-08-17 * [#997](https://github.com/stripe/stripe-php/pull/997) PHPDocs updated * [#996](https://github.com/stripe/stripe-php/pull/996) Fixing telemetry ## 7.47.0 - 2020-08-13 * [#994](https://github.com/stripe/stripe-php/pull/994) Nullable balance_transactions on issuing disputes * [#991](https://github.com/stripe/stripe-php/pull/991) Fix invalid return types in OAuthService ## 7.46.1 - 2020-08-07 * [#990](https://github.com/stripe/stripe-php/pull/990) PHPdoc changes ## 7.46.0 - 2020-08-05 * [#989](https://github.com/stripe/stripe-php/pull/989) Add support for the `PromotionCode` resource and APIs ## 7.45.0 - 2020-07-28 * [#981](https://github.com/stripe/stripe-php/pull/981) PHPdoc updates ## 7.44.0 - 2020-07-20 * [#948](https://github.com/stripe/stripe-php/pull/948) Add `first()` and `last()` functions to `Collection` ## 7.43.0 - 2020-07-17 * [#975](https://github.com/stripe/stripe-php/pull/975) Add support for `political_exposure` on `Person` ## 7.42.0 - 2020-07-15 * [#974](https://github.com/stripe/stripe-php/pull/974) Add new constants for `purpose` on `File` ## 7.41.1 - 2020-07-15 * [#973](https://github.com/stripe/stripe-php/pull/973) Multiple PHPDoc fixes ## 7.41.0 - 2020-07-14 * [#971](https://github.com/stripe/stripe-php/pull/971) Adds enum values for `billing_address_collection` on Checkout `Session` ## 7.40.0 - 2020-07-06 * [#964](https://github.com/stripe/stripe-php/pull/964) Add OAuthService ## 7.39.0 - 2020-06-25 * [#960](https://github.com/stripe/stripe-php/pull/960) Add constants for `payment_behavior` on `Subscription` ## 7.38.0 - 2020-06-24 * [#959](https://github.com/stripe/stripe-php/pull/959) Add multiple constants missing for `Event` ## 7.37.2 - 2020-06-23 * [#957](https://github.com/stripe/stripe-php/pull/957) Updated PHPDocs ## 7.37.1 - 2020-06-11 * [#952](https://github.com/stripe/stripe-php/pull/952) Improve PHPDoc ## 7.37.0 - 2020-06-09 * [#950](https://github.com/stripe/stripe-php/pull/950) Add support for `id_npwp` and `my_frp` as `type` on `TaxId` ## 7.36.2 - 2020-06-03 * [#946](https://github.com/stripe/stripe-php/pull/946) Update PHPDoc ## 7.36.1 - 2020-05-28 * [#938](https://github.com/stripe/stripe-php/pull/938) Remove extra array_keys() call. * [#942](https://github.com/stripe/stripe-php/pull/942) fix autopagination for service methods ## 7.36.0 - 2020-05-21 * [#937](https://github.com/stripe/stripe-php/pull/937) Add support for `ae_trn`, `cl_tin` and `sa_vat` as `type` on `TaxId` ## 7.35.0 - 2020-05-20 * [#936](https://github.com/stripe/stripe-php/pull/936) Add `anticipation_repayment` as a `type` on `BalanceTransaction` ## 7.34.0 - 2020-05-18 * [#934](https://github.com/stripe/stripe-php/pull/934) Add support for `issuing_dispute` as a `type` on `BalanceTransaction` ## 7.33.1 - 2020-05-15 * [#933](https://github.com/stripe/stripe-php/pull/933) Services bugfix: convert nested null params to empty strings ## 7.33.0 - 2020-05-14 * [#771](https://github.com/stripe/stripe-php/pull/771) Introduce client/services API. The [migration guide](https://github.com/stripe/stripe-php/wiki/Migration-to-StripeClient-and-services-in-7.33.0) contains before & after examples of the backwards-compatible changes. ## 7.32.1 - 2020-05-13 * [#932](https://github.com/stripe/stripe-php/pull/932) Fix multiple PHPDoc ## 7.32.0 - 2020-05-11 * [#931](https://github.com/stripe/stripe-php/pull/931) Add support for the `LineItem` resource and APIs ## 7.31.0 - 2020-05-01 * [#927](https://github.com/stripe/stripe-php/pull/927) Add support for new tax IDs ## 7.30.0 - 2020-04-29 * [#924](https://github.com/stripe/stripe-php/pull/924) Add support for the `Price` resource and APIs ## 7.29.0 - 2020-04-22 * [#920](https://github.com/stripe/stripe-php/pull/920) Add support for the `Session` resource and APIs on the `BillingPortal` namespace ## 7.28.1 - 2020-04-10 * [#915](https://github.com/stripe/stripe-php/pull/915) Improve PHPdocs for many classes ## 7.28.0 - 2020-04-03 * [#912](https://github.com/stripe/stripe-php/pull/912) Preserve backwards compatibility for typoed `TYPE_ADJUSTEMENT` enum. * [#911](https://github.com/stripe/stripe-php/pull/911) Codegenerated PHPDoc for nested resources * [#902](https://github.com/stripe/stripe-php/pull/902) Update docstrings for nested resources ## 7.27.3 - 2020-03-18 * [#899](https://github.com/stripe/stripe-php/pull/899) Convert keys to strings in `StripeObject::toArray()` ## 7.27.2 - 2020-03-13 * [#894](https://github.com/stripe/stripe-php/pull/894) Multiple PHPDocs changes ## 7.27.1 - 2020-03-03 * [#890](https://github.com/stripe/stripe-php/pull/890) Update PHPdoc ## 7.27.0 - 2020-02-28 * [#889](https://github.com/stripe/stripe-php/pull/889) Add new constants for `type` on `TaxId` ## 7.26.0 - 2020-02-26 * [#886](https://github.com/stripe/stripe-php/pull/886) Add support for listing Checkout `Session` * [#883](https://github.com/stripe/stripe-php/pull/883) Add PHPDoc class descriptions ## 7.25.0 - 2020-02-14 * [#879](https://github.com/stripe/stripe-php/pull/879) Make `\Stripe\Collection` implement `\Countable` * [#875](https://github.com/stripe/stripe-php/pull/875) Last set of PHP-CS-Fixer updates * [#874](https://github.com/stripe/stripe-php/pull/874) Enable php_unit_internal_class rule * [#873](https://github.com/stripe/stripe-php/pull/873) Add support for phpDocumentor in Makefile * [#872](https://github.com/stripe/stripe-php/pull/872) Another batch of PHP-CS-Fixer rule updates * [#871](https://github.com/stripe/stripe-php/pull/871) Fix a few PHPDoc comments * [#870](https://github.com/stripe/stripe-php/pull/870) More PHP-CS-Fixer tweaks ## 7.24.0 - 2020-02-10 * [#862](https://github.com/stripe/stripe-php/pull/862) Better PHPDoc * [#865](https://github.com/stripe/stripe-php/pull/865) Get closer to `@PhpCsFixer` standard ruleset ## 7.23.0 - 2020-02-05 * [#860](https://github.com/stripe/stripe-php/pull/860) Add PHPDoc types for expandable fields * [#858](https://github.com/stripe/stripe-php/pull/858) Use `native_function_invocation` PHPStan rule * [#857](https://github.com/stripe/stripe-php/pull/857) Update PHPDoc on nested resources * [#855](https://github.com/stripe/stripe-php/pull/855) PHPDoc: `StripeObject` -> `ErrorObject` where appropriate * [#837](https://github.com/stripe/stripe-php/pull/837) Autogen diff * [#854](https://github.com/stripe/stripe-php/pull/854) Upgrade PHPStan and fix settings * [#850](https://github.com/stripe/stripe-php/pull/850) Yet more PHPDoc updates ## 7.22.0 - 2020-01-31 * [#849](https://github.com/stripe/stripe-php/pull/849) Add new constants for `type` on `TaxId` * [#843](https://github.com/stripe/stripe-php/pull/843) Even more PHPDoc fixes * [#841](https://github.com/stripe/stripe-php/pull/841) More PHPDoc fixes ## 7.21.1 - 2020-01-29 * [#840](https://github.com/stripe/stripe-php/pull/840) Update phpdocs across multiple resources. ## 7.21.0 - 2020-01-28 * [#839](https://github.com/stripe/stripe-php/pull/839) Add support for `TYPE_ES_CIF` on `TaxId` ## 7.20.0 - 2020-01-23 * [#836](https://github.com/stripe/stripe-php/pull/836) Add new type values for `TaxId` ## 7.19.1 - 2020-01-14 * [#831](https://github.com/stripe/stripe-php/pull/831) Fix incorrect `UnexpectedValueException` instantiation ## 7.19.0 - 2020-01-14 * [#830](https://github.com/stripe/stripe-php/pull/830) Add support for `CreditNoteLineItem` ## 7.18.0 - 2020-01-13 * [#829](https://github.com/stripe/stripe-php/pull/829) Don't call php_uname function if disabled by php.ini ## 7.17.0 - 2020-01-08 * [#821](https://github.com/stripe/stripe-php/pull/821) Improve PHPDoc types for `ApiErrorException.get/setJsonBody()` methods ## 7.16.0 - 2020-01-06 * [#826](https://github.com/stripe/stripe-php/pull/826) Rename remaining `$options` to `$opts` * [#825](https://github.com/stripe/stripe-php/pull/825) Update PHPDoc ## 7.15.0 - 2020-01-06 * [#824](https://github.com/stripe/stripe-php/pull/824) Add constant `TYPE_SG_UEN` to `TaxId` ## 7.14.2 - 2019-12-04 * [#816](https://github.com/stripe/stripe-php/pull/816) Disable autoloader when checking for `Throwable` ## 7.14.1 - 2019-11-26 * [#812](https://github.com/stripe/stripe-php/pull/812) Fix invalid PHPdoc on `Subscription` ## 7.14.0 - 2019-11-26 * [#811](https://github.com/stripe/stripe-php/pull/811) Add support for `CreditNote` preview. ## 7.13.0 - 2019-11-19 * [#808](https://github.com/stripe/stripe-php/pull/808) Add support for listing lines on an Invoice directly via `Invoice::allLines()` ## 7.12.0 - 2019-11-08 - [#805](https://github.com/stripe/stripe-php/pull/805) Add Source::allSourceTransactions and SubscriptionItem::allUsageRecordSummaries - [#798](https://github.com/stripe/stripe-php/pull/798) The argument of `array_key_exists` cannot be `null` - [#803](https://github.com/stripe/stripe-php/pull/803) Removed unwanted got ## 7.11.0 - 2019-11-06 - [#797](https://github.com/stripe/stripe-php/pull/797) Add support for reverse pagination ## 7.10.0 - 2019-11-05 - [#795](https://github.com/stripe/stripe-php/pull/795) Add support for `Mandate` ## 7.9.0 - 2019-11-05 - [#794](https://github.com/stripe/stripe-php/pull/794) Add PHPDoc to `ApiResponse` - [#792](https://github.com/stripe/stripe-php/pull/792) Use single quotes for `OBJECT_NAME` constants ## 7.8.0 - 2019-11-05 - [#790](https://github.com/stripe/stripe-php/pull/790) Mark nullable fields in PHPDoc - [#788](https://github.com/stripe/stripe-php/pull/788) Early codegen fixes - [#787](https://github.com/stripe/stripe-php/pull/787) Use PHPStan in Travis CI ## 7.7.1 - 2019-10-25 - [#781](https://github.com/stripe/stripe-php/pull/781) Fix telemetry header - [#780](https://github.com/stripe/stripe-php/pull/780) Contributor Convenant ## 7.7.0 - 2019-10-23 - [#776](https://github.com/stripe/stripe-php/pull/776) Add `CAPABILITY_TRANSFERS` to `Account` - [#778](https://github.com/stripe/stripe-php/pull/778) Add support for `TYPE_MX_RFC` type on `TaxId` ## 7.6.0 - 2019-10-22 - [#770](https://github.com/stripe/stripe-php/pull/770) Add missing constants for Customer's `TaxId` ## 7.5.0 - 2019-10-18 - [#768](https://github.com/stripe/stripe-php/pull/768) Redact API key in `RequestOptions` debug info ## 7.4.0 - 2019-10-15 - [#764](https://github.com/stripe/stripe-php/pull/764) Add support for HTTP request monitoring callback ## 7.3.1 - 2019-10-07 - [#755](https://github.com/stripe/stripe-php/pull/755) Respect Stripe-Should-Retry and Retry-After headers ## 7.3.0 - 2019-10-02 - [#752](https://github.com/stripe/stripe-php/pull/752) Add `payment_intent.canceled` and `setup_intent.canceled` events - [#749](https://github.com/stripe/stripe-php/pull/749) Call `toArray()` on objects only ## 7.2.2 - 2019-09-24 - [#746](https://github.com/stripe/stripe-php/pull/746) Add missing decline codes ## 7.2.1 - 2019-09-23 - [#744](https://github.com/stripe/stripe-php/pull/744) Added new PHPDoc ## 7.2.0 - 2019-09-17 - [#738](https://github.com/stripe/stripe-php/pull/738) Added missing constants for `SetupIntent` events ## 7.1.1 - 2019-09-16 - [#737](https://github.com/stripe/stripe-php/pull/737) Added new PHPDoc ## 7.1.0 - 2019-09-13 - [#736](https://github.com/stripe/stripe-php/pull/736) Make `CaseInsensitiveArray` countable and traversable ## 7.0.2 - 2019-09-06 - [#729](https://github.com/stripe/stripe-php/pull/729) Fix usage of `SignatureVerificationException` in PHPDoc blocks ## 7.0.1 - 2019-09-05 - [#728](https://github.com/stripe/stripe-php/pull/728) Clean up Collection ## 7.0.0 - 2019-09-03 Major version release. The [migration guide](https://github.com/stripe/stripe-php/wiki/Migration-guide-for-v7) contains a detailed list of backwards-incompatible changes with upgrade instructions. Pull requests included in this release (cf. [#552](https://github.com/stripe/stripe-php/pull/552)) (⚠️ = breaking changes): - ⚠️ Drop support for PHP 5.4 ([#551](https://github.com/stripe/stripe-php/pull/551)) - ⚠️ Drop support for PHP 5.5 ([#554](https://github.com/stripe/stripe-php/pull/554)) - Bump dependencies ([#553](https://github.com/stripe/stripe-php/pull/553)) - Remove `CURLFile` check ([#555](https://github.com/stripe/stripe-php/pull/555)) - Update constant definitions for PHP >= 5.6 ([#556](https://github.com/stripe/stripe-php/pull/556)) - ⚠️ Remove `FileUpload` alias ([#557](https://github.com/stripe/stripe-php/pull/557)) - Remove `curl_reset` check ([#570](https://github.com/stripe/stripe-php/pull/570)) - Use `\Stripe\<class>::class` constant instead of strings ([#643](https://github.com/stripe/stripe-php/pull/643)) - Use `array_column` to flatten params ([#686](https://github.com/stripe/stripe-php/pull/686)) - ⚠️ Remove deprecated methods ([#692](https://github.com/stripe/stripe-php/pull/692)) - ⚠️ Remove `IssuerFraudRecord` ([#696](https://github.com/stripe/stripe-php/pull/696)) - Update constructors of Stripe exception classes ([#559](https://github.com/stripe/stripe-php/pull/559)) - Fix remaining TODOs ([#700](https://github.com/stripe/stripe-php/pull/700)) - Use yield for autopagination ([#703](https://github.com/stripe/stripe-php/pull/703)) - ⚠️ Rename fake magic methods and rewrite array conversion ([#704](https://github.com/stripe/stripe-php/pull/704)) - Add `ErrorObject` to Stripe exceptions ([#705](https://github.com/stripe/stripe-php/pull/705)) - Start using PHP CS Fixer ([#706](https://github.com/stripe/stripe-php/pull/706)) - Update error messages for nested resource operations ([#708](https://github.com/stripe/stripe-php/pull/708)) - Upgrade retry logic ([#707](https://github.com/stripe/stripe-php/pull/707)) - ⚠️ `Collection` improvements / fixes ([#715](https://github.com/stripe/stripe-php/pull/715)) - ⚠️ Modernize exceptions ([#709](https://github.com/stripe/stripe-php/pull/709)) - Add constants for error codes ([#716](https://github.com/stripe/stripe-php/pull/716)) - Update certificate bundle ([#717](https://github.com/stripe/stripe-php/pull/717)) - Retry requests on a 429 that's a lock timeout ([#718](https://github.com/stripe/stripe-php/pull/718)) - Fix `toArray()` calls ([#719](https://github.com/stripe/stripe-php/pull/719)) - Couple of fixes for PHP 7.4 ([#725](https://github.com/stripe/stripe-php/pull/725)) ## 6.43.1 - 2019-08-29 - [#722](https://github.com/stripe/stripe-php/pull/722) Make `LoggerInterface::error` compatible with its PSR-3 counterpart - [#714](https://github.com/stripe/stripe-php/pull/714) Add `pending_setup_intent` property in `Subscription` - [#713](https://github.com/stripe/stripe-php/pull/713) Add typehint to `ApiResponse` - [#712](https://github.com/stripe/stripe-php/pull/712) Fix comment - [#701](https://github.com/stripe/stripe-php/pull/701) Start testing PHP 7.3 ## 6.43.0 - 2019-08-09 - [#694](https://github.com/stripe/stripe-php/pull/694) Add `SubscriptionItem::createUsageRecord` method ## 6.42.0 - 2019-08-09 - [#688](https://github.com/stripe/stripe-php/pull/688) Remove `SubscriptionScheduleRevision` - Note that this is technically a breaking change, however we've chosen to release it as a minor version in light of the fact that this resource and its API methods were virtually unused. ## 6.41.0 - 2019-07-31 - [#683](https://github.com/stripe/stripe-php/pull/683) Move the List Balance History API to `/v1/balance_transactions` ## 6.40.0 - 2019-06-27 - [#675](https://github.com/stripe/stripe-php/pull/675) Add support for `SetupIntent` resource and APIs ## 6.39.2 - 2019-06-26 - [#676](https://github.com/stripe/stripe-php/pull/676) Fix exception message in `CustomerBalanceTransaction::update()` ## 6.39.1 - 2019-06-25 - [#674](https://github.com/stripe/stripe-php/pull/674) Add new constants for `collection_method` on `Invoice` ## 6.39.0 - 2019-06-24 - [#673](https://github.com/stripe/stripe-php/pull/673) Enable request latency telemetry by default ## 6.38.0 - 2019-06-17 - [#649](https://github.com/stripe/stripe-php/pull/649) Add support for `CustomerBalanceTransaction` resource and APIs ## 6.37.2 - 2019-06-17 - [#671](https://github.com/stripe/stripe-php/pull/671) Add new PHPDoc - [#672](https://github.com/stripe/stripe-php/pull/672) Add constants for `submit_type` on Checkout `Session` ## 6.37.1 - 2019-06-14 - [#670](https://github.com/stripe/stripe-php/pull/670) Add new PHPDoc ## 6.37.0 - 2019-05-23 - [#663](https://github.com/stripe/stripe-php/pull/663) Add support for `radar.early_fraud_warning` resource ## 6.36.0 - 2019-05-22 - [#661](https://github.com/stripe/stripe-php/pull/661) Add constants for new TaxId types - [#662](https://github.com/stripe/stripe-php/pull/662) Add constants for BalanceTransaction types ## 6.35.2 - 2019-05-20 - [#655](https://github.com/stripe/stripe-php/pull/655) Add constants for payment intent statuses - [#659](https://github.com/stripe/stripe-php/pull/659) Fix PHPDoc for various nested Account actions - [#660](https://github.com/stripe/stripe-php/pull/660) Fix various PHPDoc ## 6.35.1 - 2019-05-20 - [#658](https://github.com/stripe/stripe-php/pull/658) Use absolute value when checking timestamp tolerance ## 6.35.0 - 2019-05-14 - [#651](https://github.com/stripe/stripe-php/pull/651) Add support for the Capability resource and APIs ## 6.34.6 - 2019-05-13 - [#654](https://github.com/stripe/stripe-php/pull/654) Fix typo in definition of `Event::PAYMENT_METHOD_ATTACHED` constant ## 6.34.5 - 2019-05-06 - [#647](https://github.com/stripe/stripe-php/pull/647) Set the return type to static for more operations ## 6.34.4 - 2019-05-06 - [#650](https://github.com/stripe/stripe-php/pull/650) Add missing constants for Event types ## 6.34.3 - 2019-05-01 - [#644](https://github.com/stripe/stripe-php/pull/644) Update return type to `static` to improve static analysis - [#645](https://github.com/stripe/stripe-php/pull/645) Fix constant for `payment_intent.payment_failed` ## 6.34.2 - 2019-04-26 - [#642](https://github.com/stripe/stripe-php/pull/642) Fix an issue where existing idempotency keys would be overwritten when using automatic retries ## 6.34.1 - 2019-04-25 - [#640](https://github.com/stripe/stripe-php/pull/640) Add missing phpdocs ## 6.34.0 - 2019-04-24 - [#626](https://github.com/stripe/stripe-php/pull/626) Add support for the `TaxRate` resource and APIs - [#639](https://github.com/stripe/stripe-php/pull/639) Fix multiple phpdoc issues ## 6.33.0 - 2019-04-22 - [#630](https://github.com/stripe/stripe-php/pull/630) Add support for the `TaxId` resource and APIs ## 6.32.1 - 2019-04-19 - [#636](https://github.com/stripe/stripe-php/pull/636) Correct type of `$personId` in PHPDoc ## 6.32.0 - 2019-04-18 - [#621](https://github.com/stripe/stripe-php/pull/621) Add support for `CreditNote` ## 6.31.5 - 2019-04-12 - [#628](https://github.com/stripe/stripe-php/pull/628) Add constants for `person.*` event types - [#628](https://github.com/stripe/stripe-php/pull/628) Add missing constants for `Account` and `Person` ## 6.31.4 - 2019-04-05 - [#624](https://github.com/stripe/stripe-php/pull/624) Fix encoding of nested parameters in multipart requests ## 6.31.3 - 2019-04-02 - [#623](https://github.com/stripe/stripe-php/pull/623) Only use HTTP/2 with curl >= 7.60.0 ## 6.31.2 - 2019-03-25 - [#619](https://github.com/stripe/stripe-php/pull/619) Fix PHPDoc return types for list methods for nested resources ## 6.31.1 - 2019-03-22 - [#612](https://github.com/stripe/stripe-php/pull/612) Add a lot of constants - [#614](https://github.com/stripe/stripe-php/pull/614) Add missing subscription status constants ## 6.31.0 - 2019-03-18 - [#600](https://github.com/stripe/stripe-php/pull/600) Add support for the `PaymentMethod` resource and APIs - [#606](https://github.com/stripe/stripe-php/pull/606) Add support for retrieving a Checkout `Session` - [#611](https://github.com/stripe/stripe-php/pull/611) Add support for deleting a Terminal `Location` and `Reader` ## 6.30.5 - 2019-03-11 - [#607](https://github.com/stripe/stripe-php/pull/607) Correctly handle case where a metadata key is called `metadata` ## 6.30.4 - 2019-02-27 - [#602](https://github.com/stripe/stripe-php/pull/602) Add `subscription_schedule` to `Subscription` for PHPDoc. ## 6.30.3 - 2019-02-26 - [#603](https://github.com/stripe/stripe-php/pull/603) Improve PHPDoc on the `Source` object to cover all types of Sources currently supported. ## 6.30.2 - 2019-02-25 - [#601](https://github.com/stripe/stripe-php/pull/601) Fix PHPDoc across multiple resources and add support for new events. ## 6.30.1 - 2019-02-16 - [#599](https://github.com/stripe/stripe-php/pull/599) Fix PHPDoc for `SubscriptionSchedule` and `SubscriptionScheduleRevision` ## 6.30.0 - 2019-02-12 - [#590](https://github.com/stripe/stripe-php/pull/590) Add support for `SubscriptionSchedule` and `SubscriptionScheduleRevision` ## 6.29.3 - 2019-01-31 - [#592](https://github.com/stripe/stripe-php/pull/592) Some more PHPDoc fixes ## 6.29.2 - 2019-01-31 - [#591](https://github.com/stripe/stripe-php/pull/591) Fix PHPDoc for nested resources ## 6.29.1 - 2019-01-25 - [#566](https://github.com/stripe/stripe-php/pull/566) Fix dangling message contents - [#586](https://github.com/stripe/stripe-php/pull/586) Don't overwrite `CURLOPT_HTTP_VERSION` option ## 6.29.0 - 2019-01-23 - [#579](https://github.com/stripe/stripe-php/pull/579) Rename `CheckoutSession` to `Session` and move it under the `Checkout` namespace. This is a breaking change, but we've reached out to affected merchants and all new merchants would use the new approach. ## 6.28.1 - 2019-01-21 - [#580](https://github.com/stripe/stripe-php/pull/580) Properly serialize `individual` on `Account` objects ## 6.28.0 - 2019-01-03 - [#576](https://github.com/stripe/stripe-php/pull/576) Add support for iterating directly over `Collection` instances ## 6.27.0 - 2018-12-21 - [#571](https://github.com/stripe/stripe-php/pull/571) Add support for the `CheckoutSession` resource ## 6.26.0 - 2018-12-11 - [#568](https://github.com/stripe/stripe-php/pull/568) Enable persistent connections ## 6.25.0 - 2018-12-10 - [#567](https://github.com/stripe/stripe-php/pull/567) Add support for account links ## 6.24.0 - 2018-11-28 - [#562](https://github.com/stripe/stripe-php/pull/562) Add support for the Review resource - [#564](https://github.com/stripe/stripe-php/pull/564) Add event name constants for subscription schedule aborted/expiring ## 6.23.0 - 2018-11-27 - [#542](https://github.com/stripe/stripe-php/pull/542) Add support for `ValueList` and `ValueListItem` for Radar ## 6.22.1 - 2018-11-20 - [#561](https://github.com/stripe/stripe-php/pull/561) Add cast and some docs to telemetry introduced in 6.22.0/549 ## 6.22.0 - 2018-11-15 - [#549](https://github.com/stripe/stripe-php/pull/549) Add support for client telemetry ## 6.21.1 - 2018-11-12 - [#548](https://github.com/stripe/stripe-php/pull/548) Don't mutate `Exception` class properties from `OAuthBase` error ## 6.21.0 - 2018-11-08 - [#537](https://github.com/stripe/stripe-php/pull/537) Add new API endpoints for the `Invoice` resource. ## 6.20.1 - 2018-11-07 - [#546](https://github.com/stripe/stripe-php/pull/546) Drop files from the Composer package that aren't needed in the release ## 6.20.0 - 2018-10-30 - [#536](https://github.com/stripe/stripe-php/pull/536) Add support for the `Person` resource - [#541](https://github.com/stripe/stripe-php/pull/541) Add support for the `WebhookEndpoint` resource ## 6.19.5 - 2018-10-17 - [#539](https://github.com/stripe/stripe-php/pull/539) Fix methods on `\Stripe\PaymentIntent` to properly pass arguments to the API. ## 6.19.4 - 2018-10-11 - [#534](https://github.com/stripe/stripe-php/pull/534) Fix PSR-4 autoloading for `\Stripe\FileUpload` class alias ## 6.19.3 - 2018-10-09 - [#530](https://github.com/stripe/stripe-php/pull/530) Add constants for `flow` (`FLOW_*`), `status` (`STATUS_*`) and `usage` (`USAGE_*`) on `\Stripe\Source` ## 6.19.2 - 2018-10-08 - [#531](https://github.com/stripe/stripe-php/pull/531) Store HTTP response headers in case-insensitive array ## 6.19.1 - 2018-09-25 - [#526](https://github.com/stripe/stripe-php/pull/526) Ignore null values in request parameters ## 6.19.0 - 2018-09-24 - [#523](https://github.com/stripe/stripe-php/pull/523) Add support for Stripe Terminal ## 6.18.0 - 2018-09-24 - [#520](https://github.com/stripe/stripe-php/pull/520) Rename `\Stripe\FileUpload` to `\Stripe\File` ## 6.17.2 - 2018-09-18 - [#522](https://github.com/stripe/stripe-php/pull/522) Fix warning when adding a new additional owner to an existing array ## 6.17.1 - 2018-09-14 - [#517](https://github.com/stripe/stripe-php/pull/517) Integer-index encode all sequential arrays ## 6.17.0 - 2018-09-05 - [#514](https://github.com/stripe/stripe-php/pull/514) Add support for reporting resources ## 6.16.0 - 2018-08-23 - [#509](https://github.com/stripe/stripe-php/pull/509) Add support for usage record summaries ## 6.15.0 - 2018-08-03 - [#504](https://github.com/stripe/stripe-php/pull/504) Add cancel support for topups ## 6.14.0 - 2018-08-02 - [#505](https://github.com/stripe/stripe-php/pull/505) Add support for file links ## 6.13.0 - 2018-07-31 - [#502](https://github.com/stripe/stripe-php/pull/502) Add `isDeleted()` method to `\Stripe\StripeObject` ## 6.12.0 - 2018-07-28 - [#501](https://github.com/stripe/stripe-php/pull/501) Add support for scheduled query runs (`\Stripe\Sigma\ScheduledQueryRun`) for Sigma ## 6.11.0 - 2018-07-26 - [#500](https://github.com/stripe/stripe-php/pull/500) Add support for Stripe Issuing ## 6.10.4 - 2018-07-19 - [#498](https://github.com/stripe/stripe-php/pull/498) Internal improvements to the `\Stripe\ApiResource.classUrl()` method ## 6.10.3 - 2018-07-16 - [#497](https://github.com/stripe/stripe-php/pull/497) Use HTTP/2 only for HTTPS requests ## 6.10.2 - 2018-07-11 - [#494](https://github.com/stripe/stripe-php/pull/494) Enable HTTP/2 support ## 6.10.1 - 2018-07-10 - [#493](https://github.com/stripe/stripe-php/pull/493) Add PHPDoc for `auto_advance` on `\Stripe\Invoice` ## 6.10.0 - 2018-06-28 - [#488](https://github.com/stripe/stripe-php/pull/488) Add support for `$appPartnerId` to `Stripe::setAppInfo()` ## 6.9.0 - 2018-06-28 - [#487](https://github.com/stripe/stripe-php/pull/487) Add support for payment intents ## 6.8.2 - 2018-06-24 - [#486](https://github.com/stripe/stripe-php/pull/486) Make `Account.deauthorize()` return the `StripeObject` from the API ## 6.8.1 - 2018-06-13 - [#472](https://github.com/stripe/stripe-php/pull/472) Added phpDoc for `ApiRequestor` and others, especially regarding thrown errors ## 6.8.0 - 2018-06-13 - [#481](https://github.com/stripe/stripe-php/pull/481) Add new `\Stripe\Discount` and `\Stripe\OrderItem` classes, add more PHPDoc describing object attributes ## 6.7.4 - 2018-05-29 - [#480](https://github.com/stripe/stripe-php/pull/480) PHPDoc changes for API version 2018-05-21 and the addition of the new `CHARGE_EXPIRED` event type ## 6.7.3 - 2018-05-28 - [#479](https://github.com/stripe/stripe-php/pull/479) Fix unnecessary traits on `\Stripe\InvoiceLineItem` ## 6.7.2 - 2018-05-28 - [#471](https://github.com/stripe/stripe-php/pull/471) Add `OBJECT_NAME` constant to all API resource classes, add `\Stripe\InvoiceLineItem` class ## 6.7.1 - 2018-05-13 - [#468](https://github.com/stripe/stripe-php/pull/468) Update fields in PHP docs for accuracy ## 6.7.0 - 2018-05-09 - [#466](https://github.com/stripe/stripe-php/pull/466) Add support for issuer fraud records ## 6.6.0 - 2018-04-11 - [#460](https://github.com/stripe/stripe-php/pull/460) Add support for flexible billing primitives ## 6.5.0 - 2018-04-05 - [#461](https://github.com/stripe/stripe-php/pull/461) Don't zero keys on non-`metadata` subobjects ## 6.4.2 - 2018-03-17 - [#458](https://github.com/stripe/stripe-php/pull/458) Add PHPDoc for `account` on `\Stripe\Event` ## 6.4.1 - 2018-03-02 - [#455](https://github.com/stripe/stripe-php/pull/455) Fix namespaces in PHPDoc - [#456](https://github.com/stripe/stripe-php/pull/456) Fix namespaces for some exceptions ## 6.4.0 - 2018-02-28 - [#453](https://github.com/stripe/stripe-php/pull/453) Add constants for `reason` (`REASON_*`) and `status` (`STATUS_*`) on `\Stripe\Dispute` ## 6.3.2 - 2018-02-27 - [#452](https://github.com/stripe/stripe-php/pull/452) Add PHPDoc for `amount_paid` and `amount_remaining` on `\Stripe\Invoice` ## 6.3.1 - 2018-02-26 - [#443](https://github.com/stripe/stripe-php/pull/443) Add event types as constants to `\Stripe\Event` class ## 6.3.0 - 2018-02-23 - [#450](https://github.com/stripe/stripe-php/pull/450) Add support for `code` attribute on all Stripe exceptions ## 6.2.0 - 2018-02-21 - [#440](https://github.com/stripe/stripe-php/pull/440) Add support for topups - [#442](https://github.com/stripe/stripe-php/pull/442) Fix PHPDoc for `\Stripe\Error\SignatureVerification` ## 6.1.0 - 2018-02-12 - [#435](https://github.com/stripe/stripe-php/pull/435) Fix header persistence on `Collection` objects - [#436](https://github.com/stripe/stripe-php/pull/436) Introduce new `Idempotency` error class ## 6.0.0 - 2018-02-07 Major version release. List of backwards incompatible changes to watch out for: - The minimum PHP version is now 5.4.0. If you're using PHP 5.3 or older, consider upgrading to a more recent version. * `\Stripe\AttachedObject` no longer exists. Attributes that used to be instances of `\Stripe\AttachedObject` (such as `metadata`) are now instances of `\Stripe\StripeObject`. - Attributes that used to be PHP arrays (such as `legal_entity->additional_owners` on `\Stripe\Account` instances) are now instances of `\Stripe\StripeObject`, except when they are empty. `\Stripe\StripeObject` has array semantics so this should not be an issue unless you are actively checking types. * `\Stripe\Collection` now derives from `\Stripe\StripeObject` rather than from `\Stripe\ApiResource`. Pull requests included in this release: - [#410](https://github.com/stripe/stripe-php/pull/410) Drop support for PHP 5.3 - [#411](https://github.com/stripe/stripe-php/pull/411) Use traits for common API operations - [#414](https://github.com/stripe/stripe-php/pull/414) Use short array syntax - [#404](https://github.com/stripe/stripe-php/pull/404) Fix serialization logic - [#417](https://github.com/stripe/stripe-php/pull/417) Remove `ExternalAccount` class - [#418](https://github.com/stripe/stripe-php/pull/418) Increase test coverage - [#421](https://github.com/stripe/stripe-php/pull/421) Update CA bundle and add script for future updates - [#422](https://github.com/stripe/stripe-php/pull/422) Use vendored CA bundle for all requests - [#428](https://github.com/stripe/stripe-php/pull/428) Support for automatic request retries ## 5.9.2 - 2018-02-07 - [#431](https://github.com/stripe/stripe-php/pull/431) Update PHPDoc @property tags for latest API version ## 5.9.1 - 2018-02-06 - [#427](https://github.com/stripe/stripe-php/pull/427) Add and update PHPDoc @property tags on all API resources ## 5.9.0 - 2018-01-17 - [#421](https://github.com/stripe/stripe-php/pull/421) Updated bundled CA certificates - [#423](https://github.com/stripe/stripe-php/pull/423) Escape unsanitized input in OAuth example ## 5.8.0 - 2017-12-20 - [#403](https://github.com/stripe/stripe-php/pull/403) Add `__debugInfo()` magic method to `StripeObject` ## 5.7.0 - 2017-11-28 - [#390](https://github.com/stripe/stripe-php/pull/390) Remove some unsupported API methods - [#391](https://github.com/stripe/stripe-php/pull/391) Alphabetize the list of API resources in `Util::convertToStripeObject()` and add missing resources - [#393](https://github.com/stripe/stripe-php/pull/393) Fix expiry date update for card sources ## 5.6.0 - 2017-10-31 - [#386](https://github.com/stripe/stripe-php/pull/386) Support for exchange rates APIs ## 5.5.1 - 2017-10-30 - [#387](https://github.com/stripe/stripe-php/pull/387) Allow `personal_address_kana` and `personal_address_kanji` to be updated on an account ## 5.5.0 - 2017-10-27 - [#385](https://github.com/stripe/stripe-php/pull/385) Support for listing source transactions ## 5.4.0 - 2017-10-24 - [#383](https://github.com/stripe/stripe-php/pull/383) Add static methods to manipulate resources from parent - `Account` gains methods for external accounts and login links (e.g. `createExternalAccount`, `createLoginLink`) - `ApplicationFee` gains methods for refunds - `Customer` gains methods for sources - `Transfer` gains methods for reversals ## 5.3.0 - 2017-10-11 - [#378](https://github.com/stripe/stripe-php/pull/378) Rename source `delete` to `detach` (and deprecate the former) ## 5.2.3 - 2017-09-27 - Add PHPDoc for `Card` ## 5.2.2 - 2017-09-20 - Fix deserialization mapping of `FileUpload` objects ## 5.2.1 - 2017-09-14 - Serialized `shipping` nested attribute ## 5.2.0 - 2017-08-29 - Add support for `InvalidClient` OAuth error ## 5.1.3 - 2017-08-14 - Allow `address_kana` and `address_kanji` to be updated for custom accounts ## 5.1.2 - 2017-08-01 - Fix documented return type of `autoPagingIterator()` (was missing namespace) ## 5.1.1 - 2017-07-03 - Fix order returns to use the right URL `/v1/order_returns` ## 5.1.0 - 2017-06-30 - Add support for OAuth ## 5.0.0 - 2017-06-27 - `pay` on invoice now takes params as well as opts ## 4.13.0 - 2017-06-19 - Add support for ephemeral keys ## 4.12.0 - 2017-06-05 - Clients can implement `getUserAgentInfo()` to add additional user agent information ## 4.11.0 - 2017-06-05 - Implement `Countable` for `AttachedObject` (`metadata` and `additional_owners`) ## 4.10.0 - 2017-05-25 - Add support for login links ## 4.9.1 - 2017-05-10 - Fix docs to include arrays on `$id` parameter for retrieve methods ## 4.9.0 - 2017-04-28 - Support for checking webhook signatures ## 4.8.1 - 2017-04-24 - Allow nested field `payout_schedule` to be updated ## 4.8.0 - 2017-04-20 - Add `\Stripe\Stripe::setLogger()` to support an external PSR-3 compatible logger ## 4.7.0 - 2017-04-10 - Add support for payouts and recipient transfers ## 4.6.0 - 2017-04-06 - Please see 4.7.0 instead (no-op release) ## 4.5.1 - 2017-03-22 - Remove hard dependency on cURL ## 4.5.0 - 2017-03-20 - Support for detaching sources from customers ## 4.4.2 - 2017-02-27 - Correct handling of `owner` parameter when updating sources ## 4.4.1 - 2017-02-24 - Correct the error check on a bad JSON decoding ## 4.4.0 - 2017-01-18 - Add support for updating sources ## 4.3.0 - 2016-11-30 - Add support for verifying sources ## 4.2.0 - 2016-11-21 - Add retrieve method for 3-D Secure resources ## 4.1.1 - 2016-10-21 - Add docblock with model properties for `Plan` ## 4.1.0 - 2016-10-18 - Support for 403 status codes (permission denied) ## 4.0.1 - 2016-10-17 - Fix transfer reversal materialization - Fixes for some property definitions in docblocks ## 4.0.0 - 2016-09-28 - Support for subscription items - Drop attempt to force TLS 1.2: please note that this could be breaking if you're using old OS distributions or packages and upgraded recently (so please make sure to test your integration!) ## 3.23.0 - 2016-09-15 - Add support for Apple Pay domains ## 3.22.0 - 2016-09-13 - Add `Stripe::setAppInfo` to allow plugins to register user agent information ## 3.21.0 - 2016-08-25 - Add `Source` model for generic payment sources ## 3.20.0 - 2016-08-08 - Add `getDeclineCode` to card errors ## 3.19.0 - 2016-07-29 - Opt requests directly into TLS 1.2 where OpenSSL >= 1.0.1 (see #277 for context) ## 3.18.0 - 2016-07-28 - Add new `STATUS_` constants for subscriptions ## 3.17.1 - 2016-07-28 - Fix auto-paging iterator so that it plays nicely with `iterator_to_array` ## 3.17.0 - 2016-07-14 - Add field annotations to model classes for better editor hinting ## 3.16.0 - 2016-07-12 - Add `ThreeDSecure` model for 3-D secure payments ## 3.15.0 - 2016-06-29 - Add static `update` method to all resources that can be changed. ## 3.14.3 - 2016-06-20 - Make sure that cURL never sends `Expects: 100-continue`, even on large request bodies ## 3.14.2 - 2016-06-03 - Add `inventory` under `SKU` to list of keys that have nested data and can be updated ## 3.14.1 - 2016-05-27 - Fix some inconsistencies in PHPDoc ## 3.14.0 - 2016-05-25 - Add support for returning Relay orders ## 3.13.0 - 2016-05-04 - Add `list`, `create`, `update`, `retrieve`, and `delete` methods to the Subscription class ## 3.12.1 - 2016-04-07 - Additional check on value arrays for some extra safety ## 3.12.0 - 2016-03-31 - Fix bug `refreshFrom` on `StripeObject` would not take an `$opts` array - Fix bug where `$opts` not passed to parent `save` method in `Account` - Fix bug where non-existent variable was referenced in `reverse` in `Transfer` - Update CA cert bundle for compatibility with OpenSSL versions below 1.0.1 ## 3.11.0 - 2016-03-22 - Allow `CurlClient` to be initialized with default `CURLOPT_*` options ## 3.10.1 - 2016-03-22 - Fix bug where request params and options were ignored in `ApplicationFee`'s `refund.` ## 3.10.0 - 2016-03-15 - Add `reject` on `Account` to support the new API feature ## 3.9.2 - 2016-03-04 - Fix error when an object's metadata is set more than once ## 3.9.1 - 2016-02-24 - Fix encoding behavior of nested arrays for requests (see #227) ## 3.9.0 - 2016-02-09 - Add automatic pagination mechanism with `autoPagingIterator()` - Allow global account ID to be set with `Stripe::setAccountId()` ## 3.8.0 - 2016-02-08 - Add `CountrySpec` model for looking up country payment information ## 3.7.1 - 2016-02-01 - Update bundled CA certs ## 3.7.0 - 2016-01-27 - Support deleting Relay products and SKUs ## 3.6.0 - 2016-01-05 - Allow configuration of HTTP client timeouts ## 3.5.0 - 2015-12-01 - Add a verification routine for external accounts ## 3.4.0 - 2015-09-14 - Products, SKUs, and Orders -- https://stripe.com/relay ## 3.3.0 - 2015-09-11 - Add support for 429 Rate Limit response ## 3.2.0 - 2015-08-17 - Add refund listing and retrieval without an associated charge ## 3.1.0 - 2015-08-03 - Add dispute listing and retrieval - Add support for manage account deletion ## 3.0.0 - 2015-07-28 - Rename `\Stripe\Object` to `\Stripe\StripeObject` (PHP 7 compatibility) - Rename `getCode` and `getParam` in exceptions to `getStripeCode` and `getStripeParam` - Add support for calling `json_encode` on Stripe objects in PHP 5.4+ - Start supporting/testing PHP 7 ## 2.3.0 - 2015-07-06 - Add request ID to all Stripe exceptions ## 2.2.0 - 2015-06-01 - Add support for Alipay accounts as sources - Add support for bank accounts as sources (private beta) - Add support for bank accounts and cards as external_accounts on Account objects ## 2.1.4 - 2015-05-13 - Fix CA certificate file path (thanks @lphilps & @matthewarkin) ## 2.1.3 - 2015-05-12 - Fix to account updating to permit `tos_acceptance` and `personal_address` to be set properly - Fix to Transfer reversal creation (thanks @neatness!) - Network requests are now done through a swappable class for easier mocking ## 2.1.2 - 2015-04-10 - Remove SSL cert revokation checking (all pre-Heartbleed certs have expired) - Bug fixes to account updating ## 2.1.1 - 2015-02-27 - Support transfer reversals ## 2.1.0 - 2015-02-19 - Support new API version (2015-02-18) - Added Bitcoin Receiever update and delete actions - Edited tests to prefer "source" over "card" as per new API version ## 2.0.1 - 2015-02-16 - Fix to fetching endpoints that use a non-default baseUrl (`FileUpload`) ## 2.0.0 - 2015-02-14 - Bumped minimum version to 5.3.3 - Switched to Stripe namespace instead of Stripe\_ class name prefiexes (thanks @chadicus!) - Switched tests to PHPUnit (thanks @chadicus!) - Switched style guide to PSR2 (thanks @chadicus!) - Added \$opts hash to the end of most methods: this permits passing 'idempotency_key', 'stripe_account', or 'stripe_version'. The last 2 will persist across multiple object loads. - Added support for retrieving Account by ID ## 1.18.0 - 2015-01-21 - Support making bitcoin charges through BitcoinReceiver source object ## 1.17.5 - 2014-12-23 - Adding support for creating file uploads. ## 1.17.4 - 2014-12-15 - Saving objects fetched with a custom key now works (thanks @JustinHook & @jpasilan) - Added methods for reporting charges as safe or fraudulent and for specifying the reason for refunds ## 1.17.3 - 2014-11-06 - Better handling of HHVM support for SSL certificate blacklist checking. ## 1.17.2 - 2014-09-23 - Coupons now are backed by a `Stripe_Coupon` instead of `Stripe_Object`, and support updating metadata - Running operations (`create`, `retrieve`, `all`) on upcoming invoice items now works ## 1.17.1 - 2014-07-31 - Requests now send Content-Type header ## 1.17.0 - 2014-07-29 - Application Fee refunds now a list instead of array - HHVM now works - Small bug fixes (thanks @bencromwell & @fastest963) - `__toString` now returns the name of the object in addition to its JSON representation ## 1.16.0 - 2014-06-17 - Add metadata for refunds and disputes ## 1.15.0 - 2014-05-28 - Support canceling transfers ## 1.14.1 - 2014-05-21 - Support cards for recipients. ## 1.13.1 - 2014-05-15 - Fix bug in account resource where `id` wasn't in the result ## 1.13.0 - 2014-04-10 - Add support for certificate blacklisting - Update ca bundle - Drop support for HHVM (Temporarily) ## 1.12.0 - 2014-04-01 - Add Stripe_RateLimitError for catching rate limit errors. - Update to Zend coding style (thanks, @jpiasetz) ## 1.11.0 - 2014-01-29 - Add support for multiple subscriptions per customer ## 1.10.1 - 2013-12-02 - Add new ApplicationFee ## 1.9.1 - 2013-11-08 - Fix a bug where a null nestable object causes warnings to fire. ## 1.9.0 - 2013-10-16 - Add support for metadata API. ## 1.8.4 - 2013-09-18 - Add support for closing disputes. ## 1.8.3 - 2013-08-13 - Add new Balance and BalanceTransaction ## 1.8.2 - 2013-08-12 - Add support for unsetting attributes by updating to NULL. Setting properties to a blank string is now an error. ## 1.8.1 - 2013-07-12 - Add support for multiple cards API (Stripe API version 2013-07-12: https://stripe.com/docs/upgrades#2013-07-05) ## 1.8.0 - 2013-04-11 - Allow Transfers to be creatable - Add new Recipient resource ## 1.7.15 - 2013-02-21 - Add 'id' to the list of permanent object attributes ## 1.7.14 - 2013-02-20 - Don't re-encode strings that are already encoded in UTF-8. If you were previously using plan or coupon objects with UTF-8 IDs, they may have been treated as ISO-8859-1 (Latin-1) and encoded to UTF-8 a 2nd time. You may now need to pass the IDs to utf8_encode before passing them to Stripe_Plan::retrieve or Stripe_Coupon::retrieve. - Ensure that all input is encoded in UTF-8 before submitting it to Stripe's servers. (github issue #27) ## 1.7.13 - 2013-02-01 - Add support for passing options when retrieving Stripe objects e.g., Stripe_Charge::retrieve(array("id"=>"foo", "expand" => array("customer"))); Stripe_Charge::retrieve("foo") will continue to work ## 1.7.12 - 2013-01-15 - Add support for setting a Stripe API version override ## 1.7.11 - 2012-12-30 - Version bump to cleanup constants and such (fix issue #26) ## 1.7.10 - 2012-11-08 - Add support for updating charge disputes. - Fix bug preventing retrieval of null attributes ## 1.7.9 - 2012-11-08 - Fix usage under autoloaders such as the one generated by composer (fix issue #22) ## 1.7.8 - 2012-10-30 - Add support for creating invoices. - Add support for new invoice lines return format - Add support for new list objects ## 1.7.7 - 2012-09-14 - Get all of the various version numbers in the repo in sync (no other changes) ## 1.7.6 - 2012-08-31 - Add update and pay methods to Invoice resource ## 1.7.5 - 2012-08-23 - Change internal function names so that Stripe_SingletonApiRequest is E_STRICT-clean (github issue #16) ## 1.7.4 - 2012-08-21 - Bugfix so that Stripe objects (e.g. Customer, Charge objects) used in API calls are transparently converted to their object IDs ## 1.7.3 - 2012-08-15 - Add new Account resource ## 1.7.2 - 2012-06-26 - Make clearer that you should be including lib/Stripe.php, not test/Stripe.php (github issue #14) ## 1.7.1 - 2012-05-24 - Add missing argument to Stripe_InvalidRequestError constructor in Stripe_ApiResource::instanceUrl. Fixes a warning when Stripe_ApiResource::instanceUrl is called on a resource with no ID (fix issue #12) ## 1.7.0 - 2012-05-17 - Support Composer and Packagist (github issue #9) - Add new deleteDiscount method to Stripe_Customer - Add new Transfer resource - Switch from using HTTP Basic auth to Bearer auth. (Note: Stripe will support Basic auth for the indefinite future, but recommends Bearer auth when possible going forward) - Numerous test suite improvements stripe-php/README.md 0000666 00000031077 15165746005 0010143 0 ustar 00 # Stripe PHP bindings [](https://github.com/stripe/stripe-php/actions?query=branch%3Amaster) [](https://packagist.org/packages/stripe/stripe-php) [](https://packagist.org/packages/stripe/stripe-php) [](https://packagist.org/packages/stripe/stripe-php) [](https://coveralls.io/r/stripe/stripe-php?branch=master) The Stripe PHP library provides convenient access to the Stripe API from applications written in the PHP language. It includes a pre-defined set of classes for API resources that initialize themselves dynamically from API responses which makes it compatible with a wide range of versions of the Stripe API. ## Requirements PHP 5.6.0 and later. ## Composer You can install the bindings via [Composer](http://getcomposer.org/). Run the following command: ```bash composer require stripe/stripe-php ``` To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading): ```php require_once('vendor/autoload.php'); ``` ## Manual Installation If you do not wish to use Composer, you can download the [latest release](https://github.com/stripe/stripe-php/releases). Then, to use the bindings, include the `init.php` file. ```php require_once('/path/to/stripe-php/init.php'); ``` ## Dependencies The bindings require the following extensions in order to work properly: - [`curl`](https://secure.php.net/manual/en/book.curl.php), although you can use your own non-cURL client if you prefer - [`json`](https://secure.php.net/manual/en/book.json.php) - [`mbstring`](https://secure.php.net/manual/en/book.mbstring.php) (Multibyte String) If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available. ## Getting Started Simple usage looks like: ```php $stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); $customer = $stripe->customers->create([ 'description' => 'example customer', 'email' => 'email@example.com', 'payment_method' => 'pm_card_visa', ]); echo $customer; ``` ### Client/service patterns vs legacy patterns You can continue to use the legacy integration patterns used prior to version [7.33.0](https://github.com/stripe/stripe-php/blob/master/CHANGELOG.md#7330---2020-05-14). Review the [migration guide](https://github.com/stripe/stripe-php/wiki/Migration-to-StripeClient-and-services-in-7.33.0) for the backwards-compatible client/services pattern changes. ## Documentation See the [PHP API docs](https://stripe.com/docs/api/?lang=php#intro). See [video demonstrations][youtube-playlist] covering how to use the library. ## Legacy Version Support ### PHP 5.4 & 5.5 If you are using PHP 5.4 or 5.5, you should consider upgrading your environment as those versions have been past end of life since September 2015 and July 2016 respectively. Otherwise, you can still use Stripe by downloading stripe-php v6.43.1 ([zip](https://github.com/stripe/stripe-php/archive/v6.43.1.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/6.43.1.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will work but might not support recent features we added since the version was released and upgrading PHP is the best course of action. ### PHP 5.3 If you are using PHP 5.3, you should upgrade your environment as this version has been past end of life since August 2014. Otherwise, you can download v5.9.2 ([zip](https://github.com/stripe/stripe-php/archive/v5.9.2.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v5.9.2.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses. ## Custom Request Timeouts > **Note** > We do not recommend decreasing the timeout for non-read-only calls (e.g. charge creation), since even if you locally timeout, the request on Stripe's side can still complete. If you are decreasing timeouts on these calls, make sure to use [idempotency tokens](https://stripe.com/docs/api/?lang=php#idempotent_requests) to avoid executing the same transaction twice as a result of timeout retry logic. To modify request timeouts (connect or total, in seconds) you'll need to tell the API client to use a CurlClient other than its default. You'll set the timeouts in that CurlClient. ```php // set up your tweaked Curl client $curl = new \Stripe\HttpClient\CurlClient(); $curl->setTimeout(10); // default is \Stripe\HttpClient\CurlClient::DEFAULT_TIMEOUT $curl->setConnectTimeout(5); // default is \Stripe\HttpClient\CurlClient::DEFAULT_CONNECT_TIMEOUT echo $curl->getTimeout(); // 10 echo $curl->getConnectTimeout(); // 5 // tell Stripe to use the tweaked client \Stripe\ApiRequestor::setHttpClient($curl); // use the Stripe API client as you normally would ``` ## Custom cURL Options (e.g. proxies) Need to set a proxy for your requests? Pass in the requisite `CURLOPT_*` array to the CurlClient constructor, using the same syntax as `curl_stopt_array()`. This will set the default cURL options for each HTTP request made by the SDK, though many more common options (e.g. timeouts; see above on how to set those) will be overridden by the client even if set here. ```php // set up your tweaked Curl client $curl = new \Stripe\HttpClient\CurlClient([CURLOPT_PROXY => 'proxy.local:80']); // tell Stripe to use the tweaked client \Stripe\ApiRequestor::setHttpClient($curl); ``` Alternately, a callable can be passed to the CurlClient constructor that returns the above array based on request inputs. See `testDefaultOptions()` in `tests/CurlClientTest.php` for an example of this behavior. Note that the callable is called at the beginning of every API request, before the request is sent. ### Configuring a Logger The library does minimal logging, but it can be configured with a [`PSR-3` compatible logger][psr3] so that messages end up there instead of `error_log`: ```php \Stripe\Stripe::setLogger($logger); ``` ### Accessing response data You can access the data from the last API response on any object via `getLastResponse()`. ```php $customer = $stripe->customers->create([ 'description' => 'example customer', ]); echo $customer->getLastResponse()->headers['Request-Id']; ``` ### SSL / TLS compatibility issues Stripe's API now requires that [all connections use TLS 1.2](https://stripe.com/blog/upgrading-tls). Some systems (most notably some older CentOS and RHEL versions) are capable of using TLS 1.2 but will use TLS 1.0 or 1.1 by default. In this case, you'd get an `invalid_request_error` with the following error message: "Stripe no longer supports API requests made with TLS 1.0. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at [https://stripe.com/blog/upgrading-tls](https://stripe.com/blog/upgrading-tls).". The recommended course of action is to [upgrade your cURL and OpenSSL packages](https://support.stripe.com/questions/how-do-i-upgrade-my-stripe-integration-from-tls-1-0-to-tls-1-2#php) so that TLS 1.2 is used by default, but if that is not possible, you might be able to solve the issue by setting the `CURLOPT_SSLVERSION` option to either `CURL_SSLVERSION_TLSv1` or `CURL_SSLVERSION_TLSv1_2`: ```php $curl = new \Stripe\HttpClient\CurlClient([CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1]); \Stripe\ApiRequestor::setHttpClient($curl); ``` ### Per-request Configuration For apps that need to use multiple keys during the lifetime of a process, like one that uses [Stripe Connect][connect], it's also possible to set a per-request key and/or account: ```php $customers = $stripe->customers->all([],[ 'api_key' => 'sk_test_...', 'stripe_account' => 'acct_...' ]); $stripe->customers->retrieve('cus_123456789', [], [ 'api_key' => 'sk_test_...', 'stripe_account' => 'acct_...' ]); ``` ### Configuring CA Bundles By default, the library will use its own internal bundle of known CA certificates, but it's possible to configure your own: ```php \Stripe\Stripe::setCABundlePath("path/to/ca/bundle"); ``` ### Configuring Automatic Retries The library can be configured to automatically retry requests that fail due to an intermittent network problem: ```php \Stripe\Stripe::setMaxNetworkRetries(2); ``` [Idempotency keys][idempotency-keys] are added to requests to guarantee that retries are safe. ### Request latency telemetry By default, the library sends request latency telemetry to Stripe. These numbers help Stripe improve the overall latency of its API for all users. You can disable this behavior if you prefer: ```php \Stripe\Stripe::setEnableTelemetry(false); ``` ### Beta SDKs Stripe has features in the beta phase that can be accessed via the beta version of this package. We would love for you to try these and share feedback with us before these features reach the stable phase. Use the `composer require` command with an exact version specified to install the beta version of the stripe-php pacakge. ```bash composer require stripe/stripe-php:v9.2.0-beta.1 ``` > **Note** > There can be breaking changes between beta versions. Therefore we recommend pinning the package version to a specific beta version in your composer.json file. This way you can install the same version each time without breaking changes unless you are intentionally looking for the latest beta version. We highly recommend keeping an eye on when the beta feature you are interested in goes from beta to stable so that you can move from using a beta version of the SDK to the stable version. If your beta feature requires a `Stripe-Version` header to be sent, use the `apiVersion` property of `config` object to set it: ```php Stripe::setApiVersion(Stripe::getApiVersion() . '; feature_beta=v3'); ``` ## Support New features and bug fixes are released on the latest major version of the Stripe PHP library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates. ## Development Get [Composer][composer]. For example, on Mac OS: ```bash brew install composer ``` Install dependencies: ```bash composer install ``` The test suite depends on [stripe-mock], so make sure to fetch and run it from a background terminal ([stripe-mock's README][stripe-mock] also contains instructions for installing via Homebrew and other methods): ```bash go get -u github.com/stripe/stripe-mock stripe-mock ``` Install dependencies as mentioned above (which will resolve [PHPUnit](http://packagist.org/packages/phpunit/phpunit)), then you can run the test suite: ```bash ./vendor/bin/phpunit ``` Or to run an individual test file: ```bash ./vendor/bin/phpunit tests/Stripe/UtilTest.php ``` Update bundled CA certificates from the [Mozilla cURL release][curl]: ```bash ./update_certs.php ``` The library uses [PHP CS Fixer][php-cs-fixer] for code formatting. Code must be formatted before PRs are submitted, otherwise CI will fail. Run the formatter with: ```bash ./vendor/bin/php-cs-fixer fix -v . ``` ## Attention plugin developers Are you writing a plugin that integrates Stripe and embeds our library? Then please use the `setAppInfo` function to identify your plugin. For example: ```php \Stripe\Stripe::setAppInfo("MyAwesomePlugin", "1.2.34", "https://myawesomeplugin.info"); ``` The method should be called once, before any request is sent to the API. The second and third parameters are optional. ### SSL / TLS configuration option See the "SSL / TLS compatibility issues" paragraph above for full context. If you want to ensure that your plugin can be used on all systems, you should add a configuration option to let your users choose between different values for `CURLOPT_SSLVERSION`: none (default), `CURL_SSLVERSION_TLSv1` and `CURL_SSLVERSION_TLSv1_2`. [composer]: https://getcomposer.org/ [connect]: https://stripe.com/connect [curl]: http://curl.haxx.se/docs/caextract.html [idempotency-keys]: https://stripe.com/docs/api/?lang=php#idempotent_requests [php-cs-fixer]: https://github.com/FriendsOfPHP/PHP-CS-Fixer [psr3]: http://www.php-fig.org/psr/psr-3/ [stripe-mock]: https://github.com/stripe/stripe-mock [youtube-playlist]: https://www.youtube.com/playlist?list=PLy1nL-pvL2M6cUbiHrfMkXxZ9j9SGBxFE stripe-php/.php-cs-fixer.php 0000666 00000005032 15165746005 0011750 0 ustar 00 <?php $finder = PhpCsFixer\Finder::create() ->notPath('tests/TestCase.php'); $config = new PhpCsFixer\Config(); $config->setRiskyAllowed(true); $config->setRules([ // Rulesets '@PSR2' => true, '@PhpCsFixer' => true, '@PhpCsFixer:risky' => true, '@PHP56Migration:risky' => true, '@PHPUnit57Migration:risky' => true, // Additional rules 'fopen_flags' => true, 'linebreak_after_opening_tag' => true, // This one is non-deterministic based on what environment you are running it in and what `get_defined_constants` returns. 'native_constant_invocation' => false, 'native_function_invocation' => [ "strict" => false, ], // --- Diffs from @PhpCsFixer / @PhpCsFixer:risky --- // This is the same as the default for the @PhpCsFixer ruleset, minus // the following values: ['include', 'include_once', 'require', // 'require_once']. We could enable them and remove this line after // updating codegen for the `init.php` file to be compliant. 'blank_line_before_statement' => ['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'return', 'switch', 'throw', 'try']], // This is just prettier / easier to read. 'concat_space' => ['spacing' => 'one'], // This causes strange ordering with codegen'd classes. We might be // able to enable this if we update codegen to output class elements // in the correct order. 'ordered_class_elements' => false, // Keep this disabled to avoid unnecessary diffs in PHPDoc comments of // codegen'd classes. 'phpdoc_align' => false, // This is a "risky" rule that causes a bug in our codebase. // Specifically, in `StripeObject.updateAttributes` we construct new // `StripeObject`s for metadata. We can't use `self` there because it // needs to be a raw `StripeObject`. 'self_accessor' => false, // Visibility annotations are not supported by php5.6 'visibility_required' => false, // Apparently "uninitialized" is distinct from "null" in some versions of PHP // so I am defensively disabling this rule so as to not cause breaking changes // but we can feel free to remove it in a major version (or maybe in a minor if // we devote some effort into determining that it is safe) 'no_null_property_initialization' => false, // We have to support `@return void` to satisfy Symfony deprecations helper. // See https://github.com/stripe/stripe-php/pull/1230 'phpdoc_no_empty_return' => false, ]); $config->setFinder($finder); return $config; stripe-php/init.php 0000666 00000035630 15165746005 0010337 0 ustar 00 <?php // File generated from our OpenAPI spec require __DIR__ . '/lib/Util/ApiVersion.php'; // Stripe singleton require __DIR__ . '/lib/Stripe.php'; // Utilities require __DIR__ . '/lib/Util/CaseInsensitiveArray.php'; require __DIR__ . '/lib/Util/LoggerInterface.php'; require __DIR__ . '/lib/Util/DefaultLogger.php'; require __DIR__ . '/lib/Util/RandomGenerator.php'; require __DIR__ . '/lib/Util/RequestOptions.php'; require __DIR__ . '/lib/Util/Set.php'; require __DIR__ . '/lib/Util/Util.php'; require __DIR__ . '/lib/Util/ObjectTypes.php'; // HttpClient require __DIR__ . '/lib/HttpClient/ClientInterface.php'; require __DIR__ . '/lib/HttpClient/StreamingClientInterface.php'; require __DIR__ . '/lib/HttpClient/CurlClient.php'; // Exceptions require __DIR__ . '/lib/Exception/ExceptionInterface.php'; require __DIR__ . '/lib/Exception/ApiErrorException.php'; require __DIR__ . '/lib/Exception/ApiConnectionException.php'; require __DIR__ . '/lib/Exception/AuthenticationException.php'; require __DIR__ . '/lib/Exception/BadMethodCallException.php'; require __DIR__ . '/lib/Exception/CardException.php'; require __DIR__ . '/lib/Exception/IdempotencyException.php'; require __DIR__ . '/lib/Exception/InvalidArgumentException.php'; require __DIR__ . '/lib/Exception/InvalidRequestException.php'; require __DIR__ . '/lib/Exception/PermissionException.php'; require __DIR__ . '/lib/Exception/RateLimitException.php'; require __DIR__ . '/lib/Exception/SignatureVerificationException.php'; require __DIR__ . '/lib/Exception/UnexpectedValueException.php'; require __DIR__ . '/lib/Exception/UnknownApiErrorException.php'; // OAuth exceptions require __DIR__ . '/lib/Exception/OAuth/ExceptionInterface.php'; require __DIR__ . '/lib/Exception/OAuth/OAuthErrorException.php'; require __DIR__ . '/lib/Exception/OAuth/InvalidClientException.php'; require __DIR__ . '/lib/Exception/OAuth/InvalidGrantException.php'; require __DIR__ . '/lib/Exception/OAuth/InvalidRequestException.php'; require __DIR__ . '/lib/Exception/OAuth/InvalidScopeException.php'; require __DIR__ . '/lib/Exception/OAuth/UnknownOAuthErrorException.php'; require __DIR__ . '/lib/Exception/OAuth/UnsupportedGrantTypeException.php'; require __DIR__ . '/lib/Exception/OAuth/UnsupportedResponseTypeException.php'; // API operations require __DIR__ . '/lib/ApiOperations/All.php'; require __DIR__ . '/lib/ApiOperations/Create.php'; require __DIR__ . '/lib/ApiOperations/Delete.php'; require __DIR__ . '/lib/ApiOperations/NestedResource.php'; require __DIR__ . '/lib/ApiOperations/Request.php'; require __DIR__ . '/lib/ApiOperations/Retrieve.php'; require __DIR__ . '/lib/ApiOperations/Search.php'; require __DIR__ . '/lib/ApiOperations/SingletonRetrieve.php'; require __DIR__ . '/lib/ApiOperations/Update.php'; // Plumbing require __DIR__ . '/lib/ApiResponse.php'; require __DIR__ . '/lib/RequestTelemetry.php'; require __DIR__ . '/lib/StripeObject.php'; require __DIR__ . '/lib/ApiRequestor.php'; require __DIR__ . '/lib/ApiResource.php'; require __DIR__ . '/lib/SingletonApiResource.php'; require __DIR__ . '/lib/Service/AbstractService.php'; require __DIR__ . '/lib/Service/AbstractServiceFactory.php'; // StripeClient require __DIR__ . '/lib/BaseStripeClientInterface.php'; require __DIR__ . '/lib/StripeClientInterface.php'; require __DIR__ . '/lib/StripeStreamingClientInterface.php'; require __DIR__ . '/lib/BaseStripeClient.php'; require __DIR__ . '/lib/StripeClient.php'; // Stripe API Resources require __DIR__ . '/lib/Account.php'; require __DIR__ . '/lib/AccountLink.php'; require __DIR__ . '/lib/ApplePayDomain.php'; require __DIR__ . '/lib/ApplicationFee.php'; require __DIR__ . '/lib/ApplicationFeeRefund.php'; require __DIR__ . '/lib/Apps/Secret.php'; require __DIR__ . '/lib/Balance.php'; require __DIR__ . '/lib/BalanceTransaction.php'; require __DIR__ . '/lib/BankAccount.php'; require __DIR__ . '/lib/BillingPortal/Configuration.php'; require __DIR__ . '/lib/BillingPortal/Session.php'; require __DIR__ . '/lib/Capability.php'; require __DIR__ . '/lib/Card.php'; require __DIR__ . '/lib/CashBalance.php'; require __DIR__ . '/lib/Charge.php'; require __DIR__ . '/lib/Checkout/Session.php'; require __DIR__ . '/lib/Collection.php'; require __DIR__ . '/lib/CountrySpec.php'; require __DIR__ . '/lib/Coupon.php'; require __DIR__ . '/lib/CreditNote.php'; require __DIR__ . '/lib/CreditNoteLineItem.php'; require __DIR__ . '/lib/Customer.php'; require __DIR__ . '/lib/CustomerBalanceTransaction.php'; require __DIR__ . '/lib/CustomerCashBalanceTransaction.php'; require __DIR__ . '/lib/Discount.php'; require __DIR__ . '/lib/Dispute.php'; require __DIR__ . '/lib/EphemeralKey.php'; require __DIR__ . '/lib/ErrorObject.php'; require __DIR__ . '/lib/Event.php'; require __DIR__ . '/lib/ExchangeRate.php'; require __DIR__ . '/lib/File.php'; require __DIR__ . '/lib/FileLink.php'; require __DIR__ . '/lib/FinancialConnections/Account.php'; require __DIR__ . '/lib/FinancialConnections/AccountOwner.php'; require __DIR__ . '/lib/FinancialConnections/AccountOwnership.php'; require __DIR__ . '/lib/FinancialConnections/Session.php'; require __DIR__ . '/lib/FundingInstructions.php'; require __DIR__ . '/lib/Identity/VerificationReport.php'; require __DIR__ . '/lib/Identity/VerificationSession.php'; require __DIR__ . '/lib/Invoice.php'; require __DIR__ . '/lib/InvoiceItem.php'; require __DIR__ . '/lib/InvoiceLineItem.php'; require __DIR__ . '/lib/Issuing/Authorization.php'; require __DIR__ . '/lib/Issuing/Card.php'; require __DIR__ . '/lib/Issuing/CardDetails.php'; require __DIR__ . '/lib/Issuing/Cardholder.php'; require __DIR__ . '/lib/Issuing/Dispute.php'; require __DIR__ . '/lib/Issuing/Transaction.php'; require __DIR__ . '/lib/LineItem.php'; require __DIR__ . '/lib/LoginLink.php'; require __DIR__ . '/lib/Mandate.php'; require __DIR__ . '/lib/Order.php'; require __DIR__ . '/lib/PaymentIntent.php'; require __DIR__ . '/lib/PaymentLink.php'; require __DIR__ . '/lib/PaymentMethod.php'; require __DIR__ . '/lib/Payout.php'; require __DIR__ . '/lib/Person.php'; require __DIR__ . '/lib/Plan.php'; require __DIR__ . '/lib/Price.php'; require __DIR__ . '/lib/Product.php'; require __DIR__ . '/lib/PromotionCode.php'; require __DIR__ . '/lib/Quote.php'; require __DIR__ . '/lib/Radar/EarlyFraudWarning.php'; require __DIR__ . '/lib/Radar/ValueList.php'; require __DIR__ . '/lib/Radar/ValueListItem.php'; require __DIR__ . '/lib/Refund.php'; require __DIR__ . '/lib/Reporting/ReportRun.php'; require __DIR__ . '/lib/Reporting/ReportType.php'; require __DIR__ . '/lib/Review.php'; require __DIR__ . '/lib/SearchResult.php'; require __DIR__ . '/lib/SetupAttempt.php'; require __DIR__ . '/lib/SetupIntent.php'; require __DIR__ . '/lib/ShippingRate.php'; require __DIR__ . '/lib/Sigma/ScheduledQueryRun.php'; require __DIR__ . '/lib/SKU.php'; require __DIR__ . '/lib/Source.php'; require __DIR__ . '/lib/SourceTransaction.php'; require __DIR__ . '/lib/Subscription.php'; require __DIR__ . '/lib/SubscriptionItem.php'; require __DIR__ . '/lib/SubscriptionSchedule.php'; require __DIR__ . '/lib/TaxCode.php'; require __DIR__ . '/lib/TaxId.php'; require __DIR__ . '/lib/TaxRate.php'; require __DIR__ . '/lib/Terminal/Configuration.php'; require __DIR__ . '/lib/Terminal/ConnectionToken.php'; require __DIR__ . '/lib/Terminal/Location.php'; require __DIR__ . '/lib/Terminal/Reader.php'; require __DIR__ . '/lib/TestHelpers/TestClock.php'; require __DIR__ . '/lib/Token.php'; require __DIR__ . '/lib/Topup.php'; require __DIR__ . '/lib/Transfer.php'; require __DIR__ . '/lib/TransferReversal.php'; require __DIR__ . '/lib/Treasury/CreditReversal.php'; require __DIR__ . '/lib/Treasury/DebitReversal.php'; require __DIR__ . '/lib/Treasury/FinancialAccount.php'; require __DIR__ . '/lib/Treasury/FinancialAccountFeatures.php'; require __DIR__ . '/lib/Treasury/InboundTransfer.php'; require __DIR__ . '/lib/Treasury/OutboundPayment.php'; require __DIR__ . '/lib/Treasury/OutboundTransfer.php'; require __DIR__ . '/lib/Treasury/ReceivedCredit.php'; require __DIR__ . '/lib/Treasury/ReceivedDebit.php'; require __DIR__ . '/lib/Treasury/Transaction.php'; require __DIR__ . '/lib/Treasury/TransactionEntry.php'; require __DIR__ . '/lib/UsageRecord.php'; require __DIR__ . '/lib/UsageRecordSummary.php'; require __DIR__ . '/lib/WebhookEndpoint.php'; // Services require __DIR__ . '/lib/Service/AccountService.php'; require __DIR__ . '/lib/Service/AccountLinkService.php'; require __DIR__ . '/lib/Service/ApplePayDomainService.php'; require __DIR__ . '/lib/Service/ApplicationFeeService.php'; require __DIR__ . '/lib/Service/Apps/SecretService.php'; require __DIR__ . '/lib/Service/BalanceService.php'; require __DIR__ . '/lib/Service/BalanceTransactionService.php'; require __DIR__ . '/lib/Service/BillingPortal/ConfigurationService.php'; require __DIR__ . '/lib/Service/BillingPortal/SessionService.php'; require __DIR__ . '/lib/Service/ChargeService.php'; require __DIR__ . '/lib/Service/Checkout/SessionService.php'; require __DIR__ . '/lib/Service/CountrySpecService.php'; require __DIR__ . '/lib/Service/CouponService.php'; require __DIR__ . '/lib/Service/CreditNoteService.php'; require __DIR__ . '/lib/Service/CustomerService.php'; require __DIR__ . '/lib/Service/DisputeService.php'; require __DIR__ . '/lib/Service/EphemeralKeyService.php'; require __DIR__ . '/lib/Service/EventService.php'; require __DIR__ . '/lib/Service/ExchangeRateService.php'; require __DIR__ . '/lib/Service/FileService.php'; require __DIR__ . '/lib/Service/FileLinkService.php'; require __DIR__ . '/lib/Service/FinancialConnections/AccountService.php'; require __DIR__ . '/lib/Service/FinancialConnections/SessionService.php'; require __DIR__ . '/lib/Service/Identity/VerificationReportService.php'; require __DIR__ . '/lib/Service/Identity/VerificationSessionService.php'; require __DIR__ . '/lib/Service/InvoiceService.php'; require __DIR__ . '/lib/Service/InvoiceItemService.php'; require __DIR__ . '/lib/Service/Issuing/AuthorizationService.php'; require __DIR__ . '/lib/Service/Issuing/CardService.php'; require __DIR__ . '/lib/Service/Issuing/CardholderService.php'; require __DIR__ . '/lib/Service/Issuing/DisputeService.php'; require __DIR__ . '/lib/Service/Issuing/TransactionService.php'; require __DIR__ . '/lib/Service/MandateService.php'; require __DIR__ . '/lib/Service/OrderService.php'; require __DIR__ . '/lib/Service/PaymentIntentService.php'; require __DIR__ . '/lib/Service/PaymentLinkService.php'; require __DIR__ . '/lib/Service/PaymentMethodService.php'; require __DIR__ . '/lib/Service/PayoutService.php'; require __DIR__ . '/lib/Service/PlanService.php'; require __DIR__ . '/lib/Service/PriceService.php'; require __DIR__ . '/lib/Service/ProductService.php'; require __DIR__ . '/lib/Service/PromotionCodeService.php'; require __DIR__ . '/lib/Service/QuoteService.php'; require __DIR__ . '/lib/Service/Radar/EarlyFraudWarningService.php'; require __DIR__ . '/lib/Service/Radar/ValueListService.php'; require __DIR__ . '/lib/Service/Radar/ValueListItemService.php'; require __DIR__ . '/lib/Service/RefundService.php'; require __DIR__ . '/lib/Service/Reporting/ReportRunService.php'; require __DIR__ . '/lib/Service/Reporting/ReportTypeService.php'; require __DIR__ . '/lib/Service/ReviewService.php'; require __DIR__ . '/lib/Service/SetupAttemptService.php'; require __DIR__ . '/lib/Service/SetupIntentService.php'; require __DIR__ . '/lib/Service/ShippingRateService.php'; require __DIR__ . '/lib/Service/Sigma/ScheduledQueryRunService.php'; require __DIR__ . '/lib/Service/SkuService.php'; require __DIR__ . '/lib/Service/SourceService.php'; require __DIR__ . '/lib/Service/SubscriptionService.php'; require __DIR__ . '/lib/Service/SubscriptionItemService.php'; require __DIR__ . '/lib/Service/SubscriptionScheduleService.php'; require __DIR__ . '/lib/Service/TaxCodeService.php'; require __DIR__ . '/lib/Service/TaxRateService.php'; require __DIR__ . '/lib/Service/Terminal/ConfigurationService.php'; require __DIR__ . '/lib/Service/Terminal/ConnectionTokenService.php'; require __DIR__ . '/lib/Service/Terminal/LocationService.php'; require __DIR__ . '/lib/Service/Terminal/ReaderService.php'; require __DIR__ . '/lib/Service/TestHelpers/CustomerService.php'; require __DIR__ . '/lib/Service/TestHelpers/Issuing/CardService.php'; require __DIR__ . '/lib/Service/TestHelpers/RefundService.php'; require __DIR__ . '/lib/Service/TestHelpers/Terminal/ReaderService.php'; require __DIR__ . '/lib/Service/TestHelpers/TestClockService.php'; require __DIR__ . '/lib/Service/TestHelpers/Treasury/InboundTransferService.php'; require __DIR__ . '/lib/Service/TestHelpers/Treasury/OutboundPaymentService.php'; require __DIR__ . '/lib/Service/TestHelpers/Treasury/OutboundTransferService.php'; require __DIR__ . '/lib/Service/TestHelpers/Treasury/ReceivedCreditService.php'; require __DIR__ . '/lib/Service/TestHelpers/Treasury/ReceivedDebitService.php'; require __DIR__ . '/lib/Service/TokenService.php'; require __DIR__ . '/lib/Service/TopupService.php'; require __DIR__ . '/lib/Service/TransferService.php'; require __DIR__ . '/lib/Service/Treasury/CreditReversalService.php'; require __DIR__ . '/lib/Service/Treasury/DebitReversalService.php'; require __DIR__ . '/lib/Service/Treasury/FinancialAccountService.php'; require __DIR__ . '/lib/Service/Treasury/InboundTransferService.php'; require __DIR__ . '/lib/Service/Treasury/OutboundPaymentService.php'; require __DIR__ . '/lib/Service/Treasury/OutboundTransferService.php'; require __DIR__ . '/lib/Service/Treasury/ReceivedCreditService.php'; require __DIR__ . '/lib/Service/Treasury/ReceivedDebitService.php'; require __DIR__ . '/lib/Service/Treasury/TransactionService.php'; require __DIR__ . '/lib/Service/Treasury/TransactionEntryService.php'; require __DIR__ . '/lib/Service/WebhookEndpointService.php'; // Service factories require __DIR__ . '/lib/Service/Apps/AppsServiceFactory.php'; require __DIR__ . '/lib/Service/BillingPortal/BillingPortalServiceFactory.php'; require __DIR__ . '/lib/Service/Checkout/CheckoutServiceFactory.php'; require __DIR__ . '/lib/Service/CoreServiceFactory.php'; require __DIR__ . '/lib/Service/FinancialConnections/FinancialConnectionsServiceFactory.php'; require __DIR__ . '/lib/Service/Identity/IdentityServiceFactory.php'; require __DIR__ . '/lib/Service/Issuing/IssuingServiceFactory.php'; require __DIR__ . '/lib/Service/Radar/RadarServiceFactory.php'; require __DIR__ . '/lib/Service/Reporting/ReportingServiceFactory.php'; require __DIR__ . '/lib/Service/Sigma/SigmaServiceFactory.php'; require __DIR__ . '/lib/Service/Terminal/TerminalServiceFactory.php'; require __DIR__ . '/lib/Service/TestHelpers/Issuing/IssuingServiceFactory.php'; require __DIR__ . '/lib/Service/TestHelpers/Terminal/TerminalServiceFactory.php'; require __DIR__ . '/lib/Service/TestHelpers/TestHelpersServiceFactory.php'; require __DIR__ . '/lib/Service/TestHelpers/Treasury/TreasuryServiceFactory.php'; require __DIR__ . '/lib/Service/Treasury/TreasuryServiceFactory.php'; // OAuth require __DIR__ . '/lib/OAuth.php'; require __DIR__ . '/lib/OAuthErrorObject.php'; require __DIR__ . '/lib/Service/OAuthService.php'; // Webhooks require __DIR__ . '/lib/Webhook.php'; require __DIR__ . '/lib/WebhookSignature.php'; stripe-php/OPENAPI_VERSION 0000666 00000000004 15165746005 0011071 0 ustar 00 v202 stripe-php/update_certs.php 0000666 00000000603 15165746005 0012046 0 ustar 00 #!/usr/bin/env php <?php \chdir(__DIR__); \set_time_limit(0); // unlimited max execution time $fp = \fopen(__DIR__ . '/data/ca-certificates.crt', 'w+b'); $options = [ \CURLOPT_FILE => $fp, \CURLOPT_TIMEOUT => 3600, \CURLOPT_URL => 'https://curl.se/ca/cacert.pem', ]; $ch = \curl_init(); \curl_setopt_array($ch, $options); \curl_exec($ch); \curl_close($ch); \fclose($fp); stripe-php/composer.json 0000666 00000001642 15165746005 0011401 0 ustar 00 { "name": "stripe/stripe-php", "description": "Stripe PHP Library", "keywords": [ "stripe", "payment processing", "api" ], "homepage": "https://stripe.com/", "license": "MIT", "authors": [ { "name": "Stripe and contributors", "homepage": "https://github.com/stripe/stripe-php/contributors" } ], "require": { "php": ">=5.6.0", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*" }, "require-dev": { "phpunit/phpunit": "^5.7 || ^9.0", "squizlabs/php_codesniffer": "^3.3", "friendsofphp/php-cs-fixer": "3.5.0", "phpstan/phpstan": "^1.2", "php-coveralls/php-coveralls": "^2.5" }, "autoload": { "psr-4": { "Stripe\\": "lib/" } }, "autoload-dev": { "psr-4": { "Stripe\\": [ "tests/", "tests/Stripe/" ] } }, "extra": { "branch-alias": { "dev-master": "2.0-dev" } } } stripe-php/.gitignore 0000666 00000001260 15165746005 0010643 0 ustar 00 # Ignore build files build/* # Mac OS X dumps these all over the place. .DS_Store # Ignore the SimpleTest library if it is installed to /test/. /test/simpletest/ # Ignore the /vendor/ directory for people using composer /vendor/ # If the vendor directory isn't being commited the composer.lock file should also be ignored composer.lock # Ignore PHPUnit coverage file clover.xml # Ignore IDE's configuration files .idea # Ignore PHP CS Fixer local config and cache .php_cs .php_cs.cache .php-cs-fixer.cache # Ignore PHPStan local config .phpstan.neon # Ignore phpDocumentor's local config and artifacts .phpdoc/* phpdoc.xml # Ignore cached PHPUnit results. .phpunit.result.cache stripe-php/.editorconfig 0000666 00000000414 15165746005 0011330 0 ustar 00 ; https://editorconfig.org/ root = true [*] indent_style = space indent_size = 4 insert_final_newline = true trim_trailing_whitespace = true end_of_line = lf charset = utf-8 [*.{json,yml}] indent_size = 2 [*.neon] indent_style = tab [Makefile] indent_style = tab stripe-php/data/ca-certificates.crt 0000666 00000000000 15165746005 0013313 0 ustar 00 stripe-php/phpdoc.dist.xml 0000666 00000001717 15165746005 0011623 0 ustar 00 <?xml version="1.0" encoding="UTF-8" ?> <phpdocumentor configVersion="3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.phpdoc.org" xsi:noNamespaceSchemaLocation="data/xsd/phpdoc.xsd" > <paths> <output>build/phpdoc</output> </paths> <version number="3.0.0"> <folder>latest</folder> <api> <source dsn="."> <path>lib</path> </source> <output>api</output> <ignore hidden="true" symlinks="true"> <path>build/**/*</path> <path>examples/**/*</path> <path>tests/**/*</path> <path>vendor/**/*</path> </ignore> <extensions> <extension>php</extension> </extensions> <default-package-name>stripe-php</default-package-name> </api> </version> <template name="default"/> </phpdocumentor> stripe-php/Makefile 0000666 00000001735 15165746005 0010322 0 ustar 00 export PHPDOCUMENTOR_VERSION := v3.0.0 vendor: composer.json composer install vendor/bin/phpdoc: vendor curl -sfL https://github.com/phpDocumentor/phpDocumentor/releases/download/$(PHPDOCUMENTOR_VERSION)/phpDocumentor.phar -o vendor/bin/phpdoc chmod +x vendor/bin/phpdoc test: vendor vendor/bin/phpunit .PHONY: test fmt: vendor vendor/bin/php-cs-fixer fix -v --using-cache=no . .PHONY: fmt fmtcheck: vendor vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no . .PHONY: fmtcheck phpdoc: vendor/bin/phpdoc vendor/bin/phpdoc phpstan: vendor php -d memory_limit=512M vendor/bin/phpstan analyse lib tests .PHONY: phpstan phpstan-baseline: vendor/bin/phpstan php -d memory_limit=512M vendor/bin/phpstan analyse lib tests --generate-baseline .PHONY: phpstan-baseline update-version: @echo "$(VERSION)" > VERSION @perl -pi -e 's|VERSION = '\''[.\-\w\d]+'\''|VERSION = '\''$(VERSION)'\''|' lib/Stripe.php .PHONY: update-version codegen-format: fmt .PHONY: codegen-format stripe-php/phpstan-baseline.neon 0000666 00000000000 15165746005 0012760 0 ustar 00 stripe-php/phpstan.neon.dist 0000666 00000000302 15165746005 0012147 0 ustar 00 includes: - phpstan-baseline.neon parameters: level: 1 bootstrapFiles: - tests/bootstrap.php ignoreErrors: - '#Unsafe usage of new static\(\).#' reportUnmatchedIgnoredErrors: false
| ver. 1.4 |
Github
|
.
| PHP 5.4.45 | Generation time: 0.03 |
proxy
|
phpinfo
|
Settings