Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Charges must be refunded using the /v1/charges/{CHARGE_ID}/refunds endpoint. #1778

Open
program-the-brain-not-the-heartbeat opened this issue Oct 21, 2024 · 1 comment
Assignees
Labels

Comments

@program-the-brain-not-the-heartbeat

Describe the bug

Issuing a refund was working but it seems to randomly broken in my codebase without passing a charge ID and only passing the payment_intent ID.

It used to return successful through the API, now it is throwing an InvalidRequestException. In Stripe Dashboard, it says the refund has processed successfullly.

image

To Reproduce

See code snippets

Expected behavior

Refund should not throw exception in API.

Code snippets

// $reason = 'requested_by_customer';
// $payment->getToken() = 'pi_********';

        $refund = $this->c->get('stripe')->refunds->create([
            'amount' => $amount,
            //'charge' => $charge['id'],
            'payment_intent' => $payment->getToken(),
            'reason' => $reason,
        ]);

The following is returned thrugh a InvalidRequestException:

Status is:400
Type is:invalid_request_error
Code is:
Param is:
Message is:Charges must be refunded using the /v1/charges/{CHARGE_ID}/refunds endpoint.


### OS

Linux

### PHP version

PHP 8.3

### Library version

stripe-php v14.10.0

### API version

2024-04-10

### Additional context

_No response_
@remi-stripe
Copy link
Contributor

@program-the-brain-not-the-heartbeat do you have an exact request id req_123 I can look at to better understand what's throwing this error internally?

@remi-stripe remi-stripe self-assigned this Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants