PaymentLinkService.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Service;
  4. /**
  5. * @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
  6. * @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
  7. */
  8. class PaymentLinkService extends \Stripe\Service\AbstractService
  9. {
  10. /**
  11. * Returns a list of your payment links.
  12. *
  13. * @param null|array $params
  14. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  15. *
  16. * @throws \Stripe\Exception\ApiErrorException if the request fails
  17. *
  18. * @return \Stripe\Collection<\Stripe\PaymentLink>
  19. */
  20. public function all($params = null, $opts = null)
  21. {
  22. return $this->requestCollection('get', '/v1/payment_links', $params, $opts);
  23. }
  24. /**
  25. * When retrieving a payment link, there is an includable
  26. * <strong>line_items</strong> property containing the first handful of those
  27. * items. There is also a URL where you can retrieve the full (paginated) list of
  28. * line items.
  29. *
  30. * @param string $id
  31. * @param null|array $params
  32. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  33. *
  34. * @throws \Stripe\Exception\ApiErrorException if the request fails
  35. *
  36. * @return \Stripe\Collection<\Stripe\LineItem>
  37. */
  38. public function allLineItems($id, $params = null, $opts = null)
  39. {
  40. return $this->requestCollection('get', $this->buildPath('/v1/payment_links/%s/line_items', $id), $params, $opts);
  41. }
  42. /**
  43. * Creates a payment link.
  44. *
  45. * @param null|array $params
  46. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  47. *
  48. * @throws \Stripe\Exception\ApiErrorException if the request fails
  49. *
  50. * @return \Stripe\PaymentLink
  51. */
  52. public function create($params = null, $opts = null)
  53. {
  54. return $this->request('post', '/v1/payment_links', $params, $opts);
  55. }
  56. /**
  57. * Retrieve a payment link.
  58. *
  59. * @param string $id
  60. * @param null|array $params
  61. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  62. *
  63. * @throws \Stripe\Exception\ApiErrorException if the request fails
  64. *
  65. * @return \Stripe\PaymentLink
  66. */
  67. public function retrieve($id, $params = null, $opts = null)
  68. {
  69. return $this->request('get', $this->buildPath('/v1/payment_links/%s', $id), $params, $opts);
  70. }
  71. /**
  72. * Updates a payment link.
  73. *
  74. * @param string $id
  75. * @param null|array $params
  76. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  77. *
  78. * @throws \Stripe\Exception\ApiErrorException if the request fails
  79. *
  80. * @return \Stripe\PaymentLink
  81. */
  82. public function update($id, $params = null, $opts = null)
  83. {
  84. return $this->request('post', $this->buildPath('/v1/payment_links/%s', $id), $params, $opts);
  85. }
  86. }