How do I get all products purchased by a user in the last month through the Kroger API? - kroger-api

I'd like to get a list of all the products an authenticated user purchased in the last month back from the Kroger API. Is there a way to do this (and how)?
I'm using Svelte + Node (not that the solution has to be Svelte/Node). I'm mostly looking for what API routes to hit, as it isn't clear to me from the documentation whether this is even possible.

Related

Google places autocomplete widget using the Basic SKU but still getting charged

I'm using the Google places autocomplete widget and since Google applied the billing changes the widget is becoming very costly to maintain. I have added the basic parameters which are supposed to be free but when I view the billing I'm still getting charged for the SKU: Autocomplete without Places Details – Per Session. This is the code I'm using:
var searchBox = new google.maps.places.Autocomplete(input);
searchBox.setFields(['place_id', 'name', 'types']);
So my question is, is there a way to get the autocomplete dropdown without getting charged with the new google places API?
Please note that the setFields() method is only applicable when a user selects a place from the autocomplete suggestions. When a place is selected, a Places Details request is made which is the one that generates Data SKUs (Basic, Contact, and/or Atmosphere), depending on the fields that are specified in the request. If you specify Basic Data in your Places Details request, you will be billed for the Places Details request and not for any additional Data SKUs (like Atmosphere and Contact Data) when a user selects a place.
In your case you are only charged for all autocomplete requests and not with any Data SKU. To explain the charge that you got for SKU: Autocomplete without Places Details – Per Session, you are charged for this for the times when a user has not selected any place from the autocomplete suggestions within a few minutes of the beginning of the session. This happens when a user only types characters in the autocomplete input box but is not selecting any place from the search results.
If you have setup your billing account, you will be entitled to the recurring $200 monthly free credits.
Currently, since API requests are charged as per the pricing, if you want to stay in the free tier usage, you can cap your API usage by setting a daily limit to them. This is to avoid unexpected charges by limiting the number of API calls you can make per day.
Hope this clarifies it.
The pricing for implementing the autocomplete SearchBox is different than using the autocomplete widget. The searchbox uses the places text search functionality, which automatically bills for all three places data categories. The widget, however, allows you to mask data fields and automatically creates a session that begins when the user starts typing and ends when a selection is made. With the searchbox, you are getting billed per end user keystroke, which will rack up your charges incredibly fast. I highly recommend implementing the widget over the searchbox.

Ads Actions Stats purchase and other values

I want to fetch keys from facebook using their graph Api. Currently i am being able to fetch keys that were pretty straightforward in graph api console like frequency , reach etc. Keys like purchase, Adds to cart are not available in the graph api console and their documentation isnt very explanatory. Most of these keys are not returning any value in facebook's ads manager as well.
It would be really helpful if anyone can explain:
When these metrics will be available ?
I have seen a tool qwaya and it copies all the columns that facebook provides. How are they doing it ?
What actions are to be performed on my ad so i can see any changes in
those values ( PURCHASE , ADDS TO CART etc )
Another side note : I was using facebook-ads-sdk but now they have changed its name to business-sdk

Retrieving Card details from Square Customer

I'm trying to create a recurring payment on Square, ala Stripe subscriptions. However, I am having trouble retrieving a customer's card information (specifically customer_card_id) to pass into Charge.
Our flow is such:
A customer visits to our store and subscribes to a membership, which we process via the point of sale app.
We continuously poll Square to retrieve payment information, and create membership records appropriately.
When the user's membership period expires, charge them for the next month's membership.
When researching RetrieveCustomer, I find that there is a cards property under Customer, but iterating through all the Customers under our account, they all have cards = None despite us having taken card payments via the point of sale app.
Also, looking at ListTransactions, there doesn't seem to be anything that might be customer_card_id. The IDs I see there are tender ID, location ID, and transaction ID. The card_fingerprint also looks promising but that doesn't seem right either, since a card can have both an ID and a fingerprint.
Am I missing something? Where might I find customer_card_id?
EDIT
Looks like I was dumb and my local instance of our application was just out of date with transactions from Square. After updating my data with customers we've processed since the last time I updated, customers with a non-None card property now show up. tristansokol's answer below is still valid however.
How do you process the first charge? You need to explicitly add the card on file, it won't be added by default from processing a transaction from a customer. See: https://squareup.com/help/us/en/article/5770-use-card-on-file-with-the-square-point-of-sale-app

Syncing online and offline stock levels

We have an e-commerce site, and several bricks & mortar stores.
I have managed to extract stock data from the "bricks & mortar" database and send this up to the website, but putting the online sales back into the database is proving almost impossible. No docs + uncooperative vendor.
What happens at the moment is the website sells something, the order is processed manually into the store database and then the stock levels are updated back to the website. The issue being that the stock levels are not updated instantly so there is a possibility 2 people can purchase the same item, especially with sale items where there is only a single item left.
I am wondering if there are any good solutions to this?
One thought I had was to store the number of purchases on the website, and subtract that from the number of items in-stock leaving the correct stock level. But then once the order is processed in the "bricks & mortar" store, the stock level being exported to the website would be inclusive of that difference, and my online stock levels would be incorrect.
Any help pointing me in the right direction would be greatly appreciated
You should use a 'lock' and 'confirm' approach. If a customer at one POS is requesting an item, you should contact the server and lock up the item if it is available. Then customer will have a few seconds to 'confirm' the sale (otherwise the POS requests the server to unlock the item).

Solving the location-based app data problem

I'm trying to build a very simple location-based app and I have all of these services at my disposal (Foursquare API, SimpleGeo, Google Places, etc). All seem to provide me a list of venues (bars, coffee shops, stores, etc) near a given longitude latitude. This is great but once the users see the venues, they will be able to write reviews about each venue (for example). Now, what do I do with this data?
User ID (users for my app)
Venue Name (retrieved from Foursquare API)
Longitude, Latitude
Foursquare Venue ID
Review
Do I store this in my database? What happens if the venue name changes on the Foursquare servers? If I don't store this in my database, I'd have to do a lookup to retrieve the venue name and details every single time I want to return a list of reviews in the area. Can someone offer some advice on how to conceptually design a venue-based location app. Thanks.
Store the essential 3rd party info in your database but treat it as a cache. Have a background task that checks for updates every few minutes, days, or weeks depending on the likelyhood & severity of changes. In between updates the user may get stale data but hey, that's life... at least they got it fast. In doing your updates, don't update everything at once or you'll run quickly into API throttling limits.

Resources