Difference between revisions of "RealEx"
(added definitions of shared secrets, merchant ID and account name.) |
m |
||
Line 24: | Line 24: | ||
Set Variable [$gateway; Value:CCSetGateway("RealEx") | Set Variable [$gateway; Value:CCSetGateway("RealEx") | ||
+ | |||
+ | '''Returns''': 1 if a valid gateway is provided, "ERROR" on failure. | ||
If running card present charges, you should also set cardPresent to true when setting the gateway. | If running card present charges, you should also set cardPresent to true when setting the gateway. | ||
Line 59: | Line 61: | ||
"orderId=")] | "orderId=")] | ||
</pre> | </pre> | ||
+ | |||
+ | '''Returns''': a verification code from the payment gateway service if the order is successful, or "ERROR" if there was a problem | ||
'''Note''': It is important to store the resulting transaction ID because you may need it later to void the transaction, issue a refund or capture a previously authorized transaction. | '''Note''': It is important to store the resulting transaction ID because you may need it later to void the transaction, issue a refund or capture a previously authorized transaction. | ||
Line 149: | Line 153: | ||
"orderId=")] | "orderId=")] | ||
</pre> | </pre> | ||
+ | |||
+ | '''Returns''': 1 on success, or "ERROR" if there was a problem. | ||
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 transaction ID 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. | 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 transaction ID 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. | ||
Line 154: | Line 160: | ||
Note that CCVoidPayment 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 CCRefund instead. | Note that CCVoidPayment 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 CCRefund instead. | ||
− | See also: | + | See also: CCLastPaymentTransactionID, which 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). |
Optionally, you can also pass in a chargeDescription. | Optionally, you can also pass in a chargeDescription. | ||
Line 173: | Line 179: | ||
"refundPassword="; | "refundPassword="; | ||
"orderId=" </pre> | "orderId=" </pre> | ||
+ | |||
+ | '''Returns''': 1 on success, or "ERROR" if there was a problem. | ||
You can also pass in a chargeDescription and currency as optional parameters. | You can also pass in a chargeDescription and currency as optional parameters. | ||
Line 218: | Line 226: | ||
|} | |} | ||
</center> | </center> | ||
+ | |||
+ | '''Returns''': 1 on success, or "ERROR" if there was a problem. | ||
{{Template:Profiles}} | {{Template:Profiles}} | ||
Line 248: | Line 258: | ||
|"lastName="|| | |"lastName="|| | ||
|} | |} | ||
+ | |||
+ | '''Returns''': 1 on success, or "ERROR" if there was a problem. | ||
After creation, payments can be deleted with '''CCProfileDeletePayment'''. | After creation, payments can be deleted with '''CCProfileDeletePayment'''. | ||
Line 264: | Line 276: | ||
|"sharedSecret=" | |"sharedSecret=" | ||
|} | |} | ||
+ | |||
+ | '''Returns''': 1 on success, or "ERROR" if there was a problem. | ||
=== Running Charges Against Profiles === | === Running Charges Against Profiles === | ||
Line 294: | Line 308: | ||
|} | |} | ||
+ | '''Returns''': a transaction ID from the payment gateway service if the transaction is successful, or "ERROR" if there was a problem | ||
CCProfileProcessPayment and CCProfileRefund accept the following parameters as well: | CCProfileProcessPayment and CCProfileRefund accept the following parameters as well: |
Revision as of 19:28, 4 November 2013
Working with Plug-ins
Plastic 2 is a plug-in for FileMaker Pro and FileMaker Server that processes secure payments within FileMaker.
Requirements
FileMaker 7 or higher, Java Virtual Machine (JVM) 6 or higher, Windows or Mac OS X 10.6. Rosetta on Intel Macs not supported.
Installation
If you unzip the zip archive containing the plug-in files and open the top-level directory, you will find two subdirectories labeled WIN (for Windows) and MAC (for Macintosh). The WIN directory contains two plug-in files, one with a .fmx extension and another with a .fmx64 extension. The file with the .fmx64 extension is only used for FileMaker Server installations, which are explained below. The MAC directory contains a plug-in file with a .fmplugin extension.
To install the plug-in, copy the plug-in from the WIN or MAC folder to one of the directories listed below. Directory paths are listed relative to the parent directory of the installation home directory of the FileMaker application.
FileMaker Pro
FileMaker Pro XX/Extensions
FileMaker Pro XX Advanced/Extensions
FileMaker Server Web Publishing Engine (applies to the entire Web Publishing Engine prior to FileMaker Server 12.0.2 and to Instant Web Publishing only for FileMaker Server 12.0.2 and later)
FileMaker Server/Web Publishing/publishing-engine/wpc/Plugins (create the Plugins folder if it does not exist)
FileMaker Server Custom Web Publishing (applies only to FileMaker Server 12.0.2 and later)
FileMaker Server/Web Publishing/publishing-engine/cwpc/Plugins (create the Plugins folder if it does not exist)
Note: For 64-bit versions of Windows, be sure to use the 360Works plug-in with a .fmx64 extension
FileMaker Server Scripting Engine (applies to FileMaker Server scheduled scripts)
FileMaker Server/Database Server/Extensions
Note: Using the plug-in with the FileMaker Server Web Publishing Engine or the FileMaker Server Scripting Engine requires an Enterprise plug-in license.
Uninstalling the plug-in
Uninstall the plug-in by quitting FileMaker Pro or stopping FileMaker Server and removing the plug-in file from the appropriate Extensions or Plugins directory.
Demo mode and registering the plug-in
Plug-ins will run in a fully featured demo mode until they are registered. While running in demo mode, the plug-in will run for 2 hours at a time. In order to get another two hours of demo time, you must restart FileMaker Pro, FileMaker Server's database server module or FileMaker Server's Web Publishing Engine, depending upon where the plug-in is installed.
To register the plug-in in FileMaker Pro, you may either enter the license information in FileMaker plug-in preferences or by calling CCRegister
inside a script. You must call CCRegister
inside a script in order to register the plug-in for use with FileMaker Server.
Set Variable [ $register; Value: CCRegister ( $licenseKey, $registeredToName) ]
Returns: a 1 on success or a 0 on failure.
Error Handling/Reporting
When something unexpected happens, the plug-in will pop up a dialog showing what the error message is. This makes it easy to see what went wrong. However, in some cases, you (the developer) may prefer to show your own message to the user, or possibly not show a message at all. In that case, you can call CCSetErrorCapture ( true )
. This will suppress the displaying of error dialogs.
Whether or not you suppress the error dialogs, a plugin function will return the word "ERROR" if something goes wrong. It's a good idea to check the result of each plugin function call to determine if an error occurred. If an error occurs, use the CCLastError function to get a detailed message describing the error. For example:
Set Variable [ $result = MyPluginFunction("x" ; "y" ; "z") ] If [ $result = "ERROR" ] Show Custom Dialog [ "An error occurred: " & CCLastError ] End If
If a plug-in is not installed correctly, all plug-in function calls will return "?"
To check if a transaction succeeded
The simplest way to check to see if money has changed hands in a payment processing function call is to check the result of the function itself. This is extremely useful when calling functions such as CCProcessPayment and CCProfileProcessPayment
. The result of the transaction will give a transaction ID or the word ERROR. Using the CCLastError
like in the example above will give further information about the error, such as if there is no network connectivity, or the card was declined.
Set Variable[$result ; CCProcessPayment(...)] If[$result = "ERROR"] #Transaction is unsuccessful. Below is an example of how you might handle the error. Set Field[Transaction::Error Message ; CCLastError] Else #Transaction is successful. Set Field[Transaction::Transaction ID ; $result] End If
More Information
For more information on how to correctly install and work with plug-ins, check out the Plugins 101 documentation.
RealEx
RealEx supports running charges, authorizations and captures, and payment profiles. For detailed examples of each of these transactions, check the demo file included as a download with Plastic 2. These scripts are ready for insertion into your own solution!
Getting an account
You'll need an account using the RealEx Gateway, and use your merchant ID and the account name as the first two parameters for every plug-in function call that performs a transaction. You'll also need the shared secret, provided by RealEx, provided as an additional but required parameter. In the function signature template, you may see the terms merchant account name and transaction key instead of merchant ID and account name. This is due to the fact that Plastic 2 supports many gateways that use different definitions of log-in credentials.
Set Variable [ $result; Value: CCProcessPayment ( merchantID; accountName; "sharedSecret=shh" ...) ]
Setting the Gateway
Before processing any payments, you need to tell Plastic which gateway you are using. This is done by calling CCSetGateway.
Set Variable [$gateway; Value:CCSetGateway("RealEx")
Returns: 1 if a valid gateway is provided, "ERROR" on failure.
If running card present charges, you should also set cardPresent to true when setting the gateway.
Set Variable [$gateway; Value:CCSetGateway("RealEx"; "cardPresent=true")]
Processing Payments
Basic Credit Card Charge
This simple example will run a single charge and requires you to input a card number and expiration date. To prevent this information from being saved in your database and to simplify PCI compliance, jump to the #Payment Profiles section.
Once you properly configure your merchant account, you can quickly and easily process payment transactions. You must provide the following information for a credit card payment transaction:
- merchant ID
- account name
- dollar amount
- credit card number
- credit card expiration date
- shared secret
- order ID
The CCProcessPayment function will process a transaction and return a transaction ID. This function returns a transaction ID if the transaction is successful or the word ERROR if the transaction fails. For detailed information about the most recent transaction failure, call the CCLastError function before calling any other transaction-processing function.
In your script, you would then have a second line after setting the gateway.
Set Variable [$result Value: CCProcessPayment( merchantId; accountName; chargeAmount; cardNumber; expDate; "sharedSecret="; "orderId=")]
Returns: a verification code from the payment gateway service if the order is successful, or "ERROR" if there was a problem
Note: It is important to store the resulting transaction ID because you may need it later to void the transaction, issue a refund or capture a previously authorized transaction.
You may submit optional parameters to most of Plastic's payment-transaction processing functions. These parameters will be submitted to the payment gateway along with the basic transaction information. Although they are not usually required to process an order, these parameters can be useful for tasks such as address verification or linking a transaction to a customer id or an invoice number. To supply additional parameters to a function call, add them to the end of the parameter list after the last required parameter, using a "key=value" syntax.
Set Variable $result Value: CCProcessPayment( merchantId, accountName; chargeAmount; cardNumber; expDate; "sharedSecret="; "orderId="; "chargeDescription=" & Payment::description; "verificationCode=" & $securityCode)
Parameter | Description |
---|---|
verificationCode | the numeric verification code on the credit card. This is also known as Card Security Code (CSC), Card Verification Value (CVV), Card Verification Value Code (CVVC), Card Verification Code (CVC) or Verification Code (V-Code/V Code) |
chargeDescription | brief description of the charges |
customerId | an arbitrary customer ID for your records |
firstName | First (given) name of the credit card holder |
lastName | Last (surname) of the credit card holder |
address | the billing address |
zip | the billing address zip |
country | billing address country |
shipAddress | the shipping street address |
shipZip | the shipping address zip |
shipCountry | the shipping address country |
currency | the type of currency |
card type | the type of card used |
Authorizing and Capturing Payments
Use CCProcessAuthorizedPayment. Normally, you would also pass in a dollarAmount as the final variable, but this is not required in RealEx. Instead, use ""; for the final parameter and add the sharedSecret and orderID.
Set Variable $result Value: CCProcessAuthorizedPayment( merchantId, accountName; previousTransactionId; ""; "sharedSecret="; "orderId=")
Voiding Transactions
Set Variable [$result; Value: CCVoidPayment ( merchantId ; accountName ; previousTransactionID; "sharedSecret="; "orderId=")]
Returns: 1 on success, or "ERROR" if there was a problem.
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 transaction ID 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.
Note that CCVoidPayment 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 CCRefund instead.
See also: CCLastPaymentTransactionID, which 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).
Optionally, you can also pass in a chargeDescription.
Crediting or Refunding Transactions
To credit a transaction, you need the transaction ID returned by CCProcessPayment. Pass this (along with other payment info and the refund password) to the CCRefund function. This is similar to the void process, except it accepts a dollar amount and the credit card number (or the last four digits of the credit card number) used to process the original transaction.
Set Variable [$result; Value: CCRefund( merchantId; accountName; transactionID; cardNumber; dollarAmount; "sharedSecret="; "refundPassword="; "orderId="
Returns: 1 on success, or "ERROR" if there was a problem.
You can also pass in a chargeDescription and currency as optional parameters.
Payment Profiles
Creating Customer Profiles
Profiles save payment and customer data straight to the gateway securely for future use. To create a customer profile, call CCProfileCreateCustomer. After creation, update the customer information with CCProfileUpdateCustomer. Create your own customer ID for use with RealEx and pass it to customerId with creation. After that, use that same ID in the customerProfileId on update.
CCProfileCreateCustomer | CCProfileUpdateCustomer |
merchantId | merchantId |
accountName | accountName |
customerId | ""; |
"sharedSecret=" | customerProfileId |
"orderId=" | "sharedSecret=" |
"orderId=" |
Parameter | |
---|---|
profileDescription | firstName |
lastName | companyName |
phone | |
fax | address |
address2 | city |
zip | country |
countryCode - if you provide a country name, you must also add the ISO country code. |
Returns: 1 on success, or "ERROR" if there was a problem.
When retrieving information about a profile with CCProfileGetCustomer, CCProfileGetShipping, or CCProfileGetPayment, the response will return a list of values marked with a dollar sign, like so:
$billingFirstName="First";$billingLastName="Name";$billingCompany="";
To parse out these values, you can use a combination of the Evaluate and Let functions. After seeing a response from the gateway, note the value you want to parse, such as $billingLastName in the example above. Then you can use the formula:
Evaluate ( "Let([" & Transaction::Response Message& "] ; $billingLastName)")
Which will return the last name of the profile requested.
Creating Payment Profiles
To create a payment, use CCProfileCreatePayment. You can also update the payment method with CCProfileUpdatePayment. Both also accept "cardType=" as an optional parameter.
CCProfileCreatePayment | CCProfileUpdatePayment |
merchantId | merchantId |
accountName | accountName |
customerProfileId | customerProfileId |
cardNumber | paymentProfileId |
expirationDate | cardNumber |
"sharedSecret=" | expirationDate |
"orderId=" | "sharedSecret=" |
"paymentProfileId=" | "firstName=" |
"firstName=" | "lastName=" |
"lastName=" |
Returns: 1 on success, or "ERROR" if there was a problem.
After creation, payments can be deleted with CCProfileDeletePayment.
CCProfileDeletePayment |
merchantId |
accountName |
customerProfileId |
paymentProfileId; |
"sharedSecret=" |
Returns: 1 on success, or "ERROR" if there was a problem.
Running Charges Against Profiles
You can process a payment or refund a payment using this payment profile. Items in bold are required.
CCProfileProcessPayment | CCProfileRefund |
merchantId | merchantId |
accountName | accountName |
customerProfileId | customerProfileId |
paymentProfileId | paymentProfileId |
dollarAmount | previousTransactionId |
sharedSecret=" | amountToCredit |
"orderId=" | ""; |
"sharedSecret=" | |
"orderId=" | |
"refundPassword=" |
Returns: a transaction ID from the payment gateway service if the transaction is successful, or "ERROR" if there was a problem
CCProfileProcessPayment and CCProfileRefund accept the following parameters as well:
Parameter | Description |
---|---|
verificationCode (only payment, not refunds) | currency |
chargeDescription | customerId |
address | zip |
country | shipAddress |
shipZip | shipCountry |
Getting Information
Plastic includes a number of helper functions that allow users to retrieve data from the gateway or Plastic.
To execute any of these functions inside of a script, use a Set Field or Set Variable script step.
- CCGetCardIssuer(cardNumber) - returns the card issuer for a given card number, either: VISA, MASTERCARD, AMEX, DINERS, DISCOVER, JCB. Returns an error if the card number is from another issuer.
- CCGetLast (name) - returns a value from the most recent transaction response that corresponds with the name parameter.
- CCLastAVS- returns the gateway's Address Verification System Response for the last payment which was processed. This response is typically a one letter indicator, meaning the following:
Code | Description | Network |
---|---|---|
A | Street address matches, but 5-digit and 9-digit postal code do not match. | Standard domestic |
B | Street address matches, but postal code not verified. | Standard international |
C | Street address and postal code do not match. | Standard international |
D | Street address and postal code match. Code "M" is equivalent. | Standard international |
E | AVS data is invalid or AVS is not allowed for this card type. | Standard domestic |
G | Non-U.S. issuing bank does not support AVS. | Standard international |
I | Address not verified. | Standard international |
M | Street address and postal code match. Code "D" is equivalent. | Standard international |
N | Street address and postal code do not match. | Standard domestic |
P | Postal code matches, but street address not verified. | Standard international |
R | System unavailable. | Standard domestic |
S | Bank does not support AVS. | Standard domestic |
U | Address information unavailable. Returned if the U.S. bank does not support non-U.S. AVS or if the AVS in a U.S. bank is not functioning properly. | Standard domestic |
W | Street address does not match, but 9-digit postal code matches. | Standard domestic |
X | Street address and 9-digit postal code match. | Standard domestic |
Y | Street address and 5-digit postal code match. | Standard domestic |
Z | Street address does not match, but 5-digit postal code matches. | Standard domestic |
- CCLastCCV- returns the gateway's Card Code Verification Response for the last payment which was processed. This response is typically a one letter indicator, meaning the following:
- M- CVV2/CVC2 Match - Indicates that the card is authentic. Complete the transaction if the authorization request was approved.
- N- CVV2 / CVC2 No Match – May indicate a problem with the card. Contact the cardholder to verify the CVV2 code before completing the transaction, even if the authorization request was approved.
- P- Not Processed - Indicates that the expiration date was not provided with the request, or that the card does not have a valid CVV2 code. If the expiration date was not included with the request, resubmit the request with the expiration date.
- S- Merchant Has Indicated that CVV2 / CVC2 is not present on card - May indicate a problem with the card. Contact the cardholder to verify the CVV2 code before completing the transaction.
- U- Issuer is not certified and/or has not provided visa encryption keys
- CCLastChargeResult - returns the gateway's result code for the last operation.
- CCLastPaymentAuthCode - returns the gateway's approval code for the last payment which was processed with CCProcessPayment.
- CCLastPaymentTransactionID- returns the gateway's transaction ID for the last payment which was processed with CCProcessPayment.
- CCLastRawResponse- returns the gateway's raw text response for the most recent transaction.
- CCValidateCardNumber (cardNumber) determines if a card number is valid. Does not indicate the validity of the card itself, only its number. Returns either a 1 for valid card, or 0 for invalid cards.
- CCLastError - returns the text of the last error triggered by a plugin function.
- CCLicenseInfo - returns information about the license used.
- CCVersion - returns the version of the credit card plugin which is installed.
Getting Help
If you still need help, there are several resources available! FMForums hosts a support forum for 360Works products. Please look through the posts and see if your question has been posted before making a new topic.
Support is also available via email at plugins@360works.com. You can also call us at 770-234-9293. We offer many services in addition to our plug-ins, so let us know if you'd like a little help integrating the plug-in into your solution. Or if you'd be interested in a customized plug-in or development please let us know!