This commit is contained in:
Xes
2025-08-14 22:41:49 +02:00
parent 2de81ccc46
commit 8ce45119b6
39774 changed files with 4309466 additions and 0 deletions

View File

@@ -0,0 +1,105 @@
<?php
namespace Stripe\Service;
/**
* Abstract base class for all services.
*/
abstract class AbstractService
{
/**
* @var \Stripe\StripeClientInterface
*/
protected $client;
/**
* @var \Stripe\StripeStreamingClientInterface
*/
protected $streamingClient;
/**
* Initializes a new instance of the {@link AbstractService} class.
*
* @param \Stripe\StripeClientInterface $client
*/
public function __construct($client)
{
$this->client = $client;
$this->streamingClient = $client;
}
/**
* Gets the client used by this service to send requests.
*
* @return \Stripe\StripeClientInterface
*/
public function getClient()
{
return $this->client;
}
/**
* Gets the client used by this service to send requests.
*
* @return \Stripe\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, static function (&$value, $key) {
if (null === $value) {
$value = '';
}
});
return $params;
}
protected function request($method, $path, $params, $opts)
{
return $this->getClient()->request($method, $path, self::formatParams($params), $opts);
}
protected function requestStream($method, $path, $readBodyChunkCallable, $params, $opts)
{
return $this->getStreamingClient()->requestStream($method, $path, $readBodyChunkCallable, self::formatParams($params), $opts);
}
protected function requestCollection($method, $path, $params, $opts)
{
return $this->getClient()->requestCollection($method, $path, self::formatParams($params), $opts);
}
protected function requestSearchResult($method, $path, $params, $opts)
{
return $this->getClient()->requestSearchResult($method, $path, self::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 \Stripe\Exception\InvalidArgumentException($msg);
}
}
return \sprintf($basePath, ...\array_map('\urlencode', $ids));
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace Stripe\Service;
/**
* Abstract base class for all service factories used to expose service
* instances through {@link \Stripe\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
{
use ServiceNavigatorTrait;
/**
* @param \Stripe\StripeClientInterface $client
*/
public function __construct($client)
{
$this->client = $client;
}
}

View File

@@ -0,0 +1,30 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class AccountLinkService extends 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{account: string, collect?: string, collection_options?: array{fields?: string, future_requirements?: string}, expand?: string[], refresh_url?: string, return_url?: string, type: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\AccountLink
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/account_links', $params, $opts);
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class AccountSessionService extends AbstractService
{
/**
* Creates a AccountSession object that includes a single-use token that the
* platform can use on their front-end to grant client-side API access.
*
* @param null|array{account: string, components: array{account_management?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, external_account_collection?: bool}}, account_onboarding?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, external_account_collection?: bool}}, balances?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, edit_payout_schedule?: bool, external_account_collection?: bool, instant_payouts?: bool, standard_payouts?: bool}}, disputes_list?: array{enabled: bool, features?: array{capture_payments?: bool, destination_on_behalf_of_charge_management?: bool, dispute_management?: bool, refund_management?: bool}}, documents?: array{enabled: bool, features?: array{}}, financial_account?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, external_account_collection?: bool, send_money?: bool, transfer_balance?: bool}}, financial_account_transactions?: array{enabled: bool, features?: array{card_spend_dispute_management?: bool}}, issuing_card?: array{enabled: bool, features?: array{card_management?: bool, card_spend_dispute_management?: bool, cardholder_management?: bool, spend_control_management?: bool}}, issuing_cards_list?: array{enabled: bool, features?: array{card_management?: bool, card_spend_dispute_management?: bool, cardholder_management?: bool, disable_stripe_user_authentication?: bool, spend_control_management?: bool}}, notification_banner?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, external_account_collection?: bool}}, payment_details?: array{enabled: bool, features?: array{capture_payments?: bool, destination_on_behalf_of_charge_management?: bool, dispute_management?: bool, refund_management?: bool}}, payment_disputes?: array{enabled: bool, features?: array{destination_on_behalf_of_charge_management?: bool, dispute_management?: bool, refund_management?: bool}}, payments?: array{enabled: bool, features?: array{capture_payments?: bool, destination_on_behalf_of_charge_management?: bool, dispute_management?: bool, refund_management?: bool}}, payouts?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, edit_payout_schedule?: bool, external_account_collection?: bool, instant_payouts?: bool, standard_payouts?: bool}}, payouts_list?: array{enabled: bool, features?: array{}}, tax_registrations?: array{enabled: bool, features?: array{}}, tax_settings?: array{enabled: bool, features?: array{}}}, expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\AccountSession
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/account_sessions', $params, $opts);
}
}

View File

@@ -0,0 +1,75 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class ApplePayDomainService extends AbstractService
{
/**
* List apple pay domains.
*
* @param null|array{domain_name?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\ApplePayDomain>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{domain_name: string, expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\ApplePayDomain
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\ApplePayDomain
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\ApplePayDomain
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/apple_pay/domains/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,130 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class ApplicationFeeService extends AbstractService
{
/**
* Returns a list of application fees youve previously collected. The application
* fees are returned in sorted order, with the most recent fees appearing first.
*
* @param null|array{charge?: string, created?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\ApplicationFee>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\ApplicationFeeRefund>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 cant 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{amount?: int, expand?: string[], metadata?: array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\ApplicationFeeRefund
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\ApplicationFee
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\ApplicationFeeRefund
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[], metadata?: null|array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\ApplicationFeeRefund
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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);
}
}

View File

@@ -0,0 +1,25 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Apps;
/**
* Service factory class for API resources in the Apps namespace.
*
* @property SecretService $secrets
*/
class AppsServiceFactory extends \Stripe\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;
}
}

View File

@@ -0,0 +1,73 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Apps;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class SecretService extends \Stripe\Service\AbstractService
{
/**
* List all secrets stored on the given scope.
*
* @param null|array{ending_before?: string, expand?: string[], limit?: int, scope: array{type: string, user?: string}, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Apps\Secret>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[], expires_at?: int, name: string, payload: string, scope: array{type: string, user?: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Apps\Secret
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[], name: string, scope: array{type: string, user?: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Apps\Secret
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[], name: string, scope: array{type: string, user?: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Apps\Secret
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function find($params = null, $opts = null)
{
return $this->request('get', '/v1/apps/secrets/find', $params, $opts);
}
}

View File

@@ -0,0 +1,31 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class BalanceService extends 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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Balance
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($params = null, $opts = null)
{
return $this->request('get', '/v1/balance', $params, $opts);
}
}

View File

@@ -0,0 +1,52 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class BalanceTransactionService extends 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{created?: array|int, currency?: string, ending_before?: string, expand?: string[], limit?: int, payout?: string, source?: string, starting_after?: string, type?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\BalanceTransaction>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\BalanceTransaction
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/balance_transactions/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,108 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Billing;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class AlertService extends \Stripe\Service\AbstractService
{
/**
* Reactivates this alert, allowing it to trigger again.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\Alert
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function activate($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/billing/alerts/%s/activate', $id), $params, $opts);
}
/**
* Lists billing active and inactive alerts.
*
* @param null|array{alert_type?: string, ending_before?: string, expand?: string[], limit?: int, meter?: string, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Billing\Alert>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/billing/alerts', $params, $opts);
}
/**
* Archives this alert, removing it from the list view and APIs. This is
* non-reversible.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\Alert
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function archive($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/billing/alerts/%s/archive', $id), $params, $opts);
}
/**
* Creates a billing alert.
*
* @param null|array{alert_type: string, expand?: string[], title: string, usage_threshold?: array{filters?: array{customer?: string, type: string}[], gte: int, meter: string, recurrence: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\Alert
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/billing/alerts', $params, $opts);
}
/**
* Deactivates this alert, preventing it from triggering.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\Alert
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function deactivate($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/billing/alerts/%s/deactivate', $id), $params, $opts);
}
/**
* Retrieves a billing alert given an ID.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\Alert
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/billing/alerts/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,37 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Billing;
/**
* Service factory class for API resources in the Billing namespace.
*
* @property AlertService $alerts
* @property CreditBalanceSummaryService $creditBalanceSummary
* @property CreditBalanceTransactionService $creditBalanceTransactions
* @property CreditGrantService $creditGrants
* @property MeterEventAdjustmentService $meterEventAdjustments
* @property MeterEventService $meterEvents
* @property MeterService $meters
*/
class BillingServiceFactory extends \Stripe\Service\AbstractServiceFactory
{
/**
* @var array<string, string>
*/
private static $classMap = [
'alerts' => AlertService::class,
'creditBalanceSummary' => CreditBalanceSummaryService::class,
'creditBalanceTransactions' => CreditBalanceTransactionService::class,
'creditGrants' => CreditGrantService::class,
'meterEventAdjustments' => MeterEventAdjustmentService::class,
'meterEvents' => MeterEventService::class,
'meters' => MeterService::class,
];
protected function getServiceClass($name)
{
return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
}
}

View File

@@ -0,0 +1,28 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Billing;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class CreditBalanceSummaryService extends \Stripe\Service\AbstractService
{
/**
* Retrieves the credit balance summary for a customer.
*
* @param null|array{customer: string, expand?: string[], filter: array{applicability_scope?: array{price_type?: string, prices?: array{id: string}[]}, credit_grant?: string, type: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\CreditBalanceSummary
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($params = null, $opts = null)
{
return $this->request('get', '/v1/billing/credit_balance_summary', $params, $opts);
}
}

View File

@@ -0,0 +1,44 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Billing;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class CreditBalanceTransactionService extends \Stripe\Service\AbstractService
{
/**
* Retrieve a list of credit balance transactions.
*
* @param null|array{credit_grant?: string, customer: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Billing\CreditBalanceTransaction>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/billing/credit_balance_transactions', $params, $opts);
}
/**
* Retrieves a credit balance transaction.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\CreditBalanceTransaction
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/billing/credit_balance_transactions/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,107 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Billing;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class CreditGrantService extends \Stripe\Service\AbstractService
{
/**
* Retrieve a list of credit grants.
*
* @param null|array{customer?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Billing\CreditGrant>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/billing/credit_grants', $params, $opts);
}
/**
* Creates a credit grant.
*
* @param null|array{amount: array{monetary?: array{currency: string, value: int}, type: string}, applicability_config: array{scope: array{price_type?: string, prices?: array{id: string}[]}}, category: string, customer: string, effective_at?: int, expand?: string[], expires_at?: int, metadata?: array<string, string>, name?: string, priority?: int} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\CreditGrant
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/billing/credit_grants', $params, $opts);
}
/**
* Expires a credit grant.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\CreditGrant
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function expire($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/billing/credit_grants/%s/expire', $id), $params, $opts);
}
/**
* Retrieves a credit grant.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\CreditGrant
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/billing/credit_grants/%s', $id), $params, $opts);
}
/**
* Updates a credit grant.
*
* @param string $id
* @param null|array{expand?: string[], expires_at?: null|int, metadata?: array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\CreditGrant
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/billing/credit_grants/%s', $id), $params, $opts);
}
/**
* Voids a credit grant.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\CreditGrant
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function voidGrant($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/billing/credit_grants/%s/void', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,28 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Billing;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class MeterEventAdjustmentService extends \Stripe\Service\AbstractService
{
/**
* Creates a billing meter event adjustment.
*
* @param null|array{cancel?: array{identifier?: string}, event_name: string, expand?: string[], type: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\MeterEventAdjustment
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/billing/meter_event_adjustments', $params, $opts);
}
}

View File

@@ -0,0 +1,28 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Billing;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class MeterEventService extends \Stripe\Service\AbstractService
{
/**
* Creates a billing meter event.
*
* @param null|array{event_name: string, expand?: string[], identifier?: string, payload: array<string, string>, timestamp?: int} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\MeterEvent
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/billing/meter_events', $params, $opts);
}
}

View File

@@ -0,0 +1,125 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Billing;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class MeterService extends \Stripe\Service\AbstractService
{
/**
* Retrieve a list of billing meters.
*
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string, status?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Billing\Meter>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/billing/meters', $params, $opts);
}
/**
* Retrieve a list of billing meter event summaries.
*
* @param string $parentId
* @param null|array{customer: string, end_time: int, ending_before?: string, expand?: string[], limit?: int, start_time: int, starting_after?: string, value_grouping_window?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Billing\MeterEventSummary>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function allEventSummaries($parentId, $params = null, $opts = null)
{
return $this->requestCollection('get', $this->buildPath('/v1/billing/meters/%s/event_summaries', $parentId), $params, $opts);
}
/**
* Creates a billing meter.
*
* @param null|array{customer_mapping?: array{event_payload_key: string, type: string}, default_aggregation: array{formula: string}, display_name: string, event_name: string, event_time_window?: string, expand?: string[], value_settings?: array{event_payload_key: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\Meter
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/billing/meters', $params, $opts);
}
/**
* When a meter is deactivated, no more meter events will be accepted for this
* meter. You cant attach a deactivated meter to a price.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\Meter
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function deactivate($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/billing/meters/%s/deactivate', $id), $params, $opts);
}
/**
* When a meter is reactivated, events for this meter can be accepted and you can
* attach the meter to a price.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\Meter
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function reactivate($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/billing/meters/%s/reactivate', $id), $params, $opts);
}
/**
* Retrieves a billing meter given an ID.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\Meter
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/billing/meters/%s', $id), $params, $opts);
}
/**
* Updates a billing meter.
*
* @param string $id
* @param null|array{display_name?: string, expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Billing\Meter
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/billing/meters/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,27 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\BillingPortal;
/**
* Service factory class for API resources in the BillingPortal namespace.
*
* @property ConfigurationService $configurations
* @property SessionService $sessions
*/
class BillingPortalServiceFactory extends \Stripe\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;
}
}

View File

@@ -0,0 +1,78 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\BillingPortal;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class ConfigurationService extends \Stripe\Service\AbstractService
{
/**
* Returns a list of configurations that describe the functionality of the customer
* portal.
*
* @param null|array{active?: bool, ending_before?: string, expand?: string[], is_default?: bool, limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\BillingPortal\Configuration>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{business_profile?: array{headline?: null|string, privacy_policy_url?: string, terms_of_service_url?: string}, default_return_url?: null|string, expand?: string[], features: array{customer_update?: array{allowed_updates?: null|string[], enabled: bool}, invoice_history?: array{enabled: bool}, payment_method_update?: array{enabled: bool}, subscription_cancel?: array{cancellation_reason?: array{enabled: bool, options: null|string[]}, enabled: bool, mode?: string, proration_behavior?: string}, subscription_update?: array{default_allowed_updates?: null|string[], enabled: bool, products?: null|array{prices: string[], product: string}[], proration_behavior?: string, schedule_at_period_end?: array{conditions?: array{type: string}[]}}}, login_page?: array{enabled: bool}, metadata?: array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\BillingPortal\Configuration
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\BillingPortal\Configuration
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{active?: bool, business_profile?: array{headline?: null|string, privacy_policy_url?: null|string, terms_of_service_url?: null|string}, default_return_url?: null|string, expand?: string[], features?: array{customer_update?: array{allowed_updates?: null|string[], enabled?: bool}, invoice_history?: array{enabled: bool}, payment_method_update?: array{enabled: bool}, subscription_cancel?: array{cancellation_reason?: array{enabled: bool, options?: null|string[]}, enabled?: bool, mode?: string, proration_behavior?: string}, subscription_update?: array{default_allowed_updates?: null|string[], enabled?: bool, products?: null|array{prices: string[], product: string}[], proration_behavior?: string, schedule_at_period_end?: array{conditions?: null|array{type: string}[]}}}, login_page?: array{enabled: bool}, metadata?: null|array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\BillingPortal\Configuration
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/billing_portal/configurations/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,28 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\BillingPortal;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class SessionService extends \Stripe\Service\AbstractService
{
/**
* Creates a session of the customer portal.
*
* @param null|array{configuration?: string, customer: string, expand?: string[], flow_data?: array{after_completion?: array{hosted_confirmation?: array{custom_message?: string}, redirect?: array{return_url: string}, type: string}, subscription_cancel?: array{retention?: array{coupon_offer: array{coupon: string}, type: string}, subscription: string}, subscription_update?: array{subscription: string}, subscription_update_confirm?: array{discounts?: array{coupon?: string, promotion_code?: string}[], items: array{id: string, price?: string, quantity?: int}[], subscription: string}, type: string}, locale?: string, on_behalf_of?: string, return_url?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\BillingPortal\Session
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/billing_portal/sessions', $params, $opts);
}
}

View File

@@ -0,0 +1,127 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class ChargeService extends AbstractService
{
/**
* Returns a list of charges youve previously created. The charges are returned in
* sorted order, with the most recent charges appearing first.
*
* @param null|array{created?: array|int, customer?: string, ending_before?: string, expand?: string[], limit?: int, payment_intent?: string, starting_after?: string, transfer_group?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Charge>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/charges', $params, $opts);
}
/**
* Capture the payment of an existing, uncaptured charge that was created with the
* <code>capture</code> 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>), after which they are
* marked as refunded and capture attempts will fail.
*
* Dont use this method to capture a PaymentIntent-initiated charge. Use <a
* href="/docs/api/payment_intents/capture">Capture a PaymentIntent</a>.
*
* @param string $id
* @param null|array{amount?: int, application_fee?: int, application_fee_amount?: int, expand?: string[], receipt_email?: string, statement_descriptor?: string, statement_descriptor_suffix?: string, transfer_data?: array{amount?: int}, transfer_group?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Charge
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function capture($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/charges/%s/capture', $id), $params, $opts);
}
/**
* This method is no longer recommended—use the <a
* href="/docs/api/payment_intents">Payment Intents API</a> to initiate a new
* payment instead. Confirmation of the PaymentIntent creates the
* <code>Charge</code> object used to request payment.
*
* @param null|array{amount?: int, application_fee?: int, application_fee_amount?: int, capture?: bool, currency?: string, customer?: string, description?: string, destination?: array{account: string, amount?: int}, expand?: string[], metadata?: null|array<string, string>, on_behalf_of?: string, radar_options?: array{session?: string}, receipt_email?: string, shipping?: array{address: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, carrier?: string, name: string, phone?: string, tracking_number?: string}, source?: string, statement_descriptor?: string, statement_descriptor_suffix?: string, transfer_data?: array{amount?: int, destination: string}, transfer_group?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Charge
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Charge
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/charges/%s', $id), $params, $opts);
}
/**
* Search for charges youve previously created using Stripes <a
* href="/docs/search#search-query-language">Search Query Language</a>. Dont 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{expand?: string[], limit?: int, page?: string, query: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SearchResult<\Stripe\Charge>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{customer?: string, description?: string, expand?: string[], fraud_details?: array{user_report: null|string}, metadata?: null|array<string, string>, receipt_email?: string, shipping?: array{address: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, carrier?: string, name: string, phone?: string, tracking_number?: string}, transfer_group?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Charge
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/charges/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,25 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Checkout;
/**
* Service factory class for API resources in the Checkout namespace.
*
* @property SessionService $sessions
*/
class CheckoutServiceFactory extends \Stripe\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;
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Climate;
/**
* Service factory class for API resources in the Climate namespace.
*
* @property OrderService $orders
* @property ProductService $products
* @property SupplierService $suppliers
*/
class ClimateServiceFactory extends \Stripe\Service\AbstractServiceFactory
{
/**
* @var array<string, string>
*/
private static $classMap = [
'orders' => OrderService::class,
'products' => ProductService::class,
'suppliers' => SupplierService::class,
];
protected function getServiceClass($name)
{
return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
}
}

View File

@@ -0,0 +1,99 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Climate;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class OrderService extends \Stripe\Service\AbstractService
{
/**
* Lists all Climate order objects. The orders are returned sorted by creation
* date, with the most recently created orders appearing first.
*
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Climate\Order>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/climate/orders', $params, $opts);
}
/**
* Cancels a Climate order. You can cancel an order within 24 hours of creation.
* Stripe refunds the reservation <code>amount_subtotal</code>, but not the
* <code>amount_fees</code> for user-triggered cancellations. Frontier might cancel
* reservations if suppliers fail to deliver. If Frontier cancels the reservation,
* Stripe provides 90 days advance notice and refunds the
* <code>amount_total</code>.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Climate\Order
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function cancel($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/climate/orders/%s/cancel', $id), $params, $opts);
}
/**
* Creates a Climate order object for a given Climate product. The order will be
* processed immediately after creation and payment will be deducted your Stripe
* balance.
*
* @param null|array{amount?: int, beneficiary?: array{public_name: string}, currency?: string, expand?: string[], metadata?: array<string, string>, metric_tons?: string, product: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Climate\Order
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/climate/orders', $params, $opts);
}
/**
* Retrieves the details of a Climate order object with the given ID.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Climate\Order
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/climate/orders/%s', $id), $params, $opts);
}
/**
* Updates the specified order by setting the values of the parameters passed.
*
* @param string $id
* @param null|array{beneficiary?: null|array{public_name: null|string}, expand?: string[], metadata?: array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Climate\Order
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/climate/orders/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,44 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Climate;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class ProductService extends \Stripe\Service\AbstractService
{
/**
* Lists all available Climate product objects.
*
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Climate\Product>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/climate/products', $params, $opts);
}
/**
* Retrieves the details of a Climate product with the given ID.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Climate\Product
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/climate/products/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,44 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Climate;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class SupplierService extends \Stripe\Service\AbstractService
{
/**
* Lists all available Climate supplier objects.
*
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Climate\Supplier>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/climate/suppliers', $params, $opts);
}
/**
* Retrieves a Climate supplier object.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Climate\Supplier
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/climate/suppliers/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,29 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class ConfirmationTokenService extends AbstractService
{
/**
* Retrieves an existing ConfirmationToken object.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\ConfirmationToken
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/confirmation_tokens/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,167 @@
<?php
namespace Stripe\Service;
/**
* Service factory class for API resources in the root namespace.
*
* @property OAuthService $oauth
* // Doc: The beginning of the section generated from our OpenAPI spec
* @property AccountLinkService $accountLinks
* @property AccountService $accounts
* @property AccountSessionService $accountSessions
* @property ApplePayDomainService $applePayDomains
* @property ApplicationFeeService $applicationFees
* @property Apps\AppsServiceFactory $apps
* @property BalanceService $balance
* @property BalanceTransactionService $balanceTransactions
* @property Billing\BillingServiceFactory $billing
* @property BillingPortal\BillingPortalServiceFactory $billingPortal
* @property ChargeService $charges
* @property Checkout\CheckoutServiceFactory $checkout
* @property Climate\ClimateServiceFactory $climate
* @property ConfirmationTokenService $confirmationTokens
* @property CountrySpecService $countrySpecs
* @property CouponService $coupons
* @property CreditNoteService $creditNotes
* @property CustomerService $customers
* @property CustomerSessionService $customerSessions
* @property DisputeService $disputes
* @property Entitlements\EntitlementsServiceFactory $entitlements
* @property EphemeralKeyService $ephemeralKeys
* @property EventService $events
* @property ExchangeRateService $exchangeRates
* @property FileLinkService $fileLinks
* @property FileService $files
* @property FinancialConnections\FinancialConnectionsServiceFactory $financialConnections
* @property Forwarding\ForwardingServiceFactory $forwarding
* @property Identity\IdentityServiceFactory $identity
* @property InvoiceItemService $invoiceItems
* @property InvoicePaymentService $invoicePayments
* @property InvoiceRenderingTemplateService $invoiceRenderingTemplates
* @property InvoiceService $invoices
* @property Issuing\IssuingServiceFactory $issuing
* @property MandateService $mandates
* @property PaymentIntentService $paymentIntents
* @property PaymentLinkService $paymentLinks
* @property PaymentMethodConfigurationService $paymentMethodConfigurations
* @property PaymentMethodDomainService $paymentMethodDomains
* @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 SourceService $sources
* @property SubscriptionItemService $subscriptionItems
* @property SubscriptionService $subscriptions
* @property SubscriptionScheduleService $subscriptionSchedules
* @property Tax\TaxServiceFactory $tax
* @property TaxCodeService $taxCodes
* @property TaxIdService $taxIds
* @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 V2\V2ServiceFactory $v2
* @property WebhookEndpointService $webhookEndpoints
* // Doc: The end of the section generated from our OpenAPI spec
*/
class CoreServiceFactory extends AbstractServiceFactory
{
/**
* @var array<string, string>
*/
private static $classMap = [
'oauth' => OAuthService::class,
// Class Map: The beginning of the section generated from our OpenAPI spec
'accountLinks' => AccountLinkService::class,
'accounts' => AccountService::class,
'accountSessions' => AccountSessionService::class,
'applePayDomains' => ApplePayDomainService::class,
'applicationFees' => ApplicationFeeService::class,
'apps' => Apps\AppsServiceFactory::class,
'balance' => BalanceService::class,
'balanceTransactions' => BalanceTransactionService::class,
'billing' => Billing\BillingServiceFactory::class,
'billingPortal' => BillingPortal\BillingPortalServiceFactory::class,
'charges' => ChargeService::class,
'checkout' => Checkout\CheckoutServiceFactory::class,
'climate' => Climate\ClimateServiceFactory::class,
'confirmationTokens' => ConfirmationTokenService::class,
'countrySpecs' => CountrySpecService::class,
'coupons' => CouponService::class,
'creditNotes' => CreditNoteService::class,
'customers' => CustomerService::class,
'customerSessions' => CustomerSessionService::class,
'disputes' => DisputeService::class,
'entitlements' => Entitlements\EntitlementsServiceFactory::class,
'ephemeralKeys' => EphemeralKeyService::class,
'events' => EventService::class,
'exchangeRates' => ExchangeRateService::class,
'fileLinks' => FileLinkService::class,
'files' => FileService::class,
'financialConnections' => FinancialConnections\FinancialConnectionsServiceFactory::class,
'forwarding' => Forwarding\ForwardingServiceFactory::class,
'identity' => Identity\IdentityServiceFactory::class,
'invoiceItems' => InvoiceItemService::class,
'invoicePayments' => InvoicePaymentService::class,
'invoiceRenderingTemplates' => InvoiceRenderingTemplateService::class,
'invoices' => InvoiceService::class,
'issuing' => Issuing\IssuingServiceFactory::class,
'mandates' => MandateService::class,
'paymentIntents' => PaymentIntentService::class,
'paymentLinks' => PaymentLinkService::class,
'paymentMethodConfigurations' => PaymentMethodConfigurationService::class,
'paymentMethodDomains' => PaymentMethodDomainService::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,
'sources' => SourceService::class,
'subscriptionItems' => SubscriptionItemService::class,
'subscriptions' => SubscriptionService::class,
'subscriptionSchedules' => SubscriptionScheduleService::class,
'tax' => Tax\TaxServiceFactory::class,
'taxCodes' => TaxCodeService::class,
'taxIds' => TaxIdService::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,
'v2' => V2\V2ServiceFactory::class,
'webhookEndpoints' => WebhookEndpointService::class,
// Class Map: The end of the section generated from our OpenAPI spec
];
protected function getServiceClass($name)
{
return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
}
}

View File

@@ -0,0 +1,44 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class CountrySpecService extends AbstractService
{
/**
* Lists all Country Spec objects available in the API.
*
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\CountrySpec>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\CountrySpec
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/country_specs/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,109 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class CouponService extends AbstractService
{
/**
* Returns a list of your coupons.
*
* @param null|array{created?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Coupon>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 invoices 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{amount_off?: int, applies_to?: array{products?: string[]}, currency?: string, currency_options?: array<string, array{amount_off: int}>, duration?: string, duration_in_months?: int, expand?: string[], id?: string, max_redemptions?: int, metadata?: null|array<string, string>, name?: string, percent_off?: float, redeem_by?: int} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Coupon
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 cant redeem the
* coupon. You can also delete coupons via the API.
*
* @param string $id
* @param null|array $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Coupon
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Coupon
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{currency_options?: array<string, array{amount_off: int}>, expand?: string[], metadata?: null|array<string, string>, name?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Coupon
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/coupons/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,162 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class CreditNoteService extends AbstractService
{
/**
* Returns a list of credit notes.
*
* @param null|array{created?: array|int, customer?: string, ending_before?: string, expand?: string[], invoice?: string, limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\CreditNote>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/credit_notes', $params, $opts);
}
/**
* When retrieving a credit note, youll get a <strong>lines</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 $parentId
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\CreditNoteLineItem>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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. A credit note
* will first reduce the invoices <code>amount_remaining</code> (and
* <code>amount_due</code>), but not below zero. This amount is indicated by the
* credit notes <code>pre_payment_amount</code>. The excess amount is indicated by
* <code>post_payment_amount</code>, and it can result in any combination of the
* following:
*
* <ul> <li>Refunds: create a new refund (using <code>refund_amount</code>) or link
* existing refunds (using <code>refunds</code>).</li> <li>Customer balance credit:
* credit the customers balance (using <code>credit_amount</code>) which will be
* automatically applied to their next invoice when its 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>
*
* The sum of refunds, customer balance credits, and outside of Stripe credits must
* equal the <code>post_payment_amount</code>.
*
* You may issue multiple credit notes for an invoice. Each credit note may
* increment the invoices <code>pre_payment_credit_notes_amount</code>,
* <code>post_payment_credit_notes_amount</code>, or both, depending on the
* invoices <code>amount_remaining</code> at the time of credit note creation.
*
* @param null|array{amount?: int, credit_amount?: int, effective_at?: int, email_type?: string, expand?: string[], invoice: string, lines?: (array{amount?: int, description?: string, invoice_line_item?: string, quantity?: int, tax_amounts?: null|array{amount: int, tax_rate: string, taxable_amount: int}[], tax_rates?: null|string[], type: string, unit_amount?: int, unit_amount_decimal?: string})[], memo?: string, metadata?: array<string, string>, out_of_band_amount?: int, reason?: string, refund_amount?: int, refunds?: array{amount_refunded?: int, refund?: string}[], shipping_cost?: array{shipping_rate?: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\CreditNote
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{amount?: int, credit_amount?: int, effective_at?: int, email_type?: string, expand?: string[], invoice: string, lines?: (array{amount?: int, description?: string, invoice_line_item?: string, quantity?: int, tax_amounts?: null|array{amount: int, tax_rate: string, taxable_amount: int}[], tax_rates?: null|string[], type: string, unit_amount?: int, unit_amount_decimal?: string})[], memo?: string, metadata?: array<string, string>, out_of_band_amount?: int, reason?: string, refund_amount?: int, refunds?: array{amount_refunded?: int, refund?: string}[], shipping_cost?: array{shipping_rate?: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\CreditNote
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function preview($params = null, $opts = null)
{
return $this->request('get', '/v1/credit_notes/preview', $params, $opts);
}
/**
* When retrieving a credit note preview, youll 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{amount?: int, credit_amount?: int, effective_at?: int, email_type?: string, ending_before?: string, expand?: string[], invoice: string, limit?: int, lines?: (array{amount?: int, description?: string, invoice_line_item?: string, quantity?: int, tax_amounts?: null|array{amount: int, tax_rate: string, taxable_amount: int}[], tax_rates?: null|string[], type: string, unit_amount?: int, unit_amount_decimal?: string})[], memo?: string, metadata?: array<string, string>, out_of_band_amount?: int, reason?: string, refund_amount?: int, refunds?: array{amount_refunded?: int, refund?: string}[], shipping_cost?: array{shipping_rate?: string}, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\CreditNoteLineItem>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\CreditNote
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[], memo?: string, metadata?: array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\CreditNote
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\CreditNote
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function voidCreditNote($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/credit_notes/%s/void', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,503 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class CustomerService extends 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{created?: array|int, email?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, test_clock?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Customer>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/customers', $params, $opts);
}
/**
* Returns a list of transactions that updated the customers <a
* href="/docs/billing/customer/balance">balances</a>.
*
* @param string $parentId
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\CustomerBalanceTransaction>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 customers <a
* href="/docs/payments/customer-balance">cash balance</a>.
*
* @param string $parentId
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\CustomerCashBalanceTransaction>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{allow_redisplay?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, type?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\PaymentMethod>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{ending_before?: string, expand?: string[], limit?: int, object?: string, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Account|\Stripe\BankAccount|\Stripe\Card|\Stripe\Source>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\TaxId>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{address?: null|array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, balance?: int, cash_balance?: array{settings?: array{reconciliation_mode?: string}}, description?: string, email?: string, expand?: string[], invoice_prefix?: string, invoice_settings?: array{custom_fields?: null|array{name: string, value: string}[], default_payment_method?: string, footer?: string, rendering_options?: null|array{amount_tax_display?: null|string, template?: string}}, metadata?: null|array<string, string>, name?: string, next_invoice_sequence?: int, payment_method?: string, phone?: string, preferred_locales?: string[], shipping?: null|array{address: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, name: string, phone?: string}, source?: string, tax?: array{ip_address?: null|string, validate_location?: string}, tax_exempt?: null|string, tax_id_data?: array{type: string, value: string}[], test_clock?: string, validate?: bool} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Customer
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/customers', $params, $opts);
}
/**
* Creates an immutable transaction that updates the customers credit <a
* href="/docs/billing/customer/balance">balance</a>.
*
* @param string $parentId
* @param null|array{amount: int, currency: string, description?: string, expand?: string[], metadata?: null|array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\CustomerBalanceTransaction
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{bank_transfer: array{eu_bank_transfer?: array{country: string}, requested_address_types?: string[], type: string}, currency: string, expand?: string[], funding_type: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\FundingInstructions
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 cards 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{expand?: string[], metadata?: array<string, string>, source: string, validate?: bool} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Account|\Stripe\BankAccount|\Stripe\Card|\Stripe\Source
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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>tax_id</code> object for a customer.
*
* @param string $parentId
* @param null|array{expand?: string[], type: string, value: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\TaxId
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Customer
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Discount
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function deleteDiscount($id, $params = null, $opts = null)
{
return $this->request('delete', $this->buildPath('/v1/customers/%s/discount', $id), $params, $opts);
}
/**
* Delete a specified source for a given customer.
*
* @param string $parentId
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Account|\Stripe\BankAccount|\Stripe\Card|\Stripe\Source
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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>tax_id</code> object.
*
* @param string $parentId
* @param string $id
* @param null|array $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\TaxId
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Customer
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 customers <a
* href="/docs/billing/customer/balance">balances</a>.
*
* @param string $parentId
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\CustomerBalanceTransaction
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 customers cash balance.
*
* @param string $parentId
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\CashBalance
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 customers <a
* href="/docs/payments/customer-balance">cash balance</a>.
*
* @param string $parentId
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\CustomerCashBalanceTransaction
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PaymentMethod
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Account|\Stripe\BankAccount|\Stripe\Card|\Stripe\Source
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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>tax_id</code> object with the given identifier.
*
* @param string $parentId
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\TaxId
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 youve previously created using Stripes <a
* href="/docs/search#search-query-language">Search Query Language</a>. Dont 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{expand?: string[], limit?: int, page?: string, query: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SearchResult<\Stripe\Customer>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 customers 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 customers 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{address?: null|array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, balance?: int, cash_balance?: array{settings?: array{reconciliation_mode?: string}}, default_source?: string, description?: string, email?: string, expand?: string[], invoice_prefix?: string, invoice_settings?: array{custom_fields?: null|array{name: string, value: string}[], default_payment_method?: string, footer?: string, rendering_options?: null|array{amount_tax_display?: null|string, template?: string}}, metadata?: null|array<string, string>, name?: string, next_invoice_sequence?: int, phone?: string, preferred_locales?: string[], shipping?: null|array{address: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, name: string, phone?: string}, source?: string, tax?: array{ip_address?: null|string, validate_location?: string}, tax_exempt?: null|string, validate?: bool} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Customer
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{description?: string, expand?: string[], metadata?: null|array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\CustomerBalanceTransaction
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 customers cash balance.
*
* @param string $parentId
* @param null|array{expand?: string[], settings?: array{reconciliation_mode?: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\CashBalance
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function updateCashBalance($parentId, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/customers/%s/cash_balance', $parentId), $params, $opts);
}
/**
* Update a specified source for a given customer.
*
* @param string $parentId
* @param string $id
* @param null|array{account_holder_name?: string, account_holder_type?: string, address_city?: string, address_country?: string, address_line1?: string, address_line2?: string, address_state?: string, address_zip?: string, exp_month?: string, exp_year?: string, expand?: string[], metadata?: null|array<string, string>, name?: string, owner?: array{address?: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, email?: string, name?: string, phone?: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Account|\Stripe\BankAccount|\Stripe\Card|\Stripe\Source
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function updateSource($parentId, $id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts);
}
/**
* Verify a specified bank account for a given customer.
*
* @param string $parentId
* @param string $id
* @param null|array{amounts?: int[], expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Account|\Stripe\BankAccount|\Stripe\Card|\Stripe\Source
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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);
}
}

View File

@@ -0,0 +1,30 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class CustomerSessionService extends AbstractService
{
/**
* Creates a Customer Session object that includes a single-use client secret that
* you can use on your front-end to grant client-side API access for certain
* customer resources.
*
* @param null|array{components: array{buy_button?: array{enabled: bool}, payment_element?: array{enabled: bool, features?: array{payment_method_allow_redisplay_filters?: string[], payment_method_redisplay?: string, payment_method_redisplay_limit?: int, payment_method_remove?: string, payment_method_save?: string, payment_method_save_usage?: string}}, pricing_table?: array{enabled: bool}}, customer: string, expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\CustomerSession
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/customer_sessions', $params, $opts);
}
}

View File

@@ -0,0 +1,88 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class DisputeService extends AbstractService
{
/**
* Returns a list of your disputes.
*
* @param null|array{charge?: string, created?: array|int, ending_before?: string, expand?: string[], limit?: int, payment_intent?: string, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Dispute>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Dispute
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Dispute
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 doesnt 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{evidence?: array{access_activity_log?: string, billing_address?: string, cancellation_policy?: string, cancellation_policy_disclosure?: string, cancellation_rebuttal?: string, customer_communication?: string, customer_email_address?: string, customer_name?: string, customer_purchase_ip?: string, customer_signature?: string, duplicate_charge_documentation?: string, duplicate_charge_explanation?: string, duplicate_charge_id?: string, enhanced_evidence?: null|array{visa_compelling_evidence_3?: array{disputed_transaction?: array{customer_account_id?: null|string, customer_device_fingerprint?: null|string, customer_device_id?: null|string, customer_email_address?: null|string, customer_purchase_ip?: null|string, merchandise_or_services?: string, product_description?: null|string, shipping_address?: array{city?: null|string, country?: null|string, line1?: null|string, line2?: null|string, postal_code?: null|string, state?: null|string}}, prior_undisputed_transactions?: (array{charge: string, customer_account_id?: null|string, customer_device_fingerprint?: null|string, customer_device_id?: null|string, customer_email_address?: null|string, customer_purchase_ip?: null|string, product_description?: null|string, shipping_address?: array{city?: null|string, country?: null|string, line1?: null|string, line2?: null|string, postal_code?: null|string, state?: null|string}})[]}, visa_compliance?: array{fee_acknowledged?: bool}}, product_description?: string, receipt?: string, refund_policy?: string, refund_policy_disclosure?: string, refund_refusal_explanation?: string, service_date?: string, service_documentation?: string, shipping_address?: string, shipping_carrier?: string, shipping_date?: string, shipping_documentation?: string, shipping_tracking_number?: string, uncategorized_file?: string, uncategorized_text?: string}, expand?: string[], metadata?: null|array<string, string>, submit?: bool} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Dispute
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/disputes/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,44 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Entitlements;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class ActiveEntitlementService extends \Stripe\Service\AbstractService
{
/**
* Retrieve a list of active entitlements for a customer.
*
* @param null|array{customer: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Entitlements\ActiveEntitlement>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/entitlements/active_entitlements', $params, $opts);
}
/**
* Retrieve an active entitlement.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Entitlements\ActiveEntitlement
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/entitlements/active_entitlements/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,27 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Entitlements;
/**
* Service factory class for API resources in the Entitlements namespace.
*
* @property ActiveEntitlementService $activeEntitlements
* @property FeatureService $features
*/
class EntitlementsServiceFactory extends \Stripe\Service\AbstractServiceFactory
{
/**
* @var array<string, string>
*/
private static $classMap = [
'activeEntitlements' => ActiveEntitlementService::class,
'features' => FeatureService::class,
];
protected function getServiceClass($name)
{
return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
}
}

View File

@@ -0,0 +1,75 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Entitlements;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class FeatureService extends \Stripe\Service\AbstractService
{
/**
* Retrieve a list of features.
*
* @param null|array{archived?: bool, ending_before?: string, expand?: string[], limit?: int, lookup_key?: string, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Entitlements\Feature>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/entitlements/features', $params, $opts);
}
/**
* Creates a feature.
*
* @param null|array{expand?: string[], lookup_key: string, metadata?: array<string, string>, name: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Entitlements\Feature
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/entitlements/features', $params, $opts);
}
/**
* Retrieves a feature.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Entitlements\Feature
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/entitlements/features/%s', $id), $params, $opts);
}
/**
* Update a features metadata or permanently deactivate it.
*
* @param string $id
* @param null|array{active?: bool, expand?: string[], metadata?: null|array<string, string>, name?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Entitlements\Feature
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/entitlements/features/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,48 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class EphemeralKeyService extends AbstractService
{
/**
* Invalidates a short-lived API key for a given resource.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\EphemeralKey
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\EphemeralKey
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
if (!$opts || !isset($opts['stripe_version'])) {
throw new \Stripe\Exception\InvalidArgumentException('stripe_version must be specified to create an ephemeral key');
}
return $this->request('post', '/v1/ephemeral_keys', $params, $opts);
}
}

View File

@@ -0,0 +1,49 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class EventService extends 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="https://docs.stripe.com/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{created?: array|int, delivery_success?: bool, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, type?: string, types?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Event>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/events', $params, $opts);
}
/**
* Retrieves the details of an event if it was created in the last 30 days. Supply
* the unique identifier of the event, which you might have received in a webhook.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Event
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/events/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,46 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class ExchangeRateService extends 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{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\ExchangeRate>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\ExchangeRate
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/exchange_rates/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,75 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class FileLinkService extends AbstractService
{
/**
* Returns a list of file links.
*
* @param null|array{created?: array|int, ending_before?: string, expand?: string[], expired?: bool, file?: string, limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\FileLink>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[], expires_at?: int, file: string, metadata?: null|array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\FileLink
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\FileLink
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[], expires_at?: null|array|int|string, metadata?: null|array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\FileLink
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/file_links/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,70 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class FileService extends AbstractService
{
/**
* Returns a list of the files that your account has access to. Stripe sorts and
* returns the files by their creation dates, placing the most recently created
* files at the top.
*
* @param null|array{created?: array|int, ending_before?: string, expand?: string[], limit?: int, purpose?: string, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\File>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/files', $params, $opts);
}
/**
* Retrieves the details of an existing file object. After you supply a unique file
* ID, Stripe returns the corresponding file object. Learn how to <a
* href="/docs/file-upload#download-file-contents">access file contents</a>.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\File
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\File
*/
public function create($params = null, $opts = null)
{
$opts = \Stripe\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(\Stripe\Util\Util::flattenParams($params), 1, 0);
return $this->request('post', '/v1/files', $flatParams, $opts);
}
}

View File

@@ -0,0 +1,128 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\FinancialConnections;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class AccountService extends \Stripe\Service\AbstractService
{
/**
* Returns a list of Financial Connections <code>Account</code> objects.
*
* @param null|array{account_holder?: array{account?: string, customer?: string}, ending_before?: string, expand?: string[], limit?: int, session?: string, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\FinancialConnections\Account>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{ending_before?: string, expand?: string[], limit?: int, ownership: string, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\FinancialConnections\AccountOwner>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\FinancialConnections\Account
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[], features: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\FinancialConnections\Account
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\FinancialConnections\Account
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/financial_connections/accounts/%s', $id), $params, $opts);
}
/**
* Subscribes to periodic refreshes of data associated with a Financial Connections
* <code>Account</code>.
*
* @param string $id
* @param null|array{expand?: string[], features: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\FinancialConnections\Account
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function subscribe($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/financial_connections/accounts/%s/subscribe', $id), $params, $opts);
}
/**
* Unsubscribes from periodic refreshes of data associated with a Financial
* Connections <code>Account</code>.
*
* @param string $id
* @param null|array{expand?: string[], features: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\FinancialConnections\Account
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function unsubscribe($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/financial_connections/accounts/%s/unsubscribe', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,29 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\FinancialConnections;
/**
* Service factory class for API resources in the FinancialConnections namespace.
*
* @property AccountService $accounts
* @property SessionService $sessions
* @property TransactionService $transactions
*/
class FinancialConnectionsServiceFactory extends \Stripe\Service\AbstractServiceFactory
{
/**
* @var array<string, string>
*/
private static $classMap = [
'accounts' => AccountService::class,
'sessions' => SessionService::class,
'transactions' => TransactionService::class,
];
protected function getServiceClass($name)
{
return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
}
}

View File

@@ -0,0 +1,46 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\FinancialConnections;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class SessionService extends \Stripe\Service\AbstractService
{
/**
* To launch the Financial Connections authorization flow, create a
* <code>Session</code>. The sessions <code>client_secret</code> can be used to
* launch the flow using Stripe.js.
*
* @param null|array{account_holder: array{account?: string, customer?: string, type: string}, expand?: string[], filters?: array{account_subcategories?: string[], countries?: string[]}, permissions: string[], prefetch?: string[], return_url?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\FinancialConnections\Session
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\FinancialConnections\Session
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/financial_connections/sessions/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,44 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\FinancialConnections;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class TransactionService extends \Stripe\Service\AbstractService
{
/**
* Returns a list of Financial Connections <code>Transaction</code> objects.
*
* @param null|array{account: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, transacted_at?: array|int, transaction_refresh?: array{after: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\FinancialConnections\Transaction>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/financial_connections/transactions', $params, $opts);
}
/**
* Retrieves the details of a Financial Connections <code>Transaction</code>.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\FinancialConnections\Transaction
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/financial_connections/transactions/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,25 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Forwarding;
/**
* Service factory class for API resources in the Forwarding namespace.
*
* @property RequestService $requests
*/
class ForwardingServiceFactory extends \Stripe\Service\AbstractServiceFactory
{
/**
* @var array<string, string>
*/
private static $classMap = [
'requests' => RequestService::class,
];
protected function getServiceClass($name)
{
return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
}
}

View File

@@ -0,0 +1,59 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Forwarding;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class RequestService extends \Stripe\Service\AbstractService
{
/**
* Lists all ForwardingRequest objects.
*
* @param null|array{created?: array{gt?: int, gte?: int, lt?: int, lte?: int}, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Forwarding\Request>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/forwarding/requests', $params, $opts);
}
/**
* Creates a ForwardingRequest object.
*
* @param null|array{expand?: string[], metadata?: array<string, string>, payment_method: string, replacements: string[], request: array{body?: string, headers?: array{name: string, value: string}[]}, url: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Forwarding\Request
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/forwarding/requests', $params, $opts);
}
/**
* Retrieves a ForwardingRequest object.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Forwarding\Request
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/forwarding/requests/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,27 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Identity;
/**
* Service factory class for API resources in the Identity namespace.
*
* @property VerificationReportService $verificationReports
* @property VerificationSessionService $verificationSessions
*/
class IdentityServiceFactory extends \Stripe\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;
}
}

View File

@@ -0,0 +1,44 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Identity;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class VerificationReportService extends \Stripe\Service\AbstractService
{
/**
* List all verification reports.
*
* @param null|array{client_reference_id?: string, created?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, type?: string, verification_session?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Identity\VerificationReport>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Identity\VerificationReport
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/identity/verification_reports/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,151 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Identity;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class VerificationSessionService extends \Stripe\Service\AbstractService
{
/**
* Returns a list of VerificationSessions.
*
* @param null|array{client_reference_id?: string, created?: array|int, ending_before?: string, expand?: string[], limit?: int, related_customer?: string, starting_after?: string, status?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Identity\VerificationSession>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Identity\VerificationSession
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 sessions
* <code>url</code>.
*
* If your API key is in test mode, verification checks wont 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{client_reference_id?: string, expand?: string[], metadata?: array<string, string>, options?: array{document?: null|array{allowed_types?: string[], require_id_number?: bool, require_live_capture?: bool, require_matching_selfie?: bool}}, provided_details?: array{email?: string, phone?: string}, related_customer?: string, return_url?: string, type?: string, verification_flow?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Identity\VerificationSession
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 VerificationSessions <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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Identity\VerificationSession
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Identity\VerificationSession
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[], metadata?: array<string, string>, options?: array{document?: null|array{allowed_types?: string[], require_id_number?: bool, require_live_capture?: bool, require_matching_selfie?: bool}}, provided_details?: array{email?: string, phone?: string}, type?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Identity\VerificationSession
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/identity/verification_sessions/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,98 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class InvoiceItemService extends 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{created?: array|int, customer?: string, ending_before?: string, expand?: string[], invoice?: string, limit?: int, pending?: bool, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\InvoiceItem>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{amount?: int, currency?: string, customer: string, description?: string, discountable?: bool, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], expand?: string[], invoice?: string, metadata?: null|array<string, string>, period?: array{end: int, start: int}, price_data?: array{currency: string, product: string, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, pricing?: array{price?: string}, quantity?: int, subscription?: string, tax_behavior?: string, tax_code?: null|string, tax_rates?: string[], unit_amount_decimal?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\InvoiceItem
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 theyre not attached to invoices, or if its attached to a
* draft invoice.
*
* @param string $id
* @param null|array $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\InvoiceItem
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\InvoiceItem
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 its attached to is
* closed.
*
* @param string $id
* @param null|array{amount?: int, description?: string, discountable?: bool, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], expand?: string[], metadata?: null|array<string, string>, period?: array{end: int, start: int}, price_data?: array{currency: string, product: string, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, pricing?: array{price?: string}, quantity?: int, tax_behavior?: string, tax_code?: null|string, tax_rates?: null|string[], unit_amount_decimal?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\InvoiceItem
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/invoiceitems/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,46 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class InvoicePaymentService extends AbstractService
{
/**
* When retrieving an invoice, there is an includable payments property containing
* the first handful of those items. There is also a URL where you can retrieve the
* full (paginated) list of payments.
*
* @param null|array{ending_before?: string, expand?: string[], invoice?: string, limit?: int, payment?: array{payment_intent?: string, type: string}, starting_after?: string, status?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\InvoicePayment>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/invoice_payments', $params, $opts);
}
/**
* Retrieves the invoice payment with the given ID.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\InvoicePayment
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/invoice_payments/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,83 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class InvoiceRenderingTemplateService extends AbstractService
{
/**
* List all templates, ordered by creation date, with the most recently created
* template appearing first.
*
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string, status?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\InvoiceRenderingTemplate>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/invoice_rendering_templates', $params, $opts);
}
/**
* Updates the status of an invoice rendering template to archived so no new
* Stripe objects (customers, invoices, etc.) can reference it. The template can
* also no longer be updated. However, if the template is already set on a Stripe
* object, it will continue to be applied on invoices generated by it.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\InvoiceRenderingTemplate
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function archive($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/invoice_rendering_templates/%s/archive', $id), $params, $opts);
}
/**
* Retrieves an invoice rendering template with the given ID. It by default returns
* the latest version of the template. Optionally, specify a version to see
* previous versions.
*
* @param string $id
* @param null|array{expand?: string[], version?: int} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\InvoiceRenderingTemplate
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/invoice_rendering_templates/%s', $id), $params, $opts);
}
/**
* Unarchive an invoice rendering template so it can be used on new Stripe objects
* again.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\InvoiceRenderingTemplate
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function unarchive($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/invoice_rendering_templates/%s/unarchive', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,390 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class InvoiceService extends AbstractService
{
/**
* Adds multiple line items to an invoice. This is only possible when an invoice is
* still a draft.
*
* @param string $id
* @param null|array{expand?: string[], invoice_metadata?: null|array<string, string>, lines: (array{amount?: int, description?: string, discountable?: bool, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], invoice_item?: string, metadata?: null|array<string, string>, period?: array{end: int, start: int}, price_data?: array{currency: string, product?: string, product_data?: array{description?: string, images?: string[], metadata?: array<string, string>, name: string, tax_code?: string}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, pricing?: array{price?: string}, quantity?: int, tax_amounts?: null|array{amount: int, tax_rate_data: array{country?: string, description?: string, display_name: string, inclusive: bool, jurisdiction?: string, jurisdiction_level?: string, percentage: float, state?: string, tax_type?: string}, taxability_reason?: string, taxable_amount: int}[], tax_rates?: null|string[]})[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function addLines($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/invoices/%s/add_lines', $id), $params, $opts);
}
/**
* 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{collection_method?: string, created?: array|int, customer?: string, due_date?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, status?: string, subscription?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Invoice>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/invoices', $params, $opts);
}
/**
* When retrieving an invoice, youll 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{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\InvoiceLineItem>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function allLines($parentId, $params = null, $opts = null)
{
return $this->requestCollection('get', $this->buildPath('/v1/invoices/%s/lines', $parentId), $params, $opts);
}
/**
* Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to
* the list of <code>payments</code>.
*
* For the PaymentIntent, when the PaymentIntents status changes to
* <code>succeeded</code>, the payment is credited to the invoice, increasing its
* <code>amount_paid</code>. When the invoice is fully paid, the invoices status
* becomes <code>paid</code>.
*
* If the PaymentIntents status is already <code>succeeded</code> when its
* attached, its credited to the invoice immediately.
*
* See: <a href="/docs/invoicing/partial-payments">Partial payments</a> to learn
* more.
*
* @param string $id
* @param null|array{expand?: string[], payment_intent?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function attachPayment($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/invoices/%s/attach_payment', $id), $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{account_tax_ids?: null|string[], application_fee_amount?: int, auto_advance?: bool, automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, automatically_finalizes_at?: int, collection_method?: string, currency?: string, custom_fields?: null|array{name: string, value: string}[], customer?: string, days_until_due?: int, default_payment_method?: string, default_source?: string, default_tax_rates?: string[], description?: string, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], due_date?: int, effective_at?: int, expand?: string[], footer?: string, from_invoice?: array{action: string, invoice: string}, issuer?: array{account?: string, type: string}, metadata?: null|array<string, string>, number?: string, on_behalf_of?: string, payment_settings?: array{default_mandate?: null|string, payment_method_options?: array{acss_debit?: null|array{mandate_options?: array{transaction_type?: string}, verification_method?: string}, bancontact?: null|array{preferred_language?: string}, card?: null|array{installments?: array{enabled?: bool, plan?: null|array{count?: int, interval?: string, type: string}}, request_three_d_secure?: string}, customer_balance?: null|array{bank_transfer?: array{eu_bank_transfer?: array{country: string}, type?: string}, funding_type?: string}, konbini?: null|array{}, sepa_debit?: null|array{}, us_bank_account?: null|array{financial_connections?: array{filters?: array{account_subcategories?: string[]}, permissions?: string[], prefetch?: string[]}, verification_method?: string}}, payment_method_types?: null|string[]}, pending_invoice_items_behavior?: string, rendering?: array{amount_tax_display?: null|string, pdf?: array{page_size?: string}, template?: string, template_version?: null|int}, shipping_cost?: array{shipping_rate?: string, shipping_rate_data?: array{delivery_estimate?: array{maximum?: array{unit: string, value: int}, minimum?: array{unit: string, value: int}}, display_name: string, fixed_amount?: array{amount: int, currency: string, currency_options?: array<string, array{amount: int, tax_behavior?: string}>}, metadata?: array<string, string>, tax_behavior?: string, tax_code?: string, type?: string}}, shipping_details?: array{address: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, name: string, phone?: null|string}, statement_descriptor?: string, subscription?: string, transfer_data?: array{amount?: int, destination: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/invoices', $params, $opts);
}
/**
* At any time, you can preview the upcoming invoice for a subscription or
* subscription schedule. 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.
*
* You can also preview the effects of creating or updating a subscription or
* subscription schedule, including a preview of any prorations that will take
* place. To ensure that the actual proration is calculated exactly the same as the
* previewed proration, you should pass the
* <code>subscription_details.proration_date</code> parameter when doing the actual
* subscription update.
*
* The recommended way to get only the prorations being previewed on the invoice is
* to consider line items where
* <code>parent.subscription_item_details.proration</code> is <code>true</code>.
*
* 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
* customers discount.
*
* Note: Currency conversion calculations use the latest exchange rates. Exchange
* rates may vary between the time of the preview and the time of the actual
* invoice creation. <a href="https://docs.stripe.com/currencies/conversions">Learn
* more</a>
*
* @param null|array{automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, currency?: string, customer?: string, customer_details?: array{address?: null|array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, shipping?: null|array{address: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, name: string, phone?: string}, tax?: array{ip_address?: null|string}, tax_exempt?: null|string, tax_ids?: array{type: string, value: string}[]}, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], expand?: string[], invoice_items?: (array{amount?: int, currency?: string, description?: string, discountable?: bool, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], invoiceitem?: string, metadata?: null|array<string, string>, period?: array{end: int, start: int}, price?: string, price_data?: array{currency: string, product: string, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_behavior?: string, tax_code?: null|string, tax_rates?: null|string[], unit_amount?: int, unit_amount_decimal?: string})[], issuer?: array{account?: string, type: string}, on_behalf_of?: null|string, preview_mode?: string, schedule?: string, schedule_details?: array{end_behavior?: string, phases?: (array{add_invoice_items?: (array{discounts?: array{coupon?: string, discount?: string, promotion_code?: string}[], price?: string, price_data?: array{currency: string, product: string, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_rates?: null|string[]})[], application_fee_percent?: float, automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, billing_cycle_anchor?: string, billing_thresholds?: null|array{amount_gte?: int, reset_billing_cycle_anchor?: bool}, collection_method?: string, currency?: string, default_payment_method?: string, default_tax_rates?: null|string[], description?: null|string, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], end_date?: array|int|string, invoice_settings?: array{account_tax_ids?: null|string[], days_until_due?: int, issuer?: array{account?: string, type: string}}, items: (array{billing_thresholds?: null|array{usage_gte: int}, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], metadata?: array<string, string>, plan?: string, price?: string, price_data?: array{currency: string, product: string, recurring: array{interval: string, interval_count?: int}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_rates?: null|string[]})[], iterations?: int, metadata?: array<string, string>, on_behalf_of?: string, proration_behavior?: string, start_date?: array|int|string, transfer_data?: array{amount_percent?: float, destination: string}, trial?: bool, trial_end?: array|int|string})[], proration_behavior?: string}, subscription?: string, subscription_details?: array{billing_cycle_anchor?: array|int|string, cancel_at?: null|int, cancel_at_period_end?: bool, cancel_now?: bool, default_tax_rates?: null|string[], items?: (array{billing_thresholds?: null|array{usage_gte: int}, clear_usage?: bool, deleted?: bool, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], id?: string, metadata?: null|array<string, string>, plan?: string, price?: string, price_data?: array{currency: string, product: string, recurring: array{interval: string, interval_count?: int}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_rates?: null|string[]})[], proration_behavior?: string, proration_date?: int, resume_at?: string, start_date?: int, trial_end?: array|int|string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function createPreview($params = null, $opts = null)
{
return $this->request('post', '/v1/invoices/create_preview', $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|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 youd like to finalize a draft invoice manually, you can
* do so using this method.
*
* @param string $id
* @param null|array{auto_advance?: bool, expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 youd 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{expand?: string[], forgive?: bool, mandate?: null|string, off_session?: bool, paid_out_of_band?: bool, payment_method?: string, source?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function pay($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/invoices/%s/pay', $id), $params, $opts);
}
/**
* Removes multiple line items from an invoice. This is only possible when an
* invoice is still a draft.
*
* @param string $id
* @param null|array{expand?: string[], invoice_metadata?: null|array<string, string>, lines: array{behavior: string, id: string}[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function removeLines($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/invoices/%s/remove_lines', $id), $params, $opts);
}
/**
* Retrieves the invoice with the given ID.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/invoices/%s', $id), $params, $opts);
}
/**
* Search for invoices youve previously created using Stripes <a
* href="/docs/search#search-query-language">Search Query Language</a>. Dont 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{expand?: string[], limit?: int, page?: string, query: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SearchResult<\Stripe\Invoice>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 youd 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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function sendInvoice($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/invoices/%s/send', $id), $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{account_tax_ids?: null|string[], application_fee_amount?: int, auto_advance?: bool, automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, automatically_finalizes_at?: int, collection_method?: string, custom_fields?: null|array{name: string, value: string}[], days_until_due?: int, default_payment_method?: string, default_source?: null|string, default_tax_rates?: null|string[], description?: string, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], due_date?: int, effective_at?: null|int, expand?: string[], footer?: string, issuer?: array{account?: string, type: string}, metadata?: null|array<string, string>, number?: null|string, on_behalf_of?: null|string, payment_settings?: array{default_mandate?: null|string, payment_method_options?: array{acss_debit?: null|array{mandate_options?: array{transaction_type?: string}, verification_method?: string}, bancontact?: null|array{preferred_language?: string}, card?: null|array{installments?: array{enabled?: bool, plan?: null|array{count?: int, interval?: string, type: string}}, request_three_d_secure?: string}, customer_balance?: null|array{bank_transfer?: array{eu_bank_transfer?: array{country: string}, type?: string}, funding_type?: string}, konbini?: null|array{}, sepa_debit?: null|array{}, us_bank_account?: null|array{financial_connections?: array{filters?: array{account_subcategories?: string[]}, permissions?: string[], prefetch?: string[]}, verification_method?: string}}, payment_method_types?: null|string[]}, rendering?: array{amount_tax_display?: null|string, pdf?: array{page_size?: string}, template?: string, template_version?: null|int}, shipping_cost?: null|array{shipping_rate?: string, shipping_rate_data?: array{delivery_estimate?: array{maximum?: array{unit: string, value: int}, minimum?: array{unit: string, value: int}}, display_name: string, fixed_amount?: array{amount: int, currency: string, currency_options?: array<string, array{amount: int, tax_behavior?: string}>}, metadata?: array<string, string>, tax_behavior?: string, tax_code?: string, type?: string}}, shipping_details?: null|array{address: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, name: string, phone?: null|string}, statement_descriptor?: string, transfer_data?: null|array{amount?: int, destination: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/invoices/%s', $id), $params, $opts);
}
/**
* Updates an invoices line item. Some fields, such as <code>tax_amounts</code>,
* only live on the invoice line item, so they can only be updated through this
* endpoint. Other fields, such as <code>amount</code>, live on both the invoice
* item and the invoice line item, so updates on this endpoint will propagate to
* the invoice item as well. Updating an invoices line item is only possible
* before the invoice is finalized.
*
* @param string $parentId
* @param string $id
* @param null|array{amount?: int, description?: string, discountable?: bool, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], expand?: string[], metadata?: null|array<string, string>, period?: array{end: int, start: int}, price_data?: array{currency: string, product?: string, product_data?: array{description?: string, images?: string[], metadata?: array<string, string>, name: string, tax_code?: string}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, pricing?: array{price?: string}, quantity?: int, tax_amounts?: null|array{amount: int, tax_rate_data: array{country?: string, description?: string, display_name: string, inclusive: bool, jurisdiction?: string, jurisdiction_level?: string, percentage: float, state?: string, tax_type?: string}, taxability_reason?: string, taxable_amount: int}[], tax_rates?: null|string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\InvoiceLineItem
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function updateLine($parentId, $id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/invoices/%s/lines/%s', $parentId, $id), $params, $opts);
}
/**
* Updates multiple line items on an invoice. This is only possible when an invoice
* is still a draft.
*
* @param string $id
* @param null|array{expand?: string[], invoice_metadata?: null|array<string, string>, lines: (array{amount?: int, description?: string, discountable?: bool, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], id: string, metadata?: null|array<string, string>, period?: array{end: int, start: int}, price_data?: array{currency: string, product?: string, product_data?: array{description?: string, images?: string[], metadata?: array<string, string>, name: string, tax_code?: string}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, pricing?: array{price?: string}, quantity?: int, tax_amounts?: null|array{amount: int, tax_rate_data: array{country?: string, description?: string, display_name: string, inclusive: bool, jurisdiction?: string, jurisdiction_level?: string, percentage: float, state?: string, tax_type?: string}, taxability_reason?: string, taxable_amount: int}[], tax_rates?: null|string[]})[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function updateLines($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/invoices/%s/update_lines', $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.
*
* Consult with local regulations to determine whether and how an invoice might be
* amended, canceled, or voided in the jurisdiction youre doing business in. You
* might need to <a href="#create_invoice">issue another invoice</a> or <a
* href="#create_credit_note">credit note</a> instead. Stripe recommends that you
* consult with your legal counsel for advice specific to your business.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function voidInvoice($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/invoices/%s/void', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,110 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Issuing;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class AuthorizationService extends \Stripe\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{card?: string, cardholder?: string, created?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, status?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Issuing\Authorization>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/issuing/authorizations', $params, $opts);
}
/**
* [Deprecated] 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. This method is deprecated. Instead, <a
* href="/docs/issuing/controls/real-time-authorizations#authorization-handling">respond
* directly to the webhook request to approve an authorization</a>.
*
* @deprecated this method is deprecated, please refer to the description for details
*
* @param string $id
* @param null|array{amount?: int, expand?: string[], metadata?: null|array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Authorization
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function approve($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/issuing/authorizations/%s/approve', $id), $params, $opts);
}
/**
* [Deprecated] 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. This method is deprecated. Instead, <a
* href="/docs/issuing/controls/real-time-authorizations#authorization-handling">respond
* directly to the webhook request to decline an authorization</a>.
*
* @deprecated this method is deprecated, please refer to the description for details
*
* @param string $id
* @param null|array{expand?: string[], metadata?: null|array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Authorization
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Authorization
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[], metadata?: null|array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Authorization
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/issuing/authorizations/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,78 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Issuing;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class CardService extends \Stripe\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{cardholder?: string, created?: array|int, ending_before?: string, exp_month?: int, exp_year?: int, expand?: string[], last4?: string, limit?: int, personalization_design?: string, starting_after?: string, status?: string, type?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Issuing\Card>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{cardholder?: string, currency: string, expand?: string[], financial_account?: string, metadata?: array<string, string>, personalization_design?: string, pin?: array{encrypted_number?: string}, replacement_for?: string, replacement_reason?: string, second_line?: null|string, shipping?: array{address: array{city: string, country: string, line1: string, line2?: string, postal_code: string, state?: string}, address_validation?: array{mode: string}, customs?: array{eori_number?: string}, name: string, phone_number?: string, require_signature?: bool, service?: string, type?: string}, spending_controls?: array{allowed_categories?: string[], allowed_merchant_countries?: string[], blocked_categories?: string[], blocked_merchant_countries?: string[], spending_limits?: array{amount: int, categories?: string[], interval: string}[]}, status?: string, type: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Card
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Card
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{cancellation_reason?: string, expand?: string[], metadata?: null|array<string, string>, personalization_design?: string, pin?: array{encrypted_number?: string}, shipping?: array{address: array{city: string, country: string, line1: string, line2?: string, postal_code: string, state?: string}, address_validation?: array{mode: string}, customs?: array{eori_number?: string}, name: string, phone_number?: string, require_signature?: bool, service?: string, type?: string}, spending_controls?: array{allowed_categories?: string[], allowed_merchant_countries?: string[], blocked_categories?: string[], blocked_merchant_countries?: string[], spending_limits?: array{amount: int, categories?: string[], interval: string}[]}, status?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Card
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/issuing/cards/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,79 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Issuing;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class CardholderService extends \Stripe\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{created?: array|int, email?: string, ending_before?: string, expand?: string[], limit?: int, phone_number?: string, starting_after?: string, status?: string, type?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Issuing\Cardholder>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{billing: array{address: array{city: string, country: string, line1: string, line2?: string, postal_code: string, state?: string}}, company?: array{tax_id?: string}, email?: string, expand?: string[], individual?: array{card_issuing?: array{user_terms_acceptance?: array{date?: int, ip?: string, user_agent?: null|string}}, dob?: array{day: int, month: int, year: int}, first_name?: string, last_name?: string, verification?: array{document?: array{back?: string, front?: string}}}, metadata?: array<string, string>, name: string, phone_number?: string, preferred_locales?: string[], spending_controls?: array{allowed_categories?: string[], allowed_merchant_countries?: string[], blocked_categories?: string[], blocked_merchant_countries?: string[], spending_limits?: array{amount: int, categories?: string[], interval: string}[], spending_limits_currency?: string}, status?: string, type?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Cardholder
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Cardholder
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{billing?: array{address: array{city: string, country: string, line1: string, line2?: string, postal_code: string, state?: string}}, company?: array{tax_id?: string}, email?: string, expand?: string[], individual?: array{card_issuing?: array{user_terms_acceptance?: array{date?: int, ip?: string, user_agent?: null|string}}, dob?: array{day: int, month: int, year: int}, first_name?: string, last_name?: string, verification?: array{document?: array{back?: string, front?: string}}}, metadata?: array<string, string>, phone_number?: string, preferred_locales?: string[], spending_controls?: array{allowed_categories?: string[], allowed_merchant_countries?: string[], blocked_categories?: string[], blocked_merchant_countries?: string[], spending_limits?: array{amount: int, categories?: string[], interval: string}[], spending_limits_currency?: string}, status?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Cardholder
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/issuing/cardholders/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,104 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Issuing;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class DisputeService extends \Stripe\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{created?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, status?: string, transaction?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Issuing\Dispute>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{amount?: int, evidence?: array{canceled?: null|array{additional_documentation?: null|string, canceled_at?: null|int, cancellation_policy_provided?: null|bool, cancellation_reason?: null|string, expected_at?: null|int, explanation?: null|string, product_description?: null|string, product_type?: null|string, return_status?: null|string, returned_at?: null|int}, duplicate?: null|array{additional_documentation?: null|string, card_statement?: null|string, cash_receipt?: null|string, check_image?: null|string, explanation?: null|string, original_transaction?: string}, fraudulent?: null|array{additional_documentation?: null|string, explanation?: null|string}, merchandise_not_as_described?: null|array{additional_documentation?: null|string, explanation?: null|string, received_at?: null|int, return_description?: null|string, return_status?: null|string, returned_at?: null|int}, no_valid_authorization?: null|array{additional_documentation?: null|string, explanation?: null|string}, not_received?: null|array{additional_documentation?: null|string, expected_at?: null|int, explanation?: null|string, product_description?: null|string, product_type?: null|string}, other?: null|array{additional_documentation?: null|string, explanation?: null|string, product_description?: null|string, product_type?: null|string}, reason?: string, service_not_as_described?: null|array{additional_documentation?: null|string, canceled_at?: null|int, cancellation_reason?: null|string, explanation?: null|string, received_at?: null|int}}, expand?: string[], metadata?: array<string, string>, transaction?: string, treasury?: array{received_debit: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Dispute
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Dispute
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 disputes 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{expand?: string[], metadata?: null|array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Dispute
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{amount?: int, evidence?: array{canceled?: null|array{additional_documentation?: null|string, canceled_at?: null|int, cancellation_policy_provided?: null|bool, cancellation_reason?: null|string, expected_at?: null|int, explanation?: null|string, product_description?: null|string, product_type?: null|string, return_status?: null|string, returned_at?: null|int}, duplicate?: null|array{additional_documentation?: null|string, card_statement?: null|string, cash_receipt?: null|string, check_image?: null|string, explanation?: null|string, original_transaction?: string}, fraudulent?: null|array{additional_documentation?: null|string, explanation?: null|string}, merchandise_not_as_described?: null|array{additional_documentation?: null|string, explanation?: null|string, received_at?: null|int, return_description?: null|string, return_status?: null|string, returned_at?: null|int}, no_valid_authorization?: null|array{additional_documentation?: null|string, explanation?: null|string}, not_received?: null|array{additional_documentation?: null|string, expected_at?: null|int, explanation?: null|string, product_description?: null|string, product_type?: null|string}, other?: null|array{additional_documentation?: null|string, explanation?: null|string, product_description?: null|string, product_type?: null|string}, reason?: string, service_not_as_described?: null|array{additional_documentation?: null|string, canceled_at?: null|int, cancellation_reason?: null|string, explanation?: null|string, received_at?: null|int}}, expand?: string[], metadata?: null|array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Dispute
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/issuing/disputes/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,39 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\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 PersonalizationDesignService $personalizationDesigns
* @property PhysicalBundleService $physicalBundles
* @property TokenService $tokens
* @property TransactionService $transactions
*/
class IssuingServiceFactory extends \Stripe\Service\AbstractServiceFactory
{
/**
* @var array<string, string>
*/
private static $classMap = [
'authorizations' => AuthorizationService::class,
'cardholders' => CardholderService::class,
'cards' => CardService::class,
'disputes' => DisputeService::class,
'personalizationDesigns' => PersonalizationDesignService::class,
'physicalBundles' => PhysicalBundleService::class,
'tokens' => TokenService::class,
'transactions' => TransactionService::class,
];
protected function getServiceClass($name)
{
return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
}
}

View File

@@ -0,0 +1,77 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Issuing;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class PersonalizationDesignService extends \Stripe\Service\AbstractService
{
/**
* Returns a list of personalization design objects. The objects are sorted in
* descending order by creation date, with the most recently created object
* appearing first.
*
* @param null|array{ending_before?: string, expand?: string[], limit?: int, lookup_keys?: string[], preferences?: array{is_default?: bool, is_platform_default?: bool}, starting_after?: string, status?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Issuing\PersonalizationDesign>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/issuing/personalization_designs', $params, $opts);
}
/**
* Creates a personalization design object.
*
* @param null|array{card_logo?: string, carrier_text?: array{footer_body?: null|string, footer_title?: null|string, header_body?: null|string, header_title?: null|string}, expand?: string[], lookup_key?: string, metadata?: array<string, string>, name?: string, physical_bundle: string, preferences?: array{is_default: bool}, transfer_lookup_key?: bool} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\PersonalizationDesign
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/issuing/personalization_designs', $params, $opts);
}
/**
* Retrieves a personalization design object.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\PersonalizationDesign
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/issuing/personalization_designs/%s', $id), $params, $opts);
}
/**
* Updates a card personalization object.
*
* @param string $id
* @param null|array{card_logo?: null|string, carrier_text?: null|array{footer_body?: null|string, footer_title?: null|string, header_body?: null|string, header_title?: null|string}, expand?: string[], lookup_key?: null|string, metadata?: array<string, string>, name?: null|string, physical_bundle?: string, preferences?: array{is_default: bool}, transfer_lookup_key?: bool} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\PersonalizationDesign
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/issuing/personalization_designs/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,45 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Issuing;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class PhysicalBundleService extends \Stripe\Service\AbstractService
{
/**
* Returns a list of physical bundle objects. The objects are sorted in descending
* order by creation date, with the most recently created object appearing first.
*
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string, status?: string, type?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Issuing\PhysicalBundle>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/issuing/physical_bundles', $params, $opts);
}
/**
* Retrieves a physical bundle object.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\PhysicalBundle
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/issuing/physical_bundles/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,61 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Issuing;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class TokenService extends \Stripe\Service\AbstractService
{
/**
* Lists all Issuing <code>Token</code> objects for a given card.
*
* @param null|array{card: string, created?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, status?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Issuing\Token>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/issuing/tokens', $params, $opts);
}
/**
* Retrieves an Issuing <code>Token</code> object.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Token
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/issuing/tokens/%s', $id), $params, $opts);
}
/**
* Attempts to update the specified Issuing <code>Token</code> object to the status
* specified.
*
* @param string $id
* @param null|array{expand?: string[], status: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Token
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/issuing/tokens/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,64 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Issuing;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class TransactionService extends \Stripe\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{card?: string, cardholder?: string, created?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, type?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Issuing\Transaction>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Transaction
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[], metadata?: null|array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Issuing\Transaction
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/issuing/transactions/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,29 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class MandateService extends AbstractService
{
/**
* Retrieves a Mandate object.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Mandate
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/mandates/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,150 @@
<?php
namespace Stripe\Service;
class OAuthService extends AbstractService
{
/**
* Sends a request to Stripe's Connect API.
*
* @param 'delete'|'get'|'post' $method the HTTP method
* @param string $path the path of the request
* @param array $params the parameters of the request
* @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request
*
* @return \Stripe\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 = \Stripe\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
*
* @return \Stripe\StripeObject object containing the response from the API
*
* @throws \Stripe\Exception\OAuth\OAuthErrorException if the request fails
*/
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
*
* @return \Stripe\StripeObject object containing the response from the API
*
* @throws \Stripe\Exception\OAuth\OAuthErrorException if the request fails
*/
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 \Stripe\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 \Stripe\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|\Stripe\Util\RequestOptions $opts the special modifiers of the request
*
* @return \Stripe\Util\RequestOptions
*
* @throws \Stripe\Exception\InvalidArgumentException
*/
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
// \Stripe\Service\OAuthService from \Stripe\OAuth, where `connect_base`
// was the name of the parameter that behaves as `api_base` does here.
throw new \Stripe\Exception\InvalidArgumentException('Use `api_base`, not `connect_base`');
}
}
return \Stripe\Util\RequestOptions::parse($opts);
}
/**
* @param \Stripe\Util\RequestOptions $opts
*
* @return string
*/
private function _getBase($opts)
{
return isset($opts->apiBase)
? $opts->apiBase
: $this->client->getConnectBase();
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,94 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class PaymentLinkService extends AbstractService
{
/**
* Returns a list of your payment links.
*
* @param null|array{active?: bool, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\PaymentLink>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\LineItem>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{after_completion?: array{hosted_confirmation?: array{custom_message?: string}, redirect?: array{url: string}, type: string}, allow_promotion_codes?: bool, application_fee_amount?: int, application_fee_percent?: float, automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, billing_address_collection?: string, consent_collection?: array{payment_method_reuse_agreement?: array{position: string}, promotions?: string, terms_of_service?: string}, currency?: string, custom_fields?: array{dropdown?: array{default_value?: string, options: array{label: string, value: string}[]}, key: string, label: array{custom: string, type: string}, numeric?: array{default_value?: string, maximum_length?: int, minimum_length?: int}, optional?: bool, text?: array{default_value?: string, maximum_length?: int, minimum_length?: int}, type: string}[], custom_text?: array{after_submit?: null|array{message: string}, shipping_address?: null|array{message: string}, submit?: null|array{message: string}, terms_of_service_acceptance?: null|array{message: string}}, customer_creation?: string, expand?: string[], inactive_message?: string, invoice_creation?: array{enabled: bool, invoice_data?: array{account_tax_ids?: null|string[], custom_fields?: null|array{name: string, value: string}[], description?: string, footer?: string, issuer?: array{account?: string, type: string}, metadata?: null|array<string, string>, rendering_options?: null|array{amount_tax_display?: null|string}}}, line_items: array{adjustable_quantity?: array{enabled: bool, maximum?: int, minimum?: int}, price: string, quantity: int}[], metadata?: array<string, string>, on_behalf_of?: string, optional_items?: array{adjustable_quantity?: array{enabled: bool, maximum?: int, minimum?: int}, price: string, quantity: int}[], payment_intent_data?: array{capture_method?: string, description?: string, metadata?: array<string, string>, setup_future_usage?: string, statement_descriptor?: string, statement_descriptor_suffix?: string, transfer_group?: string}, payment_method_collection?: string, payment_method_types?: string[], phone_number_collection?: array{enabled: bool}, restrictions?: array{completed_sessions: array{limit: int}}, shipping_address_collection?: array{allowed_countries: string[]}, shipping_options?: array{shipping_rate?: string}[], submit_type?: string, subscription_data?: array{description?: string, invoice_settings?: array{issuer?: array{account?: string, type: string}}, metadata?: array<string, string>, trial_period_days?: int, trial_settings?: array{end_behavior: array{missing_payment_method: string}}}, tax_id_collection?: array{enabled: bool, required?: string}, transfer_data?: array{amount?: int, destination: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PaymentLink
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PaymentLink
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{active?: bool, after_completion?: array{hosted_confirmation?: array{custom_message?: string}, redirect?: array{url: string}, type: string}, allow_promotion_codes?: bool, automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, billing_address_collection?: string, custom_fields?: null|array{dropdown?: array{default_value?: string, options: array{label: string, value: string}[]}, key: string, label: array{custom: string, type: string}, numeric?: array{default_value?: string, maximum_length?: int, minimum_length?: int}, optional?: bool, text?: array{default_value?: string, maximum_length?: int, minimum_length?: int}, type: string}[], custom_text?: array{after_submit?: null|array{message: string}, shipping_address?: null|array{message: string}, submit?: null|array{message: string}, terms_of_service_acceptance?: null|array{message: string}}, customer_creation?: string, expand?: string[], inactive_message?: null|string, invoice_creation?: array{enabled: bool, invoice_data?: array{account_tax_ids?: null|string[], custom_fields?: null|array{name: string, value: string}[], description?: string, footer?: string, issuer?: array{account?: string, type: string}, metadata?: null|array<string, string>, rendering_options?: null|array{amount_tax_display?: null|string}}}, line_items?: array{adjustable_quantity?: array{enabled: bool, maximum?: int, minimum?: int}, id: string, quantity?: int}[], metadata?: array<string, string>, payment_intent_data?: array{description?: null|string, metadata?: null|array<string, string>, statement_descriptor?: null|string, statement_descriptor_suffix?: null|string, transfer_group?: null|string}, payment_method_collection?: string, payment_method_types?: null|string[], phone_number_collection?: array{enabled: bool}, restrictions?: null|array{completed_sessions: array{limit: int}}, shipping_address_collection?: null|array{allowed_countries: string[]}, submit_type?: string, subscription_data?: array{invoice_settings?: array{issuer?: array{account?: string, type: string}}, metadata?: null|array<string, string>, trial_period_days?: null|int, trial_settings?: null|array{end_behavior: array{missing_payment_method: string}}}, tax_id_collection?: array{enabled: bool, required?: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PaymentLink
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/payment_links/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,75 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class PaymentMethodConfigurationService extends AbstractService
{
/**
* List payment method configurations.
*
* @param null|array{application?: null|string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\PaymentMethodConfiguration>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/payment_method_configurations', $params, $opts);
}
/**
* Creates a payment method configuration.
*
* @param null|array{acss_debit?: array{display_preference?: array{preference?: string}}, affirm?: array{display_preference?: array{preference?: string}}, afterpay_clearpay?: array{display_preference?: array{preference?: string}}, alipay?: array{display_preference?: array{preference?: string}}, alma?: array{display_preference?: array{preference?: string}}, amazon_pay?: array{display_preference?: array{preference?: string}}, apple_pay?: array{display_preference?: array{preference?: string}}, apple_pay_later?: array{display_preference?: array{preference?: string}}, au_becs_debit?: array{display_preference?: array{preference?: string}}, bacs_debit?: array{display_preference?: array{preference?: string}}, bancontact?: array{display_preference?: array{preference?: string}}, billie?: array{display_preference?: array{preference?: string}}, blik?: array{display_preference?: array{preference?: string}}, boleto?: array{display_preference?: array{preference?: string}}, card?: array{display_preference?: array{preference?: string}}, cartes_bancaires?: array{display_preference?: array{preference?: string}}, cashapp?: array{display_preference?: array{preference?: string}}, customer_balance?: array{display_preference?: array{preference?: string}}, eps?: array{display_preference?: array{preference?: string}}, expand?: string[], fpx?: array{display_preference?: array{preference?: string}}, giropay?: array{display_preference?: array{preference?: string}}, google_pay?: array{display_preference?: array{preference?: string}}, grabpay?: array{display_preference?: array{preference?: string}}, ideal?: array{display_preference?: array{preference?: string}}, jcb?: array{display_preference?: array{preference?: string}}, kakao_pay?: array{display_preference?: array{preference?: string}}, klarna?: array{display_preference?: array{preference?: string}}, konbini?: array{display_preference?: array{preference?: string}}, kr_card?: array{display_preference?: array{preference?: string}}, link?: array{display_preference?: array{preference?: string}}, mobilepay?: array{display_preference?: array{preference?: string}}, multibanco?: array{display_preference?: array{preference?: string}}, name?: string, naver_pay?: array{display_preference?: array{preference?: string}}, nz_bank_account?: array{display_preference?: array{preference?: string}}, oxxo?: array{display_preference?: array{preference?: string}}, p24?: array{display_preference?: array{preference?: string}}, parent?: string, pay_by_bank?: array{display_preference?: array{preference?: string}}, payco?: array{display_preference?: array{preference?: string}}, paynow?: array{display_preference?: array{preference?: string}}, paypal?: array{display_preference?: array{preference?: string}}, pix?: array{display_preference?: array{preference?: string}}, promptpay?: array{display_preference?: array{preference?: string}}, revolut_pay?: array{display_preference?: array{preference?: string}}, samsung_pay?: array{display_preference?: array{preference?: string}}, satispay?: array{display_preference?: array{preference?: string}}, sepa_debit?: array{display_preference?: array{preference?: string}}, sofort?: array{display_preference?: array{preference?: string}}, swish?: array{display_preference?: array{preference?: string}}, twint?: array{display_preference?: array{preference?: string}}, us_bank_account?: array{display_preference?: array{preference?: string}}, wechat_pay?: array{display_preference?: array{preference?: string}}, zip?: array{display_preference?: array{preference?: string}}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PaymentMethodConfiguration
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/payment_method_configurations', $params, $opts);
}
/**
* Retrieve payment method configuration.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PaymentMethodConfiguration
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/payment_method_configurations/%s', $id), $params, $opts);
}
/**
* Update payment method configuration.
*
* @param string $id
* @param null|array{acss_debit?: array{display_preference?: array{preference?: string}}, active?: bool, affirm?: array{display_preference?: array{preference?: string}}, afterpay_clearpay?: array{display_preference?: array{preference?: string}}, alipay?: array{display_preference?: array{preference?: string}}, alma?: array{display_preference?: array{preference?: string}}, amazon_pay?: array{display_preference?: array{preference?: string}}, apple_pay?: array{display_preference?: array{preference?: string}}, apple_pay_later?: array{display_preference?: array{preference?: string}}, au_becs_debit?: array{display_preference?: array{preference?: string}}, bacs_debit?: array{display_preference?: array{preference?: string}}, bancontact?: array{display_preference?: array{preference?: string}}, billie?: array{display_preference?: array{preference?: string}}, blik?: array{display_preference?: array{preference?: string}}, boleto?: array{display_preference?: array{preference?: string}}, card?: array{display_preference?: array{preference?: string}}, cartes_bancaires?: array{display_preference?: array{preference?: string}}, cashapp?: array{display_preference?: array{preference?: string}}, customer_balance?: array{display_preference?: array{preference?: string}}, eps?: array{display_preference?: array{preference?: string}}, expand?: string[], fpx?: array{display_preference?: array{preference?: string}}, giropay?: array{display_preference?: array{preference?: string}}, google_pay?: array{display_preference?: array{preference?: string}}, grabpay?: array{display_preference?: array{preference?: string}}, ideal?: array{display_preference?: array{preference?: string}}, jcb?: array{display_preference?: array{preference?: string}}, kakao_pay?: array{display_preference?: array{preference?: string}}, klarna?: array{display_preference?: array{preference?: string}}, konbini?: array{display_preference?: array{preference?: string}}, kr_card?: array{display_preference?: array{preference?: string}}, link?: array{display_preference?: array{preference?: string}}, mobilepay?: array{display_preference?: array{preference?: string}}, multibanco?: array{display_preference?: array{preference?: string}}, name?: string, naver_pay?: array{display_preference?: array{preference?: string}}, nz_bank_account?: array{display_preference?: array{preference?: string}}, oxxo?: array{display_preference?: array{preference?: string}}, p24?: array{display_preference?: array{preference?: string}}, pay_by_bank?: array{display_preference?: array{preference?: string}}, payco?: array{display_preference?: array{preference?: string}}, paynow?: array{display_preference?: array{preference?: string}}, paypal?: array{display_preference?: array{preference?: string}}, pix?: array{display_preference?: array{preference?: string}}, promptpay?: array{display_preference?: array{preference?: string}}, revolut_pay?: array{display_preference?: array{preference?: string}}, samsung_pay?: array{display_preference?: array{preference?: string}}, satispay?: array{display_preference?: array{preference?: string}}, sepa_debit?: array{display_preference?: array{preference?: string}}, sofort?: array{display_preference?: array{preference?: string}}, swish?: array{display_preference?: array{preference?: string}}, twint?: array{display_preference?: array{preference?: string}}, us_bank_account?: array{display_preference?: array{preference?: string}}, wechat_pay?: array{display_preference?: array{preference?: string}}, zip?: array{display_preference?: array{preference?: string}}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PaymentMethodConfiguration
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/payment_method_configurations/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,102 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class PaymentMethodDomainService extends AbstractService
{
/**
* Lists the details of existing payment method domains.
*
* @param null|array{domain_name?: string, enabled?: bool, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\PaymentMethodDomain>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/payment_method_domains', $params, $opts);
}
/**
* Creates a payment method domain.
*
* @param null|array{domain_name: string, enabled?: bool, expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PaymentMethodDomain
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/payment_method_domains', $params, $opts);
}
/**
* Retrieves the details of an existing payment method domain.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PaymentMethodDomain
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/payment_method_domains/%s', $id), $params, $opts);
}
/**
* Updates an existing payment method domain.
*
* @param string $id
* @param null|array{enabled?: bool, expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PaymentMethodDomain
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/payment_method_domains/%s', $id), $params, $opts);
}
/**
* Some payment methods might require additional steps to register a domain. If the
* requirements werent satisfied when the domain was created, the payment method
* will be inactive on the domain. The payment method doesnt appear in Elements or
* Embedded Checkout for this domain until it is active.
*
* To activate a payment method on an existing payment method domain, complete the
* required registration steps specific to the payment method, and then validate
* the payment method domain with this endpoint.
*
* Related guides: <a
* href="/docs/payments/payment-methods/pmd-registration">Payment method
* domains</a>.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PaymentMethodDomain
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function validate($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/payment_method_domains/%s/validate', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,140 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class PaymentMethodService extends AbstractService
{
/**
* Returns a list of PaymentMethods for Treasury flows. If you want to list the
* PaymentMethods attached to a Customer for payments, you should use the <a
* href="/docs/api/payment_methods/customer_list">List a Customers
* PaymentMethods</a> API instead.
*
* @param null|array{customer?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, type?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\PaymentMethod>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 PaymentMethods ID.
*
* @param string $id
* @param null|array{customer: string, expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PaymentMethod
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{acss_debit?: array{account_number: string, institution_number: string, transit_number: string}, affirm?: array{}, afterpay_clearpay?: array{}, alipay?: array{}, allow_redisplay?: string, alma?: array{}, amazon_pay?: array{}, au_becs_debit?: array{account_number: string, bsb_number: string}, bacs_debit?: array{account_number?: string, sort_code?: string}, bancontact?: array{}, billie?: array{}, billing_details?: array{address?: null|array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, email?: null|string, name?: null|string, phone?: null|string, tax_id?: string}, blik?: array{}, boleto?: array{tax_id: string}, card?: array{cvc?: string, exp_month?: int, exp_year?: int, networks?: array{preferred?: string}, number?: string, token?: string}, cashapp?: array{}, customer?: string, customer_balance?: array{}, eps?: array{bank?: string}, expand?: string[], fpx?: array{account_holder_type?: string, bank: string}, giropay?: array{}, grabpay?: array{}, ideal?: array{bank?: string}, interac_present?: array{}, kakao_pay?: array{}, klarna?: array{dob?: array{day: int, month: int, year: int}}, konbini?: array{}, kr_card?: array{}, link?: array{}, metadata?: array<string, string>, mobilepay?: array{}, multibanco?: array{}, naver_pay?: array{funding?: string}, nz_bank_account?: array{account_holder_name?: string, account_number: string, bank_code: string, branch_code: string, reference?: string, suffix: string}, oxxo?: array{}, p24?: array{bank?: string}, pay_by_bank?: array{}, payco?: array{}, payment_method?: string, paynow?: array{}, paypal?: array{}, pix?: array{}, promptpay?: array{}, radar_options?: array{session?: string}, revolut_pay?: array{}, samsung_pay?: array{}, satispay?: array{}, sepa_debit?: array{iban: string}, sofort?: array{country: string}, swish?: array{}, twint?: array{}, type?: string, us_bank_account?: array{account_holder_type?: string, account_number?: string, account_type?: string, financial_connections_account?: string, routing_number?: string}, wechat_pay?: array{}, zip?: array{}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PaymentMethod
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PaymentMethod
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 Customers
* PaymentMethods</a>.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PaymentMethod
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{allow_redisplay?: string, billing_details?: array{address?: null|array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, email?: null|string, name?: null|string, phone?: null|string, tax_id?: string}, card?: array{exp_month?: int, exp_year?: int, networks?: array{preferred?: null|string}}, expand?: string[], link?: array{}, metadata?: null|array<string, string>, pay_by_bank?: array{}, us_bank_account?: array{account_holder_type?: string, account_type?: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PaymentMethod
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/payment_methods/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,132 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class PayoutService extends AbstractService
{
/**
* Returns a list of existing payouts sent to third-party bank accounts or payouts
* that Stripe sent to you. The payouts return in sorted order, with the most
* recently created payouts appearing first.
*
* @param null|array{arrival_date?: array|int, created?: array|int, destination?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, status?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Payout>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/payouts', $params, $opts);
}
/**
* You can cancel a previously created payout if its status is
* <code>pending</code>. Stripe refunds the funds to your available balance. You
* cant cancel automatic Stripe payouts.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Payout
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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, create a new payout object. Your <a
* href="#balance">Stripe balance</a> must cover the payout amount. If it doesnt,
* you receive an “Insufficient Funds” error.
*
* If your API key is in test mode, money wont actually be sent, though every
* other action occurs as if youre in live mode.
*
* If you create a manual payout on a Stripe account that uses multiple payment
* source types, you need to specify the source type balance that the payout draws
* from. The <a href="#balance_object">balance object</a> details available and
* pending amounts by source type.
*
* @param null|array{amount: int, currency: string, description?: string, destination?: string, expand?: string[], metadata?: array<string, string>, method?: string, source_type?: string, statement_descriptor?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Payout
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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. Stripe returns the
* corresponding payout information.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Payout
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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. At this time, you
* can only reverse payouts for connected accounts to US bank accounts. If the
* payout is manual and in the <code>pending</code> status, use
* <code>/v1/payouts/:id/cancel</code> instead.
*
* By requesting a reversal through <code>/v1/payouts/:id/reverse</code>, you
* confirm that the authorized signatory of the selected bank account authorizes
* the debit on the bank account and that no other authorization is required.
*
* @param string $id
* @param null|array{expand?: string[], metadata?: array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Payout
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 you pass.
* We dont change parameters that you dont provide. This request only accepts the
* metadata as arguments.
*
* @param string $id
* @param null|array{expand?: string[], metadata?: null|array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Payout
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/payouts/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,96 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class PlanService extends AbstractService
{
/**
* Returns a list of your plans.
*
* @param null|array{active?: bool, created?: array|int, ending_before?: string, expand?: string[], limit?: int, product?: string, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Plan>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{active?: bool, amount?: int, amount_decimal?: string, billing_scheme?: string, currency: string, expand?: string[], id?: string, interval: string, interval_count?: int, metadata?: null|array<string, string>, meter?: string, nickname?: string, product?: array|string, tiers?: (array{flat_amount?: int, flat_amount_decimal?: string, unit_amount?: int, unit_amount_decimal?: string, up_to: array|int|string})[], tiers_mode?: string, transform_usage?: array{divide_by: int, round: string}, trial_period_days?: int, usage_type?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Plan
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/plans', $params, $opts);
}
/**
* Deleting plans means new subscribers cant be added. Existing subscribers arent
* affected.
*
* @param string $id
* @param null|array $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Plan
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Plan
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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
* plans ID, amount, currency, or billing cycle.
*
* @param string $id
* @param null|array{active?: bool, expand?: string[], metadata?: null|array<string, string>, nickname?: string, product?: string, trial_period_days?: int} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Plan
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/plans/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,100 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class PriceService extends AbstractService
{
/**
* Returns a list of your active prices, excluding <a
* href="/docs/products-prices/pricing-models#inline-pricing">inline prices</a>.
* For the list of inactive prices, set <code>active</code> to false.
*
* @param null|array{active?: bool, created?: array|int, currency?: string, ending_before?: string, expand?: string[], limit?: int, lookup_keys?: string[], product?: string, recurring?: array{interval?: string, meter?: string, usage_type?: string}, starting_after?: string, type?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Price>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/prices', $params, $opts);
}
/**
* Creates a new <a href="https://docs.stripe.com/api/prices">Price</a> for an
* existing <a href="https://docs.stripe.com/api/products">Product</a>. The Price
* can be recurring or one-time.
*
* @param null|array{active?: bool, billing_scheme?: string, currency: string, currency_options?: array<string, array{custom_unit_amount?: array{enabled: bool, maximum?: int, minimum?: int, preset?: int}, tax_behavior?: string, tiers?: (array{flat_amount?: int, flat_amount_decimal?: string, unit_amount?: int, unit_amount_decimal?: string, up_to: array|int|string})[], unit_amount?: int, unit_amount_decimal?: string}>, custom_unit_amount?: array{enabled: bool, maximum?: int, minimum?: int, preset?: int}, expand?: string[], lookup_key?: string, metadata?: array<string, string>, nickname?: string, product?: string, product_data?: array{active?: bool, id?: string, metadata?: array<string, string>, name: string, statement_descriptor?: string, tax_code?: string, unit_label?: string}, recurring?: array{interval: string, interval_count?: int, meter?: string, trial_period_days?: int, usage_type?: string}, tax_behavior?: string, tiers?: (array{flat_amount?: int, flat_amount_decimal?: string, unit_amount?: int, unit_amount_decimal?: string, up_to: array|int|string})[], tiers_mode?: string, transfer_lookup_key?: bool, transform_quantity?: array{divide_by: int, round: string}, unit_amount?: int, unit_amount_decimal?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Price
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Price
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/prices/%s', $id), $params, $opts);
}
/**
* Search for prices youve previously created using Stripes <a
* href="/docs/search#search-query-language">Search Query Language</a>. Dont 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{expand?: string[], limit?: int, page?: string, query: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SearchResult<\Stripe\Price>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{active?: bool, currency_options?: null|array<string, array{custom_unit_amount?: array{enabled: bool, maximum?: int, minimum?: int, preset?: int}, tax_behavior?: string, tiers?: (array{flat_amount?: int, flat_amount_decimal?: string, unit_amount?: int, unit_amount_decimal?: string, up_to: array|int|string})[], unit_amount?: int, unit_amount_decimal?: string}>, expand?: string[], lookup_key?: string, metadata?: null|array<string, string>, nickname?: string, tax_behavior?: string, transfer_lookup_key?: bool} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Price
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/prices/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,183 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class ProductService extends 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{active?: bool, created?: array|int, ending_before?: string, expand?: string[], ids?: string[], limit?: int, shippable?: bool, starting_after?: string, type?: string, url?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Product>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/products', $params, $opts);
}
/**
* Retrieve a list of features for a product.
*
* @param string $parentId
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\ProductFeature>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function allFeatures($parentId, $params = null, $opts = null)
{
return $this->requestCollection('get', $this->buildPath('/v1/products/%s/features', $parentId), $params, $opts);
}
/**
* Creates a new product object.
*
* @param null|array{active?: bool, default_price_data?: array{currency: string, currency_options?: array<string, array{custom_unit_amount?: array{enabled: bool, maximum?: int, minimum?: int, preset?: int}, tax_behavior?: string, tiers?: (array{flat_amount?: int, flat_amount_decimal?: string, unit_amount?: int, unit_amount_decimal?: string, up_to: array|int|string})[], unit_amount?: int, unit_amount_decimal?: string}>, custom_unit_amount?: array{enabled: bool, maximum?: int, minimum?: int, preset?: int}, metadata?: array<string, string>, recurring?: array{interval: string, interval_count?: int}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, description?: string, expand?: string[], id?: string, images?: string[], marketing_features?: array{name: string}[], metadata?: array<string, string>, name: string, package_dimensions?: array{height: float, length: float, weight: float, width: float}, shippable?: bool, statement_descriptor?: string, tax_code?: string, type?: string, unit_label?: string, url?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Product
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/products', $params, $opts);
}
/**
* Creates a product_feature, which represents a feature attachment to a product.
*
* @param string $parentId
* @param null|array{entitlement_feature: string, expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\ProductFeature
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function createFeature($parentId, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/products/%s/features', $parentId), $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|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Product
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function delete($id, $params = null, $opts = null)
{
return $this->request('delete', $this->buildPath('/v1/products/%s', $id), $params, $opts);
}
/**
* Deletes the feature attachment to a product.
*
* @param string $parentId
* @param string $id
* @param null|array $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\ProductFeature
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function deleteFeature($parentId, $id, $params = null, $opts = null)
{
return $this->request('delete', $this->buildPath('/v1/products/%s/features/%s', $parentId, $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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Product
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/products/%s', $id), $params, $opts);
}
/**
* Retrieves a product_feature, which represents a feature attachment to a product.
*
* @param string $parentId
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\ProductFeature
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieveFeature($parentId, $id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/products/%s/features/%s', $parentId, $id), $params, $opts);
}
/**
* Search for products youve previously created using Stripes <a
* href="/docs/search#search-query-language">Search Query Language</a>. Dont 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{expand?: string[], limit?: int, page?: string, query: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SearchResult<\Stripe\Product>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{active?: bool, default_price?: string, description?: null|string, expand?: string[], images?: null|string[], marketing_features?: null|array{name: string}[], metadata?: null|array<string, string>, name?: string, package_dimensions?: null|array{height: float, length: float, weight: float, width: float}, shippable?: bool, statement_descriptor?: string, tax_code?: null|string, unit_label?: null|string, url?: null|string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Product
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/products/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,80 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class PromotionCodeService extends AbstractService
{
/**
* Returns a list of your promotion codes.
*
* @param null|array{active?: bool, code?: string, coupon?: string, created?: array|int, customer?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\PromotionCode>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{active?: bool, code?: string, coupon: string, customer?: string, expand?: string[], expires_at?: int, max_redemptions?: int, metadata?: array<string, string>, restrictions?: array{currency_options?: array<string, array{minimum_amount?: int}>, first_time_transaction?: bool, minimum_amount?: int, minimum_amount_currency?: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PromotionCode
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PromotionCode
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{active?: bool, expand?: string[], metadata?: null|array<string, string>, restrictions?: array{currency_options?: array<string, array{minimum_amount?: int}>}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\PromotionCode
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/promotion_codes/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,186 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class QuoteService extends AbstractService
{
/**
* Accepts the specified quote.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Quote
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{customer?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, status?: string, test_clock?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Quote>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\LineItem>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\LineItem>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Quote
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{application_fee_amount?: null|int, application_fee_percent?: null|float, automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, collection_method?: string, customer?: string, default_tax_rates?: null|string[], description?: null|string, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], expand?: string[], expires_at?: int, footer?: null|string, from_quote?: array{is_revision?: bool, quote: string}, header?: null|string, invoice_settings?: array{days_until_due?: int, issuer?: array{account?: string, type: string}}, line_items?: (array{discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], price?: string, price_data?: array{currency: string, product: string, recurring?: array{interval: string, interval_count?: int}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_rates?: null|string[]})[], metadata?: array<string, string>, on_behalf_of?: null|string, subscription_data?: array{description?: string, effective_date?: null|array|int|string, metadata?: array<string, string>, trial_period_days?: null|int}, test_clock?: string, transfer_data?: null|array{amount?: int, amount_percent?: float, destination: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Quote
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/quotes', $params, $opts);
}
/**
* Finalizes the quote.
*
* @param string $id
* @param null|array{expand?: string[], expires_at?: int} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Quote
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function finalizeQuote($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/quotes/%s/finalize', $id), $params, $opts);
}
/**
* Download the PDF for a finalized quote. Explanation for special handling can be
* found <a href="https://docs.stripe.com/quotes/overview#quote_pdf">here</a>.
*
* @param string $id
* @param callable $readBodyChunkCallable
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return mixed
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function pdf($id, $readBodyChunkCallable, $params = null, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
if (!isset($opts->apiBase)) {
$opts->apiBase = $this->getClient()->getFilesBase();
}
return $this->requestStream('get', $this->buildPath('/v1/quotes/%s/pdf', $id), $readBodyChunkCallable, $params, $opts);
}
/**
* Retrieves the quote with the given ID.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Quote
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{application_fee_amount?: null|int, application_fee_percent?: null|float, automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, collection_method?: string, customer?: string, default_tax_rates?: null|string[], description?: null|string, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], expand?: string[], expires_at?: int, footer?: null|string, header?: null|string, invoice_settings?: array{days_until_due?: int, issuer?: array{account?: string, type: string}}, line_items?: (array{discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], id?: string, price?: string, price_data?: array{currency: string, product: string, recurring?: array{interval: string, interval_count?: int}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_rates?: null|string[]})[], metadata?: array<string, string>, on_behalf_of?: null|string, subscription_data?: array{description?: null|string, effective_date?: null|array|int|string, metadata?: array<string, string>, trial_period_days?: null|int}, transfer_data?: null|array{amount?: int, amount_percent?: float, destination: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Quote
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/quotes/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,48 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Radar;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class EarlyFraudWarningService extends \Stripe\Service\AbstractService
{
/**
* Returns a list of early fraud warnings.
*
* @param null|array{charge?: string, created?: array|int, ending_before?: string, expand?: string[], limit?: int, payment_intent?: string, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Radar\EarlyFraudWarning>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Radar\EarlyFraudWarning
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/radar/early_fraud_warnings/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,29 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Radar;
/**
* Service factory class for API resources in the Radar namespace.
*
* @property EarlyFraudWarningService $earlyFraudWarnings
* @property ValueListItemService $valueListItems
* @property ValueListService $valueLists
*/
class RadarServiceFactory extends \Stripe\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;
}
}

View File

@@ -0,0 +1,79 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Radar;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class ValueListItemService extends \Stripe\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{created?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, value?: string, value_list: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Radar\ValueListItem>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[], value: string, value_list: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Radar\ValueListItem
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Radar\ValueListItem
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Radar\ValueListItem
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/radar/value_list_items/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,98 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Radar;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class ValueListService extends \Stripe\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{alias?: string, contains?: string, created?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Radar\ValueList>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{alias: string, expand?: string[], item_type?: string, metadata?: array<string, string>, name: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Radar\ValueList
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Radar\ValueList
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Radar\ValueList
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{alias?: string, expand?: string[], metadata?: array<string, string>, name?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Radar\ValueList
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/radar/value_lists/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,111 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class RefundService extends AbstractService
{
/**
* Returns a list of all refunds you created. We return the refunds in sorted
* order, with the most recent refunds appearing first. The 10 most recent refunds
* are always available by default on the Charge object.
*
* @param null|array{charge?: string, created?: array|int, ending_before?: string, expand?: string[], limit?: int, payment_intent?: string, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Refund>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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>.
*
* You cant cancel refunds in other states. Only refunds for payment methods that
* require customer action can enter the <code>requires_action</code> state.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Refund
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function cancel($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/refunds/%s/cancel', $id), $params, $opts);
}
/**
* When you create a new refund, you must specify a Charge or a PaymentIntent
* object on which to create it.
*
* Creating a new refund will 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.
*
* You can optionally refund only part of a charge. You can do so multiple times,
* until the entire charge has been refunded.
*
* Once entirely refunded, a charge cant be refunded again. This method will raise
* an error when called on an already-refunded charge, or when trying to refund
* more money than is left on a charge.
*
* @param null|array{amount?: int, charge?: string, currency?: string, customer?: string, expand?: string[], instructions_email?: string, metadata?: null|array<string, string>, origin?: string, payment_intent?: string, reason?: string, refund_application_fee?: bool, reverse_transfer?: bool} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Refund
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Refund
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/refunds/%s', $id), $params, $opts);
}
/**
* Updates the refund that you specify by setting the values of the passed
* parameters. Any parameters that you dont provide remain unchanged.
*
* This request only accepts <code>metadata</code> as an argument.
*
* @param string $id
* @param null|array{expand?: string[], metadata?: null|array<string, string>} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Refund
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/refunds/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,60 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Reporting;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class ReportRunService extends \Stripe\Service\AbstractService
{
/**
* Returns a list of Report Runs, with the most recent appearing first.
*
* @param null|array{created?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Reporting\ReportRun>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[], parameters?: array{columns?: string[], connected_account?: string, currency?: string, interval_end?: int, interval_start?: int, payout?: string, reporting_category?: string, timezone?: string}, report_type: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Reporting\ReportRun
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Reporting\ReportRun
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/reporting/report_runs/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,45 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Reporting;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class ReportTypeService extends \Stripe\Service\AbstractService
{
/**
* Returns a full list of Report Types.
*
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Reporting\ReportType>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Reporting\ReportType
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/reporting/report_types/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,27 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Reporting;
/**
* Service factory class for API resources in the Reporting namespace.
*
* @property ReportRunService $reportRuns
* @property ReportTypeService $reportTypes
*/
class ReportingServiceFactory extends \Stripe\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;
}
}

View File

@@ -0,0 +1,63 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class ReviewService extends 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{created?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Review>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Review
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Review
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/reviews/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,58 @@
<?php
namespace Stripe\Service;
/**
* Trait for service factories or auxiliary services
* that have to navigate to other services.
*/
trait ServiceNavigatorTrait
{
/** @var array<string, AbstractService|AbstractServiceFactory> */
protected $services = [];
/** @var \Stripe\StripeClientInterface */
protected $client;
protected function getServiceClass($name)
{
\trigger_error('Undefined property: ' . static::class . '::$' . $name);
}
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;
}
/**
* @param string $name
*
* @return null|AbstractService|AbstractServiceFactory
*/
public function getService($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;
}
}

View File

@@ -0,0 +1,28 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class SetupAttemptService extends AbstractService
{
/**
* Returns a list of SetupAttempts that associate with a provided SetupIntent.
*
* @param null|array{created?: array|int, ending_before?: string, expand?: string[], limit?: int, setup_intent: string, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\SetupAttempt>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/setup_attempts', $params, $opts);
}
}

View File

@@ -0,0 +1,151 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class SetupIntentService extends AbstractService
{
/**
* Returns a list of SetupIntents.
*
* @param null|array{attach_to_self?: bool, created?: array|int, customer?: string, ending_before?: string, expand?: string[], limit?: int, payment_method?: string, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\SetupIntent>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/setup_intents', $params, $opts);
}
/**
* You can cancel a SetupIntent object when its in one of these statuses:
* <code>requires_payment_method</code>, <code>requires_confirmation</code>, or
* <code>requires_action</code>.
*
* After you cancel it, setup is abandoned and any operations on the SetupIntent
* fail with an error. You cant cancel the SetupIntent for a Checkout Session. <a
* href="/docs/api/checkout/sessions/expire">Expire the Checkout Session</a>
* instead.
*
* @param string $id
* @param null|array{cancellation_reason?: string, expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SetupIntent
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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
* or the <code>canceled</code> status if the confirmation limit is reached.
*
* @param string $id
* @param null|array{confirmation_token?: string, expand?: string[], mandate_data?: null|array{customer_acceptance?: array{accepted_at?: int, offline?: array{}, online?: array{ip_address?: string, user_agent?: string}, type: string}}, payment_method?: string, payment_method_data?: array{acss_debit?: array{account_number: string, institution_number: string, transit_number: string}, affirm?: array{}, afterpay_clearpay?: array{}, alipay?: array{}, allow_redisplay?: string, alma?: array{}, amazon_pay?: array{}, au_becs_debit?: array{account_number: string, bsb_number: string}, bacs_debit?: array{account_number?: string, sort_code?: string}, bancontact?: array{}, billie?: array{}, billing_details?: array{address?: null|array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, email?: null|string, name?: null|string, phone?: null|string, tax_id?: string}, blik?: array{}, boleto?: array{tax_id: string}, cashapp?: array{}, customer_balance?: array{}, eps?: array{bank?: string}, fpx?: array{account_holder_type?: string, bank: string}, giropay?: array{}, grabpay?: array{}, ideal?: array{bank?: string}, interac_present?: array{}, kakao_pay?: array{}, klarna?: array{dob?: array{day: int, month: int, year: int}}, konbini?: array{}, kr_card?: array{}, link?: array{}, metadata?: array<string, string>, mobilepay?: array{}, multibanco?: array{}, naver_pay?: array{funding?: string}, nz_bank_account?: array{account_holder_name?: string, account_number: string, bank_code: string, branch_code: string, reference?: string, suffix: string}, oxxo?: array{}, p24?: array{bank?: string}, pay_by_bank?: array{}, payco?: array{}, paynow?: array{}, paypal?: array{}, pix?: array{}, promptpay?: array{}, radar_options?: array{session?: string}, revolut_pay?: array{}, samsung_pay?: array{}, satispay?: array{}, sepa_debit?: array{iban: string}, sofort?: array{country: string}, swish?: array{}, twint?: array{}, type: string, us_bank_account?: array{account_holder_type?: string, account_number?: string, account_type?: string, financial_connections_account?: string, routing_number?: string}, wechat_pay?: array{}, zip?: array{}}, payment_method_options?: array{acss_debit?: array{currency?: string, mandate_options?: array{custom_mandate_url?: null|string, default_for?: string[], interval_description?: string, payment_schedule?: string, transaction_type?: string}, verification_method?: string}, amazon_pay?: array{}, bacs_debit?: array{mandate_options?: array{reference_prefix?: null|string}}, card?: array{mandate_options?: array{amount: int, amount_type: string, currency: string, description?: string, end_date?: int, interval: string, interval_count?: int, reference: string, start_date: int, supported_types?: string[]}, moto?: bool, network?: string, request_three_d_secure?: string, three_d_secure?: array{ares_trans_status?: string, cryptogram?: string, electronic_commerce_indicator?: string, network_options?: array{cartes_bancaires?: array{cb_avalgo: string, cb_exemption?: string, cb_score?: int}}, requestor_challenge_indicator?: string, transaction_id?: string, version?: string}}, card_present?: array{}, link?: array{persistent_token?: string}, paypal?: array{billing_agreement_id?: string}, sepa_debit?: array{mandate_options?: array{reference_prefix?: null|string}}, us_bank_account?: array{financial_connections?: array{filters?: array{account_subcategories?: string[]}, permissions?: string[], prefetch?: string[], return_url?: string}, mandate_options?: array{collection_method?: null|string}, networks?: array{requested?: string[]}, verification_method?: string}}, return_url?: string, use_stripe_sdk?: bool} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SetupIntent
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 you create the SetupIntent, attach a payment method and <a
* href="/docs/api/setup_intents/confirm">confirm</a> it to collect any required
* permissions to charge the payment method later.
*
* @param null|array{attach_to_self?: bool, automatic_payment_methods?: array{allow_redirects?: string, enabled: bool}, confirm?: bool, confirmation_token?: string, customer?: string, description?: string, expand?: string[], flow_directions?: string[], mandate_data?: null|array{customer_acceptance: array{accepted_at?: int, offline?: array{}, online?: array{ip_address: string, user_agent: string}, type: string}}, metadata?: array<string, string>, on_behalf_of?: string, payment_method?: string, payment_method_configuration?: string, payment_method_data?: array{acss_debit?: array{account_number: string, institution_number: string, transit_number: string}, affirm?: array{}, afterpay_clearpay?: array{}, alipay?: array{}, allow_redisplay?: string, alma?: array{}, amazon_pay?: array{}, au_becs_debit?: array{account_number: string, bsb_number: string}, bacs_debit?: array{account_number?: string, sort_code?: string}, bancontact?: array{}, billie?: array{}, billing_details?: array{address?: null|array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, email?: null|string, name?: null|string, phone?: null|string, tax_id?: string}, blik?: array{}, boleto?: array{tax_id: string}, cashapp?: array{}, customer_balance?: array{}, eps?: array{bank?: string}, fpx?: array{account_holder_type?: string, bank: string}, giropay?: array{}, grabpay?: array{}, ideal?: array{bank?: string}, interac_present?: array{}, kakao_pay?: array{}, klarna?: array{dob?: array{day: int, month: int, year: int}}, konbini?: array{}, kr_card?: array{}, link?: array{}, metadata?: array<string, string>, mobilepay?: array{}, multibanco?: array{}, naver_pay?: array{funding?: string}, nz_bank_account?: array{account_holder_name?: string, account_number: string, bank_code: string, branch_code: string, reference?: string, suffix: string}, oxxo?: array{}, p24?: array{bank?: string}, pay_by_bank?: array{}, payco?: array{}, paynow?: array{}, paypal?: array{}, pix?: array{}, promptpay?: array{}, radar_options?: array{session?: string}, revolut_pay?: array{}, samsung_pay?: array{}, satispay?: array{}, sepa_debit?: array{iban: string}, sofort?: array{country: string}, swish?: array{}, twint?: array{}, type: string, us_bank_account?: array{account_holder_type?: string, account_number?: string, account_type?: string, financial_connections_account?: string, routing_number?: string}, wechat_pay?: array{}, zip?: array{}}, payment_method_options?: array{acss_debit?: array{currency?: string, mandate_options?: array{custom_mandate_url?: null|string, default_for?: string[], interval_description?: string, payment_schedule?: string, transaction_type?: string}, verification_method?: string}, amazon_pay?: array{}, bacs_debit?: array{mandate_options?: array{reference_prefix?: null|string}}, card?: array{mandate_options?: array{amount: int, amount_type: string, currency: string, description?: string, end_date?: int, interval: string, interval_count?: int, reference: string, start_date: int, supported_types?: string[]}, moto?: bool, network?: string, request_three_d_secure?: string, three_d_secure?: array{ares_trans_status?: string, cryptogram?: string, electronic_commerce_indicator?: string, network_options?: array{cartes_bancaires?: array{cb_avalgo: string, cb_exemption?: string, cb_score?: int}}, requestor_challenge_indicator?: string, transaction_id?: string, version?: string}}, card_present?: array{}, link?: array{persistent_token?: string}, paypal?: array{billing_agreement_id?: string}, sepa_debit?: array{mandate_options?: array{reference_prefix?: null|string}}, us_bank_account?: array{financial_connections?: array{filters?: array{account_subcategories?: string[]}, permissions?: string[], prefetch?: string[], return_url?: string}, mandate_options?: array{collection_method?: null|string}, networks?: array{requested?: string[]}, verification_method?: string}}, payment_method_types?: string[], return_url?: string, single_use?: array{amount: int, currency: string}, usage?: string, use_stripe_sdk?: bool} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SetupIntent
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{client_secret?: string, expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SetupIntent
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{attach_to_self?: bool, customer?: string, description?: string, expand?: string[], flow_directions?: string[], metadata?: null|array<string, string>, payment_method?: string, payment_method_configuration?: string, payment_method_data?: array{acss_debit?: array{account_number: string, institution_number: string, transit_number: string}, affirm?: array{}, afterpay_clearpay?: array{}, alipay?: array{}, allow_redisplay?: string, alma?: array{}, amazon_pay?: array{}, au_becs_debit?: array{account_number: string, bsb_number: string}, bacs_debit?: array{account_number?: string, sort_code?: string}, bancontact?: array{}, billie?: array{}, billing_details?: array{address?: null|array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, email?: null|string, name?: null|string, phone?: null|string, tax_id?: string}, blik?: array{}, boleto?: array{tax_id: string}, cashapp?: array{}, customer_balance?: array{}, eps?: array{bank?: string}, fpx?: array{account_holder_type?: string, bank: string}, giropay?: array{}, grabpay?: array{}, ideal?: array{bank?: string}, interac_present?: array{}, kakao_pay?: array{}, klarna?: array{dob?: array{day: int, month: int, year: int}}, konbini?: array{}, kr_card?: array{}, link?: array{}, metadata?: array<string, string>, mobilepay?: array{}, multibanco?: array{}, naver_pay?: array{funding?: string}, nz_bank_account?: array{account_holder_name?: string, account_number: string, bank_code: string, branch_code: string, reference?: string, suffix: string}, oxxo?: array{}, p24?: array{bank?: string}, pay_by_bank?: array{}, payco?: array{}, paynow?: array{}, paypal?: array{}, pix?: array{}, promptpay?: array{}, radar_options?: array{session?: string}, revolut_pay?: array{}, samsung_pay?: array{}, satispay?: array{}, sepa_debit?: array{iban: string}, sofort?: array{country: string}, swish?: array{}, twint?: array{}, type: string, us_bank_account?: array{account_holder_type?: string, account_number?: string, account_type?: string, financial_connections_account?: string, routing_number?: string}, wechat_pay?: array{}, zip?: array{}}, payment_method_options?: array{acss_debit?: array{currency?: string, mandate_options?: array{custom_mandate_url?: null|string, default_for?: string[], interval_description?: string, payment_schedule?: string, transaction_type?: string}, verification_method?: string}, amazon_pay?: array{}, bacs_debit?: array{mandate_options?: array{reference_prefix?: null|string}}, card?: array{mandate_options?: array{amount: int, amount_type: string, currency: string, description?: string, end_date?: int, interval: string, interval_count?: int, reference: string, start_date: int, supported_types?: string[]}, moto?: bool, network?: string, request_three_d_secure?: string, three_d_secure?: array{ares_trans_status?: string, cryptogram?: string, electronic_commerce_indicator?: string, network_options?: array{cartes_bancaires?: array{cb_avalgo: string, cb_exemption?: string, cb_score?: int}}, requestor_challenge_indicator?: string, transaction_id?: string, version?: string}}, card_present?: array{}, link?: array{persistent_token?: string}, paypal?: array{billing_agreement_id?: string}, sepa_debit?: array{mandate_options?: array{reference_prefix?: null|string}}, us_bank_account?: array{financial_connections?: array{filters?: array{account_subcategories?: string[]}, permissions?: string[], prefetch?: string[], return_url?: string}, mandate_options?: array{collection_method?: null|string}, networks?: array{requested?: string[]}, verification_method?: string}}, payment_method_types?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SetupIntent
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{amounts?: int[], descriptor_code?: string, expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SetupIntent
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function verifyMicrodeposits($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/setup_intents/%s/verify_microdeposits', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,75 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class ShippingRateService extends AbstractService
{
/**
* Returns a list of your shipping rates.
*
* @param null|array{active?: bool, created?: array|int, currency?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\ShippingRate>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{delivery_estimate?: array{maximum?: array{unit: string, value: int}, minimum?: array{unit: string, value: int}}, display_name: string, expand?: string[], fixed_amount?: array{amount: int, currency: string, currency_options?: array<string, array{amount: int, tax_behavior?: string}>}, metadata?: array<string, string>, tax_behavior?: string, tax_code?: string, type?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\ShippingRate
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\ShippingRate
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{active?: bool, expand?: string[], fixed_amount?: array{currency_options?: array<string, array{amount?: int, tax_behavior?: string}>}, metadata?: null|array<string, string>, tax_behavior?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\ShippingRate
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/shipping_rates/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,44 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Sigma;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class ScheduledQueryRunService extends \Stripe\Service\AbstractService
{
/**
* Returns a list of scheduled query runs.
*
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Sigma\ScheduledQueryRun>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Sigma\ScheduledQueryRun
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/sigma/scheduled_query_runs/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,25 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Sigma;
/**
* Service factory class for API resources in the Sigma namespace.
*
* @property ScheduledQueryRunService $scheduledQueryRuns
*/
class SigmaServiceFactory extends \Stripe\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;
}
}

View File

@@ -0,0 +1,117 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class SourceService extends AbstractService
{
/**
* List source transactions for a given source.
*
* @param string $id
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\SourceTransaction>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{amount?: int, currency?: string, customer?: string, expand?: string[], flow?: string, mandate?: array{acceptance?: array{date?: int, ip?: string, offline?: array{contact_email: string}, online?: array{date?: int, ip?: string, user_agent?: string}, status: string, type?: string, user_agent?: string}, amount?: null|int, currency?: string, interval?: string, notification_method?: string}, metadata?: array<string, string>, original_source?: string, owner?: array{address?: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, email?: string, name?: string, phone?: string}, receiver?: array{refund_attributes_method?: string}, redirect?: array{return_url: string}, source_order?: array{items?: array{amount?: int, currency?: string, description?: string, parent?: string, quantity?: int, type?: string}[], shipping?: array{address: array{city?: string, country?: string, line1: string, line2?: string, postal_code?: string, state?: string}, carrier?: string, name?: string, phone?: string, tracking_number?: string}}, statement_descriptor?: string, token?: string, type?: string, usage?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Source
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Account|\Stripe\BankAccount|\Stripe\Card|\Stripe\Source
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{client_secret?: string, expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Source
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{amount?: int, expand?: string[], mandate?: array{acceptance?: array{date?: int, ip?: string, offline?: array{contact_email: string}, online?: array{date?: int, ip?: string, user_agent?: string}, status: string, type?: string, user_agent?: string}, amount?: null|int, currency?: string, interval?: string, notification_method?: string}, metadata?: null|array<string, string>, owner?: array{address?: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, email?: string, name?: string, phone?: string}, source_order?: array{items?: array{amount?: int, currency?: string, description?: string, parent?: string, quantity?: int, type?: string}[], shipping?: array{address: array{city?: string, country?: string, line1: string, line2?: string, postal_code?: string, state?: string}, carrier?: string, name?: string, phone?: string, tracking_number?: string}}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Source
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[], values: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Source
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function verify($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/sources/%s/verify', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,93 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class SubscriptionItemService extends AbstractService
{
/**
* Returns a list of your subscription items for a given subscription.
*
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string, subscription: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\SubscriptionItem>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/subscription_items', $params, $opts);
}
/**
* Adds a new item to an existing subscription. No existing items will be changed
* or replaced.
*
* @param null|array{billing_thresholds?: null|array{usage_gte: int}, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], expand?: string[], metadata?: array<string, string>, payment_behavior?: string, plan?: string, price?: string, price_data?: array{currency: string, product: string, recurring: array{interval: string, interval_count?: int}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, proration_behavior?: string, proration_date?: int, quantity?: int, subscription: string, tax_rates?: null|string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SubscriptionItem
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/subscription_items', $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{clear_usage?: bool, proration_behavior?: string, proration_date?: int} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SubscriptionItem
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SubscriptionItem
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{billing_thresholds?: null|array{usage_gte: int}, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], expand?: string[], metadata?: null|array<string, string>, off_session?: bool, payment_behavior?: string, plan?: string, price?: string, price_data?: array{currency: string, product: string, recurring: array{interval: string, interval_count?: int}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, proration_behavior?: string, proration_date?: int, quantity?: int, tax_rates?: null|string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SubscriptionItem
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/subscription_items/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,118 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class SubscriptionScheduleService extends AbstractService
{
/**
* Retrieves the list of your subscription schedules.
*
* @param null|array{canceled_at?: array|int, completed_at?: array|int, created?: array|int, customer?: string, ending_before?: string, expand?: string[], limit?: int, released_at?: array|int, scheduled?: bool, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\SubscriptionSchedule>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[], invoice_now?: bool, prorate?: bool} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SubscriptionSchedule
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{customer?: string, default_settings?: array{application_fee_percent?: float, automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, billing_cycle_anchor?: string, billing_thresholds?: null|array{amount_gte?: int, reset_billing_cycle_anchor?: bool}, collection_method?: string, default_payment_method?: string, description?: null|string, invoice_settings?: array{account_tax_ids?: null|string[], days_until_due?: int, issuer?: array{account?: string, type: string}}, on_behalf_of?: null|string, transfer_data?: null|array{amount_percent?: float, destination: string}}, end_behavior?: string, expand?: string[], from_subscription?: string, metadata?: null|array<string, string>, phases?: (array{add_invoice_items?: (array{discounts?: array{coupon?: string, discount?: string, promotion_code?: string}[], price?: string, price_data?: array{currency: string, product: string, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_rates?: null|string[]})[], application_fee_percent?: float, automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, billing_cycle_anchor?: string, billing_thresholds?: null|array{amount_gte?: int, reset_billing_cycle_anchor?: bool}, collection_method?: string, currency?: string, default_payment_method?: string, default_tax_rates?: null|string[], description?: null|string, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], end_date?: int, invoice_settings?: array{account_tax_ids?: null|string[], days_until_due?: int, issuer?: array{account?: string, type: string}}, items: (array{billing_thresholds?: null|array{usage_gte: int}, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], metadata?: array<string, string>, plan?: string, price?: string, price_data?: array{currency: string, product: string, recurring: array{interval: string, interval_count?: int}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_rates?: null|string[]})[], iterations?: int, metadata?: array<string, string>, on_behalf_of?: string, proration_behavior?: string, transfer_data?: array{amount_percent?: float, destination: string}, trial?: bool, trial_end?: int})[], start_date?: array|int|string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SubscriptionSchedule
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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 subscriptions
* ID to the <code>released_subscription</code> property.
*
* @param string $id
* @param null|array{expand?: string[], preserve_cancel_date?: bool} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SubscriptionSchedule
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SubscriptionSchedule
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{default_settings?: array{application_fee_percent?: float, automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, billing_cycle_anchor?: string, billing_thresholds?: null|array{amount_gte?: int, reset_billing_cycle_anchor?: bool}, collection_method?: string, default_payment_method?: string, description?: null|string, invoice_settings?: array{account_tax_ids?: null|string[], days_until_due?: int, issuer?: array{account?: string, type: string}}, on_behalf_of?: null|string, transfer_data?: null|array{amount_percent?: float, destination: string}}, end_behavior?: string, expand?: string[], metadata?: null|array<string, string>, phases?: (array{add_invoice_items?: (array{discounts?: array{coupon?: string, discount?: string, promotion_code?: string}[], price?: string, price_data?: array{currency: string, product: string, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_rates?: null|string[]})[], application_fee_percent?: float, automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, billing_cycle_anchor?: string, billing_thresholds?: null|array{amount_gte?: int, reset_billing_cycle_anchor?: bool}, collection_method?: string, currency?: string, default_payment_method?: string, default_tax_rates?: null|string[], description?: null|string, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], end_date?: array|int|string, invoice_settings?: array{account_tax_ids?: null|string[], days_until_due?: int, issuer?: array{account?: string, type: string}}, items: (array{billing_thresholds?: null|array{usage_gte: int}, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], metadata?: array<string, string>, plan?: string, price?: string, price_data?: array{currency: string, product: string, recurring: array{interval: string, interval_count?: int}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_rates?: null|string[]})[], iterations?: int, metadata?: array<string, string>, on_behalf_of?: string, proration_behavior?: string, start_date?: array|int|string, transfer_data?: array{amount_percent?: float, destination: string}, trial?: bool, trial_end?: array|int|string})[], proration_behavior?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SubscriptionSchedule
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/subscription_schedules/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,225 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class SubscriptionService extends 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{automatic_tax?: array{enabled: bool}, collection_method?: string, created?: array|int, current_period_end?: array|int, current_period_start?: array|int, customer?: string, ending_before?: string, expand?: string[], limit?: int, plan?: string, price?: string, starting_after?: string, status?: string, test_clock?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Subscription>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/subscriptions', $params, $opts);
}
/**
* Cancels a customers subscription immediately. The customer wont be charged
* again for the subscription. After its canceled, you can no longer update the
* subscription or its <a href="/metadata">metadata</a>.
*
* Any pending invoice items that youve created are still charged at the end of
* the period, unless manually <a href="#delete_invoiceitem">deleted</a>. If youve
* set the subscription to cancel at the end of the period, any pending prorations
* are also left in place and collected at the end of the period. But if the
* subscription is set to cancel immediately, pending prorations are removed if
* <code>invoice_now</code> and <code>prorate</code> are both set to true.
*
* By default, upon subscription cancellation, Stripe stops 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{cancellation_details?: array{comment?: null|string, feedback?: null|string}, expand?: string[], invoice_now?: bool, prorate?: bool} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Subscription
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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{add_invoice_items?: (array{discounts?: array{coupon?: string, discount?: string, promotion_code?: string}[], price?: string, price_data?: array{currency: string, product: string, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_rates?: null|string[]})[], application_fee_percent?: null|float, automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, backdate_start_date?: int, billing_cycle_anchor?: int, billing_cycle_anchor_config?: array{day_of_month: int, hour?: int, minute?: int, month?: int, second?: int}, billing_thresholds?: null|array{amount_gte?: int, reset_billing_cycle_anchor?: bool}, cancel_at?: int, cancel_at_period_end?: bool, collection_method?: string, currency?: string, customer: string, days_until_due?: int, default_payment_method?: string, default_source?: string, default_tax_rates?: null|string[], description?: string, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], expand?: string[], invoice_settings?: array{account_tax_ids?: null|string[], issuer?: array{account?: string, type: string}}, items?: (array{billing_thresholds?: null|array{usage_gte: int}, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], metadata?: array<string, string>, plan?: string, price?: string, price_data?: array{currency: string, product: string, recurring: array{interval: string, interval_count?: int}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_rates?: null|string[]})[], metadata?: null|array<string, string>, off_session?: bool, on_behalf_of?: null|string, payment_behavior?: string, payment_settings?: array{payment_method_options?: array{acss_debit?: null|array{mandate_options?: array{transaction_type?: string}, verification_method?: string}, bancontact?: null|array{preferred_language?: string}, card?: null|array{mandate_options?: array{amount?: int, amount_type?: string, description?: string}, network?: string, request_three_d_secure?: string}, customer_balance?: null|array{bank_transfer?: array{eu_bank_transfer?: array{country: string}, type?: string}, funding_type?: string}, konbini?: null|array{}, sepa_debit?: null|array{}, us_bank_account?: null|array{financial_connections?: array{filters?: array{account_subcategories?: string[]}, permissions?: string[], prefetch?: string[]}, verification_method?: string}}, payment_method_types?: null|string[], save_default_payment_method?: string}, pending_invoice_item_interval?: null|array{interval: string, interval_count?: int}, proration_behavior?: string, transfer_data?: array{amount_percent?: float, destination: string}, trial_end?: array|int|string, trial_from_plan?: bool, trial_period_days?: int, trial_settings?: array{end_behavior: array{missing_payment_method: string}}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Subscription
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
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|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Discount
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function deleteDiscount($id, $params = null, $opts = null)
{
return $this->request('delete', $this->buildPath('/v1/subscriptions/%s/discount', $id), $params, $opts);
}
/**
* Initiates resumption of a paused subscription, optionally resetting the billing
* cycle anchor and creating prorations. If a resumption invoice is generated, it
* must be paid or marked uncollectible before the subscription will be unpaused.
* If payment succeeds the subscription will become <code>active</code>, and if
* payment fails the subscription will be <code>past_due</code>. The resumption
* invoice will void automatically if not paid by the expiration date.
*
* @param string $id
* @param null|array{billing_cycle_anchor?: string, expand?: string[], proration_behavior?: string, proration_date?: int} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Subscription
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function resume($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/subscriptions/%s/resume', $id), $params, $opts);
}
/**
* Retrieves the subscription with the given ID.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Subscription
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/subscriptions/%s', $id), $params, $opts);
}
/**
* Search for subscriptions youve previously created using Stripes <a
* href="/docs/search#search-query-language">Search Query Language</a>. Dont 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{expand?: string[], limit?: int, page?: string, query: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\SearchResult<\Stripe\Subscription>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function search($params = null, $opts = null)
{
return $this->requestSearchResult('get', '/v1/subscriptions/search', $params, $opts);
}
/**
* Updates an existing subscription to match the specified parameters. When
* changing prices or quantities, we optionally prorate the price we charge next
* month to make up for any price changes. To preview how the proration is
* calculated, use the <a href="/docs/api/invoices/create_preview">create
* preview</a> endpoint.
*
* By default, we prorate subscription changes. For example, if a customer signs up
* on May 1 for a <currency>100</currency> price, theyll be billed
* <currency>100</currency> immediately. If on May 15 they switch to a
* <currency>200</currency> price, then on June 1 theyll be billed
* <currency>250</currency> (<currency>200</currency> for a renewal of her
* subscription, plus a <currency>50</currency> prorating adjustment for half of
* the previous months <currency>100</currency> difference). Similarly, a
* downgrade generates a credit that is applied to the next invoice. We also
* prorate when you make quantity changes.
*
* Switching prices does not normally change the billing date or generate an
* immediate charge unless:
*
* <ul> <li>The billing interval is changed (for example, from monthly to
* yearly).</li> <li>The subscription moves from free to paid.</li> <li>A trial
* starts or ends.</li> </ul>
*
* In these cases, we apply a credit for the unused time on the previous price,
* immediately charge the customer using the new price, and reset the billing date.
* Learn about how <a
* href="/docs/billing/subscriptions/upgrade-downgrade#immediate-payment">Stripe
* immediately attempts payment for subscription changes</a>.
*
* If you want to charge for an upgrade immediately, pass
* <code>proration_behavior</code> as <code>always_invoice</code> to create
* prorations, automatically invoice the customer for those proration adjustments,
* and attempt to collect payment. If you pass <code>create_prorations</code>, the
* prorations are created but not automatically invoiced. If you want to bill the
* customer for the prorations before the subscriptions renewal date, you need to
* manually <a href="/docs/api/invoices/create">invoice the customer</a>.
*
* If you dont want to prorate, set the <code>proration_behavior</code> option to
* <code>none</code>. With this option, the customer is billed
* <currency>100</currency> on May 1 and <currency>200</currency> on June 1.
* Similarly, if you set <code>proration_behavior</code> to <code>none</code> when
* switching between different billing intervals (for example, from monthly to
* yearly), we dont generate any credits for the old subscriptions unused time.
* We still reset the billing date and bill immediately for the new subscription.
*
* Updating the quantity on a subscription many times in an hour may result in <a
* href="/docs/rate-limits">rate limiting</a>. If you need to bill for a frequently
* changing quantity, consider integrating <a
* href="/docs/billing/subscriptions/usage-based">usage-based billing</a> instead.
*
* @param string $id
* @param null|array{add_invoice_items?: (array{discounts?: array{coupon?: string, discount?: string, promotion_code?: string}[], price?: string, price_data?: array{currency: string, product: string, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_rates?: null|string[]})[], application_fee_percent?: null|float, automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, billing_cycle_anchor?: string, billing_thresholds?: null|array{amount_gte?: int, reset_billing_cycle_anchor?: bool}, cancel_at?: null|int, cancel_at_period_end?: bool, cancellation_details?: array{comment?: null|string, feedback?: null|string}, collection_method?: string, days_until_due?: int, default_payment_method?: string, default_source?: null|string, default_tax_rates?: null|string[], description?: null|string, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], expand?: string[], invoice_settings?: array{account_tax_ids?: null|string[], issuer?: array{account?: string, type: string}}, items?: (array{billing_thresholds?: null|array{usage_gte: int}, clear_usage?: bool, deleted?: bool, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], id?: string, metadata?: null|array<string, string>, plan?: string, price?: string, price_data?: array{currency: string, product: string, recurring: array{interval: string, interval_count?: int}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_rates?: null|string[]})[], metadata?: null|array<string, string>, off_session?: bool, on_behalf_of?: null|string, pause_collection?: null|array{behavior: string, resumes_at?: int}, payment_behavior?: string, payment_settings?: array{payment_method_options?: array{acss_debit?: null|array{mandate_options?: array{transaction_type?: string}, verification_method?: string}, bancontact?: null|array{preferred_language?: string}, card?: null|array{mandate_options?: array{amount?: int, amount_type?: string, description?: string}, network?: string, request_three_d_secure?: string}, customer_balance?: null|array{bank_transfer?: array{eu_bank_transfer?: array{country: string}, type?: string}, funding_type?: string}, konbini?: null|array{}, sepa_debit?: null|array{}, us_bank_account?: null|array{financial_connections?: array{filters?: array{account_subcategories?: string[]}, permissions?: string[], prefetch?: string[]}, verification_method?: string}}, payment_method_types?: null|string[], save_default_payment_method?: string}, pending_invoice_item_interval?: null|array{interval: string, interval_count?: int}, proration_behavior?: string, proration_date?: int, transfer_data?: null|array{amount_percent?: float, destination: string}, trial_end?: array|int|string, trial_from_plan?: bool, trial_settings?: array{end_behavior: array{missing_payment_method: string}}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Subscription
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/subscriptions/%s', $id), $params, $opts);
}
}

View File

@@ -0,0 +1,63 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\Tax;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class CalculationService extends \Stripe\Service\AbstractService
{
/**
* Retrieves the line items of a tax calculation as a collection, if the
* calculation hasnt expired.
*
* @param string $id
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Collection<\Stripe\Tax\CalculationLineItem>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function allLineItems($id, $params = null, $opts = null)
{
return $this->requestCollection('get', $this->buildPath('/v1/tax/calculations/%s/line_items', $id), $params, $opts);
}
/**
* Calculates tax based on the input and returns a Tax <code>Calculation</code>
* object.
*
* @param null|array{currency: string, customer?: string, customer_details?: array{address?: array{city?: null|string, country: string, line1?: null|string, line2?: null|string, postal_code?: null|string, state?: null|string}, address_source?: string, ip_address?: string, tax_ids?: array{type: string, value: string}[], taxability_override?: string}, expand?: string[], line_items: array{amount: int, metadata?: array<string, string>, product?: string, quantity?: int, reference?: string, tax_behavior?: string, tax_code?: string}[], ship_from_details?: array{address: array{city?: null|string, country: string, line1?: null|string, line2?: null|string, postal_code?: null|string, state?: null|string}}, shipping_cost?: array{amount?: int, shipping_rate?: string, tax_behavior?: string, tax_code?: string}, tax_date?: int} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Tax\Calculation
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/tax/calculations', $params, $opts);
}
/**
* Retrieves a Tax <code>Calculation</code> object, if the calculation hasnt
* expired.
*
* @param string $id
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @return \Stripe\Tax\Calculation
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/tax/calculations/%s', $id), $params, $opts);
}
}

Some files were not shown because too many files have changed in this diff Show More