Can a customer change their credit card information if using Stripe?

One customer is set for a recurring payment using Stripe. They asked me how they can change their credit card information. I contacted Stripe and it seems that they can’t and I would have to do it for them, which I find a little counterproductive because I don’t want to know their CC info.

When using Paypal, if someone subscribes a second time, it automatically cancels the previous subscription. Would that work for a Stripe subscription? The support at Stripe didn’t seem to understand what I was asking.

1 Like

there is an update form that you need to show the customer.

What update form? From s2M or from Stripe?

This is the shortcode to add to a page which shows the form to edit account info:

[s2Member-Pro-Stripe-Form update=“1” desc=“Update your billing information.” default_country_code=“US” captcha=“0” /]

You can find this and other shortcodes under the S2Member Pro > Stripe Pro-Forms menu in Wordpress admin

Thanks. I now have something to look into.

In case this is helpful for you to know: the shortcode above might not work for you. It recently stopped working for me (I hope you have better luck with it!).

Relevant thread here: Stripe - Edit Payment Method no longer works

Although I have a shortcode that I can use for a payment modification that a user can use, I have another challenge with this: if I have that as a button, on their account page, is there a way to conditionally display the Stripe one and the Paypal one based on what the user used? I would rather not display both as for some people, they might not remember which way they paid.

I guess that If customer is using Paypal, they have to use Payapl to update the card info.

For Stripe, I use s2If and S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY to know if the gateway is Stripe or not before show the Stripe form.

I hope it will be useful.

Regards,
Carlos

Thanks. I didn’t know that was a variable that could be used!

What would be the syntax for this code?
Would this work?
[s2If current_user_can(access_s2member_ccap_diamond) AND s2member_current_user_subscr_gateway(stripe)]

I am not sure how I can test it as I don’t have a paid account (Stripe or Paypal).
Would that syntax also work with paypal?

I have 2 functions created my own plugin. You can create them in functions.php:

function cmbEsPaypal() {
return eval(‘return (’.trim(do_shortcode(’’[s2Get constant=“S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY” /]’ == “paypal”’)).’);’);
}

function cmbEsStripe() {
return eval(‘return (’.trim(do_shortcode(’’[s2Get constant=“S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY” /]’ == “stripe”’)).’);’);
}

And I use them in wordpress this way:

[s2If cmbEsStripe()]

[s2Member-Pro-Stripe-Form cancel=“1” desc=“Esto cancelará la renovación ¿Está seguro?” unsub=“0” captcha=“0” /]

[/s2If]

This way, the cancelation button appears only for users who are using Stripe as payment mode.

I hope this will be useful.

Regards,
Carlos

1 Like

When I add that to my funtions.php in my theme - the site crashes. Otherwise it would be great and just what is needed…

I think either your code is maybe not compatible with PHP8 or maybe you have a typo copying it in? I get
“There has been a critical error on this website. Please check your site admin email inbox for instructions.”

Also happened with twenty twenty one default wordpress theme as soon as I insert those lines into the functions.php.

Could you please test it with PHP8?

Oh - you miss some backslashes… I found the same code with backslashes but working here: How to use constant in s2If

So it has to be:

function cmbEsStripe() {
	return eval('return ('.trim(do_shortcode('\'[s2Get constant="S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY" /]\' == "stripe"')).');');
}

I have just copy and paste the code from my site. It’s working for me.

I paste it as image …

Yes, your picture is correct. Your code above not (strange because I was able to paste it correctly).