You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An error is occurring whilst trying to run a payment sources sync after we have migrated to a new Stripe account. All previous Stripe customers were migrated across with some new ones added (not by Craft CMS/Commerce). It seems to hit an error because some Stripe customers don't have a valid Craft CMS customer ID but that is just my assumption.
Steps to reproduce
Run payment source sync console command su-exec www-data php craft commerce-stripe/sync/payment-sources Which gateway would you like to sync payment sources for? (stripe,?): stripe This will sync down all payment sources in your Stripe account, and create inactive local users if one is not found for that customer’s email. If you are using testing keys, your development environment may end up with inconsistent customer information. Do you want to continue? (yes|no) [no]:yes Syncing... Error: Cannot assign null to property craft\commerce\models\PaymentSource::$customerId of type int
2025-01-10 17:57:12 [console.ERROR] [TypeError] Cannot assign null to property craft\commerce\models\PaymentSource::$customerId of type int {"trace":["#0 /var/www/project/cms/vendor/craftcms/commerce-stripe/src/services/PaymentMethods.php(51): craft\\commerce\\stripe\\base\\SubscriptionGateway->handlePaymentMethodUpdated(Array)","#1 /var/www/project/cms/vendor/craftcms/commerce-stripe/src/console/controllers/SyncController.php(61): craft\\commerce\\stripe\\services\\PaymentMethods->syncAllPaymentMethods(Object(craft\\commerce\\stripe\\gateways\\PaymentIntents))","#2 [internal function]: craft\\commerce\\stripe\\console\\controllers\\SyncController->actionPaymentSources()","#3 /var/www/project/cms/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)","#4 /var/www/project/cms/vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams(Array)","#5 /var/www/project/cms/vendor/yiisoft/yii2/console/Controller.php(180): yii\\base\\Controller->runAction('payment-sources', Array)","#6 /var/www/project/cms/vendor/craftcms/cms/src/console/ControllerTrait.php(90): yii\\console\\Controller->runAction('payment-sources', Array)","#7 /var/www/project/cms/vendor/craftcms/cms/src/console/Controller.php(216): craft\\console\\Controller->traitRunAction('payment-sources', Array)","#8 /var/www/project/cms/vendor/yiisoft/yii2/base/Module.php(552): craft\\console\\Controller->runAction('payment-sources', Array)","#9 /var/www/project/cms/vendor/yiisoft/yii2/console/Application.php(180): yii\\base\\Module->runAction('commerce-stripe...', Array)","#10 /var/www/project/cms/vendor/craftcms/cms/src/console/Application.php(91): yii\\console\\Application->runAction('commerce-stripe...', Array)","#11 /var/www/project/cms/vendor/yiisoft/yii2/console/Application.php(147): craft\\console\\Application->runAction('commerce-stripe...', Array)","#12 /var/www/project/cms/vendor/craftcms/cms/src/console/Application.php(122): yii\\console\\Application->handleRequest(Object(craft\\console\\Request))","#13 /var/www/project/cms/vendor/yiisoft/yii2/base/Application.php(384): craft\\console\\Application->handleRequest(Object(craft\\console\\Request))","#14 /var/www/project/cms/craft(27): yii\\base\\Application->run()","#15 {main}"],"memory":35228608,"exception":"[object] (TypeError(code: 0): Cannot assign null to property craft\\commerce\\models\\PaymentSource::$customerId of type int at /var/www/project/cms/vendor/craftcms/commerce-stripe/src/base/SubscriptionGateway.php:735)"}
Additional info
Craft CMS version: 4.12.6.1
Stripe for Craft Commerce version: 4.1.5
PHP version: 8.0.13
Database driver & version: MariaDB 11.2.6
Plugins & versions:
Amazon SES 2.1.0
Chunked File Uploads 2.0.3
Cloner 2.0.4
CP Field Inspect 1.4.4
Craft Commerce 4.6.13
Embedded Assets 4.1.2
Expanded Singles 2.0.5
Formie 2.1.31
Imager X 4.4.1
Incognito Field 1.3.0
MJML 2.0.2
Redactor 3.1.0
Stripe for Craft Commerce 4.1.5
Tags 2.0.0
Vizy 2.1.23
The text was updated successfully, but these errors were encountered:
Description
An error is occurring whilst trying to run a payment sources sync after we have migrated to a new Stripe account. All previous Stripe customers were migrated across with some new ones added (not by Craft CMS/Commerce). It seems to hit an error because some Stripe customers don't have a valid Craft CMS customer ID but that is just my assumption.
Steps to reproduce
su-exec www-data php craft commerce-stripe/sync/payment-sources Which gateway would you like to sync payment sources for? (stripe,?): stripe This will sync down all payment sources in your Stripe account, and create inactive local users if one is not found for that customer’s email. If you are using testing keys, your development environment may end up with inconsistent customer information. Do you want to continue? (yes|no) [no]:yes Syncing... Error: Cannot assign null to property craft\commerce\models\PaymentSource::$customerId of type int
2025-01-10 17:57:12 [console.ERROR] [TypeError] Cannot assign null to property craft\commerce\models\PaymentSource::$customerId of type int {"trace":["#0 /var/www/project/cms/vendor/craftcms/commerce-stripe/src/services/PaymentMethods.php(51): craft\\commerce\\stripe\\base\\SubscriptionGateway->handlePaymentMethodUpdated(Array)","#1 /var/www/project/cms/vendor/craftcms/commerce-stripe/src/console/controllers/SyncController.php(61): craft\\commerce\\stripe\\services\\PaymentMethods->syncAllPaymentMethods(Object(craft\\commerce\\stripe\\gateways\\PaymentIntents))","#2 [internal function]: craft\\commerce\\stripe\\console\\controllers\\SyncController->actionPaymentSources()","#3 /var/www/project/cms/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)","#4 /var/www/project/cms/vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams(Array)","#5 /var/www/project/cms/vendor/yiisoft/yii2/console/Controller.php(180): yii\\base\\Controller->runAction('payment-sources', Array)","#6 /var/www/project/cms/vendor/craftcms/cms/src/console/ControllerTrait.php(90): yii\\console\\Controller->runAction('payment-sources', Array)","#7 /var/www/project/cms/vendor/craftcms/cms/src/console/Controller.php(216): craft\\console\\Controller->traitRunAction('payment-sources', Array)","#8 /var/www/project/cms/vendor/yiisoft/yii2/base/Module.php(552): craft\\console\\Controller->runAction('payment-sources', Array)","#9 /var/www/project/cms/vendor/yiisoft/yii2/console/Application.php(180): yii\\base\\Module->runAction('commerce-stripe...', Array)","#10 /var/www/project/cms/vendor/craftcms/cms/src/console/Application.php(91): yii\\console\\Application->runAction('commerce-stripe...', Array)","#11 /var/www/project/cms/vendor/yiisoft/yii2/console/Application.php(147): craft\\console\\Application->runAction('commerce-stripe...', Array)","#12 /var/www/project/cms/vendor/craftcms/cms/src/console/Application.php(122): yii\\console\\Application->handleRequest(Object(craft\\console\\Request))","#13 /var/www/project/cms/vendor/yiisoft/yii2/base/Application.php(384): craft\\console\\Application->handleRequest(Object(craft\\console\\Request))","#14 /var/www/project/cms/craft(27): yii\\base\\Application->run()","#15 {main}"],"memory":35228608,"exception":"[object] (TypeError(code: 0): Cannot assign null to property craft\\commerce\\models\\PaymentSource::$customerId of type int at /var/www/project/cms/vendor/craftcms/commerce-stripe/src/base/SubscriptionGateway.php:735)"}
Additional info
The text was updated successfully, but these errors were encountered: