SessionService.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Service\Checkout;
  4. class SessionService extends \Stripe\Service\AbstractService
  5. {
  6. /**
  7. * Returns a list of Checkout Sessions.
  8. *
  9. * @param null|array $params
  10. * @param null|array|\Stripe\Util\RequestOptions $opts
  11. *
  12. * @throws \Stripe\Exception\ApiErrorException if the request fails
  13. *
  14. * @return \Stripe\Collection
  15. */
  16. public function all($params = null, $opts = null)
  17. {
  18. return $this->requestCollection('get', '/v1/checkout/sessions', $params, $opts);
  19. }
  20. /**
  21. * When retrieving a Checkout Session, there is an includable
  22. * <strong>line_items</strong> property containing the first handful of those
  23. * items. There is also a URL where you can retrieve the full (paginated) list of
  24. * line items.
  25. *
  26. * @param string $parentId
  27. * @param null|array $params
  28. * @param null|array|\Stripe\Util\RequestOptions $opts
  29. *
  30. * @throws \Stripe\Exception\ApiErrorException if the request fails
  31. *
  32. * @return \Stripe\Collection
  33. */
  34. public function allLineItems($parentId, $params = null, $opts = null)
  35. {
  36. return $this->requestCollection('get', $this->buildPath('/v1/checkout/sessions/%s/line_items', $parentId), $params, $opts);
  37. }
  38. /**
  39. * Creates a Session object.
  40. *
  41. * @param null|array $params
  42. * @param null|array|\Stripe\Util\RequestOptions $opts
  43. *
  44. * @throws \Stripe\Exception\ApiErrorException if the request fails
  45. *
  46. * @return \Stripe\Checkout\Session
  47. */
  48. public function create($params = null, $opts = null)
  49. {
  50. return $this->request('post', '/v1/checkout/sessions', $params, $opts);
  51. }
  52. /**
  53. * Retrieves a Session object.
  54. *
  55. * @param string $id
  56. * @param null|array $params
  57. * @param null|array|\Stripe\Util\RequestOptions $opts
  58. *
  59. * @throws \Stripe\Exception\ApiErrorException if the request fails
  60. *
  61. * @return \Stripe\Checkout\Session
  62. */
  63. public function retrieve($id, $params = null, $opts = null)
  64. {
  65. return $this->request('get', $this->buildPath('/v1/checkout/sessions/%s', $id), $params, $opts);
  66. }
  67. }