mycred_buy

Codex / mycred/purchase / Shortcodes / mycred_buy

Description

This shortcode will generate an anchor element for buying creds according to given attributes. mycred_buy is the little brother of mycred_buy_form allowing for very simple, straight forward purchase link to a specific payment gateway.

Requires the buyCRED add-on to be enabled.

Available since version 1.1

Shortcode Attributes

Attribute Type Required Default Description
gateway string Yes - The payment gateway to use with this button. Can not be empty.
ctype string No - The point type the user gets. Should only be used if you want to sell a custom point type.
amount int or float Yes - The amount of points the buyer gets.
gift_to int No - Option to gift the purchase to a particular user. If used, you can use either the numeric ID of the user or keywords like "author" for the post author if the shortcode is used inside the loop.
class string No mycred-buy-link btn btn-primary btn-lg The classes to assign to the button.
login string No buyCRED Settings Option to show a custom message for visitors (not logged in users). Will default to the message you set in your buyCRED Settings.

CSS Styling

// The button
a.mycred-buy-link { }

Examples

Example 1: Buy 50 points (default point type) using Skrill.

[mycred_buy gateway="skrill" amount=50]Buy 50 Tokens[/mycred_buy]

Example 2: “Gift” the content author 10.50 points (assuming you use decimals in your point type).

[mycred_buy gateway="paypal-standard" amount="10.50" gift_to="author"]Buy This Author 10.50 points with PayPal[/mycred_buy]

Example 3: Buy tokens for a specific user using NETbilling.

[mycred_buy gateway="netbilling" amount=100 gift_to=1]Buy %display_name% 100 Tokens with NETbilling[/mycred_buy]

Example 4: Buy custom points “mycustompoint” via PayPal.

[mycred_buy gateway="paypal-standard" amount=100 ctype="mycustompoint"]Buy %display_name% 100 Tokens with NETbilling[/mycred_buy]

Example 5: Buy 10 points using PayPal without the link being rendered as a button but as a regular text link.

[mycred_buy gateway="paypal-standard" amount=10 class=""]Buy 10 Points[/mycred_buy]

Last edited August 12, 2016