mycred_stripe_subscribe

Codex / mycred/purchase / Shortcodes / mycred_stripe_subscribe

Description

This shortcode allows you to setup subscription buttons which triggers the Stripe Checkout window. Requires the buyCRED Stripe Gateway add-on to be enabled.

The shortcode has two different modes:

  • Subscribe Mode – This default mode is shown for anyone who views the shortcode and does not have a subscription. In this mode, clicking on the button will trigger the Stripe Checkout Window.
  • Cancel Mode – If the user viewing this shortcode already has a subscription, this button will turn into a “Cancel Subscription” button. Clicking on this button will cancel a users current point subscription.

Requires the buyCRED add-on to be enabled along with the buyCRED Stripe add-on to be installed and enabled.

Available since version 2.0

Shortcode Attributes

Attribute Type Required Default Description
planid string Yes - The unique ID you set for the Subscription Plan you want users to to join when clicking on this button. The ID is case sensitive and the button will not work if you do not set this attribute!
cancel string No "Cancel Subscription" Button label to show when this shortcode is viewed by someone who are already signed up to the subscription plan this shortcode is setup for. Set to empty if you want to hide this button in these cases.
switch string No "Switch to %plan_name%" Button label to show when this shortcode is viewed by someone who already has a subscription and could switch to the subscription plan this shortcode is setup for. Set to empty if you want to hide the button in these cases. (Requires version 2.0.1 or higher.)
to string or int No - Option to gift subscription to a specific user. Points given for the subscription plan the user signs up for will be deposited into this users account.
logo string No - Option to set a custom logo for the Stripe Checkout window. If not set, the default logo URL you set in your gateway settings is used.
title string No - Option to set a custom title for the Stripe Checkout window. If not set, the default title you set in your gateway settings is used.
desc string No - Option to set a custom description for the Stripe Checkout window. If not set, the default description you set in your gateway settings is used.
label string No - Option to set a custom button label for the Stripe Checkout window. If not set, the default button label you set in your gateway settings is used.
classes string No btn btn-primary btn-lg The button classes used.
id string No - Option to set an ID for the button element.

CSS Styling

// The button
button.mycred-stripe-subscribe-button { }

Examples

Example 1: Most basic usage example where users will be able to signup for a subscription plan with the ID of baseplan.

[mycred_stripe_subscribe planid="baseplan"]Base Plan Subscription[/mycred_stripe_subscribe]

Example 2: Allows users to signup to the subscription plan myplan. When viewed by someone already having a subscription it will show a custom cancel button label.

[mycred_stripe_subscribe planid="myplan" cancel="Downgrade Account"]Upgrade Account[/mycred_stripe_subscribe]

Example 3: Allows users to signup to the subscription plan myplan. When viewed by someone with a different active subscription, hide this button.

[mycred_stripe_subscribe planid="myplan" switch=""]Upgrade Account[/mycred_stripe_subscribe]

Last edited August 21, 2016