PaymentIntent.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. namespace Stripe;
  3. /**
  4. * Class PaymentIntent
  5. *
  6. * @property string $id
  7. * @property string $object
  8. * @property string[] $allowed_source_types
  9. * @property int $amount
  10. * @property int $amount_capturable
  11. * @property int $amount_received
  12. * @property string $application
  13. * @property int $application_fee
  14. * @property int $canceled_at
  15. * @property string $capture_method
  16. * @property Collection $charges
  17. * @property string $client_secret
  18. * @property int $created
  19. * @property string $currency
  20. * @property string $customer
  21. * @property string $description
  22. * @property bool $livemode
  23. * @property StripeObject $metadata
  24. * @property mixed $next_source_action
  25. * @property string $on_behalf_of
  26. * @property string $receipt_email
  27. * @property string $return_url
  28. * @property mixed $shipping
  29. * @property string $source
  30. * @property string $statement_descriptor
  31. * @property string $status
  32. * @property mixed $transfer_data
  33. * @property string $transfer_group
  34. *
  35. * @package Stripe
  36. */
  37. class PaymentIntent extends ApiResource
  38. {
  39. const OBJECT_NAME = "payment_intent";
  40. use ApiOperations\All;
  41. use ApiOperations\Create;
  42. use ApiOperations\Retrieve;
  43. use ApiOperations\Update;
  44. /**
  45. * @param array|null $params
  46. * @param array|string|null $options
  47. *
  48. * @return PaymentIntent The canceled payment intent.
  49. */
  50. public function cancel($params = null, $options = null)
  51. {
  52. $url = $this->instanceUrl() . '/cancel';
  53. list($response, $opts) = $this->_request('post', $url);
  54. $this->refreshFrom($response, $opts);
  55. return $this;
  56. }
  57. /**
  58. * @param array|null $params
  59. * @param array|string|null $options
  60. *
  61. * @return PaymentIntent The captured payment intent.
  62. */
  63. public function capture($params = null, $options = null)
  64. {
  65. $url = $this->instanceUrl() . '/capture';
  66. list($response, $opts) = $this->_request('post', $url);
  67. $this->refreshFrom($response, $opts);
  68. return $this;
  69. }
  70. /**
  71. * @param array|null $params
  72. * @param array|string|null $options
  73. *
  74. * @return PaymentIntent The confirmed payment intent.
  75. */
  76. public function confirm($params = null, $options = null)
  77. {
  78. $url = $this->instanceUrl() . '/confirm';
  79. list($response, $opts) = $this->_request('post', $url);
  80. $this->refreshFrom($response, $opts);
  81. return $this;
  82. }
  83. }