Microsoft Dynamics CRM 4.0 and Direct Payment Systems – PX Pay

Roshan Mehta, 10 October 2010

Direct Payment Systems (or DPS for short) is an online service which allows you to build custom applications that involve secure credit card transactions. I have had the chance to build custom web forms inside Microsoft Dynamics CRM 4.0 which use two different types of DPS services - PX Pay and PX Post. In this post, I will discuss the use of PX Pay.

Microsoft Dynamics CRM 4.0 and Direct Payment Systems – PX Pay 

PX Pay allows you to send credit card transaction information to the payment gateway using secure HTTPS posts. After filling out details on a custom web form and hitting submit, the user is redirected to a third party (DPS) page in which they can enter their credit card details. Once the transaction is successfully processed, the user is redirected to a custom success page where further processing can take place.

On Page_Load, the form checks for the contents of a query string called “result”. If this string is empty, it means that the user has not yet had any interaction with the custom web form, so no processing takes place.

Microsoft Dynamics CRM 4.0 and Direct Payment Systems – PX Pay 

Once the user has filled out the form and hits submit, we begin to build the request input. We then pass the input object to the web service in order to generate the request. If this request is valid, we redirect the user to the third party PX Pay page where the user can enter their credit card details. If the PX Pay service accepts the credit card details, the transaction is marked as successful and redirects to a custom success page with the information from your main web form stored inside the request query string. On Page_Load, you can retrieve the contents of this query string and use the information to create records inside Dynamics CRM.

The process gets tricky when wanting to use workflow processes to send out e-mail messages if a user wishes to receive a payment confirmation. In this case, I used a custom Credit Card Transaction entity inside Dynamics CRM. When the user hits submit on the custom web form, I create a new Credit Card Transaction record and set its status to “Pending”. A workflow is triggered upon record creation, but is in a waiting state until the status changes to “Paid”. Once the DPS transaction is successful, we can retrieve the ID of this record from the “result” query string, and use it to update the status of the record and process the rest of the workflow activity in order to send out the e-mail message.

Please contact us for more information on integrating Microsoft Dynamics CRM 4.0 with Direct Payment Systems. Alternatively, you can check out the DPS API by visiting www.paymentexpress.com