Jump to content

Integrating with an external API


robulus

Recommended Posts

Hi everyone,

 

first time poster and new user of WHMCS. :) I've been asked to integrate a Registrar API into WHMCS and was hoping to get some pointers as to the right way to do it.

 

I can see the example Registrar Module - which, as a test I've installed in WHMCS, and shows up in the 'Domain Registrars' section of the site with the new name I give it. (by the way, there's a syntax error in the RegistrarDevKit.zip's template.php sample file which i've notified WHMCS about, and a ticket's been raised to correct it, it's just a missing semi-colon).

 

The next step I assume is to start developing the set of functions that the template provides - for example _RegisterDomain _TransferDomain etc.

 

However, how do I go about using the credentials listed in the _getConfigArray to be used as some elements of XML I'd want to send to an API endpoint? Let's say I want to just test a login to the external endpoint. There doesn't seem to be a section in the template where a connection can be established to an API endpoint URL. So I don't know how to test a connection/see the XML being sent to the API.

 

Apologies is this is not precise, I'm just learning about WHMCS so please, be gentle - any and all constructive feedback would be very appreciated.

Rob.

Link to comment
Share on other sites

Hi,

 

I'm a bit new too, but if I understood correctly each "_function" is passed the argument $params and within this you have your configoption1, configoption2, configoption3. In the same order you specified them in the "_getConfigArray" function.

 

You can just do: die('<xmp>'.print_r($params, true).'</xmp>');

 

At the top of your function and see whats in there :)

 

Hope it helps.

Link to comment
Share on other sites

Thanks for taking a look pgullbault, I very much appreciate it. I'll use the code snippet you mentioned - my problem really is how do I trigger code like that.

 

I've got a development instance where I've setup pricing, a payment gateway and a new client to test from within WHMCS, and from there have put in the sample registrar using the provided template. It does show up, I enable it. In the template there's a _RegisterDomain function that apparently I've got to fill in with my own implementation - which is fine, but the problem I have is, I don't know how to trigger what's in there.

 

If I just choose Orders->Add New Order->filling details for a registration->price calculated->submit order then it doesn't look like that test code is getting activated. Similarly when I settle the registration payment. So basically I don't know if something is overriding the registrar account I've set up, of if what I'm trying to print to screen is ending up in a log file somewhere. If I knew some sequence of actions would trigger that code I could start trying to figure out how to send xml back to the API endpoint etc - but for the moment I'm working blind.

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