How to Renew Domains using GoDaddy Domains API

It’s been a while since I graced you all with a tutorial using GoDaddy’s Aftermarket API.

In fact, I haven’t written a tutorial since the one about retrieving a list of GoDaddy domains you own.

Although today’s tutorial is not about retrieving a list of domains, you’ll likely use the previous tutorial in conjunction to today’s tutorial covering how to renew a domain for a given time period.

I won’t bore you with the details of all that is needed to get started using GoDaddy’s API. In fact, I’ve covered most of it in another article, Get Started Using GoDaddy API With PHP.

Renewing a domain using the GoDaddy API, specifically the Domains API for renewals, is quite easy.

In short, you’ll submit a POST request that includes the domain and the extension length or period of time to renew domain using a json object.

POSTing json data with PHP cURL is a bit different than making GET requests, although not all that different.

As shown in the code example below, you’ll want to replace the domain and length variables with your respective data.

Once both variables are defined a domain from your portfolio, then you’re ready to use the renewDomain function — the code logic that performs the heavy lift to make domain renewal request.

One more important thing to note is you’ll need to replace {API_KEY} and {API_SECRET} with your own GoDaddy API credentials.

When the aforementioned tweaks to the code have been made, then you’re ready to copy and paste code into a php file, upload file to a web server, and then access the file using a web browser.

While the code above is written to be a one off renewal script, you’re not far off from adding a few lines and cron job to make this script a back domain renewal script should your registrar forget to renew the domain.

Of course, the same script could also simply a be an app that allows a user to enter or select from a list of domains they own to renew.

Let me know if you have questions or encounter any technical challenges. Thanks, and that’s all for now.

Share:
Written by Alvin Brown
He's an experienced and passionate serial entrepreneur, founder and publisher of Kickstart Commerce. Alvin possesses a great love for startups dominating their market using profitable digital strategies for greater commerce.