TransferReversal.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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
  6. * reverse transfers made to a connected account, either entirely or partially, and
  7. * can also specify whether to refund any related application fees. Transfer
  8. * reversals add to the platform's balance and subtract from the destination
  9. * account's balance.
  10. *
  11. * Reversing a transfer that was made for a <a
  12. * href="/docs/connect/destination-charges">destination charge</a> is allowed only
  13. * up to the amount of the charge. It is possible to reverse a <a
  14. * href="https://stripe.com/docs/connect/charges-transfers#transfer-options">transfer_group</a>
  15. * transfer only if the destination account has enough balance to cover the
  16. * reversal.
  17. *
  18. * Related guide: <a
  19. * href="https://stripe.com/docs/connect/charges-transfers#reversing-transfers">Reversing
  20. * Transfers</a>.
  21. *
  22. * @property string $id Unique identifier for the object.
  23. * @property string $object String representing the object's type. Objects of the same type share the same value.
  24. * @property int $amount Amount, in %s.
  25. * @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact on your account balance.
  26. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
  27. * @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>.
  28. * @property null|string|\Stripe\Refund $destination_payment_refund Linked payment refund for the transfer reversal.
  29. * @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.
  30. * @property null|string|\Stripe\Refund $source_refund ID of the refund responsible for the transfer reversal.
  31. * @property string|\Stripe\Transfer $transfer ID of the transfer that was reversed.
  32. */
  33. class TransferReversal extends ApiResource
  34. {
  35. const OBJECT_NAME = 'transfer_reversal';
  36. use ApiOperations\Update {
  37. save as protected _save;
  38. }
  39. /**
  40. * @return string the API URL for this Stripe transfer reversal
  41. */
  42. public function instanceUrl()
  43. {
  44. $id = $this['id'];
  45. $transfer = $this['transfer'];
  46. if (!$id) {
  47. throw new Exception\UnexpectedValueException(
  48. 'Could not determine which URL to request: ' .
  49. "class instance has invalid ID: {$id}",
  50. null
  51. );
  52. }
  53. $id = Util\Util::utf8($id);
  54. $transfer = Util\Util::utf8($transfer);
  55. $base = Transfer::classUrl();
  56. $transferExtn = \urlencode($transfer);
  57. $extn = \urlencode($id);
  58. return "{$base}/{$transferExtn}/reversals/{$extn}";
  59. }
  60. /**
  61. * @param null|array|string $opts
  62. *
  63. * @throws \Stripe\Exception\ApiErrorException if the request fails
  64. *
  65. * @return TransferReversal the saved reversal
  66. */
  67. public function save($opts = null)
  68. {
  69. return $this->_save($opts);
  70. }
  71. }