Skip to Content Skip to Menu

wallet points for CB Subs automation

1 year 5 months ago #334079 by webiedesign
wallet points for CB Subs automation was created by webiedesign
Our mutual client purchased CB Subs and has asked for my assistance to configure it. Subscriptions are based on points that are manually maintained in a custom cb field by staff in the admin area. I used the "wallet" promotion (Fixed Amount in CB field) and have it working to activate the subscription and subtract the points. We would like this to be automated so that when the subscription expires, the promotion is used to renew the subscription. I tried to add the initial subscription with the dummy payment gateway that is set to auto renew, hoping this might just work auto-magically, but I knew it couldn't be that simple. I could use some guidance on the best way to proceed. I see that plans have conditions and that auto-actions and/or sb subs sql actions probably need to be added. Can you get me going in the right direction ?

Mary
webie-design.com

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
1 year 5 months ago #334083 by krileon
Replied by krileon on topic wallet points for CB Subs automation

the promotion is used to renew the subscription.

I'm not sure what you mean by this. You want it to automatically renew, but using points? Basically like recurring payments similar to live payment methods?


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

1 year 5 months ago #334087 by webiedesign
Replied by webiedesign on topic wallet points for CB Subs automation
yes. The points are maintained through the year by staff in a custom filed. When a subscription expires, we want the "system" to automatically renew the subscription based on the points in the field and subtract the amount. If there aren't enough, it should not renew. I have read in numerous places how a payment method maybe doesn't need to be used, however, I really didn't see how that could be done without any real examples. Once I got the wallet part working correctly I saw that the dummy payment processor had autorenew functions and thought it might be the easiest way to go since I will enter everything manually initially including a fake credit card to make it work.  Thanks

Mary
webie-design.com

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
1 year 5 months ago - 1 year 5 months ago #334088 by krileon
Replied by krileon on topic wallet points for CB Subs automation
I would suggest not using a payment gateway at all. Instead create free plans to bypass gateways entirely. You can then use your points entirely through conditions and integrations.

So for example under the Workflows tab you'd configure conditions against your points field to ensure they can't update or subscribe to the plan if they don't have enough points. Example as follows.

Subscriptions upgrades workflows
Allow upgrade to this: Yes
Propose plan for upgrades only if it is more expensive: No: It will be possible to upgrade to this plan (for free with pro-rating) if all conditions below and elsewhere are met
First static condition: This condition must be NOT be met to allow upgrades:
Date A, Field A or Value A: Following CB field
CB Field A: SELECT_POINTS_FIELD_HERE
Date B, Field B or Value B: Constant Value or String (CB substitutions can be used)
Value B: POINTS_COST_HERE
Condition 1 (> for Dates): A < B (Value A is smaller than Value B )

This will hide the plan if they don't have enough points, but if you want the plan to always be visible there's solutions for that as well using CB Auto Actions to force some custom validation behaviors. I can provide an example of how to do this as well if that's needed, but it's a bit more complicated.

Next using CBSubs Fields you'd subtract the points that the plan costs. This will entirely handle deducting points so you don't need CBSubs Promotions here. Example as follows.

Field: SELECT_POINTS_FIELD_HERE
Operator: Subtract: Field = Field - Value
Value: POINTS_COST_HERE
Remove value on plan deactivation: No

Now the auto renewing you'll need CB Auto Actions for that. The below should work to first check if they have enough points and if they do auto renew the plan. This will trigger CBSubs Fields and deduct their points so you shouldn't need to do anything further from here.

Global
Triggers: onCPayUserStateChange
Type: CB Paid Subscriptions
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Custom > Value
Custom Value: [var3]
Operator: Equal To
Value: PLAN_ID_HERE
Condition 2
Field: Custom > Value
Custom Value: [var2]
Operator: Equal To
Value: X
Condition 3
Field: SELECT_POINTS_FIELD_HERE
Operator: Greater Than or Equal To
Value: POINTS_COST_HERE
Action
Mode: Renew
Plans: SELECT_PLAN_MATCHING_PLAN_ID_HERE

Be sure to replace PLAN_ID_HERE with the id of the plan being configured above. You'll need to do this once for each plan since I assume each plan will have a different cost. This should automatically renew the plan if they've enough points when it goes into an expired state.

The idea here is you have a points based payment system that does not interfere with normal payment processes. So for example you can have other plans that have an actual cost without these two systems conflicting. I do not suggest trying to use the dummy gateway as a solution as it's specifically designed for testing purposes only. If you really want a full payment flow then using the Offline gateway would be a better solution, but will require you to manually pay their baskets from backend.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 1 year 5 months ago by krileon.

Please Log in or Create an account to join the conversation.

1 year 5 months ago #334089 by webiedesign
Replied by webiedesign on topic wallet points for CB Subs automation
Thank you for the detailed information. I will be attempting this within the next couple of days and report back.

Mary
webie-design.com
The following user(s) said Thank You: krileon

Please Log in or Create an account to join the conversation.

1 year 5 months ago #334173 by webiedesign
Replied by webiedesign on topic wallet points for CB Subs automation
This worked brilliantly ! Thank you so much.
I am now being told that the point field must be emptied out after the renewal (as opposed to keeping the leftover points). I looked at another forum post that seemed similar ( www.joomlapolis.com/forum/professional-members-support/239154-solved-cb-auto-action-not-triggering-as-expected#304686 ) but it doesn't seem like this is the way to go.
I am thinking I need a new action based on the renewal triggering the field to empty and not an additional condition with the working auto-action. Right ?

Mary
webie-design.com

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum