Forem

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

Posted on

3

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

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (2)

Collapse
 
dailysandbox profile image
Art

It is refreshing seeing the word "ColdFusion" again!!

Collapse
 
gamesover profile image
James Moberg

Thanks.

There are a few dedicated CFML groups on Slack, Facebook, and the Adobe Forums, but many CF developers who previously maintained independent blogs have either vanished or ceased posting in the last 5 to 10 years. :(

I've gained a lot from various blogs during my time as a developer, and now I'm paying it forward with this effort.

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay