How to sync products to local sql database for on-premise app - mysql

I’ m currently developing a on-premise app for a local business.
The point of this app is to manage the cashing system and get input from a barcode scanner.
When a barcode is scanned the app should make a request to Shopify to get the product to display it in my app and adjust the stock value. I can do this by using the admin api.
But this is not a great solution when the internet is down. Then I cannot request for products.
Therefore I need to request all products periodically to store it locally and use the local db to make changes and when the internet is back update to shopify.
But when I do this a new problem arises. For example, I request at 9:00AM all the products,
If a client comes to the local store and buys an item its stock value is : stock - 1. But when another client goes to our online store and buys the same item, the stock will get adjusted to. The problem is when the product is on stock value 1.
When I do a resync later eg (1:PM) the total stock of the product will get -1, which is not a valid stock and someone bought a product that is no longer in stock.
Is there a reliable way to sync shopify products to a local db and keep the stock updated at all times ?
Kind regards
Jens Vanhulst

Related

Subscription Database for Web App: How to Determine the Expiration date?

I am confused about how to design a database structure that suits the needs of the application I am building, I really hope to get the answer here.
So, I'm creating databases for web applications, where users who want to use our application they need to subscribe first, however for new users they can use it for free for 7 days starting from the start date of account registration.
The application that I created here is used to remote a device, so that the application works properly, the user needs a VPN.
So, all users will get a VPN account and can access my application according to the active period of the plan they are using.
I am a beginner in the world of databases, this is the database structure that pops into my head.
I'm confused about the expiration date,
1. How do I update the subscription expiration date based on the package that the user selects?
2. How do I update the subscription expiration date if the user renews the subscription before the previous package expires?
Other programs also need information whether the user is in the subscription period or not, this information is used to delete the VPN account and prevent users from accessing the main application.
If you were working on this project, how would you structure your database?
I appreciate all suggestions.
Don't "update" (in terms of materializing) anything at all. When a user tries to connect (or use the application or the like), check if there's a subscription that isn't expired by adding the time period the subscription is valid to the point in time the subscription began and check if that is before now.

How to get Amazon product information through API

I am looking for a way how to get Amazon product information through API. I found some articles how to get products data:
Amazon Product API Exploration: Let’s Build a Product Searcher
Querying Amazon's product details with the Amazon Product Advertising API
If I understand it correctly, I need access to Amazon Product Advertising API. I signed up as Amazon associate, but I wasn't approved, and thus I am not able to join Amazon Product Advertising API.
I messaged Amazon support and got this response:
This is the Amazon Associates team responding to your email.
Registration for Product Advertising API is only available to Associates who have received final acceptance into the Associates Program and are in an Open status. You are unable to join because your application is still pending or in a Pending status. PA-API is only for approved members or those in an Open status. This means that when the Applications team review your application and website(s), if your application is placed into an Open status, you will be automatically eligible for API access.
Our Applications team will review your application and website(s) after you have earned at least three (3) qualifying referral sales through your Associate Product Links. Please note, three (3) qualifying referrals means three separate orders and multiple items within an order do not qualify. Applications will be reviewed shortly after you’ve referred your third qualifying sale to Amazon.com.
To begin developing your website(s) and posting on social media, you've been granted access to Associate Product Linking tools in Associates Central (affiliate.program.amazon.com) under the Product Linking tab and Site Stripe (located at Amazon.com). Use these tools to generate at least three (3) qualified referral sales to initiate your final review. Until your application is reviewed. With the access to Associates Central, you have the opportunity to create product links, banners, or native ads to add to your website and start earning money right away.
If your website requires the use of PA-API, you would need to contact them directly to see what other options would be available, or use our other Product Linking tools on a different website or social media site(s).
I am wondering, how can I get access to amazon product information if I am not amazon seller?
Amazon recently changed their affiliate policy regarding API access. They want you to have three affiliate link transactions within 180 days to be in good standing. They will need to conduct a review of your affiliate site. Until then, the API keys will only be good for generating product links.

Adyen Web SDK How to log product information?

So I'm currently using the Adyen Web SDK in conjunction with NodeJS, and was hoping to get some help with something.
Basically I'm building a store that sells digital products, and when users purchase a product, I store that information in my database. However, I'd also like to somehow store it with Adyen so that I can see in the list of transactions in the Adyen control panel what product was purchased for each transaction. (Without manually checking my Database since ideally it would be nice to export this in the reports as well!)
I've dug through the API docs for Adyen but nothing seems to be referenced about doing anything like this other than lineItems (https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v41/paymentSession)
But lineItems seems more for physical businesses I think? + I'm not sure if this information is even viewable in the Adyen Control Panel.
If this isn't possible, then what's the best option? Export the transactions from Adyen and loop through my database and grab the information for each transaction?
I would suggest using metadata. It is an available field in /paymentSession (and most of adyen's API calls). It's a hashmap you can put up to 20 key/value pairs.
You can then have the reports return the metadata in a new column. The metadata will be added as a JSON string. Though you have to reach out to adyen's support to enable returning metadata in reports.

Intergration of Paypal

i am thinking of integrating paypal into my clients website however wanted to check about a few things that i couldn't find in the documentation. I already have a working login system that starts a session upon logging in however my client wants the ability to give certain customers discounts. The discount amount can be manually added to the SQL database used for login (kept on PHPmyadmin) however is there any way for at checkout Paypal to take this value and subtract that percent form the total amount to be paid?
Many Thanks
Tom

Credit Card Processing in Magento using authorize.net for different web sites

We are trying to use the same instance of Magento for 2 different domains. We have a store that in Magento that is charging credit card using Authorize.net. The customer will see that the charge is from company A. We have a new project for a new website that we want to have the credit card charges on the customer statement show as Company B. Our developer would like to use the same instance of Magento, but in order to have 2 different credit processors we have to have separate IP addresses for each Web site.
If you have 2 stores defined in the Magento can the Credit card processing be defined separately for each store using a different processor?