• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-php / 6471862601

10 Oct 2023 04:02PM UTC coverage: 69.665% (-0.5%) from 70.141%
6471862601

push

github

web-flow
Merge pull request #1570 from localheinz/feature/coveralls

Enhancement: Use `coverallsapp/github-action` to report code coverage

2393 of 3435 relevant lines covered (69.67%)

3.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lib/Refund.php
1
<?php
2

3
// File generated from our OpenAPI spec
4

5
namespace Stripe;
6

7
/**
8
 * Refund objects allow you to refund a previously created charge that isn't
9
 * refunded yet. Funds are refunded to the credit or debit card that's
10
 * initially charged.
11
 *
12
 * Related guide: <a href="https://stripe.com/docs/refunds">Refunds</a>
13
 *
14
 * @property string $id Unique identifier for the object.
15
 * @property string $object String representing the object's type. Objects of the same type share the same value.
16
 * @property int $amount Amount, in cents (or local equivalent).
17
 * @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact on your account balance.
18
 * @property null|string|\Stripe\Charge $charge ID of the charge that's refunded.
19
 * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
20
 * @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>.
21
 * @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).
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. For credit card refunds, this can be <code>pending</code>, <code>succeeded</code>, or <code>failed</code>. For other types of refunds, it 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

38
    use ApiOperations\All;
39
    use ApiOperations\Create;
40
    use ApiOperations\Retrieve;
41
    use ApiOperations\Update;
42

43
    const FAILURE_REASON_EXPIRED_OR_CANCELED_CARD = 'expired_or_canceled_card';
44
    const FAILURE_REASON_LOST_OR_STOLEN_CARD = 'lost_or_stolen_card';
45
    const FAILURE_REASON_UNKNOWN = 'unknown';
46

47
    const REASON_DUPLICATE = 'duplicate';
48
    const REASON_EXPIRED_UNCAPTURED_CHARGE = 'expired_uncaptured_charge';
49
    const REASON_FRAUDULENT = 'fraudulent';
50
    const REASON_REQUESTED_BY_CUSTOMER = 'requested_by_customer';
51

52
    const STATUS_CANCELED = 'canceled';
53
    const STATUS_FAILED = 'failed';
54
    const STATUS_PENDING = 'pending';
55
    const STATUS_REQUIRES_ACTION = 'requires_action';
56
    const STATUS_SUCCEEDED = 'succeeded';
57

58
    /**
59
     * @param null|array $params
60
     * @param null|array|string $opts
61
     *
62
     * @throws \Stripe\Exception\ApiErrorException if the request fails
63
     *
64
     * @return \Stripe\Refund the canceled refund
65
     */
66
    public function cancel($params = null, $opts = null)
×
67
    {
68
        $url = $this->instanceUrl() . '/cancel';
×
69
        list($response, $opts) = $this->_request('post', $url, $params, $opts);
×
70
        $this->refreshFrom($response, $opts);
×
71

72
        return $this;
×
73
    }
74
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc