This example is part of several series that I will be releasing in the near future showing how to use the Sitefinity Ecommerce API. This example shows you how to work within the checkout API to create a custom checkout widget. Please note that these are just examples of which certain features may not exist or function properly. It is not my intention to create sample widgets to use in a production environment, but instead provide you with examples (source code) giving you a better understanding of our API.
One Page Checkout
The one page checkout is a custom checkout widget that can be used in combination with the donation and buy now widgets from my previous posts. Like donations, customizing a checkout process is something many ecommerce applications struggle with. Allowing the visitor to checkout as quickly as possible is ideal. However, if the visitor wants to give a donation or purchase an online gift certificate, you may want the customer to bypass any tax or shipping calculations which are usually found on standard checkout pages. With Sitefinity Ecommerce, you can create many custom checkout pages allowing for specific products (EX: ticket) to use a particular checkout page. This one page checkout consists of the billing/shipping addresses, real-time shipping rates, payment information and cart preview.
To begin, download the project source code from GitHub.com (https://github.com/esitefinity/Sitefinity-Custom-Checkout) and add the project to your existing Visual Studio Sitefinity project. Once the project has been added to Sitefinity, you will need to log into the backend of Sitefinity and create a custom checkout page, dragging-dropping the custom checkout widget onto this page. Edit the properties of the widget, selecting a “receipt page” to link the checkout process then publish this page. This is all you need to do to use this custom checkout widget.
- Real time credit card processing using the first payment method defined
- Uses-real time shipping rates as defined in store settings based on the logged in customer.
- Sends out email to customer
- Creates order in Sitefinity backend
This example is a work in progress and I want to make sure people understand this I have placed this project on GitHub.com so that other developers can contribute to it. Below are some of the current limitations of this widget
- You need to be logged in to checkout. The reason for this is there is a call to get real time shipping rates that needs the ship-to zip code in the user profile.
- Uses the first payment method defined in the payment methods of the Ecommerce store settings.
- The LUHN check does not exist therefore doesn’t check to validate the credit card.
Much of the code for this project exists in the folder called “Helpers”. This includes the file OrderHelper.cs which contains many of methods and calls for this project. The OrderHelper.cs file is a good example showing you some of the calls to the API.
Again, look for updates on GitHub.com for this project as I know others will likely contribute to it.
Much appreciation goes to Venkata Koppaka who helped in creating this example.