3CX PBX in the Cloud
1 year FREE - no ties!
google cloud platform
3CX
Zero Admin
With the new Dashboard
3CX
Bulletproof Security
With SSL certs and NGINX
3CX
Install on $200 Appliance
Intel MiniPC architecture
3CX
New, Intuitive Windows Client
More themes, more UC
3CX
More CRM Integrations
Scripting Interface to add your own
3CX
Improved Integrated Web Conferencing
iOS and Android apps included
3CX
Run On-Premise or in the Cloud
Google, OVH, Windows & Linux
Fast & easy call management
With the 3CX Web Client

Using the Credit Card component

Using the Credit Card component

On this topic

Using the Credit Card component

Introduction

Step 1: Create the project

Step 2: Add the “Credit Card” component

Step 3: Validate the credit card information using a REST Web Service

Step 4: Check the validation result and inform it to the Credit Card component

Step 5: Build and Deploy to 3CX Phone System

Introduction

Asking for credit card numbers is another very common task in call centers. This includes the number, the expiration date and the security code, and of course it’s a must that the call is not being recorded while the user enters this information. The new Credit Card component available with the 3CX Call Flow Designer comes to solve this, automatically handling retries in case of any problem validating the credit card information.

In this article we’ll explain how to use the new Credit Card” component to ask for the number, the expiration date and the security code, and perform the validation using a web service. We’ll take this opportunity to also show how to use the new Web Service REST” component for the validation.

The project for this application is installed along with the 3CX Call Flow Designer, in folder “Documents3CX Call Flow Designer Demos”.

Step 1: Create the project

First, we need to create a new project. Open the CFD and go to File > New > Project, select the folder where you want to save it, and enter a name for the project. In this case we’ll name it CreditCard.

Step 2: Add the “Credit Card” component

Now we’ll add the Credit Card” component:

  1. Drag a Credit Card” component from the toolbox, and drop it into the design surface of the “Main” callflow. Then select the component added, go to the Properties window and rename it to “requestCreditCard”.

  1. In order to open the configuration dialog for this component, double click or right click on it and select the menu option Configure. You will see the following dialog:

  1. Here we have basically 4 settings:
  • Max Retry Count for Number, Expiration and Security Code: this is the number of times the user will be able to retry entering the credit card number, expiration date and security code after a validation failure.
  • User Input for Credit Card Number: in this section we configure how we’ll be collecting the digits for the credit card number.
  • User Input for Expiration Date: in this section we specify if we want to ask for the expiration date, and we define how we’ll be collecting the digits for the it.
  • User Input for Security Code: in this section we specify if we want to ask for the security code, and we define how we’ll be collecting the digits for the it.
  1. In this demo application, we’ll be asking for the credit card number, the expiration date and the security code. We need to define the prompts to ask for each of these, the prompts to inform that the input is invalid or that no digits were detected. We also need to set the minimum and maximum number of digits to collect for each user input, even though the components are pre-configured with valid values for every type of credit card. However, if you’re only collecting a specific credit card, for example Visa, you might want to restrict some values, like the length of the number or the security code.

Step 3: Validate the credit card information using a REST Web Service

The Credit Card component has two branches: “Valid Input” and “Invalid Input”.

The “Valid Input” branch is executed when the credit card number, expiration date and security code are successfully entered. This means that the user entered at least the minimum number of digits expected, but the validation has not been performed yet, so even if we’re executing the “Valid Input” branch, that doesn’t mean that the information is valid.

The “Invalid Input” branch on the other hand is executed when any of the required fields was not entered by the user. In this case we might want to play a message for example to explain in more detail what the user needs to enter. For this particular demo we’ll leave the “Invalid Input” branch empty, so when the user doesn’t enter a valid credit card number, expiration date or security code, the component automatically retries asking for this information, until the Max Retry Count is met.

Finally, in the “Valid Input” branch we need to perform the validation. We will do this using the new Web Service REST component, which supports different authentication methods out of the box:

  1. Drag a Web Service REST component from the toolbox, and drop it into the “Valid Input” branch. Then select the component added, go to the Properties window and rename it to “validateCreditCard”.

  1. In order to open the configuration dialog for this component, double click or right click on it and select the menu option Configure. You will see the following dialog:

  1. Here we need to configure our Web Service REST component, as follows:
  • URI: this is an expression that returns the web service endpoint. Here we’re using an expression that returns the URL including the credit card number, expiration date and security code in the query string:

CONCATENATE("https://webservice.example.com/validateCreditCard?number=",requestCreditCard.Number,"&expiration=",requestCreditCard.Expiration,"&security_code=",requestCreditCard.SecurityCode)

  • Request Type: the HTTP method used for the validation, in this case we’ll be using GET.
  • Content Type: this field describes what we have in the Content field. It could be JSON, XML, or any other content type we need. In this case we’ll be leaving it blank as we’re not sending any content (this is a GET request).
  • Content: this is an expression to build the actual content. In this demo we’ll be leaving it blank.
  • Finally, we configure Basic Authentication and we set the user name and password from callflow variables.

Step 4: Check the validation result and inform it to the Credit Card component

The Credit Card component has a “Validated” property. We need to set it to true if the validation succeeds in order to stop the iterations. If we don’t do this, the Credit Card component will ask for the credit card number, expiration date and security code again when the “Valid Input” branch ends.

In order to do this, we can use a Create a Condition component. Add it from the toolbox and drop it below the Web Service REST component we added in the previous step. Rename it to “checkValidationResult”, configure the component with 2 branches and name them “validated” and “not_validated”. Set the Condition for the “validated” branch to the following expression to check if the web service returned the number “1” as validation result:

EQUAL(validateCreditCard.ResponseContent,"1")

Then, in the “validated” branch set the variable “requestCreditCard.Validated” to true and transfer the call to the Sales team extension, as the credit card is validated.

On the other hand, in the “not_validated” branch we just play an error message, so the Credit Card component can retry asking for the credit card number, expiration date and security code.

The “Valid Input” branch of the Credit Card component should look like this:

Step 5: Build and Deploy to 3CX Phone System

The project is ready. We just need to build and upload it to our 3CX Phone System server. To do this:

  1. Go to Build > Build All. The CFD will create the file “CreditCard.tcxvoiceapp”.
  2. Go to the 3CX Management Console > Call Queues, create a new queue, configure it with name and extension, check the Voice apps option, and upload the file created by the CFD in the previous step.
  3. Save the changes to the queue. The voice app is ready to use. Make a call to the configured extension to test this app.
Get 3CX Free for 1 Year Today
Download On-Premise Try in the Cloud