TransferReversal.php 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe;
  4. /**
  5. * <a href="https://stripe.com/docs/connect">Stripe Connect</a> platforms can reverse transfers made to a
  6. * connected account, either entirely or partially, and can also specify whether
  7. * to refund any related application fees. Transfer reversals add to the
  8. * platform's balance and subtract from the destination account's balance.
  9. *
  10. * Reversing a transfer that was made for a <a href="/docs/connect/destination-charges">destination
  11. * charge</a> is allowed only up to the amount of
  12. * the charge. It is possible to reverse a
  13. * <a href="https://stripe.com/docs/connect/separate-charges-and-transfers#transfer-options">transfer_group</a>
  14. * transfer only if the destination account has enough balance to cover the
  15. * reversal.
  16. *
  17. * Related guide: <a href="https://stripe.com/docs/connect/separate-charges-and-transfers#reverse-transfers">Reverse transfers</a>
  18. *
  19. * @property string $id Unique identifier for the object.
  20. * @property string $object String representing the object's type. Objects of the same type share the same value.
  21. * @property int $amount Amount, in cents (or local equivalent).
  22. * @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact on your account balance.
  23. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
  24. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
  25. * @property null|string|\Stripe\Refund $destination_payment_refund Linked payment refund for the transfer reversal.
  26. * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
  27. * @property null|string|\Stripe\Refund $source_refund ID of the refund responsible for the transfer reversal.
  28. * @property string|\Stripe\Transfer $transfer ID of the transfer that was reversed.
  29. */
  30. class TransferReversal extends ApiResource
  31. {
  32. const OBJECT_NAME = 'transfer_reversal';
  33. use ApiOperations\Update {
  34. save as protected _save;
  35. }
  36. /**
  37. * @return string the API URL for this Stripe transfer reversal
  38. */
  39. public function instanceUrl()
  40. {
  41. $id = $this['id'];
  42. $transfer = $this['transfer'];
  43. if (!$id) {
  44. throw new Exception\UnexpectedValueException(
  45. 'Could not determine which URL to request: ' .
  46. "class instance has invalid ID: {$id}",
  47. null
  48. );
  49. }
  50. $id = Util\Util::utf8($id);
  51. $transfer = Util\Util::utf8($transfer);
  52. $base = Transfer::classUrl();
  53. $transferExtn = \urlencode($transfer);
  54. $extn = \urlencode($id);
  55. return "{$base}/{$transferExtn}/reversals/{$extn}";
  56. }
  57. /**
  58. * @param null|array|string $opts
  59. *
  60. * @throws \Stripe\Exception\ApiErrorException if the request fails
  61. *
  62. * @return TransferReversal the saved reversal
  63. */
  64. public function save($opts = null)
  65. {
  66. return $this->_save($opts);
  67. }
  68. }