SetPaymentProvider throws error

Hi,

When I load the checkout, the following error is thrown from SetPaymentProvider:

2022-02-24 11:19:41.5304 [App:01] [90fb8f5a34eba9b52f0409015c59c5e8] [INFO ] [.NET ThreadPool Worker] System.Net.Http.HttpClient.Default.LogicalHandler - Start processing HTTP request POST https://customer-direct-payment.localtest.me:10011/api/payments/6432241f-5e27-48cb-b11b-9b9c664c67de/initialize 
2022-02-24 11:19:41.5304 [App:01] [90fb8f5a34eba9b52f0409015c59c5e8] [TRACE] [.NET ThreadPool Worker] System.Net.Http.HttpClient.Default.LogicalHandler - Request Headers:
User-Agent: Litium, (Client=directpayment), (8.2.1)
Authorization: Bearer xx
Content-Type: application/json; charset=utf-8
 
2022-02-24 11:19:41.5304 [App:01] [90fb8f5a34eba9b52f0409015c59c5e8] [INFO ] [.NET ThreadPool Worker] System.Net.Http.HttpClient.Default.ClientHandler - Sending HTTP request POST https://customer-direct-payment.localtest.me:10011/api/payments/6432241f-5e27-48cb-b11b-9b9c664c67de/initialize 
2022-02-24 11:19:41.5304 [App:01] [90fb8f5a34eba9b52f0409015c59c5e8] [TRACE] [.NET ThreadPool Worker] System.Net.Http.HttpClient.Default.ClientHandler - Request Headers:
User-Agent: Litium, (Client=directpayment), (8.2.1)
Authorization: Bearer xx
Content-Type: application/json; charset=utf-8
 
2022-02-24 11:19:41.6214 [App:01] [90fb8f5a34eba9b52f0409015c59c5e8] [INFO ] [] System.Net.Http.HttpClient.Default.ClientHandler - Received HTTP response headers after 90.8085ms - 200 
2022-02-24 11:19:41.6214 [App:01] [90fb8f5a34eba9b52f0409015c59c5e8] [TRACE] [] System.Net.Http.HttpClient.Default.ClientHandler - Response Headers:
Cache-Control: no-store, no-cache
Server: Microsoft-IIS/10.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: *
X-Robots-Tag: noindex, nofollow
Date: Thu, 24 Feb 2022 10:19:41 GMT
Content-Length: 11909
Content-Type: text/html
 
2022-02-24 11:19:41.6214 [App:01] [90fb8f5a34eba9b52f0409015c59c5e8] [INFO ] [] System.Net.Http.HttpClient.Default.LogicalHandler - End processing HTTP request after 91.1564ms - 200 
2022-02-24 11:19:41.6214 [App:01] [90fb8f5a34eba9b52f0409015c59c5e8] [TRACE] [] System.Net.Http.HttpClient.Default.LogicalHandler - Response Headers:
Cache-Control: no-store, no-cache
Server: Microsoft-IIS/10.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: *
X-Robots-Tag: noindex, nofollow
Date: Thu, 24 Feb 2022 10:19:41 GMT
Content-Length: 11909
Content-Type: text/html
 
