O'Reilly logo

Facebook Application Development with Graph API Cookbook by Apeksha Singh, Shashwat Srivastava

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating Facebook Credits frontend using JavaScript SDK

We can make Facebook Credits frontend by directly using the JavaScript SDK. In this recipe, we will use the Facebook Pay Dialog box to handle credits and call it through Facebook's JavaScript SDK.

Getting ready

You should have created index.php, as mentioned in the Getting ready section given at the beginning of Chapter 5.

How to do it...

The following steps will demonstrate how to create a Facebook Credits frontend:

  1. Open index.php and add the following highlighted code inside the div fb-root, as shown:
    <div id="fb-root">
      PURCHASE FROM THE LIST GIVEN BELOW <br /><br />
      <br />
      <ol>
        <li><a href="#" id="bdaygift">Rose</a></li>
        <li><a href="#" id="teddybear">Teddy Bear</a></li>
      </ol>
    </div>
  2. Next, add ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required