duncanmcclean / simple-commerce

A simple, yet powerful e-commerce addon for Statamic.
https://statamic.com/addons/duncanmcclean/simple-commerce
Other
146 stars 40 forks source link

500 error on Stripe Refund #653

Closed barchard closed 2 years ago

barchard commented 2 years ago

Bug Description

[2022-06-08 21:48:28] production.ERROR: Stripe: No Payment Intent was provided to action a refund. {"userId":"91e33e27-32da-468a-bd5f-fbc21eb88c89","exception":"[object] (DoubleThreeDigital\\SimpleCommerce\\Exceptions\\RefundFailed(code: 0): Stripe: No Payment Intent was provided to action a refund. at /home/vendor/doublethreedigital/simple-commerce/src/Gateways/Builtin/StripeGateway.php:137)
[stacktrace]
#0 /home/vendor/doublethreedigital/simple-commerce/src/Gateways/Manager.php(72): DoubleThreeDigital\\SimpleCommerce\\Gateways\\Builtin\\StripeGateway->refundCharge()
#1 /home/vendor/doublethreedigital/simple-commerce/src/Actions/RefundAction.php(45): DoubleThreeDigital\\SimpleCommerce\\Gateways\\Manager->refundCharge()
#2 /home/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(263): DoubleThreeDigital\\SimpleCommerce\\Actions\\RefundAction->DoubleThreeDigital\\SimpleCommerce\\Actions\\{closure}()
#3 /home/vendor/doublethreedigital/simple-commerce/src/Actions/RefundAction.php(46): Illuminate\\Support\\Collection->each()
#4 /home/vendor/statamic/cms/src/Http/Controllers/CP/ActionController.php(36): DoubleThreeDigital\\SimpleCommerce\\Actions\\RefundAction->run()

Steps to reproduce

  1. attempt to issue a refund via the cp

Environment

Statamic 3.3.4 Pro
Laravel 9.6.0
PHP 8.1.3
aryehraber/statamic-captcha 1.8.0
doublethreedigital/sc-digital-products 2.3.2
doublethreedigital/simple-commerce 2.4.7
doublethreedigital/yumyum 1.2.2
statamic/seo-pro 3.1.0
duncanmcclean commented 2 years ago

This has been fixed in a future version, v2.4.11.

Simple Commerce wasn't previously saving the Stripe Payment Intent as part of the 'gateway data' which was required in order for an order to be refunded. New orders after updating will be refundable fine.

Older orders can be refunded via Stripe. You may (although, it's not required) mark is_refunded on the order.