Displaying Active Subscription Details and Renewal Dates

This article explains how to use the new [ultimatemember_stripe_subscription] shortcode to display current subscription details, renewal dates, and payment plan information for logged-in users with an active Stripe subscription.


The [ultimatemember_stripe_subscription] Shortcode

This shortcode allows you to dynamically retrieve and display various pieces of data from a logged-in user's active Stripe subscription object. This is especially useful for showing a member their next renewal date or the amount they are paying.

Shortcode Parameters

The shortcode uses a primary parameter, key, to specify which data point from the Stripe subscription object should be displayed.

Parameter Purpose Accepted Values
key Specifies the subscription data field to display. Use dot notation to access nested fields (e.g., plan.amount). Any valid field name from the Stripe Subscription or Plan object.
date_format For date fields only. Defines the PHP date format to use (e.g., F j, Y g:i a). A string containing PHP date format characters.
date_time_diff For date fields only. Set to true to display the time difference (e.g., "3 weeks ago" or "3 weeks to go"). true or empty.

Examples: Displaying Dates and Renewal Info

You can display various important dates from the user's subscription, with options to show the full date or a time difference.

1. Displaying the Next Renewal Date

Use the days_until_due key and format it as a readable date.
Shortcode Purpose Example Output
[ultimatemember_stripe_subscription key="days_until_due" date_format="F j, Y"] Shows the next subscription renewal date. January 1, 2026
[ultimatemember_stripe_subscription key="current_period_end" date_format="F j, Y"] Shows the end of the current billing cycle. January 1, 2026

2. Displaying Time Remaining (Days/Weeks/Months)

Set date_time_diff=true to show the duration until the next payment. You can add text outside the shortcode for context.
Shortcode Purpose Example Output
[ultimatemember_stripe_subscription key="days_until_due" date_time_diff=true] Shows time remaining until due. 3 weeks
[ultimatemember_stripe_subscription key="days_until_due" date_time_diff=true] to go Shows time remaining with a custom suffix. 3 weeks to go

Other Available Date Keys

You can use the date_format or date_time_diff parameters with any of the following date keys:

  • start_date
  • current_period_start
  • current_period_end
  • cancel_at (When the subscription is set to cancel at period end)
  • canceled_at
  • created
  • ended_at
  • trial_start
  • trial_end

Examples: Displaying Plan and Payment Info

Use dot notation (plan.key) to access details about the pricing plan itself.
Shortcode Purpose Example Output
[ultimatemember_stripe_subscription key="plan.amount"] Shows the plan's recurring amount (in cents/minor unit). 999
[ultimatemember_stripe_subscription key="plan.currency"] Shows the currency code. usd
[ultimatemember_stripe_subscription key="plan.interval"] Shows the billing interval (e.g., month, year). month
[ultimatemember_stripe_subscription key="status"] Shows the current subscription status (e.g., active, past_due). active

Tip: To display the formatted currency and amount together, you may need a separate function or use both shortcodes in sequence (e.g., $[ultimatemember_stripe_subscription key="plan.amount" decimal=true] [ultimatemember_stripe_subscription key="plan.currency"]).


Important Notes

  • Active Subscription Only: This shortcode will only return data if the current logged-in user has an active subscription linked to their Ultimate Member profile.
  • Data Synchronization: To ensure all subscription statuses (Active, Past Due, Canceled, etc.) are accurately reflected, you must Re-Sync All Users Subscriptions & Roles in WP Admin > Ultimate Member > Settings > Extensions > Stripe. For sites with large member bases, this process now runs in the background via an Action Scheduler to prevent timeouts (502 errors).