Facebook Payments Documentation Guide for Lazy Developer

Facebook payment documentation provided just has too much chitchat going on. So here is simple quick rundown.
NOTE: This is for September 12, 2013 breaking changes local currency payments documentation.



Step 1 - Define your Items

Essentially each item has it's own http/https address and being red via GET request, so you want to have view that could display each item by giving it an id. This link will be used in your frontend js and Facebook will cache the contains on it. https://developers.facebook.com/docs/howtos/payments/definingproducts/#ogproduct_item

If you want to make dynamic prices for things such as flash sales - don't provide the price, but that defeats the purpose of Facebook cached HTML views IMO, probably just a reason to push `og`. In this case on each popup Facebook will ask your backend the exact price. Request/Response after the image:

List of supported currencieshttps://developers.facebook.com/docs/concepts/payments/currencies/

You can debug your views by pasting your item link to https://developers.facebook.com/tools/debug/

Step 2 - Add JavaScript

In this step you have to create JS method that will be called in the frontend in order to call up the payment popup.
It's easy and nothing much to add here. Just look up this https://developers.facebook.com/docs/howtos/payments/paymentflow/#paydialog

Step 3 - Create Callback

Here is the meat of the callbackhttps://developers.facebook.com/docs/howtos/payments/fulfillment/#jscallback
In the overview you'll see a graph and explanation below it, all you care at this point is what happens on step 8 and after. This is the callback logic. The best thing about it that docs are pretty solid here, also for rather quick rundown on logic video is great too.

So here you have two options (or both): you can confirm purchase via frontend (this is good for notification of payments for the user) and backend and technically you don't need both (technically!), and better one is via real time callback (backend) true graph api since it's more secure and will update in cases where JavaScript might fail (video explains this quite well).

So frontend docs are here: https://developers.facebook.com/docs/howtos/payments/fulfillment/#orderfulfillment
And Real Time docshttps://developers.facebook.com/docs/howtos/payments/fulfillment/#asynchronousconfirmation

Not much else to drop from this.
Have fun.

No comments:

Post a Comment