Implementing an automatic address lookup function for the Klarna module

Vote:
 

Our client requested that we would implement the "Klarna Payment Module for EPiServer Commerce" (http://world.episerver.com/Articles/Items/Klarna-Payment-Module-for-EPiServer-Commerce/) in their Commerce solution. But in this module the customers had to enter their own address and it had to match the exact address that is registered at Klarna. We quickly realized that this solution was not very user friendly since several customers had problems with typing in an address that exactly matched the registered address. Especially companies who had several addresses registered at Klarna were having problems, the customer support had to assist several customers.

We decided to look for a solution and found the “get_addresses” method in the Klarna API. The “get_addresses” function is used to fetch the customers address. The address is then presented to the customer on the checkout page and is submitted as the delivery address. It should be noted that Klarna only allows this function to be used for Swedish persons/companies.

We choose to create a new class that would use the “get_addresses” method to get the customers address and submit it to the Klarna module instead of modifying the module. This was done partly because the Klarna module implemented an older version of the Klarna API and partly to minimize the risk of introducing errors in the working module.

The address is then used as the customers purchase address when the purchase is processed through the Klarna Payment Module. There is a great example of how to implement the “get_addresses” method among the Klarna api examples: https://integration.klarna.com/en/api/download-api

The list of addresses that is returned from the “get_addresses” method is then converted to serializable objects and is then accessed by our JavaScript code through a web service and then presented on our check out page in a check box list. The customer can then easily choose between their addresses, if they only have one address it is directly presented as the selected address.

Note that when this method is implemented the parameter for the Klarna payment method "Allow different address:" has to be marked as true to disable the validation of the address. If this flag is marked as true, the EPiServer Commerce system will not verify the customer entered address. It will depend totally on Klarna to verity the address.

Also note that Klarna has a set of rules for the use of this service, which can be found at this address https://integration.klarna.com/en/api/advanced-integration/functions/getaddresses.

The get_addresses function is ONLY allowed to be used for Swedish persons with the following conditions:

  • The function can only be used in the checkout, never with registering customers or on any other page in the shop.
  • The function can be only used if Klarna is the default payment method when the function is used before choosing the payment method.
  • The function has to disappear if the customer chooses another payment method.
  • The button is not allowed to be called get address (hämta adress), but continue (fortsätt) or the address can be picked up automatically when all the numbers have been typed in.

Hope that this can help someone who is having similar issues.

Best regards

Andreas

#65181
Jan 22, 2013 16:57
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.