Skip to content
This repository has been archived by the owner on Jun 2, 2020. It is now read-only.

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

ASP.NET Web Forms Sample Project

The ASP.NET Web Forms sample project demonstrates the simple use case "How to generate the Klarna Checkout"

Run Project

Use IIS server or Visual Studio to run the Solution.

Note: Follow the Microsoft guidelines on building and running the project

The project serves on http://localhost:8080 by default.

Special case

Due to the Web Forms limitations be careful with using Task.Result in the Main thread: https://blogs.msdn.microsoft.com/jpsanders/2017/08/28/asp-net-do-not-use-task-result-in-main-context/

The Klarna .NET Core SDK uses async Tasks by default, so you need to create a new Task in order to avoid deadlocks.

Check the example code in Checkout.aspx.cs

Demo and Results

All the steps in the Checkout.aspx.cs file are covered by comments and logging statements. Check the source code and use your browser to render the HTML Snippet returned by the call to the Klarna Checkout API.

Remember to set $MERCHANT_ID$ and $PASSWORD$ to your account's values
Read more about authentication here.

  • Initial state

    initial state

  • Rendering the checkout

    rendering the checkout

Credits

This project makes use of imagery found on https://www.pexels.com/, licensed under https://www.pexels.com/photo-license/