MicroPayments Plugin (CMMP) - Use Case - How to Control User Wallets From the Front-end
Use Case - How to Control User Wallets From the Front-end
Note: This use case requires this to be installed and activated:
- MicroPayments Plugin - This document uses version 2.1.3
The MicroPayments Plugin is a payment system for WordPress that allows you to create digital wallets for your users, reward them with points, and let them pay for them using real money.
Use Case Front-End
Changing Wallet Nickname:
Getting Wallet Data:
Wallets: What is a Wallet?
The Wallets are the "accounts" to which the points have to be connected to. They work very similar to bank accounts, or real life wallets.
Use Case Assumptions
In this example use case guide, we'll cover how to control user wallets from the front-end. We will consider how Administrators and Editors can get wallet data of any user and add or subtract points, and how users can change their wallet nicknames.
We consider that you have already bought the plugin, but not installed it.
- Installing the plugin
- Setting up MicroPayments Plugin - recap
- Changing wallet nicknames
- Getting data about wallets
- Managing wallets
- Labels - translating the interface
- End result
Installing the Plugin
The process is the same for all CM plugins.
- Download the add-on from your customer dashboard.
- Log in to WordPress and navigate to the WordPress Admin → Plugins settings.
- Click on Add New.
- Activate it and add the license.
Learn more: Getting Started - Installation And First Steps
Setting Up MicroPayments Platform Plugin - Recap
If you still have question with these steps:
- Setting up MicroPayments Plugin
- How users can obtain points
- Grant points for purchase
- Use points for discounts
- Translating the interface
- Exporting wallets to CSV
- Adding or subtracting points periodically
Changing Wallet Nicknames
It is possible to assign a nickname to each wallet. This way, users don't have to use Wallet IDs that are long and difficult for remembering, they can use a Wallet Nickname instead of it.
Users can change the nicknames of their wallets on the front-end at any moment. It is done by the shortcode which allows users to create a wallet on the front-end -
[create_wallet_button] . Just create a page or edit the existing one, put a shortcode and click Publish or Update.
On the front-end, when the wallet is already created, the user can see the field with his Wallet ID. He needs just to write there a new nickname and click Update.
TIP: Changing Wallet Nickname by Admin
The admin can change the wallet nickname of any user on the back-end. To do this, navigate to Admin Dashboard → CM Micropayment Platform → Manage Wallets.
Find needed wallet, hover on it and click Change Nickname. Enter new nickname, then click the button Save.
Getting Data About Wallets
Users with the roles Administrator and Editor are able to get data about user wallets using the shortcode
[get_wallet_data] . It allows getting information about users' wallets balance, transactions history and add or subtract points from users' wallets on the front-end.
Adding points can be done using positive number, subtracting - using negative number. The wallet information can be reached by its Wallet ID or Wallet Nickname. The shortcode has a few parameters for configuring the feature.
- balance - Shows the balance of the chosen wallet (default value is "1").
- transactions - Shows the transactions history of the chosen wallet (default value is "0").
- managepoints - Shows the form for adding/subtracting points from the chosen wallet. The form opens on the click (default value is "0").
- capability - Here we can set a capability of the user. Default value is "publish_posts". This parameter can be used to set which users are allowed to get wallet data. For example, if we pass the value capability "edit_users" to the parameter, it means that only the users with that capability will be able to get wallet data. This way you can allow using this feature not only to users with the roles Administrator and Editor. Learn more about Roles and Capabilities.
So, let's create a page and put there a shortcode that allows to see the wallet balance, wallet transaction history and manage points. The shortcode will look like this:
[get_wallet_data balance="1" transactions="1" managepoints="1"]
When you added the shortcode to the page, click the button Publish or Update:
Now let's see the result on the front-end as Administrator or Editor. First, you need to enter Wallet ID or Wallet Nickname that you want to check to the field Wallet Name and click the button Check Wallet.
Here is what you can see:
- Wallet transaction history.
- Wallet balance.
- Button that opens the form for adding or subtracting points.
Now click the button Add / Remove Points. In the field Points set the amount of points that you want to add or subtract, using positive or negative number respectively, then add a comment (optionally). After that, click the button Adjustment. The wallet balance will be changed and this transaction will appear in the wallet history.
The plugin also has one more shortcode for managing wallets on the front-end -
[manage_wallet_points] . This shortcode is similar to the previous one, but a bit simpler - it allows users with the roles Administrator and Editor just to add and subtract points from users' wallets. Adding points can be done using positive number, subtracting - using negative number. The form also has a field Comment for adding a note to this transaction.
Add the shortcode to the page, then click the button Publish or Update:
Let's see how it works on the front-end. Enter the Wallet ID or Wallet Nickname to the field Wallet Name. Then set amount of points that you want to add or subtract in the field Points. Optionally, you can add a comment in the corresponding field. After that, click the button Adjustment.
Labels - Translating the Interface
The MicroPayments Plugin allows you to change or translate the labels that are displayed on the front-end. To find them, navigate to Admin Dashboard → CM Micropayment Platform → Settings → Labels tab.
The following labels are related to the shortcodes
Don't forget to click the button Save after editing labels.
Following instructions found in the plugin and guides, you should be able to control user wallets from the front-end.
Use Case Front-End
Changing Wallet Nickname:
Getting Wallet Data: