Once you have installed the eCommerce PowerPack and set up your PayPal accounts you can start implementing it into your Project. If you have not managed to install and set up the PowerPack please refer to PowerPack for information on how to do this.
To be able to use the eCommerce PowerPack you need to set up your DriveWorks Project using certain DriveWorks Modules and functionality.
The eCommerce PowerPack integrates with DriveWorks using the DriveWorks Live module either through the module itself or IIS.
Using the Web Theme, you can then integrate PayPal into your project seamlessly using the Integration Module
When using the Integration Module a common mistake is adding the Module. You do NOT need to this as the Integration Module is already on all the Project pages as default.
Setting the Project up to be a successful and seamless payment experience can be easily done. One part of that is having a custom Specification Flow in your Project which allows the customer to specify their items before being transferred to the checkout when the Specification is Transitioned to a Paused State.
Once they have completed the transaction they can then be Transitioned back into the Specification using the Integration Module in DriveWorks Live. For good customer experience it is advised that the customer should come back to a new form letting them know that they have completed the purchase. This switching of forms can be handled using a decision in Form Navigation.
On re-entering into the Specification it is a good idea to run the second task Execute Express Checkout Payment. Managing these changes in Transitions and URLs can be done using the Integration Module with a Constant and Specification Macro Tasks. The Constant should be populated with the URL of the next step of the payment.
This is a Flow Diagram that acts as a visual guide to the explanation below.
When a customer has selected their items, and is happy with their order they can use a Macro button on a form which runs a Specification Macro. This Macro is used to set up and then take the user to the PayPal checkout using three Specification Tasks.
The first Task is the Create Express Checkout Payment Task. This will return an Array containing the URL to the PayPal Check out. Using a Drive Constant Value Task you can then drive the URL into a Constant for example DWConstantURL.
The URL Constant is the one that the Integration Module is looking at to populate the Next Page After Complete: property with a URL for where to take the customer when the Specification is moved to a Paused State.
Using another Drive Constant Value Task you can drive the returned Array value for the Payment ID into another Constant for example DWConstantPaymentID. This will be needed later.
The final Task in the sequence is an Invoke Specification Transition which should point at your first Paused State. When this Task is run the Specification will be Transitioned to a Paused State. The Integration Module will then open the URL in the URLConstant transferring you to the PayPal Checkout.
Once the customer has completed the PayPal Checkout process they click continue which will then point them at the return URL which should be a URL that takes them back to your project. To do this the URL has to contain the details for the project and a Transition to get back into the Specification. For more information see the Task or Integration Module Help File articles.
If your rule for the URL contains spaces such as when using DWSpecification the Task won't function. This is because the URL the Task is trying to direct the customer to is invalid.
URLs are not allowed to have spaces in them. By using the URLEncode Function you can make sure your created URL will work every time.
On this re-entry another Specification Macro should run. This contains two Tasks. The first is Execute Express Checkout Payment which uses the Payment ID that was driven into DWConstantPaymentID to confirm the payment.
PayPal will not transfer monies or complete the payment until this Task has been run to authenticate the purchase.
If the Task is successful it will report Approved to the Return Constant. The final Task is another Drive Constant Value which will change the URL in DWConstantURL to take you to the Specification History Page.
This can also be set up using the Integration Module Help File for guidance. The DWConstantURL needs to be changed otherwise the customer would be re-sent to the PayPal Checkout again.
Using the PowerPack Functions and the Payment ID of a transaction you can extract the customers email address and the shipping address. The Email Address function returns an email address but the Shipping Address function returns an Array. For more information on these functions please see the function Help Files.
See Specification Form for more information on how to make your forms reactive in DriveWorks Live.
See Integration Module for more information on how to use the integration module.