Mitrahsoft
  • SERVICES
    • OUR SERVICES
      • SOFTWARE DEVELOPMENT
      • MOBILE DEVELOPMENT
      • BLOCKCHAIN DEVELOPMENT
      • SOFTWARE TESTING
      • CLOUD & DEVOPS SERVICES
      • PRODUCT DEVELOPMENT
      • OFFSHORE DEVELOPMENT
      • SOCIAL MEDIA MARKETING
      TECHNOLOGIES
      • COLDFUSION DEVELOPMENT
      • REACTJS DEVELOPMENT
      • VUEJS DEVELOPMENT
      • ANGULAR DEVELOPMENT
      • NODEJS DEVELOPMENT
      • PYTHON DEVELOPMENT
      • GOLANG DEVELOPMENT
      • GOLANG CORPORATE TRAINING
      COLDFUSION EXPERTISE
      • MURACMS EXPERTISE
      • COLDFUSION APP MIGRATION
      • COLDFUSION HOSTING & SUPPORT
      • CF LEGACY APP MAINTENANCE
      • COLDFUSION REST API
      • ECOMMERCE / SHOPPING CART SOLUTIONS
      • PRESIDECMS EXPERTISE
      MOBILE DEVELOPMENT
      • REACT NATIVE DEVELOPMENT
      • FLUTTER DEVELOPMENT
      • IONIC DEVELOPMENT
      • PHONEGAP DEVELOPMENT
  • ABOUT US
    • ABOUT MITRAHSOFT
    • OUR CLIENTS
    • TESTIMONIALS
    • PORTFOLIO
    • CAREERS
  • CONTACT US
  • BLOG
Adobe Solution PartnerLucee Solution Partner
Adobe Solution PartnerLucee Solution Partner
Adobe Solution PartnerLucee Solution Partner
  • OUR SERVICESSOFTWARE DEVELOPMENTMOBILE DEVELOPMENTBLOCKCHAIN DEVELOPMENTSOFTWARE TESTINGCLOUD & DEVOPS SERVICESPRODUCT DEVELOPMENTOFFSHORE DEVELOPMENTSOCIAL MEDIA MARKETING
    TECHNOLOGIESCOLDFUSION DEVELOPMENTREACTJS DEVELOPMENTVUEJS DEVELOPMENTANGULAR DEVELOPMENTNODEJS DEVELOPMENTPYTHON DEVELOPMENTGOLANG DEVELOPMENTGOLANG CORPORATE TRAINING
    COLDFUSION EXPERTISEMURACMS EXPERTISECOLDFUSION APP MIGRATIONCOLDFUSION HOSTING & SUPPORTCF LEGACY APP MAINTENANCECOLDFUSION REST API ECOMMERCE / SHOPPING CART SOLUTIONSPRESIDECMS EXPERTISE
    MOBILE DEVELOPMENTREACT NATIVE DEVELOPMENTFLUTTER DEVELOPMENTIONIC DEVELOPMENTPHONEGAP DEVELOPMENT
  • ABOUT MITRAHSOFTOUR CLIENTSTESTIMONIALSPORTFOLIOCAREERS
  • CONTACT US
  • BLOG

Paypal Payflow Pro Payment Processing Using ColdFusion

HomeBlogPaypal Payflow Pro Payment Processing Using ColdFusion
ColdFusionPaypalPayflow-ProPayment-gatewayColdFusion-API-Integration

Paypal Payflow Pro Payment Processing Using ColdFusion

M
Post by MitrahsoftPublished: Dec 27, 2018

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.Payflow Pro Ecommerce

Prerequisites

  1. To use Payflow, we must have Paypal Payflow Gateway Account
  2. After creating a gateway account, know your API credentials, Such as PARTNER, VENDOR, USER, PWD
API_CredentialsDescriptions
USERIf 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.
VENDORYour merchant login ID that you created when you registered for the account.
Limitations: Sixty-four alphanumeric, case-sensitive characters
PARTNERThe 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.
PWDThe password that you defined while registering for the account

EndPoints

  • Live : https://payflowpro.paypal.com
  • Test/Sandbox : https://pilot-payflowpro.paypal.com

Demo

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.

Application.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.

cfml
component output="false" {

	this.name = "paypal payflow API";

	public any function onRequestStart() {
      		APPLICATION.paypalObj = createobject("component","com.paypal").init();
	}
}

COM/paypal.cfc

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)

