Amazon Ebay Aliexpress Retail-Arbitrage-As-A-Service

Posted by

Try the Alpha version of this tool LIVE NOW!

Join our growing Telegram community for blog updates, bot chat, general fun and crypto madness? https://t.me/ManyVolumeSignalMonster

As I detailed in this recent article surrounding Twitter automation to buy cryptocurrency during pumps and in this way-old Hackernoon and Medium discussing how I once toyed with the morality of ethical hacking for profit – it’s obvious that I often have ideas for tech businesses that don’t really get off the ground. I lack the marketing chops to execute these things, so I’m going to continue letting you guys know how my Proof of Concepts go and maybe one day some of you can make a living with one of my ideas!

This is another entry in Insanely Marketable Business Ideas. Hooah!

Source: My code just a minute ago
Source: My code a minute after that

What you might notice about these two images is the insanely obvious: if someone were to buy one of these generic handhold consoles on Aliexpress and then sell it on Ebay they could pocket the difference in costs. This is called ‘retail arbitrage,’ where retail is what we’re trading and arbitrage is the act of buying low and immediately selling high. It’s preferable to sell before you have to buy – which you can effectively do selling on these marketplaces.

You’ll notice that I’m lacking a corresponding Amazon screenshot – their Product Advertising API requires you to have 3 sales in a certain amount of time as an affiliate before you can have access to the API. D’oh! I’ve sent them a message saying I’m creating a shopping comparison engine – it might be unwise to say we’re propagating the arbitrage ‘problem.’ Sometimes, people that buy an item on Ebay and receive a package wrapped up by Amazon Fulfillment will become irate they’ve been the victim of not knowing they can search more than one site, and they might kick up a customer service complaint…

Either way, there’s money to be made!

But, that’s not my idea. That idea’s been tried and done effectively by many, and you can google for more info. My idea is buried in those screenshots, above, and in my explanation of the Amazon part too – these are affiliate links. If someone were to visit Aliexpress or Ebay after clicking my link and place an order within a month or a few months, I get a little % kickback from that sale.

In the case of providing this as a service, the model would be that I create a beautiful and effective comparison tool to find the highest potential margins for search results or by the best possible margins in a given category and finding exact (or near-exact by text compare) title matches, then display them in easy-to-organize lists for arbitrageurs to peruse, click the links, buy a bulk order of many items or maybe just an item or two, and as I build my network – and community – of arbitrageurs, my income from the % of a % of each initial sale will exponentially increase above and beyond the potential returns from the actual arbitraging.

Retail arbitrage is fraught with potential pitfalls: from max. orders or max. sales, all the way to the customer service burden – and potential returns, restocking fees or concerns – it is easy to lose some or all of your profits in a second with retail arbitraging if you’re not careful. When building a service that provides instant comparisons for the potential arbitrageur – and a supportive, helpful community of arbitraging friends – we can ensure the overall success and growth of the operation.

Sunk costs?

Upkeep of servers, initial dev and MARKETING.

Potential upside?

We’d run the site for free. Everyone can come in and discuss the opportunities of Retail Arbitrage, and use the tool to their heart’s content. In return, our marketing efforts will reflect the fact that other arbitraging tools require a monthly or yearly subscription – putting ours leagues ahead of the competition.

Ebay Partner Network pays 1-6% per sale depending on geo, if the sale happens within 24hrs of clicking the link. Aliexpress up to 9%, and Amazon pays up to a walloping 10%! When someone wants to arbitrage again, they’d certainly want to find a new-and-improved arbitrage deal – they’d return to our platform, find a new killer deal, place another order and boombingbang more affiliate income!

NOW, for the win, let’s review some code.

First, after running npm install for the required packages, we’ll require them in the code:

let eBay = require('ebay-node-api')
var request = require('request')

Next we’ll instantiate our eBay object, like so:

let ebay = new eBay({
    clientID: '',
    env: 'PRODUCTION', // optional default = 'PRODUCTION'
    headers:{ // optional
        'X-EBAY-C-MARKETPLACE-ID': 'EBAY_US' // For Great Britain https://www.ebay.co.uk
    }
})

Now, I found out that I could use eBay’s affiliate tools to build an affiliate URL using my account and campaign. Afterwards, I hijack the &mpre= field and replace the item URL with my URL for any given item, to build a new-and-improved eBay aff link for any given URL.

For fun and profit, we set our eBay affiliate URL ‘template’ as well as our hard-coded search term:

