digital-pros / commerce-authorize

Authorize.net - Craft Commerce 2 Plugin
Other
3 stars 9 forks source link

Something went wrong while scheduling the recurring payment #45

Closed AmandaLutzTO closed 5 months ago

AmandaLutzTO commented 7 months ago

I don't know if this is related to https://github.com/digital-pros/commerce-authorize/issues/42 but I also can't get subscriptions to work. In my case an initial purchase is successfully processed using gateway Authorize.net and then EVENT_AFTER_COMPLETE_ORDER calls createSubscription() which would use gateway Authorize.net Subscription.

The front end error says "Something went wrong while scheduling the recurring payment in Authorize.net (Payment information is required.) Please try again." but my log is showing problems processing the webhook:

2024-04-03 16:33:14 [web.ERROR] [commerce] Exception while processing webhook: Cannot assign array to property craft\commerce\models\subscriptions\SubscriptionPayment::$response of type string
Exception thrown in /app/vendor/yiisoft/yii2/BaseYii.php:558
Stack trace:
#0 /app/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(craft\commerce\models\subscriptions\SubscriptionPayment), Array)
#1 /app/vendor/craftcms/cms/src/base/Model.php(78): yii\base\BaseObject->__construct(Array)
#2 /app/vendor/digital-pros/commerce-authorize/src/gateways/Subscriptions.php(486): craft\base\Model->__construct(Array)
#3 /app/vendor/craftcms/commerce/src/services/Webhooks.php(97): digitalpros\commerce\authorize\gateways\Subscriptions->processWebHook()
#4 /app/vendor/craftcms/commerce/src/controllers/WebhooksController.php(55): craft\commerce\services\Webhooks->processWebhook(Object(digitalpros\commerce\authorize\gateways\Subscriptions))
#5 [internal function]: craft\commerce\controllers\WebhooksController->actionProcessWebhook(6)
#6 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#7 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#8 /app/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('process-webhook', Array)
#9 /app/vendor/craftcms/cms/src/web/Application.php(305): yii\base\Module->runAction('commerce/webhoo...', Array)
#10 /app/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('commerce/webhoo...', Array)
#11 /app/vendor/craftcms/cms/src/web/Application.php(290): yii\web\Application->handleRequest(Object(craft\web\Request))
#12 /app/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#13 /app/web/index.php(12): yii\base\Application->run()
#14 {main} {"memory":4467032} 
benlobach commented 7 months ago

@AmandaLutzTO, yes, this does appear to be a related issue, and we're currently working on a fix that will separate out the subscriptions and stored payment methods.

benlobach commented 5 months ago

@AmandaLutzTO - Are you able to replicate this error with CraftCommerce version 4.6.2? It appears they have rewritten a portion of the subscription code that allows us to place the form within the plans again:

{% namespace plan.getGateway().handle|commercePaymentFormNamespace %}
     {{ plan.getGateway().getPaymentFormHtml({})|raw }}
{% endnamespace %}
benlobach commented 5 months ago

Hey, @AmandaLutzTO! Just checking in to see if this has been resolved for you?