Payout.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace Stripe;
  3. /**
  4. * Class Payout
  5. *
  6. * @property string $id
  7. * @property string $object
  8. * @property int $amount
  9. * @property int $arrival_date
  10. * @property bool $automatic
  11. * @property string $balance_transaction
  12. * @property int $created
  13. * @property string $currency
  14. * @property string $destination
  15. * @property string $failure_balance_transaction
  16. * @property string $failure_code
  17. * @property string $failure_message
  18. * @property bool $livemode
  19. * @property StripeObject $metadata
  20. * @property string $method
  21. * @property string $recipient
  22. * @property string $source_type
  23. * @property string $statement_descriptor
  24. * @property string $status
  25. * @property string $type
  26. *
  27. * @package Stripe
  28. */
  29. class Payout extends ApiResource
  30. {
  31. const OBJECT_NAME = "payout";
  32. /**
  33. * Types of payout failure codes.
  34. * @link https://stripe.com/docs/api#payout_failures
  35. */
  36. const FAILURE_ACCOUNT_CLOSED = 'account_closed';
  37. const FAILURE_ACCOUNT_FROZEN = 'account_frozen';
  38. const FAILURE_BANK_ACCOUNT_RESTRICTED = 'bank_account_restricted';
  39. const FAILURE_BANK_OWNERSHIP_CHANGED = 'bank_ownership_changed';
  40. const FAILURE_COULD_NOT_PROCESS = 'could_not_process';
  41. const FAILURE_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized';
  42. const FAILURE_DECLINED = 'declined';
  43. const FAILURE_INCORRECT_ACCOUNT_HOLDER_NAME = 'incorrect_account_holder_name';
  44. const FAILURE_INSUFFICIENT_FUNDS = 'insufficient_funds';
  45. const FAILURE_INVALID_ACCOUNT_NUMBER = 'invalid_account_number';
  46. const FAILURE_INVALID_CURRENCY = 'invalid_currency';
  47. const FAILURE_NO_ACCOUNT = 'no_account';
  48. const FAILURE_UNSUPPORTED_CARD = 'unsupported_card';
  49. use ApiOperations\All;
  50. use ApiOperations\Create;
  51. use ApiOperations\Retrieve;
  52. use ApiOperations\Update;
  53. /**
  54. * @return Payout The canceled payout.
  55. */
  56. public function cancel()
  57. {
  58. $url = $this->instanceUrl() . '/cancel';
  59. list($response, $opts) = $this->_request('post', $url);
  60. $this->refreshFrom($response, $opts);
  61. return $this;
  62. }
  63. }