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

Adding subscription plan to payment form errors #369

Closed
splendidrob opened this issue Oct 6, 2023 · 9 comments
Closed

Adding subscription plan to payment form errors #369

splendidrob opened this issue Oct 6, 2023 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@splendidrob
Copy link

splendidrob commented Oct 6, 2023

Description

Testing a subscription plan - added the first one to the payment form in the matrix for multiple plans, errors with the following:

Caused by: PDOException
SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'field_subscriptionPlan_selectPlan_wegrnswj' at row 1

This is a subscription price added to a product within stripe. The title seems to be pulling in the price id also and flows out of the dropdown box...

Craft version: Craft Pro 4.5.5
PHP version: 8.2.0
Database driver & version: MySQL 5.7.39
Plugin version: 5.4.0
Is [SCA] and Stripe Checkout enabled?: yes

@andrelopez
Copy link
Member

Hi @splendidrob I was able to recreate the overflow issue and I have reported it to Craft CMS

I was unable to recreate the SQL error, is there any chance that you can send me a screenshot to support@enupal.com to see how long if the plan name?

@DarrenLumber
Copy link

Hi @andrelopez I too have run into this issue today doing similar. After selecting a subscription plan (for the subscription type "Customer chooses plan" subscription plan matrix block) to an existing payments form and then attempting to save.

image

Stack trace is:

PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'field_subscriptionPlan_selectPlan_zqxhuwdb' at row 1 in /var/www/html/build/vendor/yiisoft/yii2/db/Command.php:1302
Stack trace:
#0 /var/www/html/build/vendor/yiisoft/yii2/db/Command.php(1302): PDOStatement->execute()
#1 /var/www/html/build/vendor/yiisoft/yii2/db/Command.php(1102): yii\db\Command->internalExecute('UPDATE `matrixc...')
#2 /var/www/html/build/vendor/craftcms/cms/src/helpers/Db.php(1086): yii\db\Command->execute()
#3 /var/www/html/build/vendor/craftcms/cms/src/services/Content.php(158): craft\helpers\Db::update('{{%matrixconten...', Array, Array, Array, true, Object(craft\db\Connection))
#4 /var/www/html/build/vendor/craftcms/cms/src/services/Elements.php(3373): craft\services\Content->saveContent(Object(craft\elements\MatrixBlock))
#5 /var/www/html/build/vendor/craftcms/cms/src/services/Elements.php(1098): craft\services\Elements->_saveElementInternal(Object(craft\elements\MatrixBlock), false, false, true, Array, false, false)
#6 /var/www/html/build/vendor/craftcms/cms/src/services/Matrix.php(719): craft\services\Elements->saveElement(Object(craft\elements\MatrixBlock), false)
#7 /var/www/html/build/vendor/craftcms/cms/src/fields/Matrix.php(1101): craft\services\Matrix->saveField(Object(craft\fields\Matrix), Object(enupal\stripe\elements\PaymentForm))
#8 /var/www/html/build/vendor/craftcms/cms/src/base/Element.php(5175): craft\fields\Matrix->afterElementPropagate(Object(enupal\stripe\elements\PaymentForm), false)
#9 /var/www/html/build/vendor/craftcms/cms/src/services/Elements.php(3424): craft\base\Element->afterPropagate(false)
#10 /var/www/html/build/vendor/craftcms/cms/src/services/Elements.php(1098): craft\services\Elements->_saveElementInternal(Object(enupal\stripe\elements\PaymentForm), true, false, true, Array, false, false)
#11 /var/www/html/build/vendor/enupal/stripe/src/services/PaymentForms.php(164): craft\services\Elements->saveElement(Object(enupal\stripe\elements\PaymentForm))
#12 /var/www/html/build/vendor/enupal/stripe/src/controllers/PaymentFormsController.php(58): enupal\stripe\services\PaymentForms->savePaymentForm(Object(enupal\stripe\elements\PaymentForm))
#13 [internal function]: enupal\stripe\controllers\PaymentFormsController->actionSaveForm()
#14 /var/www/html/build/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#15 /var/www/html/build/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#16 /var/www/html/build/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('save-form', Array)
#17 /var/www/html/build/vendor/craftcms/cms/src/web/Application.php(304): yii\base\Module->runAction('enupal-stripe/p...', Array)
#18 /var/www/html/build/vendor/craftcms/cms/src/web/Application.php(607): craft\web\Application->runAction('enupal-stripe/p...', Array)
#19 /var/www/html/build/vendor/craftcms/cms/src/web/Application.php(283): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#20 /var/www/html/build/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#21 /var/www/html/build/public/index.php(12): yii\base\Application->run()
#22 {main}

