360Works Plastic User Guide

The CreditCardProcessor provides easy credit card processing capabilities for FileMaker Pro.

Using the plugin

Consult the "CreditCardProcessor Example.fp7" Filemaker file which contains examples of plugin usage. For additional help troubleshooting the Plastic plugin, consult the 360Works Product Support Wiki.

You must have an active merchant account with a company such as Authorize.net or PayPal Payflow Pro to use this plugin.

Note: Authorize.net test accounts will not work, you must have a full account. Once you have an account, obtain a transaction key in the Account/Security Settings/Transaction Key area on the account.authorize.net website.

Selecting a gateway provider

Before you begin processing charges, you need to tell the plugin what type of gateway account you are using. This is done by calling CCSetGateway and passing in your gateway type. If you skip this step, it is assumed you are using an Authorize.net account.
CCSetGateway("Authorize.net") // for Authorize.net accounts (the default)
CCSetGateway("PayPal") // for Payflow Pro accounts

Running Charges

Once your merchant account is set up correctly, running charges can be done in one quick step. Here is an example of its usage:

CCProcessPayment(
merchantAccount;
transactionKey;
chargeAmount;
cardNumber;
expDate
)
The above method will process a payment transaction for a card, and return the gateway transactionID for the transaction, or the word "ERROR", if the transaction fails for some reason. For additional information about the failure, call CCLastError.

It is important that you store this resulting transactionID, you may need it to VOID the transaction later.

The minimum amount of information needed to process a transaction is:

There are numerous additional optional parameters you can provide such as addresses, email, po number, etc. These are not usually required to process an order, but can be useful for address verification purposes or linking a transaction with a customer or invoice. To supply additional parameters, add them as extra parameters onto the end of your function call in the form 'key=value', like this:
CCProcessPayment(
merchantAccount;
transactionKey;
chargeAmount;
cardNumber;
expDate;
"chargeDescription=" & description;
"cardType=" & cardType;
"verificationCode=" & securityCode
)
Here is a list of the most common valid additional parameters:
authMode
used to process authorization-only transactions. See CCProcessPayment for more information.
firstName
first (given) name of the credit card holder
lastName
last (surname) of the credit card holder
companyName
company name on the credit card
chargeDescription
brief description of the charges
verificationCode
the numeric verification code on the credit card. This is also known as the Card Security Code (CSC), sometimes called Card Verification Value (CVV), Card Verification Value Code (CVVC), Card Verification Code (CVC), or Verification Code (V-Code or V Code)
cardType
the type of credit card being processed (visa, mastercard, etc)
invoiceNumber
an arbitrary invoice number for your records
poNumber
an arbitrary purchase order number for your records
customerId
an arbitrary customer id for your records
address
the billing address street address
unitNumber
the billing unit/apt no.
city
the billing address city
state
the billing address state
zip
the billing address zip
country
the billing address country
phone
the cardholder's phone numer
fax
the cardholder's fax numer
shipFirstName
the shipping recipient's first name
shipLastName
the shipping recipient's last name>
shipAddress
the shipping street address
shipCity
the shipping address city
shipState
the shipping address state
shipZip
the shipping address zip
shipCountry
the shipping address country
shipCompanyName
the shipping recipient's company name
email
the cardholder's email address
currency
currency of the transaction amount (USD, for example)
track1
track1 data from a card reader*.
track2
track2 data from a card reader*.
url
an alternate url to which to send a gateway transaction (particularly useful for Authorize.Net emulators)
user
if you set up one or more additional users on the account, this value is the ID of the user authorized to process transactions (Payflow Pro only)
partner
The ID provided to you by the authorized PayPal Reseller who registered you for the Payflow Pro service. Usually this value is either PayPal or VeriSign.
tender
Set The tender type (method of payment) **.
proxyAddress
The host address of a proxy server. Required to run Payflow Pro transactions via proxy.
proxyPort
The port number of a proxy server. Required to run Payflow Pro transactions via proxy.
proxyLogon
The username for an account used to access a proxy server. Pay
proxyPassword
The password for an account used to access a proxy server.

Void/Refund Parameters: These parameters are only used in the CCVoidPayment and CCRefund functions:

cardNumber
The credit card number being voided (this is optional for CCVoidPayment)
expirationDate
The expiration date of the credit card number being voided, in MM/YY format (this is optional)

Card-present transactions

Before attempting to perform a card-present transaction, make sure your gateway merchant account is configured for processing card-present transactions. Before performing a card-present transaction using the CCProcessPayment function, you must first call the CCSetGateway function, passing in the optional parameter "cardPresent=true". If the CCSetGateway function returns a 1, then you can perform a card-present transaction using the syntax below.

Authorize.net
A card-present transaction should pass in Track 1 or Track 2 data using the additional parameters track1 and track2. Track 1 and Track 2 are parts of the raw string generated when a credit card is passed through a magnetic stripe card reader. See http://www.exeba.com/comm40/creditcardformat.htm for a description of the Track 1 and Track 2 data formats. Note: You do not have to pass in a card number and or an expiration date when performing a card-present transaction; the Authorize.Net gateway will read this information directly from the track data. Make sure you pass in empty quotes ("") for those parameters.

CCProcessPayment(
merchantAccount;
transactionKey;
chargeAmount;
"";
"";
"track1=B4111111111111111^CardUser/John^111110100000019301000000877000000"
)
Payflow Pro
A card-present transaction using Payflow Pro should also pass in Track 1 or Track 2 data using additional parameters. However, you must pass in empty strings for the card number and expiration date.

CCProcessPayment(
merchantAccount;
transactionKey;
chargeAmount;
""; //notice the empty string in place of the cardNumber
""; //notice the empty string in place of the expirationDate
"track2=;4912000033330026=15121011000012345678?"
)

Tender param options (Payflow Pro only)

A = Automated clearinghouse
C = Credit card
D = Pinless debit
E = Electronic check
K = Telecheck
P = PayPal

Voiding previous transactions

To void a transaction, you need the transactionID which was returned by the CCProcessPayment function. Pass this (along with other payment info) to the CCVoidPayment function. See the function documentation for an example of voiding a previous transaction.

Crediting / Refunding previous transactions

To credit a transaction, you need the transactionID which was returned by the CCProcessPayment function. Pass this (along with other payment info) to the CCRefund function. This is similar to the void process, but accepts a dollar amount.

CCRefund(
    settings::merchantAccount ;
    settings::transactionKey ;	// your transaction key or password
    "1321353789" ; // the transactionID being credited
    "1234" ; // the last four digits of the credit card number
    0.02 ; // the amount of the refund
    "expirationDate=" & Date(12, 1, 2010) ; // credit card expiration date
    "firstName=John" ; // card holder first name
    "lastName=Doe" ; // card holder last name
)

Error Handling/Reporting

When something unexpected happens, a plugin function returns a result of "ERROR". This makes it easy to check for errors. If a plugin function returns "ERROR", call the CCLastError function to get a detailed description of what went wrong.

Here is an example of basic error reporting:

Set Variable [ $result = MyPluginFunction("x" ; "y" ; "z") ]
If [ $result = "ERROR" ]
    Show Custom Dialog [ "An error occurred: " & CCLastError ]
End If

Chaining Multiple Functions Together

Since the string "ERROR" evaluates to false when evaluated by FileMaker, and most plugin functions return a 1 when successful, you can chain multiple dependent plugin operations together using the "and" operator. However, in this case the result will be a 1 or a 0, not "ERROR". For example:

// chain multiple calls together
// if any of the functions fail, the calculation will 
// short-circuit with a result of false,
// and none of the subsequent function calls will be evaluated.
Set Variable [ $success = 
    FirstPluginFunction("x") and 
    SecondPluginFunction("y") and 
    ThirdPluginFunction("z") 
]
If [not $success]
    Show Custom Dialog [ "An error occurred: " & CCLastError ]
End If

Note: the above only works for plugin functions which return 1 on success! Check the documentation for each function used in this manner.

Additional Error Checking - Plugin not installed

If a plugin is not installed correctly, calls to a plugin function will return "?". As part of your startup script, you should check for this occurrence and display a warning accordingly that the plugin needs to be installed. Note: when treated as a boolean true/false value, FileMaker will treat ? as true.

Installation

Requirements

FileMaker version 7 or higher.

Java Virtual Machine (JVM) version 1.5 or later. If you are running a JVM earlier than 1.5, you should upgrade. Download a JVM from http://www.java.com/en/download/. If you are not sure what version of Java you have installed, you can do java -version on the command line in Windows or OS X.

Windows, or Mac OS X version 10.4 or higher.

Note to intel Mac users: running this plugin under Rosetta is not supported. Upgrade to FileMaker 8.5 to run our plugin in native Intel mode.

Install Steps for FileMaker Pro

Drag the plugin from the MAC or WIN folder into your FileMaker extensions, and restart FileMaker.

This will also enable the plugin for use with Instant Web Publishing from the FileMaker Pro client software.

If the plugin does not load correctly, double-check that you meet the system requirements.

Install steps for FileMaker Web Publishing Engine / Instant Web Publishing

You do not need to do this step unless you plan on using the plugin with Instant Web Publishing or Custom Web Publishing with FileMaker Server Advanced. You will need an Enterprise License to use this feature.

For installing into the Web Publishing Engine with FileMaker Server or FileMaker Server Advanced, drag the plugin from the MAC or WIN folder into the FileMaker Server/Web Publishing/publishing-engine/wpc/Plugins folder. If there is no Plugins folder inside the wpc folder, then create it manually. Restart FileMaker Web Publishing, and now the plugins should be ready to go.

Note that due to a bug which we and other plugin vendors have reported to FileMaker, web plugins do not work in FileMaker Web Publishing Engine 8.0v4 on Mac OS X. You will need to use a later version, like 9, or an earlier version, like 8.0v3. The Windows FileMaker Server 8.0v4 does not have this bug, and will work correctly.

The easiest way to test whether the plugin is working is to have a calculation which calls the version function of the plugin, and display that on an IWP layout. If it shows "?", then the plugin is not working. If it shows a number, then the plugin has been installed successfully.

Install steps for FileMaker Server 9 or later

You do not need to do this step unless you plan on using the plugin with scheduled script triggering, a new feature in FileMaker Server 9. You will need an Enterprise License to use this feature.

  1. Drag the plugin from the MAC or WIN folder into the FileMaker Server extensions folder. On Mac OS X, this is located at /Library/FileMaker Server/Database Server/Extensions folder. On Windows, this is at C:\Program Files\FileMaker\FileMaker Server\Database Server\Extensions.
  2. In the Server Admin application, restart FileMaker Server by stoppping and starting it.
  3. Go to Configuration -> Database Server->Server Plug-ins and check the box that says 'Enable FileMaker Server to use plug-ins', and then check the 'enabled' box for this plugin. Click the 'save' button and wait a few seconds to make sure that the 'enabled' check box stays checked. If it does not, then there was an error loading the plugin and you should contact us for help troubleshooting. You should now be able to write schedules that trigger scripts which use the plugin.

Auto Update

360Works has created an AutoUpdate helper database which makes setting up Auto Update much easier. This file includes pre-configured plugin files which you can place on your server, and an auto-update script for each of our plugins which you can paste into your own solution.

You can get the AutoUpdate360Works file at fmp7://autoupdate.360works.com/AutoUpdate360Works. Follow the instructions included in the file to either host your own Auto Update server or pull the files from ours.

Uninstalling the plugin

Uninstall the plugin by quitting FileMaker Pro or stopping FileMaker Server and removing the plugin file from your Extensions directory.

Demo mode and Registering the plugin

Plugins will run in demo mode until they are registered. While running in Demo mode, the product will run for 2 hours every time you launch FileMaker / FileMaker Server / FileMaker Web Publishing Engine. The 2 hour time limit will reset every time you relaunch FileMaker. There is no expiration date when Demo mode stops working. There are no feature differences between the Demo version and the licensed version.

Once you have purchased the plugin, you can register it with the license key. Once a valid license key is entered, the product will run for as long as FileMaker is running. After FileMaker starts up with the plugin installed, open FileMaker preferences, click on the Plug-ins tab, select the plugin from the list, and click the Configure button. Enter your license key and company name in this dialog. You will only need to do this once on a given machine. Alternately, you can use the registration function to register the plugin during a startup script.

Note that if you are running the plugin with FileMaker Server / FileMaker Web Publishing Engine, you must use the registration function to register the plugin, since there is no preferences dialog on FileMaker Server to enter the license key and company name.

Feedback

We love to hear your suggestions for improving our products! If you are experiencing problems with this plugin, or have a feature request, or are happy with it, we'd appreciate hearing about it. Send us a message on our website, or email us!

Function Summary

Function Detail

CCGetCardIssuer ( cardNumber )

Returns the card issuer for a given card number. Only works for the following card issuers.

Returns: One of the following: VISA, MASTERCARD, AMEX, DINERS, DISCOVER, JCB. Returns an error if the card number is from another issuer.

CCLastAVS

Returns the gateway's Address Verification System Response for the last payment which was processed with CCProcessPayment. To use this, you must first process a payment. If you call this without processing a payment first, it will return the following error:
You must process a payment with the CCProcessPayment function before calling this function

The code will be one of the following:
A = Address (Street) matches, ZIP does not
B = Address information not provided for AVS check
E = AVS error
G = Non-U.S. Card Issuing Bank
N = No Match on Address (Street) or ZIP
P = AVS not applicable for this transaction
R = Retry – System unavailable or timed out
S = Service not supported by issuer
U = Address information is unavailable
W = 9 digit ZIP matches, Address (Street) does not
X = Address (Street) and 9 digit ZIP match
Y = Address (Street) and 5 digit ZIP match
Z = 5 digit ZIP matches, Address (Street) does not

Note: This feature is currently only implemented for the Authorize.net gateway.


CCLastChargeResult

Returns the gateway's result code for the last operation. This is a numeric response where the code equals a status type. For authorize.net, the codes are:
  1. Approved
  2. Declined
  3. Error
For Payflow Pro, a '0' indicates success; a negative value indicates a failure.


CCLastError

Returns the text of the last CC-related error which occurred. This should be called any time that a plugin function returns "ERROR" to get a user-readable description of the error.

Returns: Error text, or "" if there was no error.

CCLastPaymentAuthCode

Returns the gateway's approval code for the last payment which was processed with CCProcessPayment. You must process a payment before calling this function.

Returns: an approval code

CCLastPaymentTransactionID

Returns the gateway's transaction ID for the last payment which was processed with CCProcessPayment. This number identifies the transaction in the system and can be used to submit a modification of this transaction at a later time, such as voiding or crediting the transaction.

Generally, the CCProcessPayment function returns this value as well. This function is here as a convenience if you're not able to retrieve that value due to chaining multiple functions together.

You must process a payment before calling this function.

Returns: a transaction ID

CCLastRawResponse

This function returns the gateway's raw text response for the most recent transaction.

Returns: The gateway's raw text response for the most recent transaction.

CCLicenseInfo

Returns information about the license used

Returns: the type of license the plugin is registered under

CCProcessAuthorizedPayment ( merchantAccountName ; txKey ; previousTransactionID{; dollarAmount ; key1=value1; key2=value2; ...} )

This function is used to process an authorize-only transaction. See the documentation for the CCProcessPayment function for instructions on how to submit an authorize-only transaction.

The second parameter (txKey) should be your 16-digit Authorize.net transaction key. You can obtain an Authorize.net transactionKey by logging into https://account.authorize.net/ and going to the Account / Settings / Transaction key section.

Payflow Pro only supports passwords, not transaction keys. If you have a Payflow Pro merchant account, simply use your Payflow Pro account password for the second parameter to this function.

In most cases, the fourth parameter (dollarAmount) may be any amount less than or equal to the amount of the transaction identified by the third parameter (previousTransactionID).

To pass in additional parameters, see the documentation and examples at the top of this document.

If successful, this function returns the unique transactionID for the payment (as assigned by the payment gateway). If you wish to void the payment later with the CCVoidPayment function, you will need this number!

Note: if test mode is enabled, a successful Authorize.net transaction will return 123456789. detailed information about the nature of the error).

Parameters:
merchantAccountName - your payment gateway merchant account name
txKey - your payflow Pro merchant account password or Authorize.net transaction key
previousTransactionID - the id of the previously authorized transaction to be processed
dollarAmount - the amount of the transaction
Returns: a verification code or transaction id from the payment gateway service if the order is successful, or "ERROR" if there was a problem (use CCLastError for more

CCProcessPayment ( merchantAccountName ; txKey ; dollarAmount ; cardNumber ; expirationDate {; key1=value1; key2=value2; ...} )

This is the primary function used to process credit card charges. The initial five parameters are required values for every transaction.

The second parameter (txKey) should be your 16-digit Authorize.net transaction key. You can obtain an Authorize.net transactionKey by logging into https://account.authorize.net/ and going to the Account / Settings / Transaction key section.

Payflow Pro only supports passwords, not transaction keys. If you have a Payflow Pro merchant account, simply use your Payflow Pro account password for the second parameter to this function.

To perform an authorize-only transaction without submitting it for settlement, you must pass in an additional parameter named authMode. and set its value to AUTH_ONLY using the following format: 'authMode=AUTH_ONLY'.

To pass in additional parameters, see the documentation and examples at the top of this document.

If successful, this function returns the unique transactionID for the transaction (as assigned by the payment gateway). If you wish to void the transaction with the CCVoidPayment function or submit an authorize-only transaction for settlement with the CCProcessAuthorizedPayment function, you will need this number!

Note: if test mode is enabled, a successful Authorize.net transaction will return 123456789. detailed information about the nature of the error).

Parameters:
merchantAccountName - your payment gateway merchant account name
txKey - your payflow Pro merchant account password or Authorize.net transaction key
dollarAmount - the amount of the transaction
cardNumber - the credit card account number to charge for the transaction
expirationDate - the expiration date of the credit card being charged. Format the expiration date as MMYY or MM/YY or MM/DD/YY
Returns: a verification code from the payment gateway service if the order is successful, or "ERROR" if there was a problem (use CCLastError for more

CCRefund ( merchantAccountName ; txKey ; previousTransactionID ; cardNumber ; amountToCredit {; key1=value1; key2=value2; ...} )

This transaction credits all or part of an original transaction to the customer.

Refund transactions must reference a transaction ID, which identifies the transaction that serves as the source of the refund. Transactions must have been settled before they can be refunded; however, you may void unsettled transactions (see CCVoidPayment). The amount to be refunded must not exceed the total amount of the original transaction, less the total amount of any previous refunds to the same transaction.

To pass in additional parameters, see the documentation and examples at the top of this document.

Parameters:
merchantAccountName - your payment gateway merchant account name
txKey - your Payflow Pro merchant account password or Authorize.net transaction key
previousTransactionID - the transactionId of a previously processed transaction.
cardNumber - the credit card account number to credit for the transaction. For Authorize.net credits, you may either pass the entire card number, or just the last four digits. This value is not required by the Payflow Pro gateway, therefore you may pass an empty string ("").
amountToCredit - the amount to credit, as a positive number. Must be less than or equal to the original transaction amount. If a negative number is passed, the absolute value is used. If using the Payflow Pro gateway, you may enter an empty string ("") for this parameter if you wish to perform a full refund.
Returns: the transactionID from the payment gateway service if the order is successful, or "ERROR" if there was a problem (use CCLastError for more detailed information about the nature of the error).

CCRegister ( licenseKey ; registeredTo )

Registers Plastic.

Parameters:
licenseKey - a valid license key string
registeredTo - the name for the license key used
Returns: 1 on success, "ERROR" on failure

CCSetGateway ( gatewayName { ; cardPresent=true } )

Switch which gateway to use (the default is authorize.net).

The following gateways are supported:

This plugin function takes additional arguments. Currently the only optional argument is whether submitted transactions are to be processed as SWIPE (card-present) transactions. If you are using the plugin for card-present transactions, pass cardPresent=true as an optional parameter. For example:

CCSetGateway("Authorize.net" ; "cardPresent=true");
If you do not specify a value the default is false (card-not-present mode).

Parameters:
gatewayName - one of the supported gateway names.
Returns: 1 if a valid gateway is providded, ERROR otherwise.

CCSetTestMode ( testModeSetting )

Puts the credit card plugin into test mode. Pass in a 1 for test mode or 0 for real mode. When in test mode, all credit card charges will be sent to a special test server that runs the normal verification process, but does not run real charges.

Parameters:
testModeSetting - 1 or 0
Returns: 1 on success, "ERROR" on failure

CCTrackData ( trackData )

Parses track1 or track2 data, returning extracted data as return-separated values. This is convenient if you're swiping card data and want to save the cardholder name to your database, for example. Note: When passing track1 data to the CCProcessPayment function, use the raw swipe data from the card, not this parsed version!

Use the GetValue function in FileMaker to get the following specific values:

  1. Account Code
  2. Cardholder Name with leading & trailing whitespace removed (this will be empty for track2 data)
  3. Expiration Date (YYMM format)
  4. Optional Discretionary Data

Sample Usage

Set Variable[$data = mytable::swipe]
Set Variable[$accountNumber = getValue($data ; 1)]
Set Variable[$cardHolderName = getValue($data ; 2)]
Set Variable[$expirationYYMM = getValue($data ; 3)]
Set Variable[$additionalData = getValue($data ; 4)]

This is primarily for use in card-present transactions. See http://www.exeba.com/comm40/creditcardformat.htm for a description of the track1 and track2 data formats.

Parameters:
trackData - track1 or track2 data from card reader
Returns: return-separated list containing: account code, cardholder name, expiration date (YYMM), optional discretionary data

CCValidateCardNumber ( cardNumber )

Utility function for validating whether a credit card number is valid. This only checks the format of the card number, not whether it is an active account.

This can be very handy for "validated by calculation" fields, to ensure that only valid credit cards are entered.

Parameters:
cardNumber - credit card number, containing numbers and optional dashes
Returns: 1 if the card is valid, 0 if invalid

CCVersion

Returns the version of the credit card plugin which is installed.

Returns: an integer version number.

CCVoidPayment ( merchantAccountName ; txKey ; previousTransactionID{; key1=value1; key2=value2; ...} )

Voids a previously processed payment. The parameters are similar to the CCProcessPayment function, except dollarAmount is replaced with the addition of the previousTransactionID parameter. The previousTransactionID should be the transactionID of the transaction you wish to void. This value is returned by the CCProcessPayment function. Alternately, you can use the CCLastPaymentTransactionID function to get the transactionID of the last processed payment.

To pass in additional parameters, see the documentation and examples at the top of this document.

Here is an example of voiding a previous transaction whose transaction ID is 123:

CCVoidPayment (
    Settings::merchantAccount ;
    Settings::transactionKey ;
    123 ; // the previous transaction key
    "cardNumber=4444444444444441" ;
    "expirationDate=04/08" ;
    "firstName=Bob" ;
    "lastName=Smith"
)
information about the nature of the error).

Parameters:
merchantAccountName - your payment gateway merchant account name
txKey - your Payflow Pro merchant account password or Authorize.net transaction key
previousTransactionID - the transactionId of a previously processed transaction. Note that CVoidPayment will only work on orders that have not settled yet, which means that it will generally only work on payments made that same day. To void settled orders, use CCProcessPayment instead.
Returns: the transactionID from the payment gateway service if the order is successful, or "ERROR" if there was a problem (use CCLastError for more detailed