Overview

The PayPal for FileMaker solution file loads a set of custom functions in FileMaker to make integrating PayPal APIs quick and easy.

The FileMaker PayPal custom functions work like any other function you would use in FileMaker, so all you have to do is load the function, fill in the parameters with dynamic FileMaker data or static values, and the function will handle the rest.

General Setup

Initial Configuration
Before you can begin using the FileMaker PayPal functions you will need to configure the solution file.  This includes:

  • Downloading the PayPal for FileMaker solution file.
  • Installing the Scodigo SmatPill plugin to your FileMaker install directory.
  • Open the solution file and enter PayPal API credentials.

See our PayPal for FileMaker Install and Setup Guide for more details on this if you have not followed that guide already.

Usage Details

FileMaker PayPal Custom Functions
When you open the PayPal for FileMaker solution file custom functions are loaded and are available within the External Functions section of any calculation window.

 

FileMaker PayPal Custom Functions

FileMaker PayPal Custom Functions

As you can see, there are separate functions available for each individual PayPal API.

The sample here focuses on the GetBalance API, which simply pulls your current balance from your PayPal account and has only a few parameters.  Other functions will have many more parameters, however, the procedure is the same for any of the functions you would like to use.

Like any other function in FileMaker, these parameters can be populated from dynamic FileMaker data or with static values.

How to Include Order Items

To send itemized order details in a PayPal request you will need to generate a string of order items to pass into the “order_items” parameter in PayPal functions (ie. DoDirectPayment).

The data that can be passed for an individual item includes:

  • Name
  • Description
  • Price
  • Item ID
  • Quantity
  • Tax Amount
  • eBay Item Number
  • eBay Transaction ID
  • eBay Order ID

If you have more than one item being included on the order this data would be repeated, of course.

The data needs to be passed into the “order_items” parameter of the PayPal function in a specific format in order to be processed correctly.  Assuming you are passing two items, that format would be:

item_1_name|item_1_description|item_1_price|item_1_id|item_1_qty|item_1_tax|item_1_ebay_item_number|
item_1_ebay_trans_id|item_1_ebay_order_id~~~item_2_name|item_2_description|item_2_price|item_2_id|
item_2_qty|item_2_tax|item_2_ebay_item_number|item_2_ebay_trans_id|item_2_ebay_order_id

If you do not need a parameter you can leave it blank, but you still need to include it in the string.  Here is a populated sample:

Test Widget 1|This is the first test widget|5.00|123-ABC|1||||~~~Test Widget 2|
This is the second test widget.|5.00|555-ZZZ|1||||

 

Usage Sample
  • Create a new FileMaker Script to run your PayPal API request.
    • Clear out any data that might be in the global response fields using the ClearGlobalFields script provided by the solution file.
    • Set a FileMaker variable called $PayPalResult which runs the calculation which triggers the FileMaker PayPal function.
    • Set FileMaker variables for any response data you need access to using the global fields that would now be populated with response data from the previous request.
    • Use the FileMaker variables to populate your FileMaker tables accordingly.

FileMaker PayPal Script Sample

FileMaker PayPal Script Sample

Here is a sample of the Set Variable script step which performs a calculation to run the PHPx_AE_PayPal_GetBalance() function.

FileMaker PayPal Custom Functions

FileMaker PayPal Custom Functions

You’ll notice that the API credential values are populated from the configuration data that is covered in our PayPal for FileMaker Install and Setup Guide.

A static value of “USD” was used for the currency_code while the api_subject and related_record_id parameters were left blank.

NOTE:  If you do not need a particular parameter it must be left in place, but you can use double quotes ( “” ) to make it an empty text value.  Empty values will be ignored in the PayPal API request.

When this function is run within a script calculation in FileMaker, the PayPal API request is generated from the data passed in, the communication with PayPal takes place, and the response data back from PayPal is parsed and placed into individual global fields within the PayPal for FileMaker solution file so that you may easily access it for your own needs.

PayPal Response Global Fields
The PayPal for FileMaker solution file includes a layout called AE_PayPal_Global_API_Response that houses all of the data returned from PayPal by any function / API request.

The table/layout includes global fields for every possible response parameter that PayPal might return.  As such, in many cases they will not all be populated.  They are simply available at any time from any FileMaker script or calculation if you need to pull the current value.

Here is example of what the global fields layout would look like after using the AE_PayPal_GetTransactionDetails function.

FileMaker PayPal GetTransactionDetails Response

FileMaker PayPal GetTransactionDetails Response

With the data available in the global fields you may easily place it into your own FileMaker data tables, load it in variables, calculations, scripts, etc.

For more samples you can take a look at our video demonstrations for various PayPal calls from FileMaker.

FileMaker PayPal Script Templates
The PayPal for FileMaker solution file includes script samples / templates that are pre-configured for your reference.  You may browse the scripts from within FileMaker by going to Scripts -> Manage Scripts from the menu bar.

FileMaker PayPal Custom Function Script Templates

FileMaker PayPal Custom Function Script Templates

These scripts include sample data which may need adjustments to work with your own PayPal account, but they are a great reference for the steps you should take to make PayPal API calls from within FileMaker.

Need More Help?

If you are struggling to get going after reading the documentation, feel free to submit a support ticket and we will be happy to help!