Next yii\db\Exception: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'field_subscriptionPlan_selectPlan_zqxhuwdb' at row 1
The SQL being executed was: UPDATE `matrixcontent_enupalmultipleplans` SET `elementId`=24756, `siteId`=1, `field_subscriptionPlan_selectPlan_zqxhuwdb`='price_1NIa4YBZ4NJfXTm9l7JkErAt', `field_subscriptionPlan_customLabel_pgdqjqum`='Monthly', `field_subscriptionPlan_setupFee_fofqtjzy`=NULL, `field_subscriptionPlan_default_rblwlxaj`=0, `dateUpdated`='2023-10-27 15:44:37' WHERE `id`=2 in /var/www/html/build/vendor/yiisoft/yii2/db/Schema.php:676
Stack trace:
#0 /var/www/html/build/vendor/yiisoft/yii2/db/Command.php(1307): yii\db\Schema->convertException(Object(PDOException), 'UPDATE `matrixc...')
#1 /var/www/html/build/vendor/yiisoft/yii2/db/Command.php(1102): yii\db\Command->internalExecute('UPDATE `matrixc...')
#2 /var/www/html/build/vendor/craftcms/cms/src/helpers/Db.php(1086): yii\db\Command->execute()
#3 /var/www/html/build/vendor/craftcms/cms/src/services/Content.php(158): craft\helpers\Db::update('{{%matrixconten...', Array, Array, Array, true, Object(craft\db\Connection))
#4 /var/www/html/build/vendor/craftcms/cms/src/services/Elements.php(3373): craft\services\Content->saveContent(Object(craft\elements\MatrixBlock))
#5 /var/www/html/build/vendor/craftcms/cms/src/services/Elements.php(1098): craft\services\Elements->_saveElementInternal(Object(craft\elements\MatrixBlock), false, false, true, Array, false, false)
#6 /var/www/html/build/vendor/craftcms/cms/src/services/Matrix.php(719): craft\services\Elements->saveElement(Object(craft\elements\MatrixBlock), false)
#7 /var/www/html/build/vendor/craftcms/cms/src/fields/Matrix.php(1101): craft\services\Matrix->saveField(Object(craft\fields\Matrix), Object(enupal\stripe\elements\PaymentForm))
#8 /var/www/html/build/vendor/craftcms/cms/src/base/Element.php(5175): craft\fields\Matrix->afterElementPropagate(Object(enupal\stripe\elements\PaymentForm), false)
#9 /var/www/html/build/vendor/craftcms/cms/src/services/Elements.php(3424): craft\base\Element->afterPropagate(false)
#10 /var/www/html/build/vendor/craftcms/cms/src/services/Elements.php(1098): craft\services\Elements->_saveElementInternal(Object(enupal\stripe\elements\PaymentForm), true, false, true, Array, false, false)
#11 /var/www/html/build/vendor/enupal/stripe/src/services/PaymentForms.php(164): craft\services\Elements->saveElement(Object(enupal\stripe\elements\PaymentForm))
#12 /var/www/html/build/vendor/enupal/stripe/src/controllers/PaymentFormsController.php(58): enupal\stripe\services\PaymentForms->savePaymentForm(Object(enupal\stripe\elements\PaymentForm))
#13 [internal function]: enupal\stripe\controllers\PaymentFormsController->actionSaveForm()
#14 /var/www/html/build/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#15 /var/www/html/build/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#16 /var/www/html/build/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('save-form', Array)
#17 /var/www/html/build/vendor/craftcms/cms/src/web/Application.php(304): yii\base\Module->runAction('enupal-stripe/p...', Array)
#18 /var/www/html/build/vendor/craftcms/cms/src/web/Application.php(607): craft\web\Application->runAction('enupal-stripe/p...', Array)
#19 /var/www/html/build/vendor/craftcms/cms/src/web/Application.php(283): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#20 /var/www/html/build/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#21 /var/www/html/build/public/index.php(12): yii\base\Application->run()
#22 {main}
Additional Information:
Array
(
    [0] => 22001
    [1] => 1406
    [2] => Data too long for column 'field_subscriptionPlan_selectPlan_zqxhuwdb' at row 1
)

Craft version: Craft Pro 4.5.6.1
PHP version: 8.1
Database driver & version: mariadb 10.4
Plugin version: 5.4.0
Is [SCA] and Stripe Checkout enabled?: yes

@splendidrob
Copy link
Author

splendidrob commented Oct 30, 2023

Just checking in if any new guidance on this? Doesn't seem to currently be possible to use this for subscriptions?

@andrelopez
Copy link
Member

I am on it

@andrelopez
Copy link
Member

@splendidrob could you please let me know your Stripe API version? on your Stripe Dashboard click on Developers

@splendidrob
Copy link
Author

API version

[2023-10-16] Default Latest
[2022-11-15]
[2020-08-27]

@andrelopez
Copy link
Member

Thanks the issue is related to a new setting introduced on Craft 4.5 13025

I am working on a solution now

@andrelopez andrelopez added bug Something isn't working and removed need more info labels Oct 30, 2023
@andrelopez
Copy link
Member

We just released Stripe Payments v5.5.0 with a fix to this issue. Thanks for reporting and let us know if that works on your end

@splendidrob
Copy link
Author

Awesome! Thats fixed...many thanks for sorting!

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

No branches or pull requests

3 participants