cfml
component output="false" displayname="Paypal payflow API CFC wrapper"  {

    public function init () {
        VARIABLES.partner 	  = "PayPal";
        VARIABLES.endPointURL = "https://pilot-payflowpro.paypal.com";
        return this;
    }

    public array function createPayment(
        required string     user                    hint = "Paypal payflow account username",
        required string     pwd                     hint = "Paypal payflow account password",
        required string     vendor                  hint = "Paypal payflow account vendorID",
        required numeric    cardType                hint = "Credit card type",
        required numeric    acct                    hint = "Credit card number",
        required numeric    expMonth                hint = "Credit card expire month",
        required numeric    expYear                 hint = "Credit card expire year",
        required numeric    cvv                     hint = "Credit card security number",
        required numeric    amt                     hint = "Transaction amount",
                 string     currency  = "USD"       hint = "Transaction currency format",
                 string     firstName = "mitrah"    hint = "Card holder firstname",
                 string     lastName  = "soft"      hint = "Card holder lastname",
                 string     tender,
                 string     trxtype,
                 string     verbosity
    ) {
        try {
            arguments.partner = variables.partner;
            arguments.expdate = "#arguments.expMonth##arguments.expYear#";
            return apiCall(parameters = arguments);
        } catch(any e) {
            return listToArray("Something went wrong. Please try again later");
        }
    }

    public array function refund(
        required string  user       hint = "Paypal payflow account username",
        required string  pwd        hint = "Paypal payflow account password",
        required string  vendor     hint = "Paypal payflow account vendorID",
        required string  origid     hint = "Approved transactionID",
        required numeric amt        hint = "Refund amount",
        required string  tender,
                 string  trxtype
    ) {
        try {
            arguments.partner = variables.partner;
            return apiCall(parameters = arguments);
        } catch(any e) {
            return listToArray("Something went wrong. Please try again later");
        }
    }

    public array function recurringBilling(
        required string user         hint = "Paypal payflow account username",
        required string pwd          hint = "Paypal payflow account password",
        required string vendorID     hint = "Paypal payflow account vendorID",    
        required string acct         hint = "Credit card number",
        required string payperiod    hint = "Specifies Payment Occurs",
        required string action       hint = "Add, Modify, Cancel, Reactivate, Inquiry",
        required string expMonth     hint = "Credit card expire month",
        required string expYear      hint = "Credit card expire year",
        required string amt          hint = "Transaction amount",
        required string tender       hint = "Tender type",
                 string trxtype      hint = "Recurring profile request",
                 string profilename  hint = "User specified name",
                 string start        hint = "Recurring billing start date",
                 string term         hint = "Number of payments to be made over the life of the agreement",
                 string comment1     hint = "Payment comments"
    ) {
        try {
            arguments.partner = variables.partner;
            return apiCall(parameters = arguments);
        } catch(any e) {
            return listToArray("Something went wrong. Please try again later");
        }
    }

    public array function apiCall( struct parameters ) {
        var httpService = new http(url = VARIABLES.endPointURL, method = "POST");
        var encodeLists = "user,pwd,vendor,amt,billtofirstname,billtolastname";
        for (keys in parameters ) {
            if( listFindNoCase(encodeLists, keys )) {
                httpService.addParam( type = "formfield", name = keys, value = arguments.parameters[keys], encoded = false );
            } else {
                httpService.addParam( type = "formfield", name = keys, value = arguments.parameters[keys] );
            }
        };
        return listToArray(httpService.send().getPrefix().fileContent, "&" );
    }
}

Create sale transaction

A sale transaction charges the specified amount against the account and marks the transaction for immediate fund transfer during the next settlement period.Paypal Payflow Ecommerce

Parameters Used in Sale Transaction

ArgumentsDescription
TENDER

The method of payment. Values are :

  • C = Credit card
  • P = PayPal
TRXTYPE

Indicates the type of transaction to perform. Values are:

  • S = Sale transaction
  • C = Credit
  • A = Authorization
  • V = Void
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

AMTAmount (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

FIRSTNAMEAccount holder's first name.
LASTNAMEAccount holder's last name.

Sale transaction sample Request

cfml
<cfscript>
createCharge = APPLICATION.paypalObj.createPayment(
	user      = "your account username",
	pwd       = "your account password",
	vendor    = "your account vendorID",
	cardType  = 0,
	acct      = "4111111111111111",
	expMonth  = "09",
	expYear   = "2020",
	cvv       = "123",
	amt       = "1",
	currency  = "USD",
	firstName = "mitrah",
	lastName  = "soft",
	tender    = "C",
	trxtype   = "S",
	verbosity = "HIGH"
);
writeDump( createCharge );
</cfscript>

Sale transaction sample response

Explanation for few notable parts of the PayPal response is,

  • RESULT=0 - If a transaction is successful then, we will receive 0 value for RESULT.
  • PNREF=A80A0BEF6290 - This is the transaction ID, we can use this to cancel / refund transactions.

Payflow Create Payment Response

Refund Transaction

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.Payflow Refund

Refund sample Request

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.

cfml
<cfscript>
refund = APPLICATION.paypalObj.refund(
	user = "our account username",
	pwd = "our account password",
	vendor = "your account vendorID",
	origid = "transaction ID",
	amt = "1",
	tender = "C",
	trxtype = "C"
);

writeDump( refund );
abort;

</cfscript>

Refund sample responsePayflow Refund Response

Create Subscription transaction

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.Payflow Recurring Img

Parameters to Create a New Recurring Transaction

ArgumentsDescriptions
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:

  • C = credit card
  • P = PayPal
PROFILENAME

A unique name for referencing the recurring payments profile.

Character length and limitations: 127 alphanumeric characters.

EXPDATECredit 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:

  • DAY: Every Day
  • WEEK: Weekly - Every week on the same day of the week as the first payment.
  • YEAR: Yearly - Every 12 months on the same date as the first paymen
CURRENCY

One of the following three-character currency codes:

  • USD
  • EUR
  • GBP
  • CAD
  • JPY
  • AUD
cfml
<cfscript>
createRecurringBill = APPLICATION.paypalObj.recurringBilling(
	user = "your account username",
	pwd = "your account password",
	vendorID = "your account vendorID",
	acct = "4111111111111111",
	amt = "1",
	expMonth = "09",
	expYear = "2030",
	term = "12",
	start = "06252025",
	payperiod = "DAYS",
	trxtype = "R",
	tender = "C",
	action = "A",
	profilename = "RegularSubscription",
	comment1 = "My recurring payment"
);
writeDump( createRecurringBill );
</cfscript>

Recurring transaction sample responsePayflow Recurring Response

Tags

ADYENAMAZON-SESANDROIDAPACHEAPACHE-JMETERAWSBARCODE-SCANNERCOLDBOXCOLDFUSIONCOLDFUSION-API-INTEGRATIONCOLDFUSIONBUILDERECHARTSEVENT-GATEWAYFFMPEGFW1JQUERYJSOUPLUCEEMURACMSMURACMS-THEMENODEJSONESIGNALOSSPAYFLOW-PROPAYMENT-GATEWAYPAYPALPRESIDECMSPUPPETEERRAILORAZUNAREACTJSREACTNATIVERESTSASS-COMPILATIONSEMANTIC-UISUBLIMETEXTTINYMCETWILIOYUI-LIBRARY

Archives

JAN 20DEC 19AUG 19JUL 19JUN 19MAY 19APR 19MAR 19FEB 19JAN 19DEC 18NOV 18OCT 18MAR 16NOV 15SEP 15MAY 15MAY 14OCT 13JUN 13MAY 13APR 13MAR 13FEB 13JAN 13

Follow us

Mitrahsoft
United StatesUnited States

Hurst, Texas, United States

+1 (817) 606-8684usa-sales@mitrahsoft.com

IndiaIndia

Head Office

126G2/5, Thiru malai nagaram,
Kovilpatti - 628 501

Madurai

1/B, 2nd & 3rd floor, GV Complex,

Bye Pass Road, SS Colony,

Madurai - 625 016

Coimbatore

2nd Floor, Sri Narmadha Towers,

Murugan Nagar Rd, Thoppampatti Pirivu,

 K. Vadamadurai, Coimbatore - 641 017

+91 9092480924

business@mitrahsoft.com

ColdFusion
  • eCommerce / Shopping Cart Solutions
  • Payment Gateway Integrations
  • Shipping API Integrations
  • ColdFusion Development Services
  • REST API Development
  • MuraCMS Plugin Creation & Personalization
Technology Services
  • ReactJS Development
  • VueJS Development
  • AngularJS Development
  • NodeJS API Development
  • Python Development
  • Golang Development
  • React Native Development
  • D3.JS data Visualization
Other Services
  • Software Development
  • Mobile Development
  • Blockchain Development
  • Cloud & Devops Services

Connect with MitrahSoft

Please fill out this field
Please fill out this field
Please fill out this field
Please fill out this field
Please fill out this field
Please fill out this field

© 2026 All Rights Reserved. MitrahSoft Solutions Pvt Ltd

Home|About Us|Careers