I'm writing a php application which would do something with orders from ChannelAdvisor (CA).
Currently, I use CA API to get orders, and setup a cronjob which get orders from CA every minute, but this is not a good practice as my system need to process those orders in time. So, I'm finding a way to have my application receive CA orders right after placed.
In Shopify, they have webhook notification which would send json to a specific URL whenever an order was placed, is there something like that in CA?
Channeladvisor does not support webhooks or realtime notifications of any sort.
Scheduling an import (as you are) is as efficient as it will get.
Keep in mind that there are several delays before an order actually is served up for import.
It must first pass the marketplace's fraud checking, then channel advisors internal worker must import the order into their system, and finally your scheduler will pull in the order.
If you need timely orders it's best to connect directly to the marketplace and cut out the middleman.
Related
I'm new to webhooks and am not really getting the hang of some points of it. KISS; the current problem is, think about:
a platform
that provides a service X
to book a service X, customer Y has to pay in advance
every payment is authorized first only
every payment is captured after the service has been received
From the booking of a service to the capture of the related payment, only the authorization is handled involving the client-side. All the rest is handled on the server-side.
For every possible case of a booking of a service on my platform, payment authorizations is requested as the first action on the server-side. Adaptations of the DB of the platform are only executed after a successful authorization of the payment from the frontend.
The only fallback webhook I implement is for the case where a customer books a service, authenticates, and then loses connection. Because in this case, the customer would have booked the service, but the platform server could not make the related updates. So the customer will have paid, but not receive his / her service via the platform.
My strategy is thus to implement a webhook to listen for the event of a transaction authorization "completed", and, if no transaction data is found internally, execute what needs to be done.
BUT, two questions popped up:
A) How can I control that a webhook gets executed AFTER the regular server-side script should have been executed? Delay the execution of the webhook script? What are the best pracs here?
B) If A) is possible, isn't it smarter to just cancel the authorized payment in the webhook, instead of coding the completion of every possible transaction via webhook? Already the thing that you lose the entire payload in case of a client who lost connection (the payload that you need to execute the server-side tasks after a payment authorization), and the consequent need of passing the according payload back-and-fourth to your payment API, while ensuring that CID is encrypted etc.; this just sounds like overkill to me.. Was anyone in the same situation, and also decided to just immediately cancel the just-authorized payment in lost connections via webhooks? Or must webhooks generally execute the exact same server-side script that the related server-validation would do? Meaning I have to find a way to pass the payload to my webhook function?
The webhook is your notification that the event has happened - you're under no obligation to perform any processing right that moment, or ever.
If you're using webhooks as a backup to a primary synchronous flow (a good design!), then you can record the event and enqueue for later.
Stick a record somewhere indicating "got this authorization. Check this again in an hour to make sure the customer did the thing."
And to your comment above: you probably don't want your sync and async flows to be the same. Your async backup might involve contacting the customer eg via email, while that's not necessary for the sync flow since the customer is still on session.
I am interested in writing some basic php to interface with the Poloniex push api.
Their website provides the following info:
https://poloniex.com/support/api/
A php wrapper can be found here:
http://pastebin.com/iuezwGRZ
From what i can determine there are three APIs being push, public and trading. The public and trading APIs provide functions that can be passed parameters etc. The push api stumps me totally as i cannot determine how it works.
The first link above states the API pushes live data and different feeds can be subscribed to.
My questions are:
A) How can php receive a live stream of data?
B) How do i subscribe to a feed?
I may have misunderstood the oush api and my apologies in advance if this is the case.
Edit1:
I believe i need a WAMP client to connect to a WAMP router such as Minion.
https://github.com/Vinelab/minion
Edit2:
Node.js example
http://pastebin.com/dMX7mZE0
The push API is based on Websocket protocol.
Initially you need first to make a connection to the websocket server,
after that you need to register to a data stream (price update stream for example), after that as soon as the server make an update to something (a price ), all connected clients who where previously registred to it will synchronously received the updated price
Finally you got the last price without the need of doublecheck at regular interval if the price has changed
this could possibly be answered somewhere allready, but unfortunately I could not find the answer that would suit me.
The question is, can Magento be used only as a front end E-Commerce platform? That is read product nad customer data from external API, and also submit that data to external API. The trick is that it has to be done in real time, not via sheduled tasks.
If there are any Magento plugins that would allow for this, could someone mention any specific names?
Also, how complicated is adding custom functionality to Magento, without "hacking" the system (Things, like multiple shop branches, product sets, that can be enabled per branch, limiting orders to cetain amount of slots per hour etc.)
The entire Magento code base uses the Magento database tables for generating the frontend display, so there isn't really any way around it unless you plan on doing a rewrite on every core model to perform the necessary logic (i.e. fetch from/update external source). Existing solutions to this problem generally use the SOAP API and cron jobs to mirror the data (mapping as necessary to get it between the different structures) on both Magento and whatever external system you're using. You can achieve real-time results using the Magento observer system to send updates to your external system by listening to various model save events, and similarly create a SOAP API call when data is updated on your external system (specific implementation details depend on the system) to keep them in sync in real-time.
I am successfully using Authorize.net CIM via PHP to charge and then recharge credit cards using their xml api.
The information which I need when I want to recharge their card is
their customerProfileId which I use to get their customerPaymentProfileId
and then am able to charge up to the amount which has previously been authorized.
Is the customerPaymentProfileId static? As in, do I only need to retrieve it once and then it won't change 'ever' change?
Am I able to use the bulk upload feature of authorize.net as described at:
http://www.authorize.net/files/uploadguide.pdf
And if so, where should I be putting those fields?
If I am unable to use the bulk upload feature, would a solution be to just loop through the transactions that I have under my current PHP script, or may there be complications that would be introduced by doing that.
Is the customerPaymentProfileId static? As in, do I only need to retrieve it once and then it won't change 'ever' change?
Yes, it is static and will never change. If it wasn't this service would never work.
Am I able to use the bulk upload feature of authorize.net as described at: http://www.authorize.net/files/uploadguide.pdf And if so, where should I be putting those fields?
No.
If I am unable to use the bulk upload feature, would a solution be to just loop through the transactions that I have under my current PHP script, or may there be complications that would be introduced by doing that.
That would be exactly what you want to do. CIM is typically paired with a home-grown automated billing system. Usually to handle recurring billing with varying payment amounts. Those systems will do this very thing.
We have been manually been keying Amazon orders into our system and would like to automate it. However, I can't seem to figure out how to go about it. Their documentation is barely there.
There is:
Amazon Inventory Management (AIM) API: That is supposed to manage orders and inventory
Event Notification Service (ENS) API: Get order notifications
Seller Central SOAP API: Upload inventory and manage orders
Amazon Marketplace Web Service (Amazon MWS): Manage inventory and orders
So hich do I use? Using REST instead of SOAP is very much preferred. Can anyone point me out some better documentation/examples?
AIM and SOAP are historical APIs. The best choice is MWS, which supports all features of AIM and SOAP (i.e. all listing activity, inventory reports, order reports, order acknowledgement and cancellations, refunds, settlement reports).
MWS is also well documented at mws.amazon.com, and example client libraries are provided for Java, C# and PHP. For feed and report formats, you should refer to Seller Central Help pages for all formats (unless you are a Marketplace seller, in which case the help pages are accessible from your seller account page).
You may also want to peruse www.amazonservices.com
Finally, here's a link to the SOA-GuideToXML.pdf document, which describes the details of the XML feeds and reports, as well as the overall workflow:
http://g-ecx.images-amazon.com/images/G/01/rainier/help/tutorials/SOA-GuideToXML.pdf
I think Amazon's API is a confusing mess to deal with. I just wrote a simple tool to extract data from my Amazon wishlist and it was far harder than it should have been.
I would guess that you want to use the Marketplace service, but I could be wrong. If you're dealing with PHP, there is a PHP API that you might find helpful - Tarzan (link disabled - this package is apparently no longer available)
Here is a Amazon forum for that should help: http://www.amazonsellercommunity.com/forums/forum.jspa?forumID=32, and a PDF overview
If you (obviously not reffering to YOU) don't feel comfortable with web services and API calling (communication). You can download a flat file from Sellercentarl.amazon with your order information, and use an import method to enter the whole file at once, without retyping any info. Obviously the exact pricess would depend on What system you are trying to enter these orders into.
Good Luck!