ApiOperations
2 months ago
Apps
2 months ago
Billing
2 months ago
BillingPortal
2 months ago
Checkout
2 months ago
Climate
2 months ago
Entitlements
2 months ago
EventData
2 months ago
Events
2 months ago
Exception
2 months ago
FinancialConnections
2 months ago
Forwarding
2 months ago
HttpClient
2 months ago
Identity
2 months ago
Issuing
2 months ago
Radar
2 months ago
Reporting
2 months ago
Service
2 months ago
Sigma
2 months ago
Tax
2 months ago
Terminal
2 months ago
TestHelpers
2 months ago
Treasury
2 months ago
Util
2 months ago
V2
2 months ago
Account.php
2 months ago
AccountLink.php
2 months ago
AccountSession.php
2 months ago
ApiRequestor.php
2 months ago
ApiResource.php
2 months ago
ApiResponse.php
2 months ago
ApplePayDomain.php
2 months ago
Application.php
2 months ago
ApplicationFee.php
2 months ago
ApplicationFeeRefund.php
2 months ago
Balance.php
2 months ago
BalanceTransaction.php
2 months ago
BankAccount.php
2 months ago
BaseStripeClient.php
2 months ago
BaseStripeClientInterface.php
2 months ago
Capability.php
2 months ago
Card.php
2 months ago
CashBalance.php
2 months ago
Charge.php
2 months ago
Collection.php
2 months ago
ConfirmationToken.php
2 months ago
ConnectCollectionTransfer.php
2 months ago
CountrySpec.php
2 months ago
Coupon.php
2 months ago
CreditNote.php
2 months ago
CreditNoteLineItem.php
2 months ago
Customer.php
2 months ago
CustomerBalanceTransaction.php
2 months ago
CustomerCashBalanceTransaction.php
2 months ago
CustomerSession.php
2 months ago
Discount.php
2 months ago
Dispute.php
2 months ago
EphemeralKey.php
2 months ago
ErrorObject.php
2 months ago
Event.php
2 months ago
ExchangeRate.php
2 months ago
File.php
2 months ago
FileLink.php
2 months ago
FundingInstructions.php
2 months ago
Invoice.php
2 months ago
InvoiceItem.php
2 months ago
InvoiceLineItem.php
2 months ago
InvoiceRenderingTemplate.php
2 months ago
LineItem.php
2 months ago
LoginLink.php
2 months ago
Mandate.php
2 months ago
OAuth.php
2 months ago
OAuthErrorObject.php
2 months ago
PaymentIntent.php
2 months ago
PaymentLink.php
2 months ago
PaymentMethod.php
2 months ago
PaymentMethodConfiguration.php
2 months ago
PaymentMethodDomain.php
2 months ago
Payout.php
2 months ago
Person.php
2 months ago
Plan.php
2 months ago
Price.php
2 months ago
Product.php
2 months ago
ProductFeature.php
2 months ago
PromotionCode.php
2 months ago
Quote.php
2 months ago
Reason.php
2 months ago
RecipientTransfer.php
2 months ago
Refund.php
2 months ago
RelatedObject.php
2 months ago
RequestTelemetry.php
2 months ago
ReserveTransaction.php
2 months ago
Review.php
2 months ago
SearchResult.php
2 months ago
SetupAttempt.php
2 months ago
SetupIntent.php
2 months ago
ShippingRate.php
2 months ago
SingletonApiResource.php
2 months ago
Source.php
2 months ago
SourceMandateNotification.php
2 months ago
SourceTransaction.php
2 months ago
Stripe.php
2 months ago
StripeClient.php
2 months ago
StripeClientInterface.php
2 months ago
StripeObject.php
2 months ago
StripeStreamingClientInterface.php
2 months ago
Subscription.php
2 months ago
SubscriptionItem.php
2 months ago
SubscriptionSchedule.php
2 months ago
TaxCode.php
2 months ago
TaxDeductedAtSource.php
2 months ago
TaxId.php
2 months ago
TaxRate.php
2 months ago
ThinEvent.php
2 months ago
Token.php
2 months ago
Topup.php
2 months ago
Transfer.php
2 months ago
TransferReversal.php
2 months ago
UsageRecord.php
2 months ago
UsageRecordSummary.php
2 months ago
Webhook.php
2 months ago
WebhookEndpoint.php
2 months ago
WebhookSignature.php
2 months ago
Refund.php
154 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | namespace ProfilePressVendor\Stripe; |
| 5 | |
| 6 | /** |
| 7 | * Refund objects allow you to refund a previously created charge that isn't |
| 8 | * refunded yet. Funds are refunded to the credit or debit card that's |
| 9 | * initially charged. |
| 10 | * |
| 11 | * Related guide: <a href="https://stripe.com/docs/refunds">Refunds</a> |
| 12 | * |
| 13 | * @property string $id Unique identifier for the object. |
| 14 | * @property string $object String representing the object's type. Objects of the same type share the same value. |
| 15 | * @property int $amount Amount, in cents (or local equivalent). |
| 16 | * @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact on your account balance. |
| 17 | * @property null|string|\Stripe\Charge $charge ID of the charge that's refunded. |
| 18 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. |
| 19 | * @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>. |
| 20 | * @property null|string $description An arbitrary string attached to the object. You can use this for displaying to users (available on non-card refunds only). |
| 21 | * @property null|\Stripe\StripeObject $destination_details |
| 22 | * @property null|string|\Stripe\BalanceTransaction $failure_balance_transaction After the refund fails, this balance transaction describes the adjustment made on your account balance that reverses the initial balance transaction. |
| 23 | * @property null|string $failure_reason Provides the reason for the refund failure. Possible values are: <code>lost_or_stolen_card</code>, <code>expired_or_canceled_card</code>, <code>charge_for_pending_refund_disputed</code>, <code>insufficient_funds</code>, <code>declined</code>, <code>merchant_request</code>, or <code>unknown</code>. |
| 24 | * @property null|string $instructions_email For payment methods without native refund support (for example, Konbini, PromptPay), provide an email address for the customer to receive refund instructions. |
| 25 | * @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. |
| 26 | * @property null|\Stripe\StripeObject $next_action |
| 27 | * @property null|string|\Stripe\PaymentIntent $payment_intent ID of the PaymentIntent that's refunded. |
| 28 | * @property null|string $reason Reason for the refund, which is either user-provided (<code>duplicate</code>, <code>fraudulent</code>, or <code>requested_by_customer</code>) or generated by Stripe internally (<code>expired_uncaptured_charge</code>). |
| 29 | * @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this refund. |
| 30 | * @property null|string|\Stripe\TransferReversal $source_transfer_reversal The transfer reversal that's associated with the refund. Only present if the charge came from another Stripe account. |
| 31 | * @property null|string $status Status of the refund. This can be <code>pending</code>, <code>requires_action</code>, <code>succeeded</code>, <code>failed</code>, or <code>canceled</code>. Learn more about <a href="https://stripe.com/docs/refunds#failed-refunds">failed refunds</a>. |
| 32 | * @property null|string|\Stripe\TransferReversal $transfer_reversal This refers to the transfer reversal object if the accompanying transfer reverses. This is only applicable if the charge was created using the destination parameter. |
| 33 | */ |
| 34 | class Refund extends ApiResource |
| 35 | { |
| 36 | const OBJECT_NAME = 'refund'; |
| 37 | use ApiOperations\Update; |
| 38 | const FAILURE_REASON_EXPIRED_OR_CANCELED_CARD = 'expired_or_canceled_card'; |
| 39 | const FAILURE_REASON_LOST_OR_STOLEN_CARD = 'lost_or_stolen_card'; |
| 40 | const FAILURE_REASON_UNKNOWN = 'unknown'; |
| 41 | const REASON_DUPLICATE = 'duplicate'; |
| 42 | const REASON_EXPIRED_UNCAPTURED_CHARGE = 'expired_uncaptured_charge'; |
| 43 | const REASON_FRAUDULENT = 'fraudulent'; |
| 44 | const REASON_REQUESTED_BY_CUSTOMER = 'requested_by_customer'; |
| 45 | const STATUS_CANCELED = 'canceled'; |
| 46 | const STATUS_FAILED = 'failed'; |
| 47 | const STATUS_PENDING = 'pending'; |
| 48 | const STATUS_REQUIRES_ACTION = 'requires_action'; |
| 49 | const STATUS_SUCCEEDED = 'succeeded'; |
| 50 | /** |
| 51 | * When you create a new refund, you must specify a Charge or a PaymentIntent |
| 52 | * object on which to create it. |
| 53 | * |
| 54 | * Creating a new refund will refund a charge that has previously been created but |
| 55 | * not yet refunded. Funds will be refunded to the credit or debit card that was |
| 56 | * originally charged. |
| 57 | * |
| 58 | * You can optionally refund only part of a charge. You can do so multiple times, |
| 59 | * until the entire charge has been refunded. |
| 60 | * |
| 61 | * Once entirely refunded, a charge can’t be refunded again. This method will raise |
| 62 | * an error when called on an already-refunded charge, or when trying to refund |
| 63 | * more money than is left on a charge. |
| 64 | * |
| 65 | * @param null|array $params |
| 66 | * @param null|array|string $options |
| 67 | * |
| 68 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 69 | * |
| 70 | * @return \Stripe\Refund the created resource |
| 71 | */ |
| 72 | public static function create($params = null, $options = null) |
| 73 | { |
| 74 | self::_validateParams($params); |
| 75 | $url = static::classUrl(); |
| 76 | list($response, $opts) = static::_staticRequest('post', $url, $params, $options); |
| 77 | $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 78 | $obj->setLastResponse($response); |
| 79 | return $obj; |
| 80 | } |
| 81 | /** |
| 82 | * Returns a list of all refunds you created. We return the refunds in sorted |
| 83 | * order, with the most recent refunds appearing first. The 10 most recent refunds |
| 84 | * are always available by default on the Charge object. |
| 85 | * |
| 86 | * @param null|array $params |
| 87 | * @param null|array|string $opts |
| 88 | * |
| 89 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 90 | * |
| 91 | * @return \Stripe\Collection<\Stripe\Refund> of ApiResources |
| 92 | */ |
| 93 | public static function all($params = null, $opts = null) |
| 94 | { |
| 95 | $url = static::classUrl(); |
| 96 | return static::_requestPage($url, \ProfilePressVendor\Stripe\Collection::class, $params, $opts); |
| 97 | } |
| 98 | /** |
| 99 | * Retrieves the details of an existing refund. |
| 100 | * |
| 101 | * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key |
| 102 | * @param null|array|string $opts |
| 103 | * |
| 104 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 105 | * |
| 106 | * @return \Stripe\Refund |
| 107 | */ |
| 108 | public static function retrieve($id, $opts = null) |
| 109 | { |
| 110 | $opts = \ProfilePressVendor\Stripe\Util\RequestOptions::parse($opts); |
| 111 | $instance = new static($id, $opts); |
| 112 | $instance->refresh(); |
| 113 | return $instance; |
| 114 | } |
| 115 | /** |
| 116 | * Updates the refund that you specify by setting the values of the passed |
| 117 | * parameters. Any parameters that you don’t provide remain unchanged. |
| 118 | * |
| 119 | * This request only accepts <code>metadata</code> as an argument. |
| 120 | * |
| 121 | * @param string $id the ID of the resource to update |
| 122 | * @param null|array $params |
| 123 | * @param null|array|string $opts |
| 124 | * |
| 125 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 126 | * |
| 127 | * @return \Stripe\Refund the updated resource |
| 128 | */ |
| 129 | public static function update($id, $params = null, $opts = null) |
| 130 | { |
| 131 | self::_validateParams($params); |
| 132 | $url = static::resourceUrl($id); |
| 133 | list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); |
| 134 | $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 135 | $obj->setLastResponse($response); |
| 136 | return $obj; |
| 137 | } |
| 138 | /** |
| 139 | * @param null|array $params |
| 140 | * @param null|array|string $opts |
| 141 | * |
| 142 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 143 | * |
| 144 | * @return \Stripe\Refund the canceled refund |
| 145 | */ |
| 146 | public function cancel($params = null, $opts = null) |
| 147 | { |
| 148 | $url = $this->instanceUrl() . '/cancel'; |
| 149 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 150 | $this->refreshFrom($response, $opts); |
| 151 | return $this; |
| 152 | } |
| 153 | } |
| 154 |