PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 4.17.1
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v4.17.1
4.17.1 4.17.0 4.16.19 4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / third-party / vendor / stripe / stripe-php / lib / Checkout / Session.php
wp-user-avatar / third-party / vendor / stripe / stripe-php / lib / Checkout Last commit date
Session.php 2 months ago
Session.php
214 lines
1 <?php
2
3 // File generated from our OpenAPI spec
4 namespace ProfilePressVendor\Stripe\Checkout;
5
6 /**
7 * A Checkout Session represents your customer's session as they pay for
8 * one-time purchases or subscriptions through <a href="https://stripe.com/docs/payments/checkout">Checkout</a>
9 * or <a href="https://stripe.com/docs/payments/payment-links">Payment Links</a>. We recommend creating a
10 * new Session each time your customer attempts to pay.
11 *
12 * Once payment is successful, the Checkout Session will contain a reference
13 * to the <a href="https://stripe.com/docs/api/customers">Customer</a>, and either the successful
14 * <a href="https://stripe.com/docs/api/payment_intents">PaymentIntent</a> or an active
15 * <a href="https://stripe.com/docs/api/subscriptions">Subscription</a>.
16 *
17 * You can create a Checkout Session on your server and redirect to its URL
18 * to begin Checkout.
19 *
20 * Related guide: <a href="https://stripe.com/docs/checkout/quickstart">Checkout quickstart</a>
21 *
22 * @property string $id Unique identifier for the object.
23 * @property string $object String representing the object's type. Objects of the same type share the same value.
24 * @property null|\Stripe\StripeObject $adaptive_pricing Settings for price localization with <a href="https://docs.stripe.com/payments/checkout/adaptive-pricing">Adaptive Pricing</a>.
25 * @property null|\Stripe\StripeObject $after_expiration When set, provides configuration for actions to take if this Checkout Session expires.
26 * @property null|bool $allow_promotion_codes Enables user redeemable promotion codes.
27 * @property null|int $amount_subtotal Total of all items before discounts or taxes are applied.
28 * @property null|int $amount_total Total of all items after discounts and taxes are applied.
29 * @property \Stripe\StripeObject $automatic_tax
30 * @property null|string $billing_address_collection Describes whether Checkout should collect the customer's billing address. Defaults to <code>auto</code>.
31 * @property null|string $cancel_url If set, Checkout displays a back button and customers will be directed to this URL if they decide to cancel payment and return to your website.
32 * @property null|string $client_reference_id A unique string to reference the Checkout Session. This can be a customer ID, a cart ID, or similar, and can be used to reconcile the Session with your internal systems.
33 * @property null|string $client_secret Client secret to be used when initializing Stripe.js embedded checkout.
34 * @property null|\Stripe\StripeObject $collected_information Information about the customer collected within the Checkout Session.
35 * @property null|\Stripe\StripeObject $consent Results of <code>consent_collection</code> for this session.
36 * @property null|\Stripe\StripeObject $consent_collection When set, provides configuration for the Checkout Session to gather active consent from customers.
37 * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
38 * @property null|string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
39 * @property null|\Stripe\StripeObject $currency_conversion Currency conversion details for <a href="https://docs.stripe.com/payments/checkout/adaptive-pricing">Adaptive Pricing</a> sessions
40 * @property \Stripe\StripeObject[] $custom_fields Collect additional information from your customer using custom fields. Up to 3 fields are supported.
41 * @property \Stripe\StripeObject $custom_text
42 * @property null|string|\Stripe\Customer $customer The ID of the customer for this Session. For Checkout Sessions in <code>subscription</code> mode or Checkout Sessions with <code>customer_creation</code> set as <code>always</code> in <code>payment</code> mode, Checkout will create a new customer object based on information provided during the payment flow unless an existing customer was provided when the Session was created.
43 * @property null|string $customer_creation Configure whether a Checkout Session creates a Customer when the Checkout Session completes.
44 * @property null|\Stripe\StripeObject $customer_details The customer details including the customer's tax exempt status and the customer's tax IDs. Customer's address details are not present on Sessions in <code>setup</code> mode.
45 * @property null|string $customer_email If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once the payment flow is complete, use the <code>customer</code> attribute.
46 * @property null|\Stripe\StripeObject[] $discounts List of coupons and promotion codes attached to the Checkout Session.
47 * @property int $expires_at The timestamp at which the Checkout Session will expire.
48 * @property null|string|\Stripe\Invoice $invoice ID of the invoice created by the Checkout Session, if it exists.
49 * @property null|\Stripe\StripeObject $invoice_creation Details on the state of invoice creation for the Checkout Session.
50 * @property null|\Stripe\Collection<\Stripe\LineItem> $line_items The line items purchased by the customer.
51 * @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.
52 * @property null|string $locale The IETF language tag of the locale Checkout is displayed in. If blank or <code>auto</code>, the browser's locale is used.
53 * @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.
54 * @property string $mode The mode of the Checkout Session.
55 * @property null|string|\Stripe\PaymentIntent $payment_intent The ID of the PaymentIntent for Checkout Sessions in <code>payment</code> mode. You can't confirm or cancel the PaymentIntent for a Checkout Session. To cancel, <a href="https://stripe.com/docs/api/checkout/sessions/expire">expire the Checkout Session</a> instead.
56 * @property null|string|\Stripe\PaymentLink $payment_link The ID of the Payment Link that created this Session.
57 * @property null|string $payment_method_collection Configure whether a Checkout Session should collect a payment method. Defaults to <code>always</code>.
58 * @property null|\Stripe\StripeObject $payment_method_configuration_details Information about the payment method configuration used for this Checkout session if using dynamic payment methods.
59 * @property null|\Stripe\StripeObject $payment_method_options Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession.
60 * @property string[] $payment_method_types A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept.
61 * @property string $payment_status The payment status of the Checkout Session, one of <code>paid</code>, <code>unpaid</code>, or <code>no_payment_required</code>. You can use this value to decide when to fulfill your customer's order.
62 * @property null|\Stripe\StripeObject $phone_number_collection
63 * @property null|string $recovered_from The ID of the original expired Checkout Session that triggered the recovery flow.
64 * @property null|string $redirect_on_completion This parameter applies to <code>ui_mode: embedded</code>. Learn more about the <a href="https://stripe.com/docs/payments/checkout/custom-success-page?payment-ui=embedded-form">redirect behavior</a> of embedded sessions. Defaults to <code>always</code>.
65 * @property null|string $return_url Applies to Checkout Sessions with <code>ui_mode: embedded</code>. The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site.
66 * @property null|\Stripe\StripeObject $saved_payment_method_options Controls saved payment method settings for the session. Only available in <code>payment</code> and <code>subscription</code> mode.
67 * @property null|string|\Stripe\SetupIntent $setup_intent The ID of the SetupIntent for Checkout Sessions in <code>setup</code> mode. You can't confirm or cancel the SetupIntent for a Checkout Session. To cancel, <a href="https://stripe.com/docs/api/checkout/sessions/expire">expire the Checkout Session</a> instead.
68 * @property null|\Stripe\StripeObject $shipping_address_collection When set, provides configuration for Checkout to collect a shipping address from a customer.
69 * @property null|\Stripe\StripeObject $shipping_cost The details of the customer cost of shipping, including the customer chosen ShippingRate.
70 * @property null|\Stripe\StripeObject $shipping_details Shipping information for this Checkout Session.
71 * @property \Stripe\StripeObject[] $shipping_options The shipping rate options applied to this Session.
72 * @property null|string $status The status of the Checkout Session, one of <code>open</code>, <code>complete</code>, or <code>expired</code>.
73 * @property null|string $submit_type Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button. <code>submit_type</code> can only be specified on Checkout Sessions in <code>payment</code> mode. If blank or <code>auto</code>, <code>pay</code> is used.
74 * @property null|string|\Stripe\Subscription $subscription The ID of the subscription for Checkout Sessions in <code>subscription</code> mode.
75 * @property null|string $success_url The URL the customer will be directed to after the payment or subscription creation is successful.
76 * @property null|\Stripe\StripeObject $tax_id_collection
77 * @property null|\Stripe\StripeObject $total_details Tax and discount details for the computed total amount.
78 * @property null|string $ui_mode The UI mode of the Session. Defaults to <code>hosted</code>.
79 * @property null|string $url The URL to the Checkout Session. Redirect customers to this URL to take them to Checkout. If you’re using <a href="https://stripe.com/docs/payments/checkout/custom-domains">Custom Domains</a>, the URL will use your subdomain. Otherwise, it’ll use <code>checkout.stripe.com.</code> This value is only present when the session is active.
80 */
81 class Session extends \ProfilePressVendor\Stripe\ApiResource
82 {
83 const OBJECT_NAME = 'checkout.session';
84 use \ProfilePressVendor\Stripe\ApiOperations\Update;
85 const BILLING_ADDRESS_COLLECTION_AUTO = 'auto';
86 const BILLING_ADDRESS_COLLECTION_REQUIRED = 'required';
87 const CUSTOMER_CREATION_ALWAYS = 'always';
88 const CUSTOMER_CREATION_IF_REQUIRED = 'if_required';
89 const MODE_PAYMENT = 'payment';
90 const MODE_SETUP = 'setup';
91 const MODE_SUBSCRIPTION = 'subscription';
92 const PAYMENT_METHOD_COLLECTION_ALWAYS = 'always';
93 const PAYMENT_METHOD_COLLECTION_IF_REQUIRED = 'if_required';
94 const PAYMENT_STATUS_NO_PAYMENT_REQUIRED = 'no_payment_required';
95 const PAYMENT_STATUS_PAID = 'paid';
96 const PAYMENT_STATUS_UNPAID = 'unpaid';
97 const REDIRECT_ON_COMPLETION_ALWAYS = 'always';
98 const REDIRECT_ON_COMPLETION_IF_REQUIRED = 'if_required';
99 const REDIRECT_ON_COMPLETION_NEVER = 'never';
100 const STATUS_COMPLETE = 'complete';
101 const STATUS_EXPIRED = 'expired';
102 const STATUS_OPEN = 'open';
103 const SUBMIT_TYPE_AUTO = 'auto';
104 const SUBMIT_TYPE_BOOK = 'book';
105 const SUBMIT_TYPE_DONATE = 'donate';
106 const SUBMIT_TYPE_PAY = 'pay';
107 const SUBMIT_TYPE_SUBSCRIBE = 'subscribe';
108 const UI_MODE_EMBEDDED = 'embedded';
109 const UI_MODE_HOSTED = 'hosted';
110 /**
111 * Creates a Session object.
112 *
113 * @param null|array $params
114 * @param null|array|string $options
115 *
116 * @throws \Stripe\Exception\ApiErrorException if the request fails
117 *
118 * @return \Stripe\Checkout\Session the created resource
119 */
120 public static function create($params = null, $options = null)
121 {
122 self::_validateParams($params);
123 $url = static::classUrl();
124 list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
125 $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
126 $obj->setLastResponse($response);
127 return $obj;
128 }
129 /**
130 * Returns a list of Checkout Sessions.
131 *
132 * @param null|array $params
133 * @param null|array|string $opts
134 *
135 * @throws \Stripe\Exception\ApiErrorException if the request fails
136 *
137 * @return \Stripe\Collection<\Stripe\Checkout\Session> of ApiResources
138 */
139 public static function all($params = null, $opts = null)
140 {
141 $url = static::classUrl();
142 return static::_requestPage($url, \ProfilePressVendor\Stripe\Collection::class, $params, $opts);
143 }
144 /**
145 * Retrieves a Session object.
146 *
147 * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
148 * @param null|array|string $opts
149 *
150 * @throws \Stripe\Exception\ApiErrorException if the request fails
151 *
152 * @return \Stripe\Checkout\Session
153 */
154 public static function retrieve($id, $opts = null)
155 {
156 $opts = \ProfilePressVendor\Stripe\Util\RequestOptions::parse($opts);
157 $instance = new static($id, $opts);
158 $instance->refresh();
159 return $instance;
160 }
161 /**
162 * Updates a Session object.
163 *
164 * @param string $id the ID of the resource to update
165 * @param null|array $params
166 * @param null|array|string $opts
167 *
168 * @throws \Stripe\Exception\ApiErrorException if the request fails
169 *
170 * @return \Stripe\Checkout\Session the updated resource
171 */
172 public static function update($id, $params = null, $opts = null)
173 {
174 self::_validateParams($params);
175 $url = static::resourceUrl($id);
176 list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
177 $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
178 $obj->setLastResponse($response);
179 return $obj;
180 }
181 /**
182 * @param null|array $params
183 * @param null|array|string $opts
184 *
185 * @throws \Stripe\Exception\ApiErrorException if the request fails
186 *
187 * @return \Stripe\Checkout\Session the expired session
188 */
189 public function expire($params = null, $opts = null)
190 {
191 $url = $this->instanceUrl() . '/expire';
192 list($response, $opts) = $this->_request('post', $url, $params, $opts);
193 $this->refreshFrom($response, $opts);
194 return $this;
195 }
196 /**
197 * @param string $id
198 * @param null|array $params
199 * @param null|array|string $opts
200 *
201 * @throws \Stripe\Exception\ApiErrorException if the request fails
202 *
203 * @return \Stripe\Collection<\Stripe\LineItem> list of line items
204 */
205 public static function allLineItems($id, $params = null, $opts = null)
206 {
207 $url = static::resourceUrl($id) . '/line_items';
208 list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
209 $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
210 $obj->setLastResponse($response);
211 return $obj;
212 }
213 }
214