Auto recurring using Membership 2 Pro for POST api call

I am developing payment gateway for the Membership 2 Pro. Payment gateway doesn't handle auto recurring. so I have to make it happen using Membership 2 Pro for POST api call to payment gateway. Can you please guide me by giving overview of how membership 2 Pro handle auto recurring payment?

I'm afraid it's a very wide question so I'll try provide some guidance to start with.

You can use as guide the stripe subscriptions gateway located inwp-content/plugins/membership/premium/gateway/stripeplan/class-ms-gateway-stripeplan.php

You'll need to set the class properties (variables) accordingly in your php file. Also don't forget to include your gateway's api files if it provides any.

The most important method is process_purchase(). You'll need to create a method with the same name as it is called by MS_Controller_Gateway when payment notification is received from gateway. This is where it sets the subscription invoice as paid.

It's also required to use the action hook 'ms_gateway_toggle_' . $gateway_id
where $gateway_id is the id you gave to your gateway. In the stripe file gout can see an example:

Regarding recurrence, it's depended on your gateway. For example stripe supports recurring payments and you can see the args stripe requires in the update_stripe_data_membership() method :$plan_data['interval_count'] = $interval_count;

If your payment method does not support recurring payments then you could use WordPress schedules to request payments.

How do you rate me?

Thank you for rating your experience!

We’re thrilled to hear you had a great experience with . Would you like to leave a comment about your experience?
Thanks for voting on your experience with , we’d love to get some feedback please.
Ohh no! We’re really sorry to hear you didn’t have a pleasant experience with , we’re always looking at how we can improve and would appreciate you provide some further feedback here please.
Type your feedback here

it's great that you had a positive one. Based on your experience in this ticket would you please be kind enough to rate us externally on: