Use registred cards to upgrade plan

Hi,

I’m developing and selling an API solution witch include free et paying plans.
I use s2Member Pro and I implanted some Stripe Pro-Forms form that works well.
But here is my problem when they want to upgrade their plan customers need to fill cards information again
while Stripe already store their cards informations because plan is monthly recurring

I understand answer at :

S2M dont store cards localy that perfect but Stripe does
and I think I can make a solution that use registed cards like in this example with Stripe native form:


but do you think there is a way to do the same with s2Member forms?

Best regards
Brice

Hi Brice.

The s2Member integration with Stripe doesn’t include it at the moment, but it’s not impossible, their API allows it.

:slight_smile:

Ok thank you Cristìan for that answer and that confirmation :wink:

I will try to make it with their API.

Best regards
Brice

1 Like

s2Member adds the card payment method to the Stripe customer, so the card is already saved over at Stripe. What you’d have to do is get the available cards to ask the customer if he wants to use an existing one or ask for a new one.

Here’s a good starting point: https://stripe.com/docs/api/payment_methods/list

:slight_smile:

Hi

I found out how to easily update an existing subscription with:

\Stripe\Subscription::update

and by creating product and plan in Stripe (Not on the fly with Stripe API like it’s done in S2Member),
so I can get an array of my differents plans ids.

I thought to use the same webhook than with normal s2member calls.
But after searching in logs how the match between transaction and S2M Access level was made,
I found that stripe didn’t have this information.
And match is done with the “item_number” store in:

Mysql: wp_content.wp_usermeta
meta_key = wp_s2member_ipn_signup_vars

And that value in my case is defined by the s2Member-Pro-Stripe-Form level=“1”
in stripe-checkout-in.inc.php function stripe_checkout()

So my question is : Is there a proper way to script S2member promotion/demotion (to call external Notifications, update user and EOT)

Or an even better method to simulate stripe_checkout() and keep existing webhook?

Best regards
Brice

I’m not sure I understand your questions. Could you explain a bit more, please? Thanks! :slight_smile:

Hi

I think that I can’t find the match between Stripe subscription and S2Member Access Level
if I do my own calls to Stripe API to let S2Member webhook promote users (by catching an invoice.payment_succeeded).
Because this information is store after stripe_checkout() form submit fonction.

So I wounder if there is a way to promote/demote users by calling a S2Member fonction?
(And keep S2Member -> API / Notifications -> Modification Notifications working)
Cause changing Role in Wordpress Admin don’t trigger API / Notifications calls

Best regards
Brice

I wounder if there is a way to promote/demote users by calling a S2Member fonction?

Not a simple way that I can think of.

You can use PHP to change the role, but that doesn’t fire the notification. https://s2member.com/kb-article/rolescapabilities-via-php/

You’d have to use a webhook to s2’s endpoint for Stripe, to trigger the payment notification, if I’m not mistaken.