A free points management plugin for WordPress.
myCRED Logo
myCRED Logo
  • Chapters
    • Chapter I – Introduction
    • Chapter II – Getting Started
    • Chapter III – Add-ons
    • Chapter IV – Premium Add-ons
    • Chapter V – For Developers
    • Chapter VI – Reference Guides
  • Categories
    • Actions
    • Classes
    • Constants
    • Filters
    • Functions
    • Objects
    • Shortcodes
    • Hooks
    • Template Tags
  • Packages
    • mycred/api
    • mycred/badge
    • mycred/balance
    • mycred/banking
    • mycred/content
    • mycred/core
    • mycred/coupon
    • mycred/email
    • mycred/game
    • mycred/log
    • mycred/notice
    • mycred/payment
    • mycred/purchase
    • mycred/rank
    • mycred/transfer
  • Store
  • Download
    Navigation
    • Loading navigation ...
    All Shortcodes
    myCRED shortcodes
    1. mycred_affiliate_id
    2. mycred_affiliate_link
    3. mycred_all_scratch_cards
    4. mycred_badges
    5. mycred_best_user
    6. mycred_buy
    7. mycred_buy_form
    8. mycred_buy_pending
    9. mycred_chart_balance_history
    10. mycred_chart_circulation
    11. mycred_chart_gain_loss
    12. mycred_chart_history
    13. mycred_chart_instance_history
    14. mycred_chart_top_balances
    15. mycred_chart_top_instances
    16. mycred_content_buyer_avatars
    17. mycred_content_buyer_count
    18. mycred_content_sale_count
    19. mycred_email_subscriptions
    20. mycred_exchange
    21. mycred_give
    22. mycred_hide_if
    23. mycred_history
    24. mycred_hook_table
    25. mycred_leaderboard
    26. mycred_link
    27. mycred_list_ranks
    28. mycred_load_coupon
    29. mycred_lotteries
    30. mycred_lottery
    31. mycred_lottery_jackpot
    32. mycred_lottery_quickpick
    33. mycred_lottery_results
    34. mycred_lottery_winnings
    35. mycred_my_badges
    36. mycred_my_balance
    37. mycred_my_rank
    38. mycred_my_ranks
    39. mycred_my_transfer_fee
    40. mycred_paymentwall
    41. mycred_pending_transfers
    42. mycred_rank_progress
    43. mycred_sales_history
    44. mycred_scratch_cards
    45. mycred_scratch_cards_remaining
    46. mycred_scratch_history
    47. mycred_sell_this
    48. mycred_sell_this_ajax
    49. mycred_send
    50. mycred_show_if
    51. mycred_stripe_buy
    52. mycred_stripe_subscribe
    53. mycred_stripe_subscription
    54. mycred_total_balance
    55. mycred_total_points
    56. mycred_total_since
    57. mycred_transfer
    58. mycred_users_of_all_ranks
    59. mycred_users_of_rank
    60. mycred_video
    Categories
    Filter by category
    1. Actions
    2. Classes
    3. Filters
    4. Functions
    5. Hooks
    6. Objects
    7. Shortcodes
    8. Template Tags
    Chapters
    Documentation
    1. Chapter I - Introduction
    2. Chapter II - Getting Started
    3. Chapter III - Add-ons
    4. Chapter IV - Premium Add-ons
    5. Chapter V - For Developers
    6. Chapter VI - Reference Guides
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 Points[/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[/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 Points[/mycred_buy]

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

[mycred_buy gateway="paypal-standard" amount=100 ctype="customtypekey"]Buy 100 Coins[/mycred_buy]

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

[mycred_buy gateway="skrill" amount=10 class=""]Buy 10 Points[/mycred_buy]

Last edited December 7, 2016

About myCRED

myCRED is a free, open-source and developer friendly points management tool for WordPress powered websites.

Download Rate Plugin

Documentation

  • Add-ons
  • Core Shortcodes
  • F.A.Q.
  • Tutorials
  • Third Party Plugins
  • Code Snippets

Support

  • Product Licenses
  • Hire a Developer
  • Support Forums
  • Plugin Changelog
  • Contact

Copyright 2013 - 2018 Gabriel S Merovingi; All rights reserved. myCRED is licensed under GPL 2.0

Terms & Conditions • Use of Cookies • Store Policy • Community RulesHosted by One.com

myCRED Donations

Donate via PayPal

Donate via PayPal

Donate Bitcoin

myCRED Bitcoin Wallet

3LVrDPjgTkPfqGARXwAZW9cJBQEYo4FHsB

Suggest Codex Example

You can submit suggestions for codex examples that you have available as a public gist. If you are a member on the mycred.me website, you can earn Tokens for each submission. To claim these Tokens, make sure you provide your mycred.me username.

Please make sure the example you submit is relevant and if you include documentation, it's provided in English.