Make your first plugin - Facebook Payments

  • 20 favourites



7,450 visits, 19,264 views



This tutorial hasn't been translated.


This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.


Conditions are done now. Let's move onto Actions. Find line 73. You will do the same as before remove the listed parameter and action. So remove the following lines:

    AddStringParam("Message", "Enter a string to alert.");
    AddAction(0, af_none, "Alert", "My category", "Alert {0}", "Description for my action!", "MyAction");

Now replace it with the following:

    AddStringParam("Quantity", "The amount of this item the user is looking to purchase - typically used when implementing a virtual currency purchase." ,'""');
    AddStringParam("Quantity_min", "The minimum quantity of the item the user is able to purchase. This parameter is important when handling price jumping to maximize the efficiency of the transaction." ,'"1"');
    AddStringParam("Quantity_max", "The maximum quantity of the item the user is able to purchase. This parameter is important when handling price jumping to maximize the efficiency of the transaction." ,'"10"');
    AddStringParam("Request ID", "The developer defined unique identifier for this transaction, which becomes attached to the payment within the Graph API." ,'""');
    AddStringParam("Pricepoint ID", "Used to shortcut a mobile payer directly to the mobile purchase flow at a given price point." ,'""');
    AddStringParam("Test Currency", "This parameter can be used during debugging and testing your implementation to force the dialog to use a specific currency rather than the current user's preferred currency." ,'"USD"');
    AddStringParam("Url", "The URL of your og:product object that the user is looking to purchase." ,'""');
    AddAction(0, af_none, "Pay Dialog", "Payments", "Invoke Pay dialog for {6}", "The Pay Dialog will show the user the item they're going to buy, its price, and various methods of payment available to the user.", "Paydialog");

Seems like a lot, but it's just two types of lines. First you find the AddStringParam lines. Each of these represents a choice to be made by the plugin user. They should be self descriptive so read through each, just know the first pair of "" is the item that the user will select visibly. The second pair of "" is a description, and the last pair of "" is the default selection. I have kept these all to strings for simplicity in our tutorial, but you could choose any number of parameters. Examples can be found in the lines 31 through 43 of our file.

The next item is the action that uses all the above parameters. Let's break it down:


0, -- The 0 is the numerical index for the action. This must be unique or it will generate an error.

"Pay Dialog", -- How it appears when selecting which action to use.

"Payments", -- The category our action fits into.

"Invoke Pay dialog for {6}", -- This is how it is displayed in the event sheet. The {6} is special as well. What that means is that parameter number 6 above is listed in the event wizard. It's zero based, so the top parameter is 0 and the bottom parameter is 6.

"The Pay Dial..." -- This is the description of our action.

"Paydialog"); -- The invisible name for our action. We will be referencing this in a future file, so remember it.


  • Order by
Want to leave a comment? Login or Register an account!