2022-02-24 11:19:41.6214 [App:01] [90fb8f5a34eba9b52f0409015c59c5e8] [TRACE] [] Newtonsoft.Json.JsonSerializer - Unexpected character encountered while parsing value: <. Path '', line 0, position 0. Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
2022-02-24 11:19:41.8700 [App:01] [90fb8f5a34eba9b52f0409015c59c5e8] [ERROR] [.NET ThreadPool Worker] Litium.Accelerator.Mvc.Controllers.Api.CheckoutController - Error when changing payment method to DirectPayment:DirectPay Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at Litium.Application.Runtime.ApplicationJsonConverterImpl.TryConvert[T](String json, Func`2 action)
   at Litium.Application.Runtime.ApplicationJsonConverterImpl.ConvertJsonToObject[T](String jsonString)
   at Litium.Connect.Application.Payments.PaymentProviderClient.SendAsJsonAsync[T](HttpClient httpClient, HttpMethod httpMethod, Uri uri, Object payload, CancellationToken cancellationToken)
   at Litium.Connect.Application.Payments.PaymentProviderClient.InitializeOrUpdateSessionAsync(Payment payment, CancellationToken cancellationToken)
   at Litium.Connect.Application.Payments.PaymentServiceBase.InitializePaymentAsync(Guid paymentSystemId, CartContextSession cartContext, InitializePaymentArgs args)
   at Litium.Application.Sales.Checkout.CheckoutServiceImpl.BuildPaymentFlowResults(CartContextSession cartContext)
   at Litium.Application.Sales.Checkout.CheckoutServiceImpl.InitializePaymentsAsync(CartContextSession cartContext, InitializePaymentsArgs args)
   at Litium.Application.Sales.Checkout.CheckoutServiceImpl.AddPaymentAsync(ProviderOptionIdentifier paymentOptionId, CartContextSession cartContext, AddPaymentArgs args)
   at Litium.Application.Sales.Checkout.CheckoutServiceImpl.AddPaymentAsync(ProviderOptionIdentifier paymentOptionId, CartContextSession cartContext, AddPaymentArgs args)
   at Litium.Application.Sales.CartContextSessionServiceImpl.SelectPaymentOptionAsync(Guid systemId, SelectPaymentOptionArgs args)
   at Litium.Application.Sales.CartContextSessionServiceImpl.SelectPaymentOptionAsync(Guid systemId, SelectPaymentOptionArgs args)
   at Litium.Application.Sales.CartContextImpl.SelectPaymentOptionAsync(SelectPaymentOptionArgs args, CancellationToken cancellationToken)
   at Litium.Accelerator.Mvc.Controllers.Api.CheckoutController.SetPaymentProvider(CheckoutViewModel model) in C:\xx\Src\Litium.Accelerator.Mvc\Controllers\Api\CheckoutController.cs:line 165

docker-compose.yaml:

version: '3'
services:
  dnsresolver:
    image: cytopia/bind
    container_name: dnsresolver
    ports:
    - "53:53/tcp"
    - "53:53/udp"
    environment: 
    - WILDCARD_DNS=localtest.me=host.docker.internal
    - DNS_FORWARDER=192.168.65.5
    dns: 192.168.65.5
    restart: unless-stopped
  direct-payment:
    image: registry.litium.cloud/apps/direct-payment:latest
    dns: 
    - 192.168.65.2
    restart: unless-stopped
    ports:
    - "10010:80"
    - "10011:443"
    environment:
    # Enable HTTPS binding
    - ASPNETCORE_URLS=https://+;http://+
    - ASPNETCORE_HTTPS_PORT=10011
    # Configuration for HTTPS inside the container, exported dotnet dev-certs with corresponding password
    - ASPNETCORE_Kestrel__Certificates__Default__Password=xx
    - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/localhost.pfx
    # Folder for the configuraiton, this is volume-mapped
    - CONFIG_PATH=/app_config
    # Folder where logfiles should be placed, this is volume-mapped
    - APP_LOG_PATH=/logs
    # Don't validate certificates
    - AppConfiguration__ValidateCertificate=false
    # Url to this app
    - AppMetadata__AppUrl=https://customer-direct-payment.localtest.me:10011
    # Url to the litium installation
    - LitiumApi__ApiUrl=https://customer.localtest.me
    volumes:
    - ./data/direct-payment/config:/app_config
    - ./data/direct-payment/data:/app_data
    - ./data/direct-payment/logs:/logs
    - ./data/direct-payment/DataProtection-Keys:/root/.aspnet/DataProtection-Keys
    - ./data/https:/https:ro
  direct-shipment:
    image: registry.litium.cloud/apps/direct-shipment:latest
    dns: 
    - 192.168.65.2
    restart: unless-stopped
    ports:
    - "10020:80"
    - "10021:443"
    environment:
    # Enable HTTPS binding
    - ASPNETCORE_URLS=https://+;http://+
    - ASPNETCORE_HTTPS_PORT=10021
    # Configuration for HTTPS inside the container, exported dotnet dev-certs with corresponding password
    - ASPNETCORE_Kestrel__Certificates__Default__Password=xx
    - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/localhost.pfx
    # Folder for the configuraiton, this is volume-mapped
    - CONFIG_PATH=/app_config
    # Folder where logfiles should be placed, this is volume-mapped
    - APP_LOG_PATH=/logs
    # Don't validate certificates
    - AppConfiguration__ValidateCertificate=false
    # Url to this app
    - AppMetadata__AppUrl=https://customer-direct-shipment.localtest.me:10021
    # Url to the litium installation
    - LitiumApi__ApiUrl=https://customer.localtest.me
    volumes:
    - ./data/direct-shipment/config:/app_config
    - ./data/direct-shipment/data:/app_data
    - ./data/direct-shipment/logs:/logs
    - ./data/direct-shipment/DataProtection-Keys:/root/.aspnet/DataProtection-Keys
    - ./data/https:/https:ro

direct payment config:

{
  "DirectPay": {
    "PaymentAccounts": [
      {
        "Id": "DirectPay",
        "MerchantAccountId": null,
        "Environment": "Test"
      }
    ]
  }
}

Not really sure what to do here…

Direct payment version: 1.1.2
Litium version: 8.2.1

I tried to post to the same url that is specified in the logs, and I receive the backoffice html code as a response?

I have the same problem, if i set up payment/shipment on my computer, another developer have to reinstall the apps for there checkout to work.

We are using a shared database.

So everytime a developer has to do development on the checkout, they have to reinstall the apps.

Have not found a way around this yet.

That worked, thank you.

Weird behaviour… :smiley:

If you using a shared database, maybe to setup an shared version of the payment/shipment apps for that customer also? Then all developers can use the same database without the need to reinstall for their computer.

When using a shared database, also the redis for communication between the developers computer can be needed for everything to work correctly.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.