Payment
Payment methods are a critical component of Ecommerce websites, as they complete the bridge between your web shop and a financial institute – a bank, credit card company, or an online wallet such as PayPal.
A payment method uses a piece of software called a checkout handler to interact with your payment provider – e.g. AuthorizeNet, ChargeLogic Connect, DIBS or QuickPay – which then handles transferring payment to the payment acquirer (i.e. your bank).
Setting up payment in Dynamicweb Ecommerce consists of:
- Creating a new payment method
- Selecting and configuring a checkout handler
- Configuring the matching payment provider
In this article, you can read about creating and configuring a new payment method in Dynamicweb on a general level, as well as associated subjects such as how to set up the saved cards functionality.
Additionally, each checkout handler provided by Dynamicweb comes with a dedicated how-to outlining the setup process for that particular provider.
Basic Concepts
In this section, you will learn about:
- Creating and configuring a new payment method
- The checkout handlers you have at your disposal
Creating a payment method
To create a new payment method:
- Go to Management Center > Ecommerce > Orders > Payment
- Click New payment in the toolbar (Figure 3.1)
This opens the payment method window (Figure 3.2).
From here, you must:
- Name the payment method – and optionally provide it with a description and icons
- Select a cart type – none or Checkout Handler (which is used with the current shopping cart). Gateway is only supported for legacy reasons, for those who use the old shopping cart module.
- If relevant, select the Checkout Handler which integrates with the payment provider you want to use
- Fill in any associated parameters, and more, as outlined in the how-to for each checkout handler – read more below.
Payment & Country fees
With the fees tabs you can set a fixed amount or a percentage of the price of an order and add it to the tota. This makes it possible to account for various fees – universal or country-specific – which a payment provider may charge for their service.
With the regular fees tab (Figure 4.1), you can use the green plus-icon on the right to add a new fee to the payment method.
You must:
- Enter a fee amount
- Select a type – fixed amount ($) or percentage (%)
- Set an order price, at which point the fee will trigger – and below which it will not trigger.
With the country fees tab (Figure 4.2), you can create country specific fees.
You must:
- Select one or more countries where the fee is applicable, of the countries created under Countries. If you have added states or regions to a country, you can also set up state- or region specific fees.
- Specify a fee amount and type, as with regular fees, for each of your selected countries/regions.
Please note, that region/state fees override country-fees – and country-fees override the fees created under the fees tab.
This means that you can create region and country-specific fees, yet still have general fees to fall back on.
Calculating fees based on the delivery country
To calculate your shipping/payment fees based on the delivery country, and not the billing country, go to Management Center > Ecommerce > Advanced configuration > General and modify the fee calculation settings (Figure 5.1) to suit your purposes.
An error occurred while attaching module (Dynamicweb.Frontend.Content)
System.Data.SqlClient.SqlException (0x80131904): Invalid column name 'Providers_Keywords'.
Invalid column name 'Providers_Keywords'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at Dynamicweb.Data.Database.CreateDataReader(IDbCommand command, CommandBehavior behavior)
at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, CommandBehavior behavior, Int32 commandTimeout)
at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, Int32 commandTimeout)
at Dynamicweb.Content.Items.Queries.Repository.SelectByParentPageIds(IEnumerable`1 parentIds, Query query, Boolean includeParagraphs, Boolean includeChildItems, Boolean checkPermissions, Boolean includeInheritedItems)
at Dynamicweb.ItemPublisher.Frontend.GetItems()
at Dynamicweb.ItemPublisher.Frontend.List()
at Dynamicweb.ItemPublisher.Frontend.GetContent()
at Dynamicweb.Frontend.Content.GetModuleOutput(Paragraph paragraph, PageView pageview)
ClientConnectionId:92364fef-e49f-4597-9118-ea1e5f845ffe
Error Number:207,State:1,Class:16
System.Data.SqlClient.SqlException (0x80131904): Invalid column name 'Providers_Keywords'. Invalid column name 'Providers_Keywords'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at Dynamicweb.Data.Database.CreateDataReader(IDbCommand command, CommandBehavior behavior) at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, CommandBehavior behavior, Int32 commandTimeout) at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, Int32 commandTimeout) at Dynamicweb.Content.Items.Queries.Repository.SelectByParentPageIds(IEnumerable`1 parentIds, Query query, Boolean includeParagraphs, Boolean includeChildItems, Boolean checkPermissions, Boolean includeInheritedItems) at Dynamicweb.ItemPublisher.Frontend.GetItems() at Dynamicweb.ItemPublisher.Frontend.List() at Dynamicweb.ItemPublisher.Frontend.GetContent() at Dynamicweb.Frontend.Content.GetModuleOutput(Paragraph paragraph, PageView pageview) ClientConnectionId:92364fef-e49f-4597-9118-ea1e5f845ffe Error Number:207,State:1,Class:16
Implementing
In this section you will learn about:
- How to set up the Saved Cards functionality on your solution
Saved Cards
Saved Cards currently only works with Stripe, Charge Logic Connect and Quickpay Payment Window and DIBS Payment Window checkout handlers.
With Saved Cards logged-in customers can store a credit card token at your web shop. This makes it possible for the customer to return to the web shop at a later point, and buy products with the token only – without entering their credit card information.
When the customer enables the Saved cards functionality, the checkout handler makes a real-time request to a secure remote storage server for a credit card token, and stores the token in the database.
When a transaction is submitted, the checkout handler makes another real-time request to the payment provider for the card number, so that it can be submitted directly to the payment processor.
The credit card information is never stored in the Dynamicweb database, but retrieved from the remote storage server, securely transmitted, and then forgotten.
All in all, a safe, easy and user friendly way of making payment easier.
To implement Saved Cards, you must:
- Modify an order step in the shopping cart to allow users to pay with a saved card token.
- Modify your customer center to allow logged-in users to view and cancel their saved cards.
Setting up payment using a saved cart on the Shopping Cart
In order to let the customer choose a stored card to pay with, you need to add a section in the order flow where it’s possible to choose a saved card.
To do so:
- Navigate to the page with the Shopping cart module.
- Open module settings.
- Select the default template InformationSavedCards.html in the Information step, or modify your own information template to to allow users to name and save a credit card token and to contain a radio button list of saved cards.
- Save and close the page.
ChargeLogic Connect checkout handler uses an inline payment window which means that you need to modify the ChargeLogic payment template in the checkout handler settings to allow users to name and save a credit card token during checkout. The default post template Payment_Confirmation.html provides an example.
Setting up saved cards in Customer Center
You need to add a section in the Customer Center where the customer is able to get an overview of their saved cards.
- Navigate to a page with the Customer Center module and open the module settings
- In the Menu texts section, rename “Saved cards” to a name that fits your solution or language. This is the name which will show up in the Customer Center navigation.
In the Templates section of the module settings:
- Insert the Ecom:CustomerCenter.SavedCards tag in the navigation template in order to render the navigation name and link to saved cards list – or select the default template named NavigationSavedCards.html in the Menu layout field.
- In the Saved card list field, select the default SavedCardList.html template. This renders the list of saved cards.
- Save and close the page.
Test your implementation with a test user:
- Login to frontend and create an order with a test card and save the card during the checkout.
- Go to Customer Center and check that the test card is added in the saved card list.
Saved cards from a user perspective
Once set up, a user may save a credit card by following these steps:
- Login with their extranet login.
- Add product(s) to the shopping cart and go to checkout
- During the information step, select a payment method
- Check the “Save used card with name”-checkbox, and provide a name (e.g. “My Mastercard”) – See Figure 12.1
- Enter the credit card information
- Complete the order and, which saves the credit card token in the database.
The credit card will then be available for selection when placing orders:
- Login with their extranet login.
- Add product(s) to the shopping cart and go to checkout
- During the information step, select the saved credit card (Figure 12.2) and check out
- The order is then completed
A user may get an overview of their saved cards from the Customer Center.
They will be able to see the name they gave their saved card, the card type, the last four digits of the credit card, and the payment provider which was used when the card was saved (Figure 12.3).
From the overview, the user can delete a saved credit card, which removes the token from the database. In Messages the user can view errors - if payments with the card fails, e.g. if a card or it's token has expired.