Jump to content

Credits used in another app


Kelevra

Recommended Posts

Is it possible to use the credits from WHMCS in another app? I have a online SAAS app, at the moment im using WHMCS and let my clients register to WHMCS and then I give them a account in my SAAS app. There is some functions we are planning to develope for this SAAS app, like SMS, where my clients would be able to send SMS to their customers from the SAAS app using the credits they have in WHMCS. Meaning they can send SMS if they have credits in WHMCS and when they send SMS, the cost would be reduced from their credits in WHMCS. 

Is this doable and how?

 

Thank you in advance

 

Link to comment
Share on other sites

Yes, but how you implement it depends on how you are connecting to the SaaS app from WHMCS and how fast you want them to be billed for their usage .  For example, you could use a server / provisioning module to connect to the SaaS, get usage and use AddBillableItem API to be invoiced when you set.  So, say their usage is 106 SMS since last checked and for each SMS is $0.01.  The billable item would then be $1.06.  You could also do straight invoice generation, but doing that on a daily basis might be a bit much.   With the billable item,. you can set it to their next invoice for example so they only get one invoice a month.  A custom field could be used to track their usage and bill off that.   Another option would be to use the internal classes and deduct from the $credit amount and record it with a addtransaction API call.  However, I think the billable item approach provides a better record tracking. 

On the SaaS side, if you want to have hard limits, you could do an addon module for the connecting the two systems and have the addon module query for paid for usage and then limit if needed.  You could do external API calls also, but personally like to have API access as limited as possible and so passing through an addon module would be the best option. 

Link to comment
Share on other sites

6 hours ago, steven99 said:

Yes, but how you implement it depends on how you are connecting to the SaaS app from WHMCS and how fast you want them to be billed for their usage .  For example, you could use a server / provisioning module to connect to the SaaS, get usage and use AddBillableItem API to be invoiced when you set.  So, say their usage is 106 SMS since last checked and for each SMS is $0.01.  The billable item would then be $1.06.  You could also do straight invoice generation, but doing that on a daily basis might be a bit much.   With the billable item,. you can set it to their next invoice for example so they only get one invoice a month.  A custom field could be used to track their usage and bill off that.   Another option would be to use the internal classes and deduct from the $credit amount and record it with a addtransaction API call.  However, I think the billable item approach provides a better record tracking. 

On the SaaS side, if you want to have hard limits, you could do an addon module for the connecting the two systems and have the addon module query for paid for usage and then limit if needed.  You could do external API calls also, but personally like to have API access as limited as possible and so passing through an addon module would be the best option. 

 

I think the best for my services as there is several items that will be sold by used basis, meaning they are payed only if used would be to deduct the credits used for instance for SMS, if customer sends 100 SMS then the cost is taken from the credits, if there is no credits system recognises this and tells customer to buy credits. When the SMS is sent, then customer gets a reciept (invoice marked payed). Im relly new with trying to code WHMCS, been using it for ages but never done anything like this. How would you suggest the server module (AddBillableItem API) would be done best?

Link to comment
Share on other sites

Well, the main question is when do you want the billing to happen?  At the time of usage or on a recurring period?  I ask because at the time of usage could mean potentially creating 1 invoice for every SMS sent unless they are sent in bulk at the same time without any options otherwise. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated