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

Status not updating for previously declined cards. #1625

Closed
danielsiemers opened this issue Nov 11, 2024 · 3 comments
Closed

Status not updating for previously declined cards. #1625

danielsiemers opened this issue Nov 11, 2024 · 3 comments
Assignees
Labels
issue Something isn't working correctly

Comments

@danielsiemers
Copy link

danielsiemers commented Nov 11, 2024

What happened?

I'm experiencing some issues with the stripe webhooks.

When a card is declined and then updated to a card that succeeds, I get a 500 error on the webhook when posting the payment_intent.successful event.

The error occurs in the StripeCallbackService.php file on like 89:
$metadata['type'] = $paymentMethod->type;

It says cannot read attribute type on a string.
This means that this piece of code above:

$paymentIntent = $stripe->paymentIntents->retrieve(
$paymentIntent->id,
['expand' => ['customer', 'payment_method', 'invoice.subscription.plan.product']]
);

Is not actually expanding the payment_method and instead returning the string for the payment id.

Any help here is appreciated, many thanks!

Errors and Stack Trace (if available)

yii\base\ErrorException: Attempt to read property "type" on string in /container/application/releases/15b166078606ce95bcf2d0438a0e0bcd071fa5d1/vendor/solspace/craft-freeform/packages/plugin/src/Integrations/PaymentGateways/Stripe/Services/StripeCallbackService.php:89


Stack trace:
#0 /container/application/releases/15b166078606ce95bcf2d0438a0e0bcd071fa5d1/vendor/craftcms/cms/src/web/ErrorHandler.php(79): yii\base\ErrorHandler->handleError(2, 'Attempt to read...', '/container/appl...', 89)
#1 /container/application/releases/15b166078606ce95bcf2d0438a0e0bcd071fa5d1/vendor/solspace/craft-freeform/packages/plugin/src/Integrations/PaymentGateways/Stripe/Services/StripeCallbackService.php(89): craft\web\ErrorHandler->handleError(2, 'Attempt to read...', '/container/appl...', 89)
#2 /container/application/releases/15b166078606ce95bcf2d0438a0e0bcd071fa5d1/vendor/solspace/craft-freeform/packages/plugin/src/Integrations/PaymentGateways/Stripe/Controllers/StripeWebhookController.php(74): Solspace\Freeform\Integrations\PaymentGateways\Stripe\Services\StripeCallbackService->handleSavedForm(Object(Solspace\Freeform\Form\Types\Regular), Object(Solspace\Freeform\Integrations\PaymentGateways\Stripe\Stripe), Object(Solspace\Freeform\Integrations\PaymentGateways\Stripe\Fields\StripeField), Object(Stripe\PaymentIntent), Object(Solspace\Freeform\Records\SavedFormRecord))
#3 /container/application/releases/15b166078606ce95bcf2d0438a0e0bcd071fa5d1/vendor/solspace/craft-freeform/packages/plugin/src/Integrations/PaymentGateways/Stripe/Controllers/StripeWebhookController.php(51): Solspace\Freeform\Integrations\PaymentGateways\Stripe\Controllers\StripeWebhookController->handlePaymentIntent(Object(Stripe\Event))
#4 [internal function]: Solspace\Freeform\Integrations\PaymentGateways\Stripe\Controllers\StripeWebhookController->actionWebhooks()
#5 /container/application/releases/15b166078606ce95bcf2d0438a0e0bcd071fa5d1/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#6 /container/application/releases/15b166078606ce95bcf2d0438a0e0bcd071fa5d1/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#7 /container/application/releases/15b166078606ce95bcf2d0438a0e0bcd071fa5d1/vendor/solspace/craft-freeform/packages/plugin/src/controllers/BaseApiController.php(15): yii\base\Controller->runAction('webhooks', Array)
#8 /container/application/releases/15b166078606ce95bcf2d0438a0e0bcd071fa5d1/vendor/yiisoft/yii2/base/Module.php(552): Solspace\Freeform\controllers\BaseApiController->runAction('webhooks', Array)
#9 /container/application/releases/15b166078606ce95bcf2d0438a0e0bcd071fa5d1/vendor/craftcms/cms/src/web/Application.php(349): yii\base\Module->runAction('freeform/stripe...', Array)
#10 /container/application/releases/15b166078606ce95bcf2d0438a0e0bcd071fa5d1/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('freeform/stripe...', Array)
#11 /container/application/releases/15b166078606ce95bcf2d0438a0e0bcd071fa5d1/vendor/craftcms/cms/src/web/Application.php(317): yii\web\Application->handleRequest(Object(craft\web\Request))
#12 /container/application/releases/15b166078606ce95bcf2d0438a0e0bcd071fa5d1/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#13 /container/application/releases/15b166078606ce95bcf2d0438a0e0bcd071fa5d1/public/index.php(12): yii\base\Application->run()

How can we reproduce this?

  1. Use a test card with an elevated risk 4000000000009235
  2. Make a test payment on a stripe field
  3. Ensure the card is decline at first and then authorised on a subsequent request
  4. Check the submission to see the status for the payment is "
    Requires payment method"

Freeform Edition

Pro

Freeform Version

5.6.8

Craft Version

5.3.6

When did this issue start?

Fresh install of Freeform

Previous Freeform Version

No response

@danielsiemers danielsiemers added the issue Something isn't working correctly label Nov 11, 2024
@kjmartens
Copy link
Contributor

Sorry for the delay and the trouble you're experiencing @danielsiemers.

We will investigate this issue shortly. 🙂

@kjmartens
Copy link
Contributor

Hi @danielsiemers,

This will be resolved in Freeform 5.7.3, which will be available later today. 🙂

@danielsiemers
Copy link
Author

Amazing!
Will give it a go when this releases.

Thank you @kjmartens!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue Something isn't working correctly
Development

No branches or pull requests

3 participants