Forums / Code Collaboration / Automated Importing of Amazon Sellercentral Orders via gmail API?

Automated Importing of Amazon Sellercentral Orders via gmail API?

Views: 4,397

Results 1 to 7 of 7
13 Dec 2020, 10:21 PM
#1
wolfderby avatar

wolfderby

Zen Follower

Join Date:
Dec 2008
Location:
Pittsburgh, PA
Posts:
241
Plugin Contributions:
0

Automated Importing of Amazon Sellercentral Orders via gmail API?

Is anyone interested in collaborating on importing amazon orders in as-automated-process-as-possible to within a zen-cart framework?

Current dev game-plan:

//sync productid or product model as seller sku > asin (add asin field within products table)

////pull data from amazon into a zen-cart order
//use tampermonkey browser add-on to scrape/populate data from order page and push to (operating system's) clipboard? (or to a page in the admin (or straight to the shopping cart if you use my admin-on-catalog-side browser cookie hack)
(similar to: https://gist.github.com/jacenko/a9b7ff278ffa93e078d44276e103ca3e)

//submit order under [email protected] email account

Future-istic game-plan:

//use gmail api to scrap "your earnings" email w/ exact figures (note missing data amount paid for shipping in amazon sellercentral (if shipping was purchased through amazon)

//use casperjs or amazon api to gather amount paid for shipping

//calculate actual purchase price by "your earnings" - "shipping actually purchased" = "final retail price"

//if you have cost data in zen-cart you can then calculate your profit on the order (I have hacks that do this that aren't core within super-orders and from the profit margin calculator add-on)

note: I realize this is a high degree of specificity/customization for an open-source community so my current expectations are low.

any suggestions/pseudo code welcome. (:

15 Jan 2021, 11:35 PM
#2
lindasdd avatar

lindasdd

Zen Follower

Join Date:
Jun 2007
Posts:
474
Plugin Contributions:
0

Re: Automated Importing of Amazon Sellercentral Orders via gmail API?

Why would you want to build this? Is it so that you can use Zen-Cart as master inventory tracking? Is it because you use Zen-Cart as your shipping solution?

20 Jun 2021, 3:05 PM
#3
wolfderby avatar

wolfderby

Zen Follower

Join Date:
Dec 2008
Location:
Pittsburgh, PA
Posts:
241
Plugin Contributions:
0

Re: Automated Importing of Amazon Sellercentral Orders via gmail API?

lindasdd:

Why would you want to build this? Is it so that you can use Zen-Cart as master inventory tracking? Is it because you use Zen-Cart as your shipping solution?

Yes, I currently use zen-cart as my inventory mgmt system. I currently ship through the marketplace's that we've sold through. And if our zen-cart store gets a sale I create them on the USPS, UPS, or Fedex sites manually. I haven't received a level of sales that I need a better shipping solution, but hope to increase them soon. (:

20 Jun 2021, 3:15 PM
#4
wolfderby avatar

wolfderby

Zen Follower

Join Date:
Dec 2008
Location:
Pittsburgh, PA
Posts:
241
Plugin Contributions:
0

Re: Automated Importing of Amazon Sellercentral Orders via gmail API?

So I'd like to share the code for this approach via GitHub, however I was thinking I should smooth out the logging into your gmail first.

I'm currently stuck on the token.json file getting created successfully, because I'm trying to place it in YOUR_ADMIN and the chmod permissions are 0755 instead of 0777.

Should I put the token.json in the root "public_html" ? Any thoughts?

Here's how the google api code generates the "token.json" file:

  file_put_contents($tokenPath, json_encode($client->getAccessToken()));

It works as it should on my localhost machine, just not on my shared hosting atm.

20 Jun 2021, 6:39 PM
#5
wolfderby avatar

wolfderby

Zen Follower

Join Date:
Dec 2008
Location:
Pittsburgh, PA
Posts:
241
Plugin Contributions:
0

Re: Automated Importing of Amazon Sellercentral Orders via gmail API?

wolfderby:

So I'd like to share the code for this approach via GitHub, however I was thinking I should smooth out the logging into your gmail first.

I'm currently stuck on the token.json file getting created successfully, because I'm trying to place it in YOUR_ADMIN and the chmod permissions are 0755 instead of 0777.

Should I put the token.json in the root "public_html" ? Any thoughts?

Here's how the google api code generates the "token.json" file:

file_put_contents($tokenPath, json_encode($client->getAccessToken()));

> 
> It works as it should on my localhost machine, just not on my shared hosting atm.

Got it! (: now I will clean it up a bit!
22 Jun 2021, 12:26 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Automated Importing of Amazon Sellercentral Orders via gmail API?

wolfderby:

Should I put the token.json in the root "public_html" ? Any thoughts?
NO! That token is basically a password alternative.
Never put a sensitive file like that in the root of your site! Bots are always crawling for those kinds of things hoping to find something they can use to get access they shouldn't have.

Put it in the directory "above" public_html so that nobody can ever read it via a web browser.
And probably call it gmail_token.json or something specific to its purpose so that you know not to delete it when cleaning up things above public_html.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

23 Jun 2021, 9:50 PM
#7
wolfderby avatar

wolfderby

Zen Follower

Join Date:
Dec 2008
Location:
Pittsburgh, PA
Posts:
241
Plugin Contributions:
0

Re: Automated Importing of Amazon Sellercentral Orders via gmail API?

DrByte:

NO! That token is basically a password alternative.
Never put a sensitive file like that in the root of your site! Bots are always crawling for those kinds of things hoping to find something they can use to get access they shouldn't have.

Put it in the directory "above" public_html so that nobody can ever read it via a web browser.
And probably call it gmail_token.json or something specific to its purpose so that you know not to delete it when cleaning up things above public_html.

Got it. Thanks, yeah I was able to keep it in the admin, turned out I had an issue w/ the secret in the credentials.json file being incorrect.