var template = 'http://rover.ebay.com/rover/1/706-53473-19255-0/1?ff3=4&pub=5575480811&toolid=10001&campid=5338476385&customid=&mpre='
var search = '500in1 nes'

In our ebaydo function, we search eBay products using the eBay node package and loop over the resulting json. The url for the item is parsed then encoded, and we create our affiliate URL by joining our template from above with this new encoded item’s url.

Voila! Paydirt!

We log to console the network, affiliate URL, title, and price object for fun and profit. If there’s an error, let’s also log the error! Debugging is fun, right?

function ebaydo(keywords) {

    ebay.findItemsByKeywords({
        keywords: keywords
    }).then((data) => {
        for (var item in data[0].searchResult[0].item) {
            url = encodeURIComponent(data[0].searchResult[0].item[item].viewItemURL[0])
            url = template + url
            console.log('ebay:')
            console.log('affiliate url: ' + url)
            console.log(data[0].searchResult[0].item[item].title[0])
            console.log(data[0].searchResult[0].item[item].sellingStatus[0].currentPrice[0])
            console.log(' ')
        }
    }, (error) => {
        console.log(error);
    });
}

The ali function is more complicated. First, we’ll get and parse the current time into url-encoded string. Phew, that took a lot of Googling to figure out…

Next, we’ll encode our keywords. That probably means some handy %20s (spaces). Then, we load a list of products based on those keywords from Alibaba’s API, parse the result into json, loop over the products and save some useful info to vars for later. We’ll take note of the price, product url, image url (why not? Should have done this for eBay too! People can compare the images when finding their like products…) and product title. Next, we send some of these vars off to a separate function.

function ali(keywords) {
    var time = new Date();
    var time2 = (time.getHours().toString() + "%20" + time.getMinutes().toString() + "%20" + time.getSeconds().toString());
    keywords = encodeURIComponent(keywords)

    var url = "http://gw.api.alibaba.com/openapi/param2/2/portals.open/api.listPromotionProduct/76080?sort=volumeDown&fields=salePrice,productTitle,volume,imageUrl,productUrl&keywords=" + keywords;
    console.log('keywords?: ' + url);
    var responses = new Array();
    try {
        var result2 = request.get(url, function(e, r, result2) {
            var json = JSON.parse(result2)
            if (json.result != null) {
                for (var i in json.result.products) {
                    console.log(json.result.products[i]);
                    var price = json.result.products[i].salePrice;
                    var id = json.result.products[i].productUrl;
                    var img = json.result.products[i].imageUrl;
                    var title = json.result.products[i].productTitle;

                    
                    dosearchurl(id, title, img, price)
                }
            } 
        })
    } catch (e) {
        console.log('exception: ' + e.toString());
    }
}

In dosearchurl, this genius technique allows me to have the variables persistent over the next request.get call, which returns a promise, meaning that if we did request.get inside a for loop then tried to access our old variables (like title in this case, for example) it would only find the variable value at the state in the new point in time when the promise has resolved (ie. the request completes) – meaning all our results would output the same data as the for loop has completed and it executes the console.log code with the for loops final value, instead of each incremented value.

So, by taking the for loop and feeding it the variables in a different scope, the variables remain persistent even though there’s a time delay for the promise – and we can output the variables in their proper sequence, instead of only the final one over and over again.

In here, we load the product id on another alibaba api endpoint – this one to create an affiliate url for our product we’ve found. Then, we output to console all the juicey details about our potential arbitrageur’s opportunity – and our potential affiliate income.

function dosearchurl(id, title, img, price) {
    var url2 = "http://gw.api.alibaba.com/openapi/param2/2/portals.open/api.getPromotionLinks/76080?fields=promotionUrl&trackingId=4632&urls=" + id;
    var responses = new Array();
    try {
        var result3 = request.get(url2, function(e, r, result3) {

            var json = JSON.parse(result3)
            console.log('aliexpress:')
            console.log('title: ' + title.replace(/<[^>]*>?/gm, ''))
            console.log('affiliate url: ' + json.result.promotionUrls[0].promotionUrl);
            console.log('img: ' + img)
            console.log('price: ' + price)
            console.log(' ')

        });

    } catch (e) {
        console.log('exception: ' + e.toString());
    }
}

It’s a win-win-win: goldmoney for the arbitrageur who earns surebet money, paydirt for me as I gain a tiny percent of those sales over and over again, and of course it’s a good thing – big bucks – for the retail marketplace. Hooah!

I hope you’re as excited about my POC as I was creating it then describing it here. Someone will surely bet some time and effort and marketing chops to execute this vision.. will it be me?