drastik / com.drastikbydesign.stripe

CMS Independent Stripe payment processor for CiviCRM 4.x
Other
35 stars 48 forks source link

" is not of type String" error in v. 1.7 (Civi 4.4.3) #27

Open laryn opened 10 years ago

laryn commented 10 years ago

I have a site running CiviCRM 4.4.3 with CiviCRM-Stripe 1.7, and the contribution page errors out on submission with " is not of type String". Interestingly, I think event pages that take contributions through Stripe are still functioning but I've had to put the donation page in "Pay later" mode since mid-December.

The backtrace is below. Any ideas?

[info] $backTrace = #0 /public_html/sites/all/modules/civicrm/CRM/Core/Error.php(322): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /public_html/sites/all/modules/civicrm/CRM/Core/DAO.php(999): CRM_Core_Error::fatal(" is not of type String")
#2 /public_html/sites/all/modules/civicrm/CRM/Core/DAO.php(893): CRM_Core_DAO::composeQuery("INSERT INTO civicrm_stripe_customers\n          (email, id) VALUES (%1, %2)", (Array:2), TRUE)
#3 /public_html/civi_extensions/com.drastickbydesign.stripe/CRM/Core/Payment/Stripe.php(292): CRM_Core_DAO::executeQuery("INSERT INTO civicrm_stripe_customers\n          (email, id) VALUES (%1, %2)", (Array:2))
#4 /public_html/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution/Utils.php(230): CRM_Core_Payment_Stripe->doDirectPayment((Array:72))
#5 /public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(972): CRM_Contribute_BAO_Contribution_Utils::processConfirm(Object(CRM_Contribute_Form_Contribution_Confirm), (Array:72), (Array:62), "36314", "1", "contribution", (Array:0))
#6 /public_html/sites/all/modules/civicrm/CRM/Core/Form.php(261): CRM_Contribute_Form_Contribution_Confirm->postProcess()
#7 /public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Main.php(1316): CRM_Core_Form->mainProcess()
#8 /public_html/sites/all/modules/civicrm/CRM/Core/Form.php(261): CRM_Contribute_Form_Contribution_Main->postProcess()
#9 /public_html/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php(151): CRM_Core_Form->mainProcess()
#10 /public_html/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php(128): CRM_Core_QuickForm_Action_Upload->realPerform(Object(CRM_Contribute_Form_Contribution_Main), "upload")
#11 /public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Upload->perform(Object(CRM_Contribute_Form_Contribution_Main), "upload")
#12 /public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contribute_Form_Contribution_Main), "upload")
#13 /public_html/sites/all/modules/civicrm/CRM/Core/Controller.php(345): HTML_QuickForm_Page->handle("upload")
#14 /public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(323): CRM_Core_Controller->run((Array:3), NULL)
#15 /public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(72): CRM_Core_Invoke::runItem((Array:15))
#16 /public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
#17 /public_html/sites/all/modules/civicrm/drupal/civicrm.module(456): CRM_Core_Invoke::invoke((Array:3))
#18 [internal function](): civicrm_invoke("contribute", "transact")
#19 /public_html/includes/menu.inc(517): call_user_func_array("civicrm_invoke", (Array:2))
#20 /public_html/index.php(21): menu_execute_active_handler()
#21 {main}
zesgar commented 10 years ago

@laryn It seems like we are so close. Stripe.js is the problem. somehow it is not processing information correctly...i am looking into it this afternoon...

zesgar commented 10 years ago

in Stripe.js the function to create the token is Stripe.createToken looking at stripes api documentation and it shows Stripe.card.createToken I am testing now!

drastik commented 10 years ago

@zesgar Ah, yep -- looks like they changed that according to this: https://stripe.com/docs/tutorials/forms

Crazy how many critical changes they are making without notifying anyone. I wish they would send out an email when they make these API changes..

Is it working?

drastik commented 10 years ago

Ah, no -- they also use a different JS:

https://js.stripe.com/v2/

Instead of v1 which we're still using. I'll try updating both of those changes and see if anything improves.

rowjamesrow commented 10 years ago

Did anybody ever figure this out? I'm on CiviCRM 4.4, Stripe payment processor 1.7 and I get the string error on live transactions as well...

drastik commented 10 years ago

@rowjamesrow Start with the latest version here on GitHub: https://github.com/drastik/civicrm_stripe/archive/4.4-1.8.zip

Let me know of any issues you run into after that.

rowjamesrow commented 10 years ago

@drastik For whatever reason, I can't seem to get CiviCRM to recognize 1.8 as an installable extension. I've cloned it into my extension directory and tried various different combinations of directory permissions and names, but to no avail.

cacardinal commented 10 years ago

I'm having the same issues with getting CiviCRM to recognize 1.8 as an installable extension. Also of note. In 1.7 the recurring payments and one time contributions are working fine for me, but I'm getting the "is not of type String" error only on event registrations. @rowjamesrow, were you able to find a solution to the 1.8 installable extension issue?

rowjamesrow commented 10 years ago

No, I was not. I gave up on the Stripe extension because it wasn't really compatible with our system, and haven't revisited it since.

On Mon, Jun 2, 2014 at 9:55 AM, cacardinal notifications@github.com wrote:

I'm having the same issues with getting CiviCRM to recognize 1.8 as an installable extension. Also of note. In 1.7 the recurring payments and one time contributions are working fine for me, but I'm getting the "is not of type String" error only on event registrations. @rowjamesrow https://github.com/rowjamesrow, were you able to find a solution to the 1.8 installable extension issue?

— Reply to this email directly or view it on GitHub https://github.com/drastik/civicrm_stripe/issues/27#issuecomment-44839351 .

drastik commented 10 years ago

Oh my, @cacardinal -- sorry for the confusion. The info.xml file in the 1.8 branch does not state version 1.8 in it yet: https://github.com/drastik/civicrm_stripe/blob/4.4-1.8/info.xml

So you very well probably have 1.8 installed. The fact that "recurring and one time contributions are working" is very encouraging! If you are using Civi 4.4, that means that this commit must have worked: https://github.com/drastik/civicrm_stripe/commit/021e9a6d89b11b553965838f4eae1c05b6a65e87

I know there are other issues. Don't worry about the version number reporting 1.7, I was waiting until stable to update that, but in hindsight, that was a bad decision. Sorry again for the confusion.

laryn commented 10 years ago

The org I was helping initially gave up on Stripe due to these issues and went back to Paypal, so I wasn't able to devote a lot of time to this. I am testing out of curiousity on my own site and am still seeing these problems.

After updating CiviCRM to 4.4.5, CiviCRM-Stripe to 1.8, updating the API version in my Stripe account to the latest, and updating the Stripe PHP library, I am getting "You cannot set 'card'to an empty string. We interpret empty strings as NULL in requests. You may set obj->card = NULL to delete the property" on test transactions.

I see both of these issues occurring on my site:

eliotlandrum commented 10 years ago

@laryn - Just as a point of reference, I finally stopped getting this issue when I disabled Privacy Badger and Adblocker on my browser.

laryn commented 10 years ago

@eliotlandrum @drastik VERY interesting -- quick test on a test-drive link is promising after disabling Adblock Plus! Thanks for the tip, that may well be the issue.

drastik commented 10 years ago

Created an issue here on the ADP situation. Created a bug report on ADP's forums. Progress can be tracked here: https://github.com/drastik/civicrm_stripe/issues/45

maximillianh commented 10 years ago

Thanks for all the great work on this extension @drastik -- unfortunately, it seems like this issue is not limited to Adblock Plus. Using civicrm_stripe 1.8 and CiviCRM 4.4.6, have reproduced in Firefox and Chrome with no plugins installed. Stripe is getting the request: { description: "Donor from CiviCRM" card: "" email: "dev.null@eff.org" } and responding with:

type: "invalid_request_error" message: "You passed an empty string for 'card'. We assume empty values are an attempt to unset a parameter; however 'card' cannot be unset. You should remove 'card' from your request or supply a non-empty value" param: "card"

drastik commented 10 years ago

So strange. There is a line that should catch that and not even continue to submit to Stripe: https://github.com/drastik/civicrm_stripe/blob/4.4-1.8/CRM/Core/Payment/Stripe.php#L272

Although it's isset() not empty()... So in this case, it may be safe to say that $params['stripe_token'] is present, but the javascript on page isn't properly filling it out during pre-form submission (js call to Stripe).

Any JS conflicts on the contribution page you can see in console? Recent updates to Stripe API (setting within stripe.com account)?

ghost commented 10 years ago

Don't know if this is helpful, but I had similar issue to maxateff. However, I believe problem is with my install.

Uncommenting lines 283-293 fixed for me. It appears the unsupervised de dupe rule "Email" is used to check for existing customers, and for whatever reason this rule does not work in this install. (white screen). Because this failed, no customer name was set or sent to Stripe, hence assumed Stripe Error.

Initial error mesages:

Stripe_Error create_customer: Array ( [error] => Array ( [type] => invalid_request_error [message] => You passed an empty string for 'card'. We assume empty values are an attempt to unset a parameter; however 'card' cannot be unset. You should remove 'card' from your request or supply a non-empty value [param] => card )

)

MESSAGE Notice: Use of undefined constant Stripe_Error - assumed 'Stripe_Error' in CRM_Core_Payment_Stripe->stripeCatchErrors() (line 173 of /sites/default/files/civicrm/extensions/civicrm_stripe-4.4-1.8/CRM/Core/Payment/Stripe.php).