ApiOperations
2 months ago
Apps
2 months ago
Billing
2 months ago
BillingPortal
2 months ago
Checkout
2 months ago
Climate
2 months ago
Entitlements
2 months ago
EventData
2 months ago
Events
2 months ago
Exception
2 months ago
FinancialConnections
2 months ago
Forwarding
2 months ago
HttpClient
2 months ago
Identity
2 months ago
Issuing
2 months ago
Radar
2 months ago
Reporting
2 months ago
Service
2 months ago
Sigma
2 months ago
Tax
2 months ago
Terminal
2 months ago
TestHelpers
2 months ago
Treasury
2 months ago
Util
2 months ago
V2
2 months ago
Account.php
2 months ago
AccountLink.php
2 months ago
AccountSession.php
2 months ago
ApiRequestor.php
2 months ago
ApiResource.php
2 months ago
ApiResponse.php
2 months ago
ApplePayDomain.php
2 months ago
Application.php
2 months ago
ApplicationFee.php
2 months ago
ApplicationFeeRefund.php
2 months ago
Balance.php
2 months ago
BalanceTransaction.php
2 months ago
BankAccount.php
2 months ago
BaseStripeClient.php
2 months ago
BaseStripeClientInterface.php
2 months ago
Capability.php
2 months ago
Card.php
2 months ago
CashBalance.php
2 months ago
Charge.php
2 months ago
Collection.php
2 months ago
ConfirmationToken.php
2 months ago
ConnectCollectionTransfer.php
2 months ago
CountrySpec.php
2 months ago
Coupon.php
2 months ago
CreditNote.php
2 months ago
CreditNoteLineItem.php
2 months ago
Customer.php
2 months ago
CustomerBalanceTransaction.php
2 months ago
CustomerCashBalanceTransaction.php
2 months ago
CustomerSession.php
2 months ago
Discount.php
2 months ago
Dispute.php
2 months ago
EphemeralKey.php
2 months ago
ErrorObject.php
2 months ago
Event.php
2 months ago
ExchangeRate.php
2 months ago
File.php
2 months ago
FileLink.php
2 months ago
FundingInstructions.php
2 months ago
Invoice.php
2 months ago
InvoiceItem.php
2 months ago
InvoiceLineItem.php
2 months ago
InvoiceRenderingTemplate.php
2 months ago
LineItem.php
2 months ago
LoginLink.php
2 months ago
Mandate.php
2 months ago
OAuth.php
2 months ago
OAuthErrorObject.php
2 months ago
PaymentIntent.php
2 months ago
PaymentLink.php
2 months ago
PaymentMethod.php
2 months ago
PaymentMethodConfiguration.php
2 months ago
PaymentMethodDomain.php
2 months ago
Payout.php
2 months ago
Person.php
2 months ago
Plan.php
2 months ago
Price.php
2 months ago
Product.php
2 months ago
ProductFeature.php
2 months ago
PromotionCode.php
2 months ago
Quote.php
2 months ago
Reason.php
2 months ago
RecipientTransfer.php
2 months ago
Refund.php
2 months ago
RelatedObject.php
2 months ago
RequestTelemetry.php
2 months ago
ReserveTransaction.php
2 months ago
Review.php
2 months ago
SearchResult.php
2 months ago
SetupAttempt.php
2 months ago
SetupIntent.php
2 months ago
ShippingRate.php
2 months ago
SingletonApiResource.php
2 months ago
Source.php
2 months ago
SourceMandateNotification.php
2 months ago
SourceTransaction.php
2 months ago
Stripe.php
2 months ago
StripeClient.php
2 months ago
StripeClientInterface.php
2 months ago
StripeObject.php
2 months ago
StripeStreamingClientInterface.php
2 months ago
Subscription.php
2 months ago
SubscriptionItem.php
2 months ago
SubscriptionSchedule.php
2 months ago
TaxCode.php
2 months ago
TaxDeductedAtSource.php
2 months ago
TaxId.php
2 months ago
TaxRate.php
2 months ago
ThinEvent.php
2 months ago
Token.php
2 months ago
Topup.php
2 months ago
Transfer.php
2 months ago
TransferReversal.php
2 months ago
UsageRecord.php
2 months ago
UsageRecordSummary.php
2 months ago
Webhook.php
2 months ago
WebhookEndpoint.php
2 months ago
WebhookSignature.php
2 months ago
SetupIntent.php
196 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | namespace ProfilePressVendor\Stripe; |
| 5 | |
| 6 | /** |
| 7 | * A SetupIntent guides you through the process of setting up and saving a customer's payment credentials for future payments. |
| 8 | * For example, you can use a SetupIntent to set up and save your customer's card without immediately collecting a payment. |
| 9 | * Later, you can use <a href="https://stripe.com/docs/api#payment_intents">PaymentIntents</a> to drive the payment flow. |
| 10 | * |
| 11 | * Create a SetupIntent when you're ready to collect your customer's payment credentials. |
| 12 | * Don't maintain long-lived, unconfirmed SetupIntents because they might not be valid. |
| 13 | * The SetupIntent transitions through multiple <a href="https://docs.stripe.com/payments/intents#intent-statuses">statuses</a> as it guides |
| 14 | * you through the setup process. |
| 15 | * |
| 16 | * Successful SetupIntents result in payment credentials that are optimized for future payments. |
| 17 | * For example, cardholders in <a href="https://stripe.com/guides/strong-customer-authentication">certain regions</a> might need to be run through |
| 18 | * <a href="https://docs.stripe.com/strong-customer-authentication">Strong Customer Authentication</a> during payment method collection |
| 19 | * to streamline later <a href="https://docs.stripe.com/payments/setup-intents">off-session payments</a>. |
| 20 | * If you use the SetupIntent with a <a href="https://stripe.com/docs/api#setup_intent_object-customer">Customer</a>, |
| 21 | * it automatically attaches the resulting payment method to that Customer after successful setup. |
| 22 | * We recommend using SetupIntents or <a href="https://stripe.com/docs/api#payment_intent_object-setup_future_usage">setup_future_usage</a> on |
| 23 | * PaymentIntents to save payment methods to prevent saving invalid or unoptimized payment methods. |
| 24 | * |
| 25 | * By using SetupIntents, you can reduce friction for your customers, even as regulations change over time. |
| 26 | * |
| 27 | * Related guide: <a href="https://docs.stripe.com/payments/setup-intents">Setup Intents API</a> |
| 28 | * |
| 29 | * @property string $id Unique identifier for the object. |
| 30 | * @property string $object String representing the object's type. Objects of the same type share the same value. |
| 31 | * @property null|string|\Stripe\Application $application ID of the Connect application that created the SetupIntent. |
| 32 | * @property null|bool $attach_to_self <p>If present, the SetupIntent's payment method will be attached to the in-context Stripe Account.</p><p>It can only be used for this Stripe Account’s own money movement flows like InboundTransfer and OutboundTransfers. It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer.</p> |
| 33 | * @property null|\Stripe\StripeObject $automatic_payment_methods Settings for dynamic payment methods compatible with this Setup Intent |
| 34 | * @property null|string $cancellation_reason Reason for cancellation of this SetupIntent, one of <code>abandoned</code>, <code>requested_by_customer</code>, or <code>duplicate</code>. |
| 35 | * @property null|string $client_secret <p>The client secret of this SetupIntent. Used for client-side retrieval using a publishable key.</p><p>The client secret can be used to complete payment setup from your frontend. It should not be stored, logged, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.</p> |
| 36 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. |
| 37 | * @property null|string|\Stripe\Customer $customer <p>ID of the Customer this SetupIntent belongs to, if one exists.</p><p>If present, the SetupIntent's payment method will be attached to the Customer on successful setup. Payment methods attached to other Customers cannot be used with this SetupIntent.</p> |
| 38 | * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. |
| 39 | * @property null|string[] $flow_directions <p>Indicates the directions of money movement for which this payment method is intended to be used.</p><p>Include <code>inbound</code> if you intend to use the payment method as the origin to pull funds from. Include <code>outbound</code> if you intend to use the payment method as the destination to send funds to. You can include both if you intend to use the payment method for both purposes.</p> |
| 40 | * @property null|\Stripe\StripeObject $last_setup_error The error encountered in the previous SetupIntent confirmation. |
| 41 | * @property null|string|\Stripe\SetupAttempt $latest_attempt The most recent SetupAttempt for this SetupIntent. |
| 42 | * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. |
| 43 | * @property null|string|\Stripe\Mandate $mandate ID of the multi use Mandate generated by the SetupIntent. |
| 44 | * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. |
| 45 | * @property null|\Stripe\StripeObject $next_action If present, this property tells you what actions you need to take in order for your customer to continue payment setup. |
| 46 | * @property null|string|\Stripe\Account $on_behalf_of The account (if any) for which the setup is intended. |
| 47 | * @property null|string|\Stripe\PaymentMethod $payment_method ID of the payment method used with this SetupIntent. If the payment method is <code>card_present</code> and isn't a digital wallet, then the <a href="https://docs.stripe.com/api/setup_attempts/object#setup_attempt_object-payment_method_details-card_present-generated_card">generated_card</a> associated with the <code>latest_attempt</code> is attached to the Customer instead. |
| 48 | * @property null|\Stripe\StripeObject $payment_method_configuration_details Information about the <a href="https://stripe.com/docs/api/payment_method_configurations">payment method configuration</a> used for this Setup Intent. |
| 49 | * @property null|\Stripe\StripeObject $payment_method_options Payment method-specific configuration for this SetupIntent. |
| 50 | * @property string[] $payment_method_types The list of payment method types (e.g. card) that this SetupIntent is allowed to set up. |
| 51 | * @property null|string|\Stripe\Mandate $single_use_mandate ID of the single_use Mandate generated by the SetupIntent. |
| 52 | * @property string $status <a href="https://stripe.com/docs/payments/intents#intent-statuses">Status</a> of this SetupIntent, one of <code>requires_payment_method</code>, <code>requires_confirmation</code>, <code>requires_action</code>, <code>processing</code>, <code>canceled</code>, or <code>succeeded</code>. |
| 53 | * @property string $usage <p>Indicates how the payment method is intended to be used in the future.</p><p>Use <code>on_session</code> if you intend to only reuse the payment method when the customer is in your checkout flow. Use <code>off_session</code> if your customer may or may not be in your checkout flow. If not provided, this value defaults to <code>off_session</code>.</p> |
| 54 | */ |
| 55 | class SetupIntent extends ApiResource |
| 56 | { |
| 57 | const OBJECT_NAME = 'setup_intent'; |
| 58 | use ApiOperations\Update; |
| 59 | const CANCELLATION_REASON_ABANDONED = 'abandoned'; |
| 60 | const CANCELLATION_REASON_DUPLICATE = 'duplicate'; |
| 61 | const CANCELLATION_REASON_REQUESTED_BY_CUSTOMER = 'requested_by_customer'; |
| 62 | const STATUS_CANCELED = 'canceled'; |
| 63 | const STATUS_PROCESSING = 'processing'; |
| 64 | const STATUS_REQUIRES_ACTION = 'requires_action'; |
| 65 | const STATUS_REQUIRES_CONFIRMATION = 'requires_confirmation'; |
| 66 | const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method'; |
| 67 | const STATUS_SUCCEEDED = 'succeeded'; |
| 68 | /** |
| 69 | * Creates a SetupIntent object. |
| 70 | * |
| 71 | * After you create the SetupIntent, attach a payment method and <a |
| 72 | * href="/docs/api/setup_intents/confirm">confirm</a> it to collect any required |
| 73 | * permissions to charge the payment method later. |
| 74 | * |
| 75 | * @param null|array $params |
| 76 | * @param null|array|string $options |
| 77 | * |
| 78 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 79 | * |
| 80 | * @return \Stripe\SetupIntent the created resource |
| 81 | */ |
| 82 | public static function create($params = null, $options = null) |
| 83 | { |
| 84 | self::_validateParams($params); |
| 85 | $url = static::classUrl(); |
| 86 | list($response, $opts) = static::_staticRequest('post', $url, $params, $options); |
| 87 | $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 88 | $obj->setLastResponse($response); |
| 89 | return $obj; |
| 90 | } |
| 91 | /** |
| 92 | * Returns a list of SetupIntents. |
| 93 | * |
| 94 | * @param null|array $params |
| 95 | * @param null|array|string $opts |
| 96 | * |
| 97 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 98 | * |
| 99 | * @return \Stripe\Collection<\Stripe\SetupIntent> of ApiResources |
| 100 | */ |
| 101 | public static function all($params = null, $opts = null) |
| 102 | { |
| 103 | $url = static::classUrl(); |
| 104 | return static::_requestPage($url, \ProfilePressVendor\Stripe\Collection::class, $params, $opts); |
| 105 | } |
| 106 | /** |
| 107 | * Retrieves the details of a SetupIntent that has previously been created. |
| 108 | * |
| 109 | * Client-side retrieval using a publishable key is allowed when the |
| 110 | * <code>client_secret</code> is provided in the query string. |
| 111 | * |
| 112 | * When retrieved with a publishable key, only a subset of properties will be |
| 113 | * returned. Please refer to the <a href="#setup_intent_object">SetupIntent</a> |
| 114 | * object reference for more details. |
| 115 | * |
| 116 | * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key |
| 117 | * @param null|array|string $opts |
| 118 | * |
| 119 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 120 | * |
| 121 | * @return \Stripe\SetupIntent |
| 122 | */ |
| 123 | public static function retrieve($id, $opts = null) |
| 124 | { |
| 125 | $opts = \ProfilePressVendor\Stripe\Util\RequestOptions::parse($opts); |
| 126 | $instance = new static($id, $opts); |
| 127 | $instance->refresh(); |
| 128 | return $instance; |
| 129 | } |
| 130 | /** |
| 131 | * Updates a SetupIntent object. |
| 132 | * |
| 133 | * @param string $id the ID of the resource to update |
| 134 | * @param null|array $params |
| 135 | * @param null|array|string $opts |
| 136 | * |
| 137 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 138 | * |
| 139 | * @return \Stripe\SetupIntent the updated resource |
| 140 | */ |
| 141 | public static function update($id, $params = null, $opts = null) |
| 142 | { |
| 143 | self::_validateParams($params); |
| 144 | $url = static::resourceUrl($id); |
| 145 | list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); |
| 146 | $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 147 | $obj->setLastResponse($response); |
| 148 | return $obj; |
| 149 | } |
| 150 | /** |
| 151 | * @param null|array $params |
| 152 | * @param null|array|string $opts |
| 153 | * |
| 154 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 155 | * |
| 156 | * @return \Stripe\SetupIntent the canceled setup intent |
| 157 | */ |
| 158 | public function cancel($params = null, $opts = null) |
| 159 | { |
| 160 | $url = $this->instanceUrl() . '/cancel'; |
| 161 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 162 | $this->refreshFrom($response, $opts); |
| 163 | return $this; |
| 164 | } |
| 165 | /** |
| 166 | * @param null|array $params |
| 167 | * @param null|array|string $opts |
| 168 | * |
| 169 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 170 | * |
| 171 | * @return \Stripe\SetupIntent the confirmed setup intent |
| 172 | */ |
| 173 | public function confirm($params = null, $opts = null) |
| 174 | { |
| 175 | $url = $this->instanceUrl() . '/confirm'; |
| 176 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 177 | $this->refreshFrom($response, $opts); |
| 178 | return $this; |
| 179 | } |
| 180 | /** |
| 181 | * @param null|array $params |
| 182 | * @param null|array|string $opts |
| 183 | * |
| 184 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 185 | * |
| 186 | * @return \Stripe\SetupIntent the verified setup intent |
| 187 | */ |
| 188 | public function verifyMicrodeposits($params = null, $opts = null) |
| 189 | { |
| 190 | $url = $this->instanceUrl() . '/verify_microdeposits'; |
| 191 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 192 | $this->refreshFrom($response, $opts); |
| 193 | return $this; |
| 194 | } |
| 195 | } |
| 196 |