code
stringlengths
15
9.96M
docstring
stringlengths
1
10.1k
func_name
stringlengths
1
124
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
6
186
url
stringlengths
50
236
license
stringclasses
4 values
public function getMaxNetworkRetries() { return $this->config['max_network_retries']; }
Gets the configured number of retries. @return int the number of times this client will retry failed requests
getMaxNetworkRetries
php
stripe/stripe-php
lib/BaseStripeClient.php
https://github.com/stripe/stripe-php/blob/master/lib/BaseStripeClient.php
MIT
public function getAppInfo() { return $this->config['app_info']; }
Gets the app info for this client. @return null|array information to identify a plugin that integrates Stripe using this library
getAppInfo
php
stripe/stripe-php
lib/BaseStripeClient.php
https://github.com/stripe/stripe-php/blob/master/lib/BaseStripeClient.php
MIT
public function request($method, $path, $params, $opts) { $defaultRequestOpts = $this->defaultOpts; $apiMode = Util::getApiMode($path); $opts = $defaultRequestOpts->merge($opts, true); $baseUrl = $opts->apiBase ?: $this->getApiBase(); $requestor = new ApiRequestor($this->apiKeyForRequest($opts), $baseUrl, $this->getAppInfo()); list($response, $opts->apiKey) = $requestor->request($method, $path, $params, $opts->headers, $apiMode, ['stripe_client'], $opts->maxNetworkRetries); $opts->discardNonPersistentHeaders(); $obj = Util::convertToStripeObject($response->json, $opts, $apiMode); if (\is_array($obj)) { // Edge case for v2 endpoints that return empty/void response // Example: client->v2->billing->meterEventStream->create $obj = new StripeObject(); } $obj->setLastResponse($response); return $obj; }
Sends a request to Stripe's 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 StripeObject the object returned by Stripe's API
request
php
stripe/stripe-php
lib/BaseStripeClient.php
https://github.com/stripe/stripe-php/blob/master/lib/BaseStripeClient.php
MIT
public function rawRequest($method, $path, $params = null, $opts = [], $maxNetworkRetries = null) { if ('post' !== $method && null !== $params) { throw new Exception\InvalidArgumentException('Error: rawRequest only supports $params on post requests. Please pass null and add your parameters to $path'); } $apiMode = Util::getApiMode($path); $headers = []; if (\is_array($opts) && \array_key_exists('headers', $opts)) { $headers = $opts['headers'] ?: []; unset($opts['headers']); } if (\is_array($opts) && \array_key_exists('stripe_context', $opts)) { $headers['Stripe-Context'] = $opts['stripe_context']; unset($opts['stripe_context']); } $defaultRawRequestOpts = $this->defaultOpts; $opts = $defaultRawRequestOpts->merge($opts, true); // Concatenate $headers to $opts->headers, removing duplicates. $opts->headers = \array_merge($opts->headers, $headers); $baseUrl = $opts->apiBase ?: $this->getApiBase(); $requestor = new ApiRequestor($this->apiKeyForRequest($opts), $baseUrl); list($response) = $requestor->request($method, $path, $params, $opts->headers, $apiMode, ['raw_request'], $maxNetworkRetries); return $response; }
Sends a raw request to Stripe's API. This is the lowest level method for interacting with the Stripe API. This method is useful for interacting with endpoints that are not covered yet in stripe-php. @param 'delete'|'get'|'post' $method the HTTP method @param string $path the path of the request @param null|array $params the parameters of the request @param array $opts the special modifiers of the request @param null|int $maxNetworkRetries @return ApiResponse
rawRequest
php
stripe/stripe-php
lib/BaseStripeClient.php
https://github.com/stripe/stripe-php/blob/master/lib/BaseStripeClient.php
MIT
public function requestStream($method, $path, $readBodyChunkCallable, $params, $opts) { $opts = $this->defaultOpts->merge($opts, true); $baseUrl = $opts->apiBase ?: $this->getApiBase(); $requestor = new ApiRequestor($this->apiKeyForRequest($opts), $baseUrl, $this->getAppInfo()); $apiMode = Util::getApiMode($path); list($response, $opts->apiKey) = $requestor->requestStream($method, $path, $readBodyChunkCallable, $params, $opts->headers, $apiMode, ['stripe_client']); }
Sends a request to Stripe's API, passing chunks of the streamed response into a user-provided $readBodyChunkCallable callback. @param 'delete'|'get'|'post' $method the HTTP method @param string $path the path of the request @param callable $readBodyChunkCallable a function that will be called @param array $params the parameters of the request @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request with chunks of bytes from the body if the request is successful
requestStream
php
stripe/stripe-php
lib/BaseStripeClient.php
https://github.com/stripe/stripe-php/blob/master/lib/BaseStripeClient.php
MIT
public function requestCollection($method, $path, $params, $opts) { $obj = $this->request($method, $path, $params, $opts); $apiMode = Util::getApiMode($path); if ('v1' === $apiMode) { if (!$obj instanceof Collection) { $received_class = \get_class($obj); $msg = "Expected to receive `Stripe\\Collection` object from Stripe API. Instead received `{$received_class}`."; throw new Exception\UnexpectedValueException($msg); } $obj->setFilters($params); } else { if (!$obj instanceof V2\Collection) { $received_class = \get_class($obj); $msg = "Expected to receive `Stripe\\V2\\Collection` object from Stripe API. Instead received `{$received_class}`."; throw new Exception\UnexpectedValueException($msg); } } return $obj; }
Sends a request to Stripe's 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 Collection|V2\Collection of ApiResources
requestCollection
php
stripe/stripe-php
lib/BaseStripeClient.php
https://github.com/stripe/stripe-php/blob/master/lib/BaseStripeClient.php
MIT
public function requestSearchResult($method, $path, $params, $opts) { $obj = $this->request($method, $path, $params, $opts); if (!$obj instanceof SearchResult) { $received_class = \get_class($obj); $msg = "Expected to receive `Stripe\\SearchResult` object from Stripe API. Instead received `{$received_class}`."; throw new Exception\UnexpectedValueException($msg); } $obj->setFilters($params); return $obj; }
Sends a request to Stripe's 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 SearchResult of ApiResources
requestSearchResult
php
stripe/stripe-php
lib/BaseStripeClient.php
https://github.com/stripe/stripe-php/blob/master/lib/BaseStripeClient.php
MIT
private function apiKeyForRequest($opts) { $apiKey = $opts->apiKey ?: $this->getApiKey(); if (null === $apiKey) { $msg = 'No API key provided. Set your API key when constructing the ' . 'StripeClient instance, or provide it on a per-request basis ' . 'using the `api_key` key in the $opts argument.'; throw new Exception\AuthenticationException($msg); } return $apiKey; }
@param \Stripe\Util\RequestOptions $opts @return string @throws Exception\AuthenticationException
apiKeyForRequest
php
stripe/stripe-php
lib/BaseStripeClient.php
https://github.com/stripe/stripe-php/blob/master/lib/BaseStripeClient.php
MIT
private function validateConfig($config) { // api_key if (null !== $config['api_key'] && !\is_string($config['api_key'])) { throw new Exception\InvalidArgumentException('api_key must be null or a string'); } if (null !== $config['api_key'] && ('' === $config['api_key'])) { $msg = 'api_key cannot be the empty string'; throw new Exception\InvalidArgumentException($msg); } if (null !== $config['api_key'] && \preg_match('/\s/', $config['api_key'])) { $msg = 'api_key cannot contain whitespace'; throw new Exception\InvalidArgumentException($msg); } // client_id if (null !== $config['client_id'] && !\is_string($config['client_id'])) { throw new Exception\InvalidArgumentException('client_id must be null or a string'); } // stripe_account if (null !== $config['stripe_account'] && !\is_string($config['stripe_account'])) { throw new Exception\InvalidArgumentException('stripe_account must be null or a string'); } // stripe_context if (null !== $config['stripe_context'] && !\is_string($config['stripe_context'])) { throw new Exception\InvalidArgumentException('stripe_context must be null or a string'); } // stripe_version if (null !== $config['stripe_version'] && !\is_string($config['stripe_version'])) { throw new Exception\InvalidArgumentException('stripe_version must be null or a string'); } // api_base if (!\is_string($config['api_base'])) { throw new Exception\InvalidArgumentException('api_base must be a string'); } // connect_base if (!\is_string($config['connect_base'])) { throw new Exception\InvalidArgumentException('connect_base must be a string'); } // files_base if (!\is_string($config['files_base'])) { throw new Exception\InvalidArgumentException('files_base must be a string'); } // app info if (null !== $config['app_info'] && !\is_array($config['app_info'])) { throw new Exception\InvalidArgumentException('app_info must be an array'); } // max_network_retries if (!\is_int($config['max_network_retries'])) { throw new Exception\InvalidArgumentException('max_network_retries must an int'); } $appInfoKeys = ['name', 'version', 'url', 'partner_id']; if (null !== $config['app_info'] && array_diff_key($config['app_info'], array_flip($appInfoKeys))) { $msg = 'app_info must be of type array{name: string, version?: string, url?: string, partner_id?: string}'; throw new Exception\InvalidArgumentException($msg); } // check absence of extra keys $extraConfigKeys = \array_diff(\array_keys($config), \array_keys(self::DEFAULT_CONFIG)); if (!empty($extraConfigKeys)) { // Wrap in single quote to more easily catch trailing spaces errors $invalidKeys = "'" . \implode("', '", $extraConfigKeys) . "'"; throw new Exception\InvalidArgumentException('Found unknown key(s) in configuration array: ' . $invalidKeys); } }
@param array<string, mixed> $config @throws Exception\InvalidArgumentException
validateConfig
php
stripe/stripe-php
lib/BaseStripeClient.php
https://github.com/stripe/stripe-php/blob/master/lib/BaseStripeClient.php
MIT
public function deserialize($json, $apiMode = 'v1') { return Util::convertToStripeObject(\json_decode($json, true), [], $apiMode); }
Deserializes the raw JSON string returned by rawRequest into a similar class. @param string $json @param 'v1'|'v2' $apiMode @return StripeObject
deserialize
php
stripe/stripe-php
lib/BaseStripeClient.php
https://github.com/stripe/stripe-php/blob/master/lib/BaseStripeClient.php
MIT
public function parseThinEvent($payload, $sigHeader, $secret, $tolerance = Webhook::DEFAULT_TOLERANCE) { $eventData = Util::utf8($payload); WebhookSignature::verifyHeader($payload, $sigHeader, $secret, $tolerance); try { return Util::json_decode_thin_event_object( $eventData, '\Stripe\ThinEvent' ); } catch (\ReflectionException $e) { // Fail gracefully return new ThinEvent(); } }
Returns a V2\Events instance using the provided JSON payload. Throws an Exception\UnexpectedValueException if the payload is not valid JSON, and an Exception\SignatureVerificationException if the signature verification fails for any reason. @param string $payload the payload sent by Stripe @param string $sigHeader the contents of the signature header sent by Stripe @param string $secret secret used to generate the signature @param int $tolerance maximum difference allowed between the header's timestamp and the current time. Defaults to 300 seconds (5 min) @return ThinEvent @throws Exception\SignatureVerificationException if the verification fails @throws Exception\UnexpectedValueException if the payload is not valid JSON,
parseThinEvent
php
stripe/stripe-php
lib/BaseStripeClient.php
https://github.com/stripe/stripe-php/blob/master/lib/BaseStripeClient.php
MIT
public static function create($params = null, $options = null) { self::_validateParams($params); $url = static::classUrl(); list($response, $opts) = static::_staticRequest('post', $url, $params, $options); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
To send funds from your Stripe account to a connected account, you create a new transfer object. Your <a href="#balance">Stripe balance</a> must be able to cover the transfer amount, or you’ll receive an “Insufficient Funds” error. @param null|array{amount?: int, currency: string, description?: string, destination: string, expand?: string[], metadata?: StripeObject, source_transaction?: string, source_type?: string, transfer_group?: string} $params @param null|array|string $options @return Transfer the created resource @throws Exception\ApiErrorException if the request fails
create
php
stripe/stripe-php
lib/Transfer.php
https://github.com/stripe/stripe-php/blob/master/lib/Transfer.php
MIT
public static function all($params = null, $opts = null) { $url = static::classUrl(); return static::_requestPage($url, Collection::class, $params, $opts); }
Returns a list of existing transfers sent to connected accounts. The transfers are returned in sorted order, with the most recently created transfers appearing first. @param null|array{created?: array|int, destination?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, transfer_group?: string} $params @param null|array|string $opts @return Collection<Transfer> of ApiResources @throws Exception\ApiErrorException if the request fails
all
php
stripe/stripe-php
lib/Transfer.php
https://github.com/stripe/stripe-php/blob/master/lib/Transfer.php
MIT
public static function retrieve($id, $opts = null) { $opts = Util\RequestOptions::parse($opts); $instance = new static($id, $opts); $instance->refresh(); return $instance; }
Retrieves the details of an existing transfer. Supply the unique transfer ID from either a transfer creation request or the transfer list, and Stripe will return the corresponding transfer information. @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key @param null|array|string $opts @return Transfer @throws Exception\ApiErrorException if the request fails
retrieve
php
stripe/stripe-php
lib/Transfer.php
https://github.com/stripe/stripe-php/blob/master/lib/Transfer.php
MIT
public static function update($id, $params = null, $opts = null) { self::_validateParams($params); $url = static::resourceUrl($id); list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
Updates the specified transfer by setting the values of the parameters passed. Any parameters not provided will be left unchanged. This request accepts only metadata as an argument. @param string $id the ID of the resource to update @param null|array{description?: string, expand?: string[], metadata?: null|StripeObject} $params @param null|array|string $opts @return Transfer the updated resource @throws Exception\ApiErrorException if the request fails
update
php
stripe/stripe-php
lib/Transfer.php
https://github.com/stripe/stripe-php/blob/master/lib/Transfer.php
MIT
public static function allReversals($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_REVERSALS, $params, $opts); }
@param string $id the ID of the transfer on which to retrieve the transfer reversals @param null|array $params @param null|array|string $opts @return Collection<TransferReversal> the list of transfer reversals @throws Exception\ApiErrorException if the request fails
allReversals
php
stripe/stripe-php
lib/Transfer.php
https://github.com/stripe/stripe-php/blob/master/lib/Transfer.php
MIT
public static function createReversal($id, $params = null, $opts = null) { return self::_createNestedResource($id, static::PATH_REVERSALS, $params, $opts); }
@param string $id the ID of the transfer on which to create the transfer reversal @param null|array $params @param null|array|string $opts @return TransferReversal @throws Exception\ApiErrorException if the request fails
createReversal
php
stripe/stripe-php
lib/Transfer.php
https://github.com/stripe/stripe-php/blob/master/lib/Transfer.php
MIT
public static function retrieveReversal($id, $reversalId, $params = null, $opts = null) { return self::_retrieveNestedResource($id, static::PATH_REVERSALS, $reversalId, $params, $opts); }
@param string $id the ID of the transfer to which the transfer reversal belongs @param string $reversalId the ID of the transfer reversal to retrieve @param null|array $params @param null|array|string $opts @return TransferReversal @throws Exception\ApiErrorException if the request fails
retrieveReversal
php
stripe/stripe-php
lib/Transfer.php
https://github.com/stripe/stripe-php/blob/master/lib/Transfer.php
MIT
public static function updateReversal($id, $reversalId, $params = null, $opts = null) { return self::_updateNestedResource($id, static::PATH_REVERSALS, $reversalId, $params, $opts); }
@param string $id the ID of the transfer to which the transfer reversal belongs @param string $reversalId the ID of the transfer reversal to update @param null|array $params @param null|array|string $opts @return TransferReversal @throws Exception\ApiErrorException if the request fails
updateReversal
php
stripe/stripe-php
lib/Transfer.php
https://github.com/stripe/stripe-php/blob/master/lib/Transfer.php
MIT
public static function create($params = null, $options = null) { self::_validateParams($params); $url = static::classUrl(); list($response, $opts) = static::_staticRequest('post', $url, $params, $options); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
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 can’t 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|StripeObject, origin?: string, payment_intent?: string, reason?: string, refund_application_fee?: bool, reverse_transfer?: bool} $params @param null|array|string $options @return Refund the created resource @throws Exception\ApiErrorException if the request fails
create
php
stripe/stripe-php
lib/Refund.php
https://github.com/stripe/stripe-php/blob/master/lib/Refund.php
MIT
public static function all($params = null, $opts = null) { $url = static::classUrl(); return static::_requestPage($url, Collection::class, $params, $opts); }
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|array|string $opts @return Collection<Refund> of ApiResources @throws Exception\ApiErrorException if the request fails
all
php
stripe/stripe-php
lib/Refund.php
https://github.com/stripe/stripe-php/blob/master/lib/Refund.php
MIT
public static function retrieve($id, $opts = null) { $opts = Util\RequestOptions::parse($opts); $instance = new static($id, $opts); $instance->refresh(); return $instance; }
Retrieves the details of an existing refund. @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key @param null|array|string $opts @return Refund @throws Exception\ApiErrorException if the request fails
retrieve
php
stripe/stripe-php
lib/Refund.php
https://github.com/stripe/stripe-php/blob/master/lib/Refund.php
MIT
public static function update($id, $params = null, $opts = null) { self::_validateParams($params); $url = static::resourceUrl($id); list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
Updates the refund that you specify by setting the values of the passed parameters. Any parameters that you don’t provide remain unchanged. This request only accepts <code>metadata</code> as an argument. @param string $id the ID of the resource to update @param null|array{expand?: string[], metadata?: null|StripeObject} $params @param null|array|string $opts @return Refund the updated resource @throws Exception\ApiErrorException if the request fails
update
php
stripe/stripe-php
lib/Refund.php
https://github.com/stripe/stripe-php/blob/master/lib/Refund.php
MIT
public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
@param null|array $params @param null|array|string $opts @return Refund the canceled refund @throws Exception\ApiErrorException if the request fails
cancel
php
stripe/stripe-php
lib/Refund.php
https://github.com/stripe/stripe-php/blob/master/lib/Refund.php
MIT
public static function getPermanentAttributes() { static $permanentAttributes = null; if (null === $permanentAttributes) { $permanentAttributes = new Util\Set([ 'id', ]); } return $permanentAttributes; }
@return Util\Set Attributes that should not be sent to the API because they're not updatable (e.g. ID).
getPermanentAttributes
php
stripe/stripe-php
lib/StripeObject.php
https://github.com/stripe/stripe-php/blob/master/lib/StripeObject.php
MIT
public function __set($k, $v) { if (static::getPermanentAttributes()->includes($k)) { throw new Exception\InvalidArgumentException( "Cannot set {$k} on this object. HINT: you can't set: " . \implode(', ', static::getPermanentAttributes()->toArray()) ); } if ('' === $v) { throw new Exception\InvalidArgumentException( 'You cannot set \'' . $k . '\'to an empty string. ' . 'We interpret empty strings as NULL in requests. ' . 'You may set obj->' . $k . ' = NULL to delete the property' ); } $this->_values[$k] = Util\Util::convertToStripeObject($v, $this->_opts); $this->dirtyValue($this->_values[$k]); $this->_unsavedValues->add($k); }
Standard accessor magic methods
__set
php
stripe/stripe-php
lib/StripeObject.php
https://github.com/stripe/stripe-php/blob/master/lib/StripeObject.php
MIT
public function __isset($k) { return isset($this->_values[$k]); }
@param mixed $k @return bool
__isset
php
stripe/stripe-php
lib/StripeObject.php
https://github.com/stripe/stripe-php/blob/master/lib/StripeObject.php
MIT
public function __debugInfo() { return $this->_values; }
Magic method for var_dump output. Only works with PHP >= 5.6. @return array
__debugInfo
php
stripe/stripe-php
lib/StripeObject.php
https://github.com/stripe/stripe-php/blob/master/lib/StripeObject.php
MIT
public function offsetSet($k, $v) { $this->{$k} = $v; }
[\ReturnTypeWillChange]
offsetSet
php
stripe/stripe-php
lib/StripeObject.php
https://github.com/stripe/stripe-php/blob/master/lib/StripeObject.php
MIT
public function offsetExists($k) { return \array_key_exists($k, $this->_values); }
[\ReturnTypeWillChange]
offsetExists
php
stripe/stripe-php
lib/StripeObject.php
https://github.com/stripe/stripe-php/blob/master/lib/StripeObject.php
MIT
public function offsetUnset($k) { unset($this->{$k}); }
[\ReturnTypeWillChange]
offsetUnset
php
stripe/stripe-php
lib/StripeObject.php
https://github.com/stripe/stripe-php/blob/master/lib/StripeObject.php
MIT
public function offsetGet($k) { return \array_key_exists($k, $this->_values) ? $this->_values[$k] : null; }
[\ReturnTypeWillChange]
offsetGet
php
stripe/stripe-php
lib/StripeObject.php
https://github.com/stripe/stripe-php/blob/master/lib/StripeObject.php
MIT
public function count() { return \count($this->_values); }
[\ReturnTypeWillChange]
count
php
stripe/stripe-php
lib/StripeObject.php
https://github.com/stripe/stripe-php/blob/master/lib/StripeObject.php
MIT
public static function constructFrom($values, $opts = null, $apiMode = 'v1') { $obj = new static(isset($values['id']) ? $values['id'] : null); $obj->refreshFrom($values, $opts, false, $apiMode); return $obj; }
This unfortunately needs to be public to be used in Util\Util. @param array $values @param null|array|string|Util\RequestOptions $opts @param 'v1'|'v2' $apiMode @return static the object constructed from the given values
constructFrom
php
stripe/stripe-php
lib/StripeObject.php
https://github.com/stripe/stripe-php/blob/master/lib/StripeObject.php
MIT
public function jsonSerialize() { return $this->toArray(); }
[\ReturnTypeWillChange]
jsonSerialize
php
stripe/stripe-php
lib/StripeObject.php
https://github.com/stripe/stripe-php/blob/master/lib/StripeObject.php
MIT
public function toJSON() { return \json_encode($this->toArray(), \JSON_PRETTY_PRINT); }
Returns a pretty JSON representation of the Stripe object. @return string the JSON representation of the Stripe object
toJSON
php
stripe/stripe-php
lib/StripeObject.php
https://github.com/stripe/stripe-php/blob/master/lib/StripeObject.php
MIT
public static function emptyValues($obj) { if (\is_array($obj)) { $values = $obj; } elseif ($obj instanceof StripeObject) { $values = $obj->_values; } else { throw new Exception\InvalidArgumentException( 'empty_values got unexpected object type: ' . \get_class($obj) ); } return \array_fill_keys(\array_keys($values), ''); }
Returns a hash of empty values for all the values that are in the given StripeObject. @param mixed $obj
emptyValues
php
stripe/stripe-php
lib/StripeObject.php
https://github.com/stripe/stripe-php/blob/master/lib/StripeObject.php
MIT
public function getLastResponse() { return $this->_lastResponse; }
@return null|ApiResponse The last response from the Stripe API
getLastResponse
php
stripe/stripe-php
lib/StripeObject.php
https://github.com/stripe/stripe-php/blob/master/lib/StripeObject.php
MIT
public function setLastResponse($resp) { $this->_lastResponse = $resp; }
Sets the last response from the Stripe API. @param ApiResponse $resp
setLastResponse
php
stripe/stripe-php
lib/StripeObject.php
https://github.com/stripe/stripe-php/blob/master/lib/StripeObject.php
MIT
public function isDeleted() { return isset($this->_values['deleted']) ? $this->_values['deleted'] : false; }
Indicates whether or not the resource has been deleted on the server. Note that some, but not all, resources can indicate whether they have been deleted. @return bool whether the resource is deleted
isDeleted
php
stripe/stripe-php
lib/StripeObject.php
https://github.com/stripe/stripe-php/blob/master/lib/StripeObject.php
MIT
public static function all($params = null, $opts = null) { $url = static::classUrl(); return static::_requestPage($url, Collection::class, $params, $opts); }
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|array|string $opts @return Collection<SetupAttempt> of ApiResources @throws Exception\ApiErrorException if the request fails
all
php
stripe/stripe-php
lib/SetupAttempt.php
https://github.com/stripe/stripe-php/blob/master/lib/SetupAttempt.php
MIT
public static function create($params = null, $options = null) { self::_validateParams($params); $url = static::classUrl(); list($response, $opts) = static::_staticRequest('post', $url, $params, $options); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
Creates a PaymentIntent object. After the PaymentIntent is created, attach a payment method and <a href="/docs/api/payment_intents/confirm">confirm</a> to continue the payment. Learn more about <a href="/docs/payments/payment-intents">the available payment flows with the Payment Intents API</a>. When you use <code>confirm=true</code> during creation, it’s equivalent to creating and confirming the PaymentIntent in the same call. You can use any parameters available in the <a href="/docs/api/payment_intents/confirm">confirm API</a> when you supply <code>confirm=true</code>. @param null|array{amount: int, application_fee_amount?: int, automatic_payment_methods?: array{allow_redirects?: string, enabled: bool}, capture_method?: string, confirm?: bool, confirmation_method?: string, confirmation_token?: string, currency: string, customer?: string, description?: string, error_on_requires_action?: bool, expand?: string[], mandate?: string, mandate_data?: null|array{customer_acceptance: array{accepted_at?: int, offline?: array{}, online?: array{ip_address: string, user_agent: string}, type: string}}, metadata?: StripeObject, off_session?: array|bool|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?: StripeObject, 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?: null|array{mandate_options?: array{custom_mandate_url?: null|string, interval_description?: string, payment_schedule?: string, transaction_type?: string}, setup_future_usage?: null|string, target_date?: string, verification_method?: string}, affirm?: null|array{capture_method?: null|string, preferred_locale?: string, setup_future_usage?: string}, afterpay_clearpay?: null|array{capture_method?: null|string, reference?: string, setup_future_usage?: string}, alipay?: null|array{setup_future_usage?: null|string}, alma?: null|array{capture_method?: null|string}, amazon_pay?: null|array{capture_method?: null|string, setup_future_usage?: null|string}, au_becs_debit?: null|array{setup_future_usage?: null|string, target_date?: string}, bacs_debit?: null|array{mandate_options?: array{reference_prefix?: null|string}, setup_future_usage?: null|string, target_date?: string}, bancontact?: null|array{preferred_language?: string, setup_future_usage?: null|string}, billie?: null|array{capture_method?: null|string}, blik?: null|array{code?: string, setup_future_usage?: null|string}, boleto?: null|array{expires_after_days?: int, setup_future_usage?: null|string}, card?: null|array{capture_method?: null|string, cvc_token?: string, installments?: array{enabled?: bool, plan?: null|array{count?: int, interval?: string, type: string}}, mandate_options?: array{amount: int, amount_type: string, description?: string, end_date?: int, interval: string, interval_count?: int, reference: string, start_date: int, supported_types?: string[]}, moto?: bool, network?: string, request_extended_authorization?: string, request_incremental_authorization?: string, request_multicapture?: string, request_overcapture?: string, request_three_d_secure?: string, require_cvc_recollection?: bool, setup_future_usage?: null|string, statement_descriptor_suffix_kana?: null|string, statement_descriptor_suffix_kanji?: null|string, three_d_secure?: array{ares_trans_status?: string, cryptogram: string, electronic_commerce_indicator?: string, exemption_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?: null|array{request_extended_authorization?: bool, request_incremental_authorization_support?: bool, routing?: array{requested_priority?: string}}, cashapp?: null|array{capture_method?: null|string, setup_future_usage?: null|string}, customer_balance?: null|array{bank_transfer?: array{eu_bank_transfer?: array{country: string}, requested_address_types?: string[], type: string}, funding_type?: string, setup_future_usage?: string}, eps?: null|array{setup_future_usage?: string}, fpx?: null|array{setup_future_usage?: string}, giropay?: null|array{setup_future_usage?: string}, grabpay?: null|array{setup_future_usage?: string}, ideal?: null|array{setup_future_usage?: null|string}, interac_present?: null|array{}, kakao_pay?: null|array{capture_method?: null|string, setup_future_usage?: null|string}, klarna?: null|array{capture_method?: null|string, preferred_locale?: string, setup_future_usage?: string}, konbini?: null|array{confirmation_number?: null|string, expires_after_days?: null|int, expires_at?: null|int, product_description?: null|string, setup_future_usage?: string}, kr_card?: null|array{capture_method?: null|string, setup_future_usage?: null|string}, link?: null|array{capture_method?: null|string, persistent_token?: string, setup_future_usage?: null|string}, mobilepay?: null|array{capture_method?: null|string, setup_future_usage?: string}, multibanco?: null|array{setup_future_usage?: string}, naver_pay?: null|array{capture_method?: null|string, setup_future_usage?: null|string}, nz_bank_account?: null|array{setup_future_usage?: null|string, target_date?: string}, oxxo?: null|array{expires_after_days?: int, setup_future_usage?: string}, p24?: null|array{setup_future_usage?: string, tos_shown_and_accepted?: bool}, pay_by_bank?: null|array{}, payco?: null|array{capture_method?: null|string}, paynow?: null|array{setup_future_usage?: string}, paypal?: null|array{capture_method?: null|string, preferred_locale?: string, reference?: string, risk_correlation_id?: string, setup_future_usage?: null|string}, pix?: null|array{expires_after_seconds?: int, expires_at?: int, setup_future_usage?: string}, promptpay?: null|array{setup_future_usage?: string}, revolut_pay?: null|array{capture_method?: null|string, setup_future_usage?: null|string}, samsung_pay?: null|array{capture_method?: null|string}, sepa_debit?: null|array{mandate_options?: array{reference_prefix?: null|string}, setup_future_usage?: null|string, target_date?: string}, sofort?: null|array{preferred_language?: null|string, setup_future_usage?: null|string}, swish?: null|array{reference?: null|string, setup_future_usage?: string}, twint?: null|array{setup_future_usage?: string}, us_bank_account?: null|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[]}, preferred_settlement_speed?: null|string, setup_future_usage?: null|string, target_date?: string, verification_method?: string}, wechat_pay?: null|array{app_id?: string, client?: string, setup_future_usage?: string}, zip?: null|array{setup_future_usage?: string}}, payment_method_types?: string[], radar_options?: array{session?: string}, receipt_email?: string, return_url?: string, setup_future_usage?: 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, statement_descriptor_suffix?: string, transfer_data?: array{amount?: int, destination: string}, transfer_group?: string, use_stripe_sdk?: bool} $params @param null|array|string $options @return PaymentIntent the created resource @throws Exception\ApiErrorException if the request fails
create
php
stripe/stripe-php
lib/PaymentIntent.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentIntent.php
MIT
public static function all($params = null, $opts = null) { $url = static::classUrl(); return static::_requestPage($url, Collection::class, $params, $opts); }
Returns a list of PaymentIntents. @param null|array{created?: array|int, customer?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params @param null|array|string $opts @return Collection<PaymentIntent> of ApiResources @throws Exception\ApiErrorException if the request fails
all
php
stripe/stripe-php
lib/PaymentIntent.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentIntent.php
MIT
public static function retrieve($id, $opts = null) { $opts = Util\RequestOptions::parse($opts); $instance = new static($id, $opts); $instance->refresh(); return $instance; }
Retrieves the details of a PaymentIntent that has previously been created. You can retrieve a PaymentIntent client-side using a publishable key when the <code>client_secret</code> is in the query string. If you retrieve a PaymentIntent with a publishable key, it only returns a subset of properties. Refer to the <a href="#payment_intent_object">payment intent</a> object reference for more details. @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key @param null|array|string $opts @return PaymentIntent @throws Exception\ApiErrorException if the request fails
retrieve
php
stripe/stripe-php
lib/PaymentIntent.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentIntent.php
MIT
public static function update($id, $params = null, $opts = null) { self::_validateParams($params); $url = static::resourceUrl($id); list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
Updates properties on a PaymentIntent object without confirming. Depending on which properties you update, you might need to confirm the PaymentIntent again. For example, updating the <code>payment_method</code> always requires you to confirm the PaymentIntent again. If you prefer to update and confirm at the same time, we recommend updating properties through the <a href="/docs/api/payment_intents/confirm">confirm API</a> instead. @param string $id the ID of the resource to update @param null|array{amount?: int, application_fee_amount?: null|int, capture_method?: string, currency?: string, customer?: string, description?: string, expand?: string[], metadata?: null|StripeObject, 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?: StripeObject, 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?: null|array{mandate_options?: array{custom_mandate_url?: null|string, interval_description?: string, payment_schedule?: string, transaction_type?: string}, setup_future_usage?: null|string, target_date?: string, verification_method?: string}, affirm?: null|array{capture_method?: null|string, preferred_locale?: string, setup_future_usage?: string}, afterpay_clearpay?: null|array{capture_method?: null|string, reference?: string, setup_future_usage?: string}, alipay?: null|array{setup_future_usage?: null|string}, alma?: null|array{capture_method?: null|string}, amazon_pay?: null|array{capture_method?: null|string, setup_future_usage?: null|string}, au_becs_debit?: null|array{setup_future_usage?: null|string, target_date?: string}, bacs_debit?: null|array{mandate_options?: array{reference_prefix?: null|string}, setup_future_usage?: null|string, target_date?: string}, bancontact?: null|array{preferred_language?: string, setup_future_usage?: null|string}, billie?: null|array{capture_method?: null|string}, blik?: null|array{code?: string, setup_future_usage?: null|string}, boleto?: null|array{expires_after_days?: int, setup_future_usage?: null|string}, card?: null|array{capture_method?: null|string, cvc_token?: string, installments?: array{enabled?: bool, plan?: null|array{count?: int, interval?: string, type: string}}, mandate_options?: array{amount: int, amount_type: string, description?: string, end_date?: int, interval: string, interval_count?: int, reference: string, start_date: int, supported_types?: string[]}, moto?: bool, network?: string, request_extended_authorization?: string, request_incremental_authorization?: string, request_multicapture?: string, request_overcapture?: string, request_three_d_secure?: string, require_cvc_recollection?: bool, setup_future_usage?: null|string, statement_descriptor_suffix_kana?: null|string, statement_descriptor_suffix_kanji?: null|string, three_d_secure?: array{ares_trans_status?: string, cryptogram: string, electronic_commerce_indicator?: string, exemption_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?: null|array{request_extended_authorization?: bool, request_incremental_authorization_support?: bool, routing?: array{requested_priority?: string}}, cashapp?: null|array{capture_method?: null|string, setup_future_usage?: null|string}, customer_balance?: null|array{bank_transfer?: array{eu_bank_transfer?: array{country: string}, requested_address_types?: string[], type: string}, funding_type?: string, setup_future_usage?: string}, eps?: null|array{setup_future_usage?: string}, fpx?: null|array{setup_future_usage?: string}, giropay?: null|array{setup_future_usage?: string}, grabpay?: null|array{setup_future_usage?: string}, ideal?: null|array{setup_future_usage?: null|string}, interac_present?: null|array{}, kakao_pay?: null|array{capture_method?: null|string, setup_future_usage?: null|string}, klarna?: null|array{capture_method?: null|string, preferred_locale?: string, setup_future_usage?: string}, konbini?: null|array{confirmation_number?: null|string, expires_after_days?: null|int, expires_at?: null|int, product_description?: null|string, setup_future_usage?: string}, kr_card?: null|array{capture_method?: null|string, setup_future_usage?: null|string}, link?: null|array{capture_method?: null|string, persistent_token?: string, setup_future_usage?: null|string}, mobilepay?: null|array{capture_method?: null|string, setup_future_usage?: string}, multibanco?: null|array{setup_future_usage?: string}, naver_pay?: null|array{capture_method?: null|string, setup_future_usage?: null|string}, nz_bank_account?: null|array{setup_future_usage?: null|string, target_date?: string}, oxxo?: null|array{expires_after_days?: int, setup_future_usage?: string}, p24?: null|array{setup_future_usage?: string, tos_shown_and_accepted?: bool}, pay_by_bank?: null|array{}, payco?: null|array{capture_method?: null|string}, paynow?: null|array{setup_future_usage?: string}, paypal?: null|array{capture_method?: null|string, preferred_locale?: string, reference?: string, risk_correlation_id?: string, setup_future_usage?: null|string}, pix?: null|array{expires_after_seconds?: int, expires_at?: int, setup_future_usage?: string}, promptpay?: null|array{setup_future_usage?: string}, revolut_pay?: null|array{capture_method?: null|string, setup_future_usage?: null|string}, samsung_pay?: null|array{capture_method?: null|string}, sepa_debit?: null|array{mandate_options?: array{reference_prefix?: null|string}, setup_future_usage?: null|string, target_date?: string}, sofort?: null|array{preferred_language?: null|string, setup_future_usage?: null|string}, swish?: null|array{reference?: null|string, setup_future_usage?: string}, twint?: null|array{setup_future_usage?: string}, us_bank_account?: null|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[]}, preferred_settlement_speed?: null|string, setup_future_usage?: null|string, target_date?: string, verification_method?: string}, wechat_pay?: null|array{app_id?: string, client?: string, setup_future_usage?: string}, zip?: null|array{setup_future_usage?: string}}, payment_method_types?: string[], receipt_email?: null|string, setup_future_usage?: null|string, shipping?: null|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, statement_descriptor_suffix?: string, transfer_data?: array{amount?: int}, transfer_group?: string} $params @param null|array|string $opts @return PaymentIntent the updated resource @throws Exception\ApiErrorException if the request fails
update
php
stripe/stripe-php
lib/PaymentIntent.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentIntent.php
MIT
public function applyCustomerBalance($params = null, $opts = null) { $url = $this->instanceUrl() . '/apply_customer_balance'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
@param null|array $params @param null|array|string $opts @return PaymentIntent the applied payment intent @throws Exception\ApiErrorException if the request fails
applyCustomerBalance
php
stripe/stripe-php
lib/PaymentIntent.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentIntent.php
MIT
public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
@param null|array $params @param null|array|string $opts @return PaymentIntent the canceled payment intent @throws Exception\ApiErrorException if the request fails
cancel
php
stripe/stripe-php
lib/PaymentIntent.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentIntent.php
MIT
public function capture($params = null, $opts = null) { $url = $this->instanceUrl() . '/capture'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
@param null|array $params @param null|array|string $opts @return PaymentIntent the captured payment intent @throws Exception\ApiErrorException if the request fails
capture
php
stripe/stripe-php
lib/PaymentIntent.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentIntent.php
MIT
public function confirm($params = null, $opts = null) { $url = $this->instanceUrl() . '/confirm'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
@param null|array $params @param null|array|string $opts @return PaymentIntent the confirmed payment intent @throws Exception\ApiErrorException if the request fails
confirm
php
stripe/stripe-php
lib/PaymentIntent.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentIntent.php
MIT
public function incrementAuthorization($params = null, $opts = null) { $url = $this->instanceUrl() . '/increment_authorization'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
@param null|array $params @param null|array|string $opts @return PaymentIntent the incremented payment intent @throws Exception\ApiErrorException if the request fails
incrementAuthorization
php
stripe/stripe-php
lib/PaymentIntent.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentIntent.php
MIT
public function verifyMicrodeposits($params = null, $opts = null) { $url = $this->instanceUrl() . '/verify_microdeposits'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
@param null|array $params @param null|array|string $opts @return PaymentIntent the verified payment intent @throws Exception\ApiErrorException if the request fails
verifyMicrodeposits
php
stripe/stripe-php
lib/PaymentIntent.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentIntent.php
MIT
public static function search($params = null, $opts = null) { $url = '/v1/payment_intents/search'; return static::_requestPage($url, SearchResult::class, $params, $opts); }
@param null|array $params @param null|array|string $opts @return SearchResult<PaymentIntent> the payment intent search results @throws Exception\ApiErrorException if the request fails
search
php
stripe/stripe-php
lib/PaymentIntent.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentIntent.php
MIT
public static function create($params = null, $options = null) { self::_validateParams($params); $url = static::classUrl(); list($response, $opts) = static::_staticRequest('post', $url, $params, $options); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
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?: StripeObject, on_behalf_of?: null|string, subscription_data?: array{description?: string, effective_date?: null|array|int|string, metadata?: StripeObject, trial_period_days?: null|int}, test_clock?: string, transfer_data?: null|array{amount?: int, amount_percent?: float, destination: string}} $params @param null|array|string $options @return Quote the created resource @throws Exception\ApiErrorException if the request fails
create
php
stripe/stripe-php
lib/Quote.php
https://github.com/stripe/stripe-php/blob/master/lib/Quote.php
MIT
public static function all($params = null, $opts = null) { $url = static::classUrl(); return static::_requestPage($url, Collection::class, $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|array|string $opts @return Collection<Quote> of ApiResources @throws Exception\ApiErrorException if the request fails
all
php
stripe/stripe-php
lib/Quote.php
https://github.com/stripe/stripe-php/blob/master/lib/Quote.php
MIT
public static function retrieve($id, $opts = null) { $opts = Util\RequestOptions::parse($opts); $instance = new static($id, $opts); $instance->refresh(); return $instance; }
Retrieves the quote with the given ID. @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key @param null|array|string $opts @return Quote @throws Exception\ApiErrorException if the request fails
retrieve
php
stripe/stripe-php
lib/Quote.php
https://github.com/stripe/stripe-php/blob/master/lib/Quote.php
MIT
public static function update($id, $params = null, $opts = null) { self::_validateParams($params); $url = static::resourceUrl($id); list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
A quote models prices and services for a customer. @param string $id the ID of the resource to update @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?: StripeObject, on_behalf_of?: null|string, subscription_data?: array{description?: null|string, effective_date?: null|array|int|string, metadata?: StripeObject, trial_period_days?: null|int}, transfer_data?: null|array{amount?: int, amount_percent?: float, destination: string}} $params @param null|array|string $opts @return Quote the updated resource @throws Exception\ApiErrorException if the request fails
update
php
stripe/stripe-php
lib/Quote.php
https://github.com/stripe/stripe-php/blob/master/lib/Quote.php
MIT
public function accept($params = null, $opts = null) { $url = $this->instanceUrl() . '/accept'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
@param null|array $params @param null|array|string $opts @return Quote the accepted quote @throws Exception\ApiErrorException if the request fails
accept
php
stripe/stripe-php
lib/Quote.php
https://github.com/stripe/stripe-php/blob/master/lib/Quote.php
MIT
public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
@param null|array $params @param null|array|string $opts @return Quote the canceled quote @throws Exception\ApiErrorException if the request fails
cancel
php
stripe/stripe-php
lib/Quote.php
https://github.com/stripe/stripe-php/blob/master/lib/Quote.php
MIT
public function finalizeQuote($params = null, $opts = null) { $url = $this->instanceUrl() . '/finalize'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
@param null|array $params @param null|array|string $opts @return Quote the finalized quote @throws Exception\ApiErrorException if the request fails
finalizeQuote
php
stripe/stripe-php
lib/Quote.php
https://github.com/stripe/stripe-php/blob/master/lib/Quote.php
MIT
public static function allComputedUpfrontLineItems($id, $params = null, $opts = null) { $url = static::resourceUrl($id) . '/computed_upfront_line_items'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
@param string $id @param null|array $params @param null|array|string $opts @return Collection<LineItem> list of line items @throws Exception\ApiErrorException if the request fails
allComputedUpfrontLineItems
php
stripe/stripe-php
lib/Quote.php
https://github.com/stripe/stripe-php/blob/master/lib/Quote.php
MIT
public static function allLineItems($id, $params = null, $opts = null) { $url = static::resourceUrl($id) . '/line_items'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
@param string $id @param null|array $params @param null|array|string $opts @return Collection<LineItem> list of line items @throws Exception\ApiErrorException if the request fails
allLineItems
php
stripe/stripe-php
lib/Quote.php
https://github.com/stripe/stripe-php/blob/master/lib/Quote.php
MIT
public function pdf($readBodyChunkCallable, $params = null, $opts = null) { $opts = Util\RequestOptions::parse($opts); if (!isset($opts->apiBase)) { $opts->apiBase = Stripe::$apiUploadBase; } $url = $this->instanceUrl() . '/pdf'; $this->_requestStream('get', $url, $readBodyChunkCallable, $params, $opts); }
@param callable $readBodyChunkCallable @param null|array $params @param null|array|string $opts @return void @throws Exception\ApiErrorException if the request fails
pdf
php
stripe/stripe-php
lib/Quote.php
https://github.com/stripe/stripe-php/blob/master/lib/Quote.php
MIT
public static function create($params = null, $options = null) { self::_validateParams($params); $url = static::classUrl(); list($response, $opts) = static::_staticRequest('post', $url, $params, $options); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
Top up the balance of an account. @param null|array{amount: int, currency: string, description?: string, expand?: string[], metadata?: null|StripeObject, source?: string, statement_descriptor?: string, transfer_group?: string} $params @param null|array|string $options @return Topup the created resource @throws Exception\ApiErrorException if the request fails
create
php
stripe/stripe-php
lib/Topup.php
https://github.com/stripe/stripe-php/blob/master/lib/Topup.php
MIT
public static function all($params = null, $opts = null) { $url = static::classUrl(); return static::_requestPage($url, Collection::class, $params, $opts); }
Returns a list of top-ups. @param null|array{amount?: array|int, created?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, status?: string} $params @param null|array|string $opts @return Collection<Topup> of ApiResources @throws Exception\ApiErrorException if the request fails
all
php
stripe/stripe-php
lib/Topup.php
https://github.com/stripe/stripe-php/blob/master/lib/Topup.php
MIT
public static function retrieve($id, $opts = null) { $opts = Util\RequestOptions::parse($opts); $instance = new static($id, $opts); $instance->refresh(); return $instance; }
Retrieves the details of a top-up that has previously been created. Supply the unique top-up ID that was returned from your previous request, and Stripe will return the corresponding top-up information. @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key @param null|array|string $opts @return Topup @throws Exception\ApiErrorException if the request fails
retrieve
php
stripe/stripe-php
lib/Topup.php
https://github.com/stripe/stripe-php/blob/master/lib/Topup.php
MIT
public static function update($id, $params = null, $opts = null) { self::_validateParams($params); $url = static::resourceUrl($id); list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
Updates the metadata of a top-up. Other top-up details are not editable by design. @param string $id the ID of the resource to update @param null|array{description?: string, expand?: string[], metadata?: null|StripeObject} $params @param null|array|string $opts @return Topup the updated resource @throws Exception\ApiErrorException if the request fails
update
php
stripe/stripe-php
lib/Topup.php
https://github.com/stripe/stripe-php/blob/master/lib/Topup.php
MIT
public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
@param null|array $params @param null|array|string $opts @return Topup the canceled topup @throws Exception\ApiErrorException if the request fails
cancel
php
stripe/stripe-php
lib/Topup.php
https://github.com/stripe/stripe-php/blob/master/lib/Topup.php
MIT
public static function all($params = null, $opts = null) { $url = static::classUrl(); return static::_requestPage($url, Collection::class, $params, $opts); }
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|array|string $opts @return Collection<InvoiceRenderingTemplate> of ApiResources @throws Exception\ApiErrorException if the request fails
all
php
stripe/stripe-php
lib/InvoiceRenderingTemplate.php
https://github.com/stripe/stripe-php/blob/master/lib/InvoiceRenderingTemplate.php
MIT
public static function retrieve($id, $opts = null) { $opts = Util\RequestOptions::parse($opts); $instance = new static($id, $opts); $instance->refresh(); return $instance; }
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 array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key @param null|array|string $opts @return InvoiceRenderingTemplate @throws Exception\ApiErrorException if the request fails
retrieve
php
stripe/stripe-php
lib/InvoiceRenderingTemplate.php
https://github.com/stripe/stripe-php/blob/master/lib/InvoiceRenderingTemplate.php
MIT
public function archive($params = null, $opts = null) { $url = $this->instanceUrl() . '/archive'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
@param null|array $params @param null|array|string $opts @return InvoiceRenderingTemplate the archived invoice rendering template @throws Exception\ApiErrorException if the request fails
archive
php
stripe/stripe-php
lib/InvoiceRenderingTemplate.php
https://github.com/stripe/stripe-php/blob/master/lib/InvoiceRenderingTemplate.php
MIT
public function unarchive($params = null, $opts = null) { $url = $this->instanceUrl() . '/unarchive'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
@param null|array $params @param null|array|string $opts @return InvoiceRenderingTemplate the unarchived invoice rendering template @throws Exception\ApiErrorException if the request fails
unarchive
php
stripe/stripe-php
lib/InvoiceRenderingTemplate.php
https://github.com/stripe/stripe-php/blob/master/lib/InvoiceRenderingTemplate.php
MIT
public static function create($params = null, $options = null) { self::_validateParams($params); $url = static::classUrl(); list($response, $opts) = static::_staticRequest('post', $url, $params, $options); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
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?: StripeObject, 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|array|string $options @return PaymentMethod the created resource @throws Exception\ApiErrorException if the request fails
create
php
stripe/stripe-php
lib/PaymentMethod.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentMethod.php
MIT
public static function all($params = null, $opts = null) { $url = static::classUrl(); return static::_requestPage($url, Collection::class, $params, $opts); }
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 Customer’s PaymentMethods</a> API instead. @param null|array{customer?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, type?: string} $params @param null|array|string $opts @return Collection<PaymentMethod> of ApiResources @throws Exception\ApiErrorException if the request fails
all
php
stripe/stripe-php
lib/PaymentMethod.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentMethod.php
MIT
public static function retrieve($id, $opts = null) { $opts = Util\RequestOptions::parse($opts); $instance = new static($id, $opts); $instance->refresh(); return $instance; }
Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method attached to a Customer, you should use <a href="/docs/api/payment_methods/customer">Retrieve a Customer’s PaymentMethods</a>. @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key @param null|array|string $opts @return PaymentMethod @throws Exception\ApiErrorException if the request fails
retrieve
php
stripe/stripe-php
lib/PaymentMethod.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentMethod.php
MIT
public static function update($id, $params = null, $opts = null) { self::_validateParams($params); $url = static::resourceUrl($id); list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. @param string $id the ID of the resource to update @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|StripeObject, pay_by_bank?: array{}, us_bank_account?: array{account_holder_type?: string, account_type?: string}} $params @param null|array|string $opts @return PaymentMethod the updated resource @throws Exception\ApiErrorException if the request fails
update
php
stripe/stripe-php
lib/PaymentMethod.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentMethod.php
MIT
public function attach($params = null, $opts = null) { $url = $this->instanceUrl() . '/attach'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
@param null|array $params @param null|array|string $opts @return PaymentMethod the attached payment method @throws Exception\ApiErrorException if the request fails
attach
php
stripe/stripe-php
lib/PaymentMethod.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentMethod.php
MIT
public function detach($params = null, $opts = null) { $url = $this->instanceUrl() . '/detach'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
@param null|array $params @param null|array|string $opts @return PaymentMethod the detached payment method @throws Exception\ApiErrorException if the request fails
detach
php
stripe/stripe-php
lib/PaymentMethod.php
https://github.com/stripe/stripe-php/blob/master/lib/PaymentMethod.php
MIT
public static function retrieve($id, $opts = null) { $opts = Util\RequestOptions::parse($opts); $instance = new static($id, $opts); $instance->refresh(); return $instance; }
Retrieves an existing ConfirmationToken object. @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key @param null|array|string $opts @return ConfirmationToken @throws Exception\ApiErrorException if the request fails
retrieve
php
stripe/stripe-php
lib/ConfirmationToken.php
https://github.com/stripe/stripe-php/blob/master/lib/ConfirmationToken.php
MIT
public static function all($params = null, $opts = null) { $url = static::classUrl(); return static::_requestPage($url, Collection::class, $params, $opts); }
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|array|string $opts @return Collection<ExchangeRate> of ApiResources @throws Exception\ApiErrorException if the request fails
all
php
stripe/stripe-php
lib/ExchangeRate.php
https://github.com/stripe/stripe-php/blob/master/lib/ExchangeRate.php
MIT
public static function retrieve($id, $opts = null) { $opts = Util\RequestOptions::parse($opts); $instance = new static($id, $opts); $instance->refresh(); return $instance; }
Retrieves the exchange rates from the given currency to every supported currency. @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key @param null|array|string $opts @return ExchangeRate @throws Exception\ApiErrorException if the request fails
retrieve
php
stripe/stripe-php
lib/ExchangeRate.php
https://github.com/stripe/stripe-php/blob/master/lib/ExchangeRate.php
MIT
public static function create($params = null, $options = null) { self::_validateParams($params); $url = static::classUrl(); list($response, $opts) = static::_staticRequest('post', $url, $params, $options); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
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?: StripeObject, custom_unit_amount?: array{enabled: bool, maximum?: int, minimum?: int, preset?: int}, expand?: string[], lookup_key?: string, metadata?: StripeObject, nickname?: string, product?: string, product_data?: array{active?: bool, id?: string, metadata?: StripeObject, 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|array|string $options @return Price the created resource @throws Exception\ApiErrorException if the request fails
create
php
stripe/stripe-php
lib/Price.php
https://github.com/stripe/stripe-php/blob/master/lib/Price.php
MIT
public static function all($params = null, $opts = null) { $url = static::classUrl(); return static::_requestPage($url, Collection::class, $params, $opts); }
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|array|string $opts @return Collection<Price> of ApiResources @throws Exception\ApiErrorException if the request fails
all
php
stripe/stripe-php
lib/Price.php
https://github.com/stripe/stripe-php/blob/master/lib/Price.php
MIT
public static function retrieve($id, $opts = null) { $opts = Util\RequestOptions::parse($opts); $instance = new static($id, $opts); $instance->refresh(); return $instance; }
Retrieves the price with the given ID. @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key @param null|array|string $opts @return Price @throws Exception\ApiErrorException if the request fails
retrieve
php
stripe/stripe-php
lib/Price.php
https://github.com/stripe/stripe-php/blob/master/lib/Price.php
MIT
public static function update($id, $params = null, $opts = null) { self::_validateParams($params); $url = static::resourceUrl($id); list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged. @param string $id the ID of the resource to update @param null|array{active?: bool, currency_options?: null|StripeObject, expand?: string[], lookup_key?: string, metadata?: null|StripeObject, nickname?: string, tax_behavior?: string, transfer_lookup_key?: bool} $params @param null|array|string $opts @return Price the updated resource @throws Exception\ApiErrorException if the request fails
update
php
stripe/stripe-php
lib/Price.php
https://github.com/stripe/stripe-php/blob/master/lib/Price.php
MIT
public static function search($params = null, $opts = null) { $url = '/v1/prices/search'; return static::_requestPage($url, SearchResult::class, $params, $opts); }
@param null|array $params @param null|array|string $opts @return SearchResult<Price> the price search results @throws Exception\ApiErrorException if the request fails
search
php
stripe/stripe-php
lib/Price.php
https://github.com/stripe/stripe-php/blob/master/lib/Price.php
MIT
public function instanceUrl() { $id = $this['id']; $transfer = $this['transfer']; if (!$id) { throw new Exception\UnexpectedValueException( 'Could not determine which URL to request: ' . "class instance has invalid ID: {$id}", null ); } $id = Util\Util::utf8($id); $transfer = Util\Util::utf8($transfer); $base = Transfer::classUrl(); $transferExtn = \urlencode($transfer); $extn = \urlencode($id); return "{$base}/{$transferExtn}/reversals/{$extn}"; }
@return string the API URL for this Stripe transfer reversal
instanceUrl
php
stripe/stripe-php
lib/TransferReversal.php
https://github.com/stripe/stripe-php/blob/master/lib/TransferReversal.php
MIT
public function save($opts = null) { return $this->_save($opts); }
@param null|array|string $opts @return TransferReversal the saved reversal @throws Exception\ApiErrorException if the request fails
save
php
stripe/stripe-php
lib/TransferReversal.php
https://github.com/stripe/stripe-php/blob/master/lib/TransferReversal.php
MIT
public static function baseUrl() { return Stripe::$apiBase; }
@return string the base URL for the given class
baseUrl
php
stripe/stripe-php
lib/SearchResult.php
https://github.com/stripe/stripe-php/blob/master/lib/SearchResult.php
MIT
public function getFilters() { return $this->filters; }
Returns the filters. @return array the filters
getFilters
php
stripe/stripe-php
lib/SearchResult.php
https://github.com/stripe/stripe-php/blob/master/lib/SearchResult.php
MIT
public function setFilters($filters) { $this->filters = $filters; }
Sets the filters, removing paging options. @param array $filters the filters
setFilters
php
stripe/stripe-php
lib/SearchResult.php
https://github.com/stripe/stripe-php/blob/master/lib/SearchResult.php
MIT
public function offsetGet($k) { if (\is_string($k)) { return parent::offsetGet($k); } $msg = "You tried to access the {$k} index, but SearchResult " . 'types only support string keys. (HINT: Search calls ' . 'return an object with a `data` (which is the data ' . "array). You likely want to call ->data[{$k}])"; throw new Exception\InvalidArgumentException($msg); }
[\ReturnTypeWillChange]
offsetGet
php
stripe/stripe-php
lib/SearchResult.php
https://github.com/stripe/stripe-php/blob/master/lib/SearchResult.php
MIT
public function all($params = null, $opts = null) { self::_validateParams($params); list($url, $params) = $this->extractPathAndUpdateParams($params); list($response, $opts) = $this->_request('get', $url, $params, $opts); $obj = Util\Util::convertToStripeObject($response, $opts); if (!$obj instanceof SearchResult) { throw new Exception\UnexpectedValueException( 'Expected type ' . SearchResult::class . ', got "' . \get_class($obj) . '" instead.' ); } $obj->setFilters($params); return $obj; }
@param null|array $params @param null|array|string $opts @return SearchResult<TStripeObject> @throws Exception\ApiErrorException
all
php
stripe/stripe-php
lib/SearchResult.php
https://github.com/stripe/stripe-php/blob/master/lib/SearchResult.php
MIT
public function count() { return \count($this->data); }
[\ReturnTypeWillChange]
count
php
stripe/stripe-php
lib/SearchResult.php
https://github.com/stripe/stripe-php/blob/master/lib/SearchResult.php
MIT
public function getIterator() { return new \ArrayIterator($this->data); }
[\ReturnTypeWillChange]
getIterator
php
stripe/stripe-php
lib/SearchResult.php
https://github.com/stripe/stripe-php/blob/master/lib/SearchResult.php
MIT
public function autoPagingIterator() { $page = $this; while (true) { foreach ($page as $item) { yield $item; } $page = $page->nextPage(); if ($page->isEmpty()) { break; } } }
@return \Generator|TStripeObject[] A generator that can be used to iterate across all objects across all pages. As page boundaries are encountered, the next page will be fetched automatically for continued iteration. @throws Exception\ApiErrorException
autoPagingIterator
php
stripe/stripe-php
lib/SearchResult.php
https://github.com/stripe/stripe-php/blob/master/lib/SearchResult.php
MIT
public static function emptySearchResult($opts = null) { return SearchResult::constructFrom(['data' => []], $opts); }
Returns an empty set of search results. This is returned from {@see nextPage()} when we know that there isn't a next page in order to replicate the behavior of the API when it attempts to return a page beyond the last. @param null|array|string $opts @return SearchResult
emptySearchResult
php
stripe/stripe-php
lib/SearchResult.php
https://github.com/stripe/stripe-php/blob/master/lib/SearchResult.php
MIT
public function isEmpty() { return empty($this->data); }
Returns true if the page object contains no element. @return bool
isEmpty
php
stripe/stripe-php
lib/SearchResult.php
https://github.com/stripe/stripe-php/blob/master/lib/SearchResult.php
MIT
public function nextPage($params = null, $opts = null) { if (!$this->has_more) { return static::emptySearchResult($opts); } $params = \array_merge( $this->filters ?: [], ['page' => $this->next_page], $params ?: [] ); return $this->all($params, $opts); }
Fetches the next page in the resource list (if there is one). This method will try to respect the limit of the current page. If none was given, the default limit will be fetched again. @param null|array $params @param null|array|string $opts @return SearchResult<TStripeObject> @throws Exception\ApiErrorException
nextPage
php
stripe/stripe-php
lib/SearchResult.php
https://github.com/stripe/stripe-php/blob/master/lib/SearchResult.php
MIT
public function first() { return \count($this->data) > 0 ? $this->data[0] : null; }
Gets the first item from the current page. Returns `null` if the current page is empty. @return null|TStripeObject
first
php
stripe/stripe-php
lib/SearchResult.php
https://github.com/stripe/stripe-php/blob/master/lib/SearchResult.php
MIT
public function last() { return \count($this->data) > 0 ? $this->data[\count($this->data) - 1] : null; }
Gets the last item from the current page. Returns `null` if the current page is empty. @return null|TStripeObject
last
php
stripe/stripe-php
lib/SearchResult.php
https://github.com/stripe/stripe-php/blob/master/lib/SearchResult.php
MIT