Receipt API availability? - walmart-api

I see that the Walmart Android app has an ability to capture the receipt barcode (seems to be the traditional 1D barcode and not the 2D QR code), then retrieve the electronic version of that receipt. It then adds that receipt to your "purchase history" in the app. Is this receipt API available? I'd like to capture data from Walmart receipts, but the poor quality of the receipts themselves causes numerous OCR problems.
I've looked at the WalmartLabs Walmart.io APIs and do not see the receipt API. I tried to ask this question there, but their "ask a question" form is broken (Submit button does nothing).

Found this while investigating a similar question, and stumbled upon an answer. I am trying to build a tool that allows me to auto-categorize some purchases. Unfortunately, Walmart takes their security quite seriously and has implemented several measures to prevent running automated tools on their website (even with things like puppeteer-stealth)
However, today I found out that if you go to https://walmart.com/receipt-lookup, and check out the network tab—you can actually see a request goes out to https://walmart.com/chcwebapp/api/receipts and it only requires a few parameters:
{
"storeId": number;
"purchaseDate": string - MM-DD-YYYY;
"cardType": string (ex. "visa")
"total": number (ex. 100.89)
"lastFourDigits": string (ex. "1234")
}
For completeness, an example cURL request:
curl 'https://www.walmart.com/chcwebapp/api/receipts' \
-H 'sec-ch-ua: "Chromium";v="98", " Not A;Brand";v="99", "Google Chrome";v="98"' \
-H 'accept: application/json' \
-H 'Referer: https://www.walmart.com/receipt-lookup' \
-H 'content-type: application/json' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36' \
-H 'sec-ch-ua-platform: "Mac OS X"' \
--data-raw '{"storeId":"123","purchaseDate":"02-19-2022","cardType":"visa","total":"100.00","lastFourDigits":"1234"}' \
--compressed
It doesn't appear to require any type of authentication as a quick glance at the request shows no cookies!
I am ecstatic to have found this. I'm not totally sure if it will fit your needs, but since my tool already has access to the total, last 4, and date all I need is the storeId which I can easily hard-code since we only shop at one Walmart!
As an aside, if anyone from Walmart's engineering team ever sees this—please consider allowing the develop community access to their own data. I totally get implementing PerimeterX Bot Defense for things like PS5 releases, but blocking login attempts just to look at my own receipts? It seems like taking out an anthill with a bazooka.

Related

Interpreting nm output after rejected app

my app was rejected by Apple, because somehow my app uses private API's.
Apple said that my app uses
framework: '/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation': CFHashBytes
I couldn't find anything in the code, so I searched stackoverflow and fout out that I can use otool or strings.
With string I find two "hash" calls (wherever they are) and using nm, I get the following output:
nm Sporty\ Architect | grep hash
0000000100077490 T __TFO16Sporty_Architect12ActivityTypeg9hashValueSi
0000000100056240 T __TFO16Sporty_Architect12RotationModeg9hashValueSi
0000000100064480 T __TFO16Sporty_Architect13DraggedSliderg9hashValueSi
000000010003e3a0 T __TFO16Sporty_Architect8FileTypeg9hashValueSi
000000010003d910 T __TFO16Sporty_Architect9DateRangeg9hashValueSi
0000000100021360 T __TFO16Sporty_Architect9ModelModeg9hashValueSi
U __TFSig9hashValueSi
00000001000777b0 T __TTWO16Sporty_Architect12ActivityTypes8HashableS_FS1_g9hashValueSi
00000001000562e0 T __TTWO16Sporty_Architect12RotationModes8HashableS_FS1_g9hashValueSi
0000000100064500 T __TTWO16Sporty_Architect13DraggedSliders8HashableS_FS1_g9hashValueSi
000000010003e9d0 T __TTWO16Sporty_Architect8FileTypes8HashableS_FS1_g9hashValueSi
000000010003e080 T __TTWO16Sporty_Architect9DateRanges8HashableS_FS1_g9hashValueSi
0000000100021500 T __TTWO16Sporty_Architect9ModelModes8HashableS_FS1_g9hashValueSi
I think the U __TFSig9hashValueSi is it, isn't it? But now the question...how can i narrow this down any further?
It is beyond me, why Apple offers a validate button that shows that everything is OK and once the app is in review, it gets rejected for something, that could clearly be detected at compile time (or at least when it is submitted).
If you don't use any external API or framework, CFHashBytes is present only in Swift framework.
I had this issue with two Apps. I have sent this message to the Resolution Center and now both have been approved:
"Hello,
I think that there is an error. The only file that contains that non-public API is libswiftFoundation.dylib, framework used in Swift Apps. Xcode uses it automatically. Please, check it again.
Many thanks."
I hope this helps you.

Twitter tweeting error because of [ ] characters from a macOS App

Twitter shows error message for all tweets which has these [ ] characters. Error given below;
HTTP Status 401: Unauthorized, Response: {"errors":
[{"code":32,"message":"Could not authenticate you."}]}
I have been developing a Twitter client in macOS, recently realised that if I put [ or ] in a tweet content, the tweet is not getting tweeted. Twitter just sends back the error message given above.
I am using macOS Sierra, I have faced the same issue in El Capitan and and also in Yosemite, but I could not reproduce the issue neither in iOS nor in Android twitter clients which I built. In iOS and Android it just works fine.
I am damn sure that I don't do any kind of string encoding before I tweet the content, I submit a normal String value to system's default JSONSerialisation method which takes care of converting it into corresponding Data format with anyone of the following encoding UTF-8, UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE.
Have you guys faced an issue like this in macOS, Thanks in advance !!

How to fix a "403 - disallowed_useragent" with the native Google Drive iOS SDK?

I'm following the instructions given at: https://developers.google.com/drive/ios/quickstart?ver=swift.
Yesterday it was working but this morning it seems to always fail. The weird part is that I'm using their native SDK. I don't know why does it believe I'm using a web-view. The exact error is:
This user-agent is not permitted to make an OAuth authorization request to Google as it is classified as an embedded user-agent (also known as a web-view). Per our policy, only browser are permitted to make authorization requests to Google. We offer several libraries and samples for native apps to perform authorization request in the browser.
I cloned: https://github.com/googledrive/ios-quickeditor and got the same error.
try this, it will works for
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
Google restrict the authentication from webviews. it's accepting safari webkit useragent .override useragent with above useragent string it will works.
Here is the unfortunate answer: Yes, you are using the example from Google's iOS Quickstart, the "native SDK" as you call it. That's outdated, however, as it uses exactly the embedded web view that Google doesn't want you to use anymore.
If it did work before, but has stopped doing so all of a sudden (like I experienced myself), it may have to do with you changing something related to the client ID. For client IDs that exist for some time, there seems to be a longer grace period until Google hard-blocks the web view use (there should still be just some warning for now, I understand). A new client ID I created recently for unrelated reasons, seems to have caused just that, getting me stuck in having to replace Google Drive authentication code for a new release at short notice.
As to the options (that the so far only other respondent to your question lists from the Google blog post), after a bit of research GTMAppAuth seems to be the most viable option to me, as I am not interested in complete user sign-in and -out. But I may be wrong there.
GTMAppAuth has sample code for iOS, yet just in Objective-C. I have yet to make it through that. In general, your code logic will change like so: Your current solution does authentication purely within your app. It's asynchronous, but doesn't leave your app. The new solution requires you to initiate authentication within your app while preparing and remembering your callback functionality. The authentication initiation then opens a browser outside, which, once done causes a URL callback in your app delegate. In your app delegate, you then check for your prepared callback and, depending on the result status of the outside call, notify the user about success or failure of the outside authentication.
Add this code to your AppDelegate.m (assuming it is in ObjC):
NSString *userAgent = #"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/603.1.23 (KHTML, like Gecko) Version/10.0 Mobile/14E5239e Safari/602";
// set default user agent
NSDictionary *dictionary = [[NSDictionary alloc]initWithObjectsAndKeys:userAgent,#"UserAgent", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:(dictionary)];
You can solve this issue by using the 3rd party SDK by CloudRail which works fine for Google Drive and the new authentication restrictions. This tutorial exactly shows you how to use an external browser rather than a web -view.

Opening iOS deep links from within the Facebook web view stopped working

All of a sudden deep links to my app stopped working from within the Facebook web view but they work fine when I open the deep link within Safari (or click share in the web view and choose Safari).
I added all necessary open graph tags for my resource and the app links as stated here: https://developers.facebook.com/docs/applinks/add-to-content
Has anyone experienced the same behaviour since the new Facebook app update? Version: (34.0.0.36.265)
I'm getting the usual prompt if I want to leave Facebook but upon clicking it nothing happens and the device stays in the Facebook web view. I checked the scraper information on https://developers.facebook.com/tools/debug/og/object/ but there are no errors reported.
Here is the URL/resource that gets shared and routes to the deep link (server might need to wake): https://www.qonnect-it.com/mexx
Any ideas?
I'm having the exact same issue with the latest Facebook app update, seems to be something on their end rather than on your app (or even mine).
I suggest going to https://www.facebook.com/help/186570224871049 and report the problem so we can escalate this issue quickly.
Glad.. we found this defect logged. This has taken aways days of my productive work. Now, something weird that we noticed is that, while nothing happens even after selected "Open App", try to slide the web view holding the header a lil bit and for your surprise, the deep-link then works. Funny and interesting. Let me know if anyone else also experiences it.
If you’re looking for a possible workaround until this is fixed, use facebook’s mobile hosting API. It seems that tapping on links created with it don’t get handed to the currently buggy iOS facebook in-app-browser and therefore work.
Here’s a short step-by-step guide (adapted from the documentation):
Create a new app on facebook (or use your existing one).
Request an access token for the app: curl "https://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&grant_type=client_credentials"
Create the app-link by filling in the data you usually define in your meta tags in your page header:
curl https://graph.facebook.com/app/app_link_hosts \
-F access_token="TOKEN_FROM_STEP_2" \
-F name="YOUR_APP_NAME" \
-F ios=' [
{
"url" : "your://deep/link",
"app_store_id" : YOUR_APP_STORE_APP_ID,
"app_name" : "YOUR_APP_NAME",
},
]' \
-F android=' [
{
"url" : "your://deep/link",
"package" : "your.package.name",
"app_name" : "YOUR_APP_NAME"
},
]' \
-F web=' {
"should_fallback" : false,
}'
Use the returned ID {"id":"somethingsomething"} to request your canonical URLs:
curl -G https://graph.facebook.com/ID_FROM_STEP_3 \
-d access_token="TOKEN_FROM_STEP_2" \
-d fields=canonical_url \
-d pretty=true
Directly use the returned canonical URL https://fb.me/ID for deep linking instead of linking to your usual page.

Have Chrome pretend to be an iPad

I am sure that I have seen someone impersonate iPad Safari in Chrome. Do you know how?
Browsers identify themselves by the 'user-agent' string in HTTP request header
You can change it https://chrome.google.com/webstore/detail/djflhoibgkdhkhhcedjiklpkjnoahfmg?hl=en-US&gl=US
Here's a tutorial that shows you how to accomplish this. You simply change the user agent to be the same as that of ipad safari
Get Ipad interface using Chrome user agent string
I might be wrong but I think this mostly has to do with the user-agent string that the browser sends. When testing access scenarios it is useful to impersonate other browsers such as Safari or Mobile Safari from a Windows PC. This can be done with Chrome using the following syntax when launching the app. This example impersonates the mobile safari browser on an iPhone. Try this -
chrome.exe --user-agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543 Safari/419.3"
There are many “user-agent” strings that can be added to this syntax and a google search should discover the correct one required.
This is very useful during testing when one wants to know how the back-end systems behave when requests from different browsers come in.

Resources