Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Black Friday Intro Offer for your subscription's lifetime
🎉 Black Friday sale is here! Great savings on professional and developer memberships! Get 25% off now with code BLACK-FRIDAY-2024!

[SOLVED] [#9091] Programmatically invoice a subscriber

  • 3by400Inc
  • 3by400Inc
  • OFFLINE
  • Posts: 119
  • Thanks: 11
  • Karma: 0
2 years 8 months ago - 1 year 11 months ago #328878 by 3by400Inc
We are programmatically subscribing users via auto action which works well. Currently those have no fee attached.

Now we need to programmatically subscriber users to a plan with a fee to be paid.

We have a table of fees by country. Depending on the country field in CB we need to get the fee and create a basket for subscription. Preferably the user will receive an email notification and once logged into the site will be presented with the basket for payment of the subscription.

Should this be done via CB query field, auto action, or what?

Our thought is to externally calculate the fee based on the CB country field and place the fee in the user's CB record. Then possibly use a promotion to get the fee dynamically to override the CBSubs plan fee.

Can a resulting basket invoice be presented to the logged in user via their profile? If not, how?
Last edit: 1 year 11 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48573
  • Thanks: 8293
  • Karma: 1445
2 years 8 months ago #328886 by krileon
Replied by krileon on topic Programmatically invoice a subscriber
CB Auto Actions bypasses basket entirely. It has no function for generating baskets. For that it's best to just find a way to send them to the following URL.

index.php?option=com_comprofiler&task=pluginclass&plugin=cbpaidsubscriptions&do=addplanstobasket&plans=PLAN_ID_HERE

That URL will generate a basket and add the supplied plan to it automatically and display the basket. You could probably do this using CB Auto Actions using a Redirect action after they login. You'd then be able to condition your field and condition to see if they're already subscribed to the plan. I recommend using onAfterUserLoginSuccess trigger though since it's the final trigger in the frontend login process.


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.

  • 3by400Inc
  • 3by400Inc
  • OFFLINE
  • Posts: 119
  • Thanks: 11
  • Karma: 0
2 years 6 months ago #329366 by 3by400Inc
Replied by 3by400Inc on topic Programmatically invoice a subscriber
When I use the addplanstobasket URL it does not take into account promotions. Should it?

I am setting a CB field to a fixed value that will override the plan price. I'm following all the documentation and the promotion appears to be properly set for the plan. Before I move ahead with thinking I don't have it configured correctly I wanted to ask to be sure that the addplanstobasket URL would encompass using promotions.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48573
  • Thanks: 8293
  • Karma: 1445
2 years 6 months ago #329370 by krileon
Replied by krileon on topic Programmatically invoice a subscriber

When I use the addplanstobasket URL it does not take into account promotions. Should it?

It works like any normal frontend purchase. It's just bypassing them having to select the plan and click the button to upgrade.

I am setting a CB field to a fixed value that will override the plan price. I'm following all the documentation and the promotion appears to be properly set for the plan. Before I move ahead with thinking I don't have it configured correctly I wanted to ask to be sure that the addplanstobasket URL would encompass using promotions.

It sounds like your promotion isn't configured correctly.


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.

  • 3by400Inc
  • 3by400Inc
  • OFFLINE
  • Posts: 119
  • Thanks: 11
  • Karma: 0
2 years 4 days ago - 2 years 4 days ago #331821 by 3by400Inc
Replied by 3by400Inc on topic Programmatically invoice a subscriber
We've tried several adjustments to the promotion and all attempts fail to set the plan price in the basket to be the amount in the user's custom field. Attached is our promotion config. We know the promotion is at least being considered because the override we have defined on the promotion's display tab is shown in the basket.

We have removed all conditions and access level requirements. All that remains is the promotion calculation shown in the screenshot.
Attachments:
Last edit: 2 years 4 days ago by 3by400Inc.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48573
  • Thanks: 8293
  • Karma: 1445
2 years 4 days ago #331826 by krileon
Replied by krileon on topic Programmatically invoice a subscriber
What type of field is it? Text? Integer? What is the value in the field? It's possible it's working, but the value in the field isn't compatible with pricing.


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.

Moderators: beatnantkrileon
Powered by Kunena Forum