private AuthorizeResponse AuthorizePayment(
            AmazonPaySettings settings,
            AmazonPayCheckoutState state,
            Store store,
            ProcessPaymentRequest request,
            Client client,
            bool synchronously,
            out AuthorizeRequest authRequest)
        {
            authRequest = new AuthorizeRequest()
                          .WithMerchantId(settings.SellerId)
                          .WithAmazonOrderReferenceId(state.OrderReferenceId)
                          .WithAuthorizationReferenceId(GetRandomId("Authorize"))
                          .WithCaptureNow(settings.TransactionType == AmazonPayTransactionType.AuthorizeAndCapture)
                          .WithCurrencyCode(ConvertCurrency(store.PrimaryStoreCurrency.CurrencyCode))
                          .WithAmount(request.OrderTotal);

            if (synchronously)
            {
                authRequest = authRequest.WithTransactionTimeout(0);
            }

            // See https://pay.amazon.com/de/developer/documentation/lpwa/201956480
            //{"SandboxSimulation": {"State":"Declined", "ReasonCode":"InvalidPaymentMethod", "PaymentMethodUpdateTimeInMins":5}}
            //{"SandboxSimulation": {"State":"Declined", "ReasonCode":"AmazonRejected"}}
            //if (settings.UseSandbox)
            //{
            //	var authNote = _services.Settings.GetSettingByKey<string>("SmartStore.AmazonPay.SellerAuthorizationNote");
            //  authRequest = authRequest.WithSellerAuthorizationNote(authNote);
            //}

            var authResponse = client.Authorize(authRequest);

            return(authResponse);
        }