ConfirmationToken.php 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe;
  4. /**
  5. * ConfirmationTokens help transport client side data collected by Stripe JS over
  6. * to your server for confirming a PaymentIntent or SetupIntent. If the confirmation
  7. * is successful, values present on the ConfirmationToken are written onto the Intent.
  8. *
  9. * To learn more about how to use ConfirmationToken, visit the related guides:
  10. * - <a href="https://stripe.com/docs/payments/finalize-payments-on-the-server">Finalize payments on the server</a>
  11. * - <a href="https://stripe.com/docs/payments/build-a-two-step-confirmation">Build two-step confirmation</a>.
  12. *
  13. * @property string $id Unique identifier for the object.
  14. * @property string $object String representing the object's type. Objects of the same type share the same value.
  15. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
  16. * @property null|int $expires_at Time at which this ConfirmationToken expires and can no longer be used to confirm a PaymentIntent or SetupIntent.
  17. * @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.
  18. * @property null|\Stripe\StripeObject $mandate_data Data used for generating a Mandate.
  19. * @property null|string $payment_intent ID of the PaymentIntent that this ConfirmationToken was used to confirm, or null if this ConfirmationToken has not yet been used.
  20. * @property null|\Stripe\StripeObject $payment_method_preview Payment details collected by the Payment Element, used to create a PaymentMethod when a PaymentIntent or SetupIntent is confirmed with this ConfirmationToken.
  21. * @property null|string $return_url Return URL used to confirm the Intent.
  22. * @property null|string $setup_future_usage <p>Indicates that you intend to make future payments with this ConfirmationToken's payment method.</p><p>The presence of this property will <a href="https://stripe.com/docs/payments/save-during-payment">attach the payment method</a> to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete.</p>
  23. * @property null|string $setup_intent ID of the SetupIntent that this ConfirmationToken was used to confirm, or null if this ConfirmationToken has not yet been used.
  24. * @property null|\Stripe\StripeObject $shipping Shipping information collected on this ConfirmationToken.
  25. * @property bool $use_stripe_sdk Indicates whether the Stripe SDK is used to handle confirmation flow. Defaults to <code>true</code> on ConfirmationToken.
  26. */
  27. class ConfirmationToken extends ApiResource
  28. {
  29. const OBJECT_NAME = 'confirmation_token';
  30. const SETUP_FUTURE_USAGE_OFF_SESSION = 'off_session';
  31. const SETUP_FUTURE_USAGE_ON_SESSION = 'on_session';
  32. /**
  33. * Retrieves an existing ConfirmationToken object.
  34. *
  35. * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
  36. * @param null|array|string $opts
  37. *
  38. * @throws \Stripe\Exception\ApiErrorException if the request fails
  39. *
  40. * @return \Stripe\ConfirmationToken
  41. */
  42. public static function retrieve($id, $opts = null)
  43. {
  44. $opts = \Stripe\Util\RequestOptions::parse($opts);
  45. $instance = new static($id, $opts);
  46. $instance->refresh();
  47. return $instance;
  48. }
  49. }