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
    Feb 06, 2015 @ 11:36
    Tobbe
    0

    Klarna payment provider 3.0 - getting 400-error (bad request)

    Im trying to add Klarna. But Im getting 400-error (bad request). This is how my settings looks like:

    enter image description here

    Im trying to get the klarna iframe with this code:

    Order currentOrder = TC.GetCurrentOrder(1);
    string html = "";
    WebClient webclient = new WebClient();
    webclient.Headers["Referer"] = HttpContext.Current.Request.Url.AbsoluteUri.ToString();
    
    
    try
    {
    // returns http://localhost:62438/base/TC/PaymentCommunication/1/Klarna/f10f4894-59c3-4b84-a18c-04bbee42e8e7/f5120cd0719fd282dbcd822edd83a79f476160d2e5dd896750026462f229dd62.aspx?communicationType=checkout
        html = webclient.DownloadString(currentOrder.Properties.First(x => x.Alias.Equals("teaCommerceCommunicationUrl")).ToString() + "?communicationType=checkout");
    }
    catch (Exception ex)
    {
        @ex.Message
    }
    @Html.Raw(html)
    

    Stacktrace:

        2015-02-06 11:18:31,191 [20] ERROR TeaCommerce.Umbraco.Configuration.Infrastructure.Logging.LoggingProvider - [Thread 8] Klarna(CART-23) - ProcessRequest - Exception: Klarna.Checkout.ConnectorException: BadRequest ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
       at System.Net.HttpWebRequest.GetResponse()
       at Klarna.Checkout.HTTP.BasicHttpTransport.Send(HttpWebRequest request, String payload)
       at Klarna.Checkout.BasicConnector.Handle(HttpMethod method, IResource resource, Dictionary`2 options, List`1 visitedUrl)
       --- End of inner exception stack trace ---
       at Klarna.Checkout.BasicConnector.Handle(HttpMethod method, IResource resource, Dictionary`2 options, List`1 visitedUrl)
       at Klarna.Checkout.BasicConnector.Apply(HttpMethod method, IResource resource, Dictionary`2 options)
       at TeaCommerce.PaymentProviders.Inline.Klarna.ProcessRequest(Order order, HttpRequest request, IDictionary`2 settings)
    Klarna.Checkout.ConnectorException: BadRequest ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
       at System.Net.HttpWebRequest.GetResponse()
       at Klarna.Checkout.HTTP.BasicHttpTransport.Send(HttpWebRequest request, String payload)
       at Klarna.Checkout.BasicConnector.Handle(HttpMethod method, IResource resource, Dictionary`2 options, List`1 visitedUrl)
       --- End of inner exception stack trace ---
       at Klarna.Checkout.BasicConnector.Handle(HttpMethod method, IResource resource, Dictionary`2 options, List`1 visitedUrl)
       at Klarna.Checkout.BasicConnector.Apply(HttpMethod method, IResource resource, Dictionary`2 options)
       at TeaCommerce.PaymentProviders.Inline.Klarna.ProcessRequest(Order order, HttpRequest request, IDictionary`2 settings)
    

    Any help would be greatly appreciated!

  • Tobbe 81 posts 387 karma points c-trib
    Feb 06, 2015 @ 13:19
    Tobbe
    100

    hmm, it seems like the problem was that I'd set the wrong region code on the country (it should be SE not SWE for Sweden)

Please Sign in or register to post replies

Write your reply to:

Draft