DEV Community

Cover image for ColdFusion PayPal REST API CFC
James Moberg
James Moberg

Posted on

ColdFusion PayPal REST API CFC

PayPal's NVP/SOAP API for Website Payments Pro accounts suddenly stopped working sometime around October 4th (possibly Sep 30). Some developers that reported having the issue were using legacy classic ASP and others were using ColdFusion. I believe we've been using the PayPal DoDirectPayment API since it was introduced back in 2002.

At some point, PayPal added the following undated disclaimer to their documentation. (According to Microsoft Copilot, "PayPal's NVP (Name-Value Pair) API was marked as "legacy" around October 12th, 2021".)

Important: PayPal isn't accepting new users for this feature, and we require existing users to upgrade to our Advanced Debit and Credit solution that supports EMV 3DS (3DS 2.0) for PSD2. Our Advanced Debit and Credit solution enables highly customizable custom-card fields and reduced PCI Compliance requirements. For more information, see Set up advanced credit and debit card payments.

CFPayment (retired) supports WPP & Payflow, but not the new REST API method. Searching online for "ColdFusion (or cfml) paypal rest api" didn't return anything beneficial, so it became apparent that there was a need for a solution... any solution.

For our client's needs (Level 1; B2C), we were only required to perform a simple credit card transaction. This is a basic CFC that provides that functionality of the PayPal NVP/SOAP endpoint. Please note that there are many other resources available for the PayPal REST APIs, but this CFC only supports minimal features available in the Create Order and Confirm the Order endpoints.

Source Code

https://github.com/JamoCA/cfml-paypal-rest-api

GitHub logo JamoCA / cfml-paypal-rest-api

ColdFusion/CFML CFC for transacting a credit card using PayPal REST API with Advanced Credit and Debit Card Payments

cfml-paypal-rest-api

ColdFusion/CFML CFC for transacting a credit card using PayPal REST API with Advanced Credit and Debit Card Payments.

Important: You'll need a PayPal Business account to do the following:

  • Go live with integrations.
  • Test integrations outside the US.

Here's how to get your client ID and client secret:

  • Select Log in to Dashboard and log in or sign up.
  • Select Apps & Credentials.
  • New accounts come with a Default Application in the REST API apps section. To create a new project, select Create App.
  • View app details and enable "Advanced Credit and Debit Card Payments"
  • Copy the client ID and client secret for your app.
  • Using "Live mode" requires approval from PayPal, but you can test using the sandbox.

1. Initialize the CFC

payPalApi = new PaypalRestAPI(
    clientId = "[PayPal API ClientID]"
    clientSecret = "[PayPal API Secret]",
    descriptor =
Enter fullscreen mode Exit fullscreen mode

Top comments (0)