Session.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\FinancialConnections;
  4. /**
  5. * A Financial Connections Session is the secure way to programmatically launch the client-side Stripe.js modal that lets your users link their accounts.
  6. *
  7. * @property string $id Unique identifier for the object.
  8. * @property string $object String representing the object's type. Objects of the same type share the same value.
  9. * @property null|\Stripe\StripeObject $account_holder The account holder for whom accounts are collected in this session.
  10. * @property \Stripe\Collection<\Stripe\FinancialConnections\Account> $accounts The accounts that were collected as part of this Session.
  11. * @property string $client_secret A value that will be passed to the client to launch the authentication flow.
  12. * @property null|\Stripe\StripeObject $filters
  13. * @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.
  14. * @property string[] $permissions Permissions requested for accounts collected during this session.
  15. * @property null|string[] $prefetch Data features requested to be retrieved upon account creation.
  16. * @property null|string $return_url For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app.
  17. */
  18. class Session extends \Stripe\ApiResource
  19. {
  20. const OBJECT_NAME = 'financial_connections.session';
  21. /**
  22. * To launch the Financial Connections authorization flow, create a
  23. * <code>Session</code>. The session’s <code>client_secret</code> can be used to
  24. * launch the flow using Stripe.js.
  25. *
  26. * @param null|array $params
  27. * @param null|array|string $options
  28. *
  29. * @throws \Stripe\Exception\ApiErrorException if the request fails
  30. *
  31. * @return \Stripe\FinancialConnections\Session the created resource
  32. */
  33. public static function create($params = null, $options = null)
  34. {
  35. self::_validateParams($params);
  36. $url = static::classUrl();
  37. list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
  38. $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
  39. $obj->setLastResponse($response);
  40. return $obj;
  41. }
  42. /**
  43. * Retrieves the details of a Financial Connections <code>Session</code>.
  44. *
  45. * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
  46. * @param null|array|string $opts
  47. *
  48. * @throws \Stripe\Exception\ApiErrorException if the request fails
  49. *
  50. * @return \Stripe\FinancialConnections\Session
  51. */
  52. public static function retrieve($id, $opts = null)
  53. {
  54. $opts = \Stripe\Util\RequestOptions::parse($opts);
  55. $instance = new static($id, $opts);
  56. $instance->refresh();
  57. return $instance;
  58. }
  59. }