Stripe not working on update

Recently updated to v200221 and when trying to sign up to the website via a stripe pro payment form, on submitting there’s just a message stating “Invalid parameters to Stripe; please contact the site owner.”

I enabled logging and tried to sign up again. The log suggested that the name parameter was empty, so it appeared that the form was submitting empty fields. I put this down to modifications that i’d made in stripe-checkout-form.php so renamed this to have the suffix -old (so that it’s not used). Submitted the form again and the log file now has all the data that I submitted, but still getting the message “Invalid parameters to Stripe; please contact the site owner.”

I have googled this and seen that a few other people had this issue pre-update but thought that the recent update may have fixed this, but doesn’t seem to have.

Any help appreciated, this is quite urgent as cannot make sales unless the plugin is rolled back to v190822 because v191022 also didn’t work.

Thanks

Just to note, i’ve just logged in to Stripe and under the developers screen it says that there is an API update available, I clicked on Logs and it shows all my sign up attempts with “400 err” under status - is this an issue that s2member needs to address with regards to support for a new API?

POST /v1/products

Status: 400

Request POST body
{
“id”: “s2_prod_7215ee9c7d9dc229d2921a40e899ec5f”,
“name”: " ",
“type”: “service”
}

Response body
{
“error”: {
“code”: “parameter_invalid_empty”,
“doc_url”: “https://stripe.com/docs/error-codes/parameter-invalid-empty”,
“message”: “You passed an empty string for ‘name’. We assume empty values are an attempt to unset a parameter; however ‘name’ cannot be unset. You should remove ‘name’ from your request or supply a non-empty value.”,
“param”: “name”,
“type”: “invalid_request_error”
}
}

Hi Adrian.

Right, the previous update addressed the “invalid params” error. I’m curious about you getting it, and although the message is the same, the reason behind it seems a bit different in your case…

The API is fine. Although they keep coming with new small updates often, the one in s2 is recent enough and works.

You are using a customized pro-form… Did you try reproducing the problem with the default pro-form to remove the customizations as the possible cause? When you do that, can you give me the steps to reproduce it in my tests installation?

I look forward to your update. :slight_smile:

Hi Cristian,

Yes I tried with all default forms, I removed the stripe-checkout-in.inc.php and stripe-form-in.inc.php from /mu-plugins and added the -old suffix to my templates in the theme folder so that it was just the original stripe pro form on the free-trial page.

I then re-enabled logging files and deleted all previous so it’s a new log file, submitted the free-trial form to see what happened:

The form didn’t appear to submit, it gave me “Invalid parameters to Stripe; please contact the site owner.”
I logged in to Stripe to look at the activity and s2member did actually appear to have communicated with s2member (see attached) and I had been set up as a new customer with my card details attached

I have not been set up as a subscribing user on the website.

In stripe-api.log it has the following amongst many other things:

LOG ENTRY: Mon Mar 2nd, 2020 @ precisely 1:34 pm UTC
PHP v7.3.15 :: WordPress v5.3.2 :: s2Member v200301 :: s2Member Pro v200301
Memory 15.65 MB :: Real Memory 18.00 MB :: Peak Memory 15.80 MB :: Real Peak Memory 18.00 MB
sharepilates.com/free-trial/
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36
-------- Function/Caller: ( get_product ) --------
-------- Input vars: ( Mon, 02 Mar 20 13:34:53 +0000 ) --------
Array
(
[name] =>
[input_time] => 1583156093
)

-------- Output string/vars: ( Mon, 02 Mar 20 13:34:53 +0000 ) --------
Stripe\Exception\InvalidRequestException Object
(
[stripeParam:protected] => name
[error:protected] => Stripe\ErrorObject Object
(
[charge] =>
[code] => parameter_invalid_empty
[decline_code] =>
[doc_url] => https://stripe.com/docs/error-codes/parameter-invalid-empty
[message] => You passed an empty string for ‘name’. We assume empty values are an attempt to unset a parameter; however ‘name’ cannot be unset. You should remove ‘name’ from your request or supply a non-empty value.
[param] => name
[payment_intent] =>
[payment_method] =>
[setup_intent] =>
[source] =>
[type] => invalid_request_error
)

[httpBody:protected] => {

“error”: {
“code”: “parameter_invalid_empty”,
“doc_url”: “https://stripe.com/docs/error-codes/parameter-invalid-empty”,
“message”: “You passed an empty string for ‘name’. We assume empty values are an attempt to unset a parameter; however ‘name’ cannot be unset. You should remove ‘name’ from your request or supply a non-empty value.”,
“param”: “name”,
“type”: “invalid_request_error”
}
}

Thanks for the additional info.

I ran several tests trying to reproduce that behavior, but I didn’t have any problems…

I checked, and the log entry seems related to the subscription product. The name field would be populated from the shortcode’s description. So I tested having a blank description attribute, but correctly get an error about it before being allowed to use the pro-form. I can’t reproduce your problem…

Could you show me your shortcode, please?

Are you sure there are no other customizations that may be still affecting this?

What did you customize with the mu-plugins files? Could you remove the custom templates instead of just renaming? Just in case they’re still being picked up for whatever reason.

If any of the above works, could you test for plugin conflicts? Or maybe easier, since this is a production site, could you create a clean installation of WP, add s2 and try reproducing this behavior there? If it works well, you can start adding things one by one, testing after each, to see what brings in that behavior.

:slight_smile:

The shortcode being used is:

[s2Member-Pro-Stripe-Form level=“1” ccaps="" desc=" " cc=“GBP” custom=“sharepilates.com” ta=“0” tp=“15” tt=“D” ra=“13.00” rp=“1” rt=“M” rr=“1” coupon="" accept_coupons=“0” default_country_code=“GB” captcha=“0” template=“stripe-checkout-form.php” /]

As far as I know there aren’t any other customisations, and I cant remember what I modified in those other 2 files but also cant find the previous threads I used in order to get advice (as I am still a PHP novice so relied on help from others) so removed the files and that didn’t change much so whatever I did change couldn’t have been major.

Got it. Thanks for the additional info. Did you try removing the template attribute from the shortcode and the custom template file from where you put it? (e.g. your template dir, or wp-content dir)

Could you do that and let me know so I take a new look at your pro-form with the default template?

Thanks! :slight_smile:

Hi Cristian

Sorry again for the slow reply. I removed the template attribute so in the shortcode it just had template="" and also deleted the file (instead of adding the -old suffix), I still got the same error on submitting and when I checked Stripe it stopped at the same point (see attached)

I then re-inserted stripe-checkout-form.php in to the template attribute in the shortcode, reverted s2member and s2member-pro back to v190822 and re-uploaded stripe-checkout-form.php to the theme directory, re-submitted the same form and it works perfectly, user account was created on the site and everything is fine in Stripe (see attached).

Adrian

Thanks for the update.

Hmm… So you get a 400 error. Could you show me the Stripe log entries for those? (remove any sensitive info pls) https://dashboard.stripe.com/logs

Thanks. :slight_smile:

Of course, see below:

and