Integrate PayPal links into your AppGini application

This tutorial will show you how to place paypal links into a table view generated by AppGini. Let's say that we have a table listing items for sale, like this one below.

We'll make some simple modifications so that it becomes like this:

Prepare the links

First of all, you need to log into your PayPal account, and prepare the payment links for your products. This tutorial would work fine with single item buy links, add-to-cart links, and subscription (regular payment) links. PayPal provides special HTML code for the link. Using a text editor, copy that code into an empty html file and give it a clear name (for example, "blue-doll.html"). Create a similar file for each payment link.

To avoid clutter, I'd recommend that you create a folder inside your AppGini application folder. This folder can have a name like "paypal" for example. We'll save all the html files containing the PayPal payment links into that folder.

Modify the table view template

The next step is modifying the generated "templates/tablename_templateTV.html" (where tablename is the name of the table where you want to place the links). Open that file in a text editor. Find the line containing the placeholder for the field that you want to replace with the PayPal button (corresponding to the "buy" field in the example screenshots above). The code, as generated by AppGini, should be similar to this:


Change it to:

<iframe src="paypal/<%%VALUE(buy)%%>" frameborder="0" width="160" height="80"></iframe>

Remember to change "buy" above to the actual field name. You might also want to adjust the width and height values in the above code if the PayPal button doesn't display correctly.

Now, just add items to your table and enjoy!

By now you're ready to go! To add a new product/item to your table, go to PayPal to generate a button for it, create the button html file into the "paypal" folder as explained above, and add a new record to your table to define the new item. Don't forget to provide the file name of the button html file in the "buy" field (or the corresponding field in your table) as shown in the following screenshot: