DEV Community

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

Posted on

1

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

Image of AssemblyAI tool

Transforming Interviews into Publishable Stories with AssemblyAI

Insightview is a modern web application that streamlines the interview workflow for journalists. By leveraging AssemblyAI's LeMUR and Universal-2 technology, it transforms raw interview recordings into structured, actionable content, dramatically reducing the time from recording to publication.

Key Features:
šŸŽ„ Audio/video file upload with real-time preview
šŸ—£ļø Advanced transcription with speaker identification
ā­ Automatic highlight extraction of key moments
āœļø AI-powered article draft generation
šŸ“¤ Export interview's subtitles in VTT format

Read full post

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.

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

šŸ‘‹ Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay