[Membership 2 Pro] How to make payment a one-step (instead of current two-steps) in Membership2?

Hi, currently when a user clicks on the SIGNUP button (generated by the [ms-membership-buy] shortcode), instead of going straight to PayPal, he's being taken to yet another extremely confusing page, where he needs to click on "COMPLETE PAYMENT" button and THEN he's taken to the PayPal page.
Where do I tweak the code in order to take the user to PayPal immediately when he clicks the SIGNUP button?
Or, alternatively, how do I generate a correct COMPLETE PAYMENT button so that it would return the right information about the logged in user who just paid the payment?
Thank you

  • Adam Czajczyk
    • Support Gorilla

    Hello Rohit

    I hope you're well today and thank you for your question!

    When a [ms-membership-buy id="123"] (where 123 is an ID of a membership) shortcode is used it displays a button/link and after clicking on this:

    - a logged out user should be taken to a registration form (because they have to be users to be able to become members) and then a "summary" page is displayed with a membership name, price, an option to add coupon code (if coupons are enabled) and a payment button;

    - a logged in user should be taken straight to that "summary" page (skipping the registration form)

    The default page looks similar to this (this is with Twenty Seventeen theme and PayPal in "sandbox" mode):

    Is this the page you're referring to? You mentioned "complete payment" so I'm not sure. If it's different to what you are getting would you please share a screenshot or point me to any location at any of your sites where I can see/check it live?

    I'd just like to avoid any confusions on my end in order to be able to give you a proper answer :slight_smile:

    Best regards,

  • Rohit
    • Flash Drive

    Thanks for your reply Adam, yes - I'm referring to exactly that "summary" page. I'm only talking about registered, logged-in users.
    As you've correctly outlined, there's two steps for such users:
    1. Click on the button generated by [ms-membership-buy id="123"] to be taken to summary page,
    2. Click on the PayPal button to be taken to PayPal.

    I want to know what to tweak in order to either:
    A) Click on [ms-membership-buy id="123"] and get to PayPal immediately (ideal option)
    or, if that's extremely difficult, then how to:
    B) generate the last-step PayPal button that would take the user to PayPal immediately.

    In any solution, I still want, of course, to be able to correctly capture in the call back the user ID, and the rest of the info that's normally passed back from PayPal.

  • Predrag Dubajic
    • Support

    Hi Rohit,

    I'm afraid that something like this is not possible out of the box and it would require custom coding to accomplish.

    We previously had API Docs in the plugin but we had to temporarily remove them due to some SEO issues, so I've attached them here and you can download the file, unzip it and then from docs folder open index.html in your browser to check API Docs that could help you with creating a custom solution for your desired process.

    Best regards,

  • Rohit
    • Flash Drive

    Hi Predrag,

    I've checked the API Docs but that didn’t help much, it’s still very unclear how to achieve the one-step functionality that I need.

    So I just copied the HTML generated by the [ms-membership-buy id="123"] shortcode and tried to use that:

    <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
    <input class="wpmui-field-input wpmui-hidden " type="hidden" id="business" name="business" value="ng@gottobe.fit">
    <input class="wpmui-field-input wpmui-hidden " type="hidden" id="cmd" name="cmd" value="_xclick">
    <input class="wpmui-field-input wpmui-hidden " type="hidden" id="bn" name="bn" value="incsub_SP">
    <input class="wpmui-field-input wpmui-hidden " type="hidden" id="item_number" name="item_number" value="5157">
    <input class="wpmui-field-input wpmui-hidden " type="hidden" id="item_name" name="item_name" value="Pre-rus email">
    <input class="wpmui-field-input wpmui-hidden " type="hidden" id="no_shipping" name="no_shipping" value="1">
    <input class="wpmui-field-input wpmui-hidden " type="hidden" id="amount" name="amount" value="49.00">
    <input class="wpmui-field-input wpmui-hidden " type="hidden" id="currency_code" name="currency_code" value="USD">
    <input class="wpmui-field-input wpmui-hidden " type="hidden" id="return" name="return" value="https://staging.gottobe.fit/registration-complete/?ms_relationship_id=9333">
    <input class="wpmui-field-input wpmui-hidden " type="hidden" id="cancel_return" name="cancel_return" value="https://staging.gottobe.fit/register/">
    <input class="wpmui-field-input wpmui-hidden " type="hidden" id="notify_url" name="notify_url" value="https://staging.gottobe.fit/ms-payment-return/paypalsingle">
    <input class="wpmui-field-input wpmui-hidden " type="hidden" id="lc" name="lc" value="US">
    <input class="wpmui-field-input wpmui-hidden " type="hidden" id="invoice" name="invoice" value="9334">
    <button class="wpmui-field-input button wpmui-submit button-primary" type="submit" id="submit" name="submit" value="">$49</button>
    <img alt="" border="0" width="1" height="1" src="https://www.paypal.com/en_US/i/scr/pixel.gif">

    However, this code is static html, and although it goes directly to paypal as desired (skipping the “summary” page), it has 2 fields - “ms_relationship_id”=9333 and “invoice” = 9334, which are supposed to be dynamic and this, of course, breaks the functionality (I don’t get back the correct user from PayPal).

    How can I get ms_relationship_id and invoice values dynamically, so when it returns after payment, I get the correct latest membership ID and and user id attached to that membership ID?

    Or, alternatively, how can I make my own shortcode (instead of [ms-membership-buy id="123”]), that would generate the correct values for those fields, but will skip the “summary” page?

  • Predrag Dubajic
    • Support

    Hi Rohit,

    I'm afraid that using only HTML from shortcodes will not do the trick here and it would need to be additionally coded by using the available API and hooks.
    Making your own registration process falls under custom development as it requires coding a new process that's not available in the plugin itself, and even tho we do try to help with as much questions as possible, complex custom development is not something we can do, you can read more about this here: https://premium.wpmudev.org/docs/getting-started/getting-support/#chapter-1

    Perhaps checking /wp-content/plugins/membership-pro/app/controller/class-ms-controller-shortcode.php on line 466 could help you with better understanding of how the shortcodes was built.

    If you need to customize this then you can post a job on our jobs board where you can hire a developer to assist further:
    Please note that no WPMU official staff members are allowed to work on the job board.

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.