Payflow Pro is one of the secure, open payment gateway from PayPal. Using Payflow Pro, we can able to do create Authorization and do sales transaction, Refund transaction and Void transaction.Payflow pro Payment Gateway handles all major credit and debit cards. Payflow is integrated with major shopping carts and works with almost every processor.
API_Credentials | Descriptions |
---|---|
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. If, however, you have not set up additional users on the account, USER has the same value as VENDOR. |
VENDOR | Your merchant login ID that you created when you registered for the account. Limitations: Sixty-four alphanumeric, case-sensitive characters |
PARTNER | The ID provided to you by the authorized PayPal Reseller who registered you for the Payflow SDK. If you purchased your account directly from PayPal, use PayPal. |
PWD | The password that you defined while registering for the account |
In this post, we will explain, how we can able to create a sale transaction, Recurring sale transaction and Refund transaction using ColdFusion. First create a folder called as 'Payflow' in your webroot. Inside of the folder, create following files Application.cfc, index.cfm and com/payapl.cfc.
In this file, we created a singleton PayPal object in OnRequestStart function to access the PayPal component's methods. We created object in Application scope to access to access to any files of this application.
This ColdFusion component has all neccessary functions for create transaction, create recurring transaction and refund transaction. We prefer to use modern cfscript
syntax instead of tag based syntax. For demonstrated purpose, we have just hardcoded PARTNER
& endPointURL
values in init() function. But we could pass these as arguments too. In each function, we provided proper hints
attributes, that will explain each arguments purpose as well as, it will be useful to create documentation of your ColdFusion components using DocBox ( another excellent open source project from Ortus solutions to create documentation from source code of ColdFusion components)
A sale transaction charges the specified amount against the account and marks the transaction for immediate fund transfer during the next settlement period.
Arguments | Description |
---|---|
TENDER | The method of payment. Values are :
|
TRXTYPE | Indicates the type of transaction to perform. Values are:
|
ACCT | Credit card or purchase card number. For the Pinless debit TENDER type, ACCT can be the bank account number. Limitations: This value may not contain spaces, non-numeric characters, or dashes. For example, ACCT=5555555555554444 |
EXPDATE | Expiration date of the credit card. Limitations: mmyy format. For example, 1008 represents November 2008 |
AMT | Amount (Default: U.S. based currency). |
CVV2 | A code that is printed (not imprinted) on the back of a credit card. Used as partial assurance that the card is in the buyer's possession. Limitations: 3 or 4 digits |
FIRSTNAME | Account holder's first name. |
LASTNAME | Account holder's last name. |
Explanation for few notable parts of the PayPal response is,
RESULT
.You can only refund a transaction that has not been settled. You need to include the original transaction ID obtained from the transaction's response. Using this endpoint, we can able to Refund the amount to your customer/client.
PayPal support both partial & full refunds. If we pass amount
to PayPal api endpoint, it will considered as partial refund & only that particular amount will be refunded. If we omit amount
parameter, then whole transaction amount will be refunded. For example, In the above sale transaction we are transfered $1 amount. If we would like to refun only $0.5 amount, then we need to pass the amount like $0.5 in the corresponding field. If we didn't pass the amount arguments means, the payflow automatically refund the whole $1.
Recurring Payments allows you to bill a buyer's credit card or PayPal account for a fixed amount of money on a fixed schedule. PayPal offers Payflow recurring payments with the Direct Payments (credit card processing) solutions.
Arguments | Descriptions |
---|---|
TRXTYPE | The transaction type R for recurring payments profile request. Character length and limitations: One alpha character. |
ACTION | The value A for creating a new recurring payments profile. Character length and limitations: One alpha character. |
TENDER | The tender type. Is one of the following values:
|
PROFILENAME | A unique name for referencing the recurring payments profile. Character length and limitations: 127 alphanumeric characters. |
EXPDATE | Credit card expiration date. Character length and limitations: Four numeric characters in the format MMYY. |
START | Beginning date for the recurring payments cycle used to calculate when payments should be made. Use tomorrow’s date or a date in the future. Character length and limitations: Eight numeric characters in the format MMDDYYYY. |
TERM | The total number of regular payment periods over the life of the agreement. If there are 36 monthly payments, for example, TERM is 36. Character length and limitations: Numeric. A value of 0 means that payments should continue until the profile is deactivated (suspended). |
PAYPERIOD | How often the regular payment occurs. On the PayPal website, PAYPERIOD is called payment cycle. Values are:
|
CURRENCY | One of the following three-character currency codes:
|