mycred_stripe_buy

Description

This shortcode allows you to setup purchase buttons which triggers the Stripe Checkout window. It should be used instead of the mycred_buy shortcode if you have the buyCRED Stripe Gateway add-on enabled.

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

Available since version 2.0

Shortcode Attributes

Attribute Type Required Default Description
amount int or float Yes - The amount of points to sell using this shortcode. The price is automatically calculated using this amount and the exchange rate you set. If a user with a custom exchange rate views the shortcode, their price will adjust accordingly.
to string or int No current Option to gift purchases to a specific user instead of the current user (default). buyCRED Gifting must be enabled for this to work. If set, it should either be set to "current" or to a user ID.
ctype string No mycred_default The point type to use. Should not be used if you only have one point type installed.
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.
e_rate int or float No - Gateway defined exchange rate can be changed for each shortcode using this attribute e_rate. If admin doesn't provide any exchange rate value utilizing this attribute in a shortcode, gateway defined exchange rate will be applied by default.

CSS Styling

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

Examples

Example 1: Most basic usage of this shortcode selling 100 points. Wrap the shortcode around any text you want to show as the buttons label. Supports HTML elements that you can add inside a button element.

[mycred_stripe_buy amount=100]Buy 100 Points[/mycred_stripe_buy]

Example 2: Allows users to buy 500 points to a user that has the ID 123.

[mycred_stripe_buy amount=500 to=123]Gift user 500 Points[/mycred_stripe_buy]

Example 3: Sell 100 points and adjust the Stripe Checkout Window’s title.

[mycred_stripe_buy amount=100 title="Top-up Account"]Buy 100 Points[/mycred_stripe_buy]