Stripe - Add Subscription Plans to a Registration Form
Before adding a Stripe plan to a registration form, ensure that you've read and set up the required details in the following documentation articles:
- Setting up Webhook and Test/Public Keys
- Setting up Stripe Success and Cancel Payment Pages
- Create Subscription Prices
Add Stripe subscription plan to a registration form
To add a Stripe subscription plan to a registration form, do the following steps:
- Go to wp-admin > Ultimate Member > Forms > Edit/Add a Registration form. Click on the " plus(+) " icon to show the Fields Manager where you can select which necessary fields to include in your registration form.
Note: When there's no Password field in the Register forms, the placeholder tag
{action_url}
must be used or added to your 'account welcome email' to allow users to set their password. Similarly, when using the direct subscribe URL or the Payment Links with Stripe, this placeholder tag can also be used in the Welcome Email templates. - Click "Stripe Plans" in the Predefined Fields section of the Fields Manager. You may also add a predefined field called "Stripe Billing Email" if you want to add an option where this email field’s value will be used as the billing email for the Stripe Account.
- Edit the 'Stripe Plans' field by clicking the 'Pencil icon.'
- There are three (3) stripe plan types available for displaying the field in a registration form:
- Stripe Plan ( Hidden ) - The Stripe Plan is hidden in the Register form. Once the form is submitted, the plan will be assigned to the user and redirected to the Stripe checkout page.
- Single Plan ( Visible ) - Displays a single plan as a radio field.
- Multiple Plan Options - Displays multiple plan options as radio fields.
- The title and subscription prices are from the product created on Stripe.com. The Stripe Prices dropdown field is populated by the subscription plans created in WP-Admin > Ultimate Member > Stripe Plans or the imported Stripe plans. The optional Default Value should be the Subscription Plan ID created in WP-Admin > Ultimate Member > Stripe Plans.
- Once the field settings and the registration form are saved, add the Register form shortcode to a page to display it. Visit the Register page on your site. The subscription plans field in the front end should look like the image below.
NOTE: When a user tries to register with their selected plan, they will be redirected to the Stripe Checkout external page to pay the subscription price. Users will be logged in automatically on the site before redirecting them to the Stripe Checkout external page. If the user is successfully subscribed, they will be redirected back to the site on the Payment Successful page and If they didn't subscribe to a plan, they will be linked back to the site on the Cancel page.
Redirect Users to the Payment Successful Page Upon a Successful Subscription
To redirect your users to the Payment Successful page, you must add the URL of the Payment Successful page with the required parameter to the Registration Options of your user role. Here are the steps to set up the redirection to the Payment Successful page:
- Go to wp-admin>Pages>Edit Payment successful — UM Payment successful page.
- On the page settings>Summary, you can find the page URL, copy it, and save it for later.
- Go to wp-admin>Ultimate Member> User Roles> Edit a user role> Scroll down to Registration Options.
- Set the 'Action to be taken after registration' option to 'Redirect to URL'
- The 'Set Custom Redirect URL' setting will become available. In the field provided, paste the payment successful page URL and add the required parameter:
?umm_stripe_sid=UM_STRIPE_CHECKOUT_SID
(e.g. domain.com/payment-successful/?umm_stripe_sid=UM_STRIPE_CHECKOUT_SID).Note: UM Stripe requires adding an extra parameter to the payment successful page URL. This is to prevent subscribers or members from seeing a blank page. Make sure that this parameter is included in the URL.
-
Update the role and test the redirection to confirm that it is working correctly.