Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tobbe 81 posts 387 karma points c-trib
    Jan 07, 2014 @ 13:01
    Tobbe
    0

    Set up Klarna

    Im trying to set up klarna payment provider but I cant get it to work. Im a bit lost on how to do it to be honest.

    Ive created a new provider and filled in merchant.id and sharedSecret. Ive also set paymentFormUrl to a url that points to a node which uses a template that contains this code:

    @using TeaCommerce.Api.Models @using TeaCommerce.Umbraco.Web

    @{ Order currentOrder = TC.GetCurrentOrder( long.Parse( Model._store ) ); WebClient webclient = new WebClient(); webclient.Headers[ "referer" ] = HttpContext.Current.Request.Url.AbsoluteUri; string html = webclient.DownloadString( currentOrder.Properties[ "teaCommerceCommunicationUrl" ]+"?communicationType=checkout" ); }

    @Html.Raw( html )

    When I click the Payment-button in the cart-step I just end up on a blank page (=> @Html.Raw( html ) doesnt return anything). Im probably missing something important heh..

    How should it be set up?

  • Anders Burla 2560 posts 8256 karma points
    Jan 07, 2014 @ 13:24
    Anders Burla
    0

    What is the url for this line of code?
    currentOrder.Properties[ "teaCommerceCommunicationUrl" ]+"?communicationType=checkout"

  • Tobbe 81 posts 387 karma points c-trib
    Jan 07, 2014 @ 13:27
    Tobbe
    0

    If i add @currentOrder.Properties[ "teaCommerceCommunicationUrl" ] in my template it prints this:

    http://mysecretpage/base/TC/PaymentCommunication/1/Klarna/bbfb3c4e-e125-462a-855b-5bca7068b6d2.aspx

  • Anders Burla 2560 posts 8256 karma points
    Jan 07, 2014 @ 14:44
    Anders Burla
    0

    Then try check the log if it says something with "Klarna" after the request is made and the html is empty

  • Tobbe 81 posts 387 karma points c-trib
    Jan 07, 2014 @ 15:07
    Tobbe
    0

    2014-01-07 14:59:24,830 [32] INFO umbraco.BusinessLogic.Log - [Thread 26] Redirected log call (please use Umbraco.Core.Logging.LogHelper instead of umbraco.BusinessLogic.Log) | Type: Error | User: 0 | NodeId: -1 | Comment: Klarna(CART-123) - ProcessRequest - Exception: Klarna.Checkout.ConnectorException: Unauthorized ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() at Klarna.Checkout.HTTP.BasicHttpTransport.Send(HttpWebRequest request, String payload) at Klarna.Checkout.BasicConnector.Handle(HttpMethod method, IResource resource, Dictionary2 options, List1 visitedUrl)
    --- End of inner exception stack trace --- at Klarna.Checkout.BasicConnector.Handle(HttpMethod method, IResource resource, Dictionary2 options, List1 visitedUrl) at Klarna.Checkout.BasicConnector.Apply(HttpMethod method, IResource resource, Dictionary2 options) at TeaCommerce.PaymentProviders.Inline.Klarna.ProcessRequest(Order order, HttpRequest request, IDictionary2 settings)

    Hmm! seems like I get 401-error. Is there something i must set up on Klarnas side?

  • Anders Burla 2560 posts 8256 karma points
    Jan 07, 2014 @ 16:33
    Anders Burla
    0

    You should double check your merchant.id and the sharedSecret.

    Kind regards
    Anders

  • Tobbe 81 posts 387 karma points c-trib
    Jan 08, 2014 @ 10:39
    Tobbe
    101

    Ahhhhhhh! sharedSecret and merchant.id is bound to a domain. I was using another domain for development and was therefore getting 401-error. When testing while developing you have to use Klarnas testing credentials: https://docs.klarna.com/en/testing/testing-credentials (merchant.id: 200, sharedSecret: test).

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies