Here's my scenario: I have 10 ios apps with subscription in app purchases. I need one subscription purchase to be valid accross the 10 apps. Thus I require server-side receipt validation. The flow is like this: When the customer pays for the subscription, the receipt is sent to the Firebase DB and from there, I require a PHP script that takes in the receipt data . as input and sends a 'POST' request to the App store. The App store would then validate the receipt and return a JSON object back. We then overwrite the old receipt with the latest copy. Also, whenever the user logs in to any of the apps, we repeat this process and update the receipt to make sure the subscription of the user is still valid. My question is, is Firebase capable of dynamic script handling and HTTP requests?
Thanks :) for any help.
Firebase Hosting cannot execute PHP scripts. It mostly a static hosting service (so serving uninterpreted HTML, JavaScript, CSS, etc).
Recently Firebase added the ability to connect Cloud Functions to Firebase Hosting. But that still doesn't allow you to run PHP code on Firebase Hosting.
Related
I am new to swift and was wondering how could I send commands from a server to my iOS application ? For example imagine a website where I can click a button and that button would then trigger a pop up to all users of my app. Is this possible and if so can someone lead me in the right direction?
Much appreciated
Yes, you can
Silent Push Notification: Send a Silent Push Notification and handle in your app. But you need user permissions to receive Notifications. Add "content-available" : 1 to your notification content.
Using Sockets: There are many options to create connection b/w device and server. example: https://socket.io/
It depends what you are trying to do, you might want to look at apple push notifications and see how they work. From there I would suggest looking into sending notifications to the apple server (that would send the push notifications to the app). I hope this sends you in the right path good luck!
I just assume that you have an application that a number of users are using and you have a web application that can show all mobile users.
For the most of cases, whenever a user is using the application, you let the application send a request with your user's information to your server and your server records the user information in the database.
When your website wants to show all the users' information, it just fetches all the information from the database instead of sending sort of commands to all applications to get information in real-time.
Of course, there is a more complex way to send commands to all running applications to get the results. However, it requires both server-side and client-side (ios application) implement functions sending commands in real-time using Socket or MQTT etc. This is more complex and it requires iOS application running in front or background at the same time.
I assume that using HTTP to record every mobile user is more suitable for your case.
I have to make an application that receives commands from a website and therefore perform an action.
I thought about creating a login in android to send the username and password for POST and if this is correct, the web server will return a unique token. That would serve me later to send information to the server and ensure authentication...
But ... how can my android application know when the website has a warrant for?
I've thought about that all the time is pending a URL "checkOrders" and if it finds your token, request orders to another URL
Anybody know other method to make it?
If I understood your question correctly, the only (battery and otherwise) efficient way is using push notifications. Unfortunately, this approach is not even close to being simple.
Since you're developing an Android application, you may want to consider Google Cloud Messaging and Parse Push. If you're planing on developing apps for iOS and Windows phones in the future, I'd strongly recommend Parse Push. At the moment, it's free for up to one million users.
Hyperlink for GCM will lead you to generally useful reading on this topic. That's why I am not elaborating here.
Very shortly I will be required to do an integration between Quickbooks Desktop and a PHP website. I'm aware that there exists a PHP QuickBooks class that helps with integrating, but to my knowledge that only works when the PHP site is the one to initiate contact with the Desktop application. It's required of me that when a Purchase Order and/or Product is created on QuickBooks, it will automatically (and instantaneously) send the information over to my website using a REST API. Considering there will be multiple instances of QuickBooks Desktop that will be connected (we will allow customers to use a QuickBooks application that we will build), it is not practical to have to constantly check if ALL of those QuickBooks Desktop instances have any new Purchase Orders or Products that have been created since the last time we checked.
Is there a way to somehow add code to QuickBooks to send Purchase Orders and Products (upon creation) to my website using a REST API?
Thank you
QuickBooks itself doesn't really have any reliable method of catching events like you're talking about, and also doesn't have any way to then relay those events to an external REST API. So, you're not going to find exactly what you're looking for - it isn't possible.
With that said, you CAN get close by having an external application that polls QuickBooks periodically (as often as every few seconds) to grab new data from it, and then relays that data up to your REST API.
The easiest way to do this is via the Web Connector. It can poll as frequently as 1 minute, and is very capable of doing exactly what you're talking about. If you want to go with the Web Connector, your best bet is probably this open-source QuickBooks PHP DevKit (disclaimer: I'm the author). You could start with the Web Connector quick-start guide.
The harder way, but more flexible way is to write a custom QuickBooks SDK application that sits alongside QuickBooks, polls QuickBooks periodically, and relays that data up to your app. If you want to do this, you should check out the QuickBooks SDK - it has some C# and VB.NET examples in it which should prove useful.
Some specific notes:
but to my knowledge that only works when the PHP site is the one to initiate contact with the Desktop application.
Actually no - it only works when the Web Connector (which runs alongside QuickBooks) initiates the communication. But you can set it to run every 1 minute, which makes it pretty much constantly run and push data up to your app.
it will automatically
This is easily do-able with either the Web Connector or a custom SDK app.
(and instantaneously)
This isn't do-able. QuickBooks isn't even fast-enough performing to instantaneously relay data. You will never get instant data transfers from QuickBooks, so just forget about it now. (This is especially the case when you realize that there are lots of things in QuickBooks that can completely lock integrated applications out of even connecting to the data file - single-user mode, QuickBooks automatic updates, QuickBooks not being running, too many users in QuickBooks, etc.)
send the information over to my website using a REST API.
If using the Web Connector, your website receives the data, and you can then transform it and send it to your REST API.
If using a custom SDK app, you can write custom code to do that no problem.
it is not practical to have to constantly check if ALL of those QuickBooks Desktop instances have any new Purchase Orders or Products that have been created since the last time we checked.
Are you sure? We do this every day for thousands and thousands of people on ridiculously under-powered hardware.
I'm developing both the server api and client-side app. I'm struggling with the client-side, as to whether to code it up as an app placed on their server or embedded with iframe and hosted on ours. I need your insights.
Here are our constraints:
Paid subscription based app. We want to authorize each request made to the server to ensure it's coming from a paid customer's site. Currently, we designed the API to accept HMAC Auth in the header and then compared it and the referrer host to what's in our db.
The API is RESTful. We do not want cookies or sessions.
Authorization is only for the client hosted site (our paid customers) and not their audience.
Resources sent back (if request is validated) will then be embedded into our customers' HTML pages.
We want to minimize the amount of code sitting on our customers' servers.
We're open to SSL/HTTPS and Oauth, if needed.
Given the above parameters, how would you go about the client-side portion? My first thoughts are to develop server code for generating the HMAC (sits on our customer's server) and then embed pass it to our iframe embedded on their page.
Thank you for your time and insights
I'm working on integrating a Magento store with an existing desktop Point of Sales software. My idea is that this desktop program would connect through Magento's REST API to gather the product list, inventory changes, etc., and it will also commit new products and other updates through the API endpoint.
The problem arises when I don't want the person in charge of the PoS know the API credentials or don't want to bother prompting for them. The best would be to set them up in a config file.
I thought about loading the API authorize page in the background and automatically post the credentials to the login form. But this looks like a nasty approach.
Any ideas?
Not a solution but some words of experience in this matter...
Magento's API can be slow and the user will wait forever for the task to finish especially if the server is under load. We use another application which uses the Magento's SOAP API which I built using java to handle all updates/downloads between magento and our POS. This way the user is not waiting on slow responses, or stopped by loss of connectivity.
We have adopted your queue approcach, and another reason for having 1 application with a queue is that it handles all updates from all users and Only Allows 1 Task To Execute At Once. You need to do this to avoid database locks. e.g. Two users modify a product and you get a table lock error and the update fails. You can also overload the server by flooding it with lots of single user requests to the server. We still have event driven processing as opposed to synch scripts by having our POS send messages to our local app instructing the app about the task and it simply queues the task for processing. Our application has no user interface what so ever and I run it as a System service on our server, with the user credentials stored in a config file.