TokenService.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Service;
  4. class TokenService extends \Stripe\Service\AbstractService
  5. {
  6. /**
  7. * Creates a single-use token that represents a bank account’s details. This token
  8. * can be used with any API method in place of a bank account dictionary. This
  9. * token can be used only once, by attaching it to a <a href="#accounts">Custom
  10. * account</a>.
  11. *
  12. * @param null|array $params
  13. * @param null|array|\Stripe\Util\RequestOptions $opts
  14. *
  15. * @throws \Stripe\Exception\ApiErrorException if the request fails
  16. *
  17. * @return \Stripe\Token
  18. */
  19. public function create($params = null, $opts = null)
  20. {
  21. return $this->request('post', '/v1/tokens', $params, $opts);
  22. }
  23. /**
  24. * Retrieves the token with the given ID.
  25. *
  26. * @param string $id
  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\Token
  33. */
  34. public function retrieve($id, $params = null, $opts = null)
  35. {
  36. return $this->request('get', $this->buildPath('/v1/tokens/%s', $id), $params, $opts);
  37. }
  38. }