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

Refunds #40

Open
CushtyDev opened this issue Nov 7, 2024 · 2 comments
Open

Refunds #40

CushtyDev opened this issue Nov 7, 2024 · 2 comments

Comments

@CushtyDev
Copy link

Hi, I have been reading the docs but can't see anything about refunds. Great package by the way :) Let me know, thanks

@l4nos
Copy link
Owner

l4nos commented Nov 20, 2024

Refunds are straightforward and not needed to be done via the package, you simply standard cashier, feeding in the ID of the payment intent / charge.

Happy to assist further if you're stuck.

@Tob0t
Copy link

Tob0t commented Feb 17, 2025

This did not work for me:

$store->refund($booking->stripe_payment_intent_id, [
            'amount' => $request->amount * 100,
            'refund_application_fee' => true,
            'reason' => 'requested_by_customer',
        ],
            ['stripe_account' => $store->stripeAccountId()],
        );

Response/Error: No such payment_intent

I guess it is due to the implementation of Cashier, which is not allowing any additional $opts:

    /**
     * Refund a customer for a charge.
     *
     * @param  string  $paymentIntent
     * @param  array  $options
     * @return \Stripe\Refund
     */
    public function refund($paymentIntent, array $options = [])
    {
        return static::stripe()->refunds->create(
            ['payment_intent' => $paymentIntent] + $options
        );
    }

This worked for me (workaround):

Cashier::stripe()->refunds->create(
            [
                'payment_intent' => $booking->stripe_payment_intent_id,
                'amount' => $request->amount * 100,
                'refund_application_fee' => true,
                'reason' => 'requested_by_customer',
            ],
            ['stripe_account' => $store->stripeAccountId()],
        );

So I think it would be beneficial to also provide this over this package, I can contribute with a PR if you want ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants