Wednesday, September 11, 2013

Step by Step Example to implement FaceBook local currency payments (latest September-2013 changes) with JavaScript SDK in ASP.NET ?

 

Step by Step Example to implement FaceBook local currency payments (latest September-2013 changes) with JavaScript SDK in ASP.NET ?

Dear Friends,

I know you came to this blog because you really frustrated how to implement the chances which introduce by FaceBook in local currency payment changes of September 2013 because you not found any specific example so far with JavaScript SDK and ASP.NET .

So don’t worry actually i was also frustrated with latest changes because whatever i have implemented  before this changes is very easy straight forward and have proper example in Facebook developer forum but for this new changes i did not find any thing which is relevant.

With following example you can achieve Static pricing & Dynamic pricing with same line of code.

So here  is the basic steps which you need to follow to achieve Facebook payment dialog and process payment

1. Create a  new ASPX page i have created page with name “MyProductDetail.aspx” in attached sample

2. On this page add meta tags with and also add run at server property (if you want dynamic pricing) see below snap shot

facebook_Local_currency_payment_Sample_Step_1

3. Now for this page in page load event  (C# code) you need to write following things according to your requirement

in brief i can say on page load event we set all the meta tag at runtime according to query string parameter which will be dynamic . just check below screen.

facebook_Local_currency_payment_Sample_Step_2

4. Now open  the page on which you need to implement payment. Add the payment javascript as shown below to invoke payment dialog. You just need to copy the detail of JavaScript from facebook’s new  pay dialog example

facebook_Local_currency_payment_Sample_Step_3

Now you are good to go to run this.

You can test the product URL with value in facebook debugger

whole code can be download from download code.

I hope this will help you in developing the facebook payment integration.

 

Thanks

Rajat Jaiswal