VivaPayments / API

Index of Viva Wallet open source projects on GitHub.
139 stars 162 forks source link

Creating an order by Smart Checkout only works from local running server, not from Azure #2353

Closed Kruki closed 1 year ago

Kruki commented 1 year ago

Hi, i am trying to integrate SmartCheckout in our solution. Everything works fine when i launch our program from my local server.

When i create a SmartCheckout using our server hosted on Azure (exactly the same program with the same databate running on it), the following call returns a weird error message:

https://demo-api.vivapayments.com/checkout/v2/orders

The error message: Update order 7452767999537985 failed

When i launch the request from my local server, i receive an URL to the checkout like intended.

So the only difference between sending the request local and from Azure is the IP-Adress the request is sent from. Does this matter in any way? Are certain IPs banned for some reason?

Could there be another reason why i receive this error message?

Kind regards, Tobias

VivaWalletCustomerSupport commented 1 year ago

Hello @Kruki,

Thank you very much for contacting us. Can you please send us the create payment order API request (full code) and the response you are getting. Also, please send us the domain of your website and the IP of your server. Thank you in advance.

Kind regards, Viva Wallet E-commerce Support Team

Kruki commented 1 year ago

Hello, here is the code of the API request:

 public async Task<string> CreateSmartCheckout(VivaWalletCreatePaymentModel model)
        {
            model.SourceCode = vivaWalletSourceCode;
            var res = await _http.PostAsJsonAsync<VivaWalletCreatePaymentModel>("https://demo-api.vivapayments.com/checkout/v2/orders", model);
            if (res.IsSuccessStatusCode)
            {
                var resultString = Regex.Match(await res.Content.ReadAsStringAsync(), @"\d+").Value;
                return resultString;
            } else if (res.StatusCode == System.Net.HttpStatusCode.Unauthorized)
            {
                await Initialize();
                return await CreateSmartCheckout(model);
            }
            else
            {
                _logger.LogError($"{ res.StatusCode} \n {res.ReasonPhrase} \n {await res.Content.ReadAsStringAsync()}");
                throw new Exception($"{res.StatusCode} \n {res.ReasonPhrase} \n {await res.Content.ReadAsStringAsync()}");
            }
        }

The response that i receive looks like the following: Statuscode: 500 (Internal Server Error) Content: { "status": 500, "message": "Update order 8973565728655850 failed", "eventId": "0" }

The request body looks like the this:

{
    "Amount": 4000,
    "Customer": {
        "Email": "tkruk34@gmail.com",
        "FullName": "Tobias Krukenfellner",
        "CountryCode": "AT",
        "RequestLang": "de"
    },
    "PaymentTimeout": 0,
    "Preauth": false,
    "AllowRecurring": false,
    "MaxInstallments": 0,
    "PaymentNotification": false,
    "TipAmount": 0,
    "DisableExactAmount": false,
    "DisableCash": false,
    "DisableWallet": false
}

Our domain: amused-api.azurewebsites.net

Kind regards, Tobias

VivaWalletCustomerSupport commented 1 year ago

Hello @Kruki,

Thank you for the additional information. We kindly advise you to share with us the hosted IPs of the server and the IPs of their application. We will gladly inform you if those IPs are blacklisted or not. Kindly note that the software servers should be in Europe.

Kind regards, Viva Wallet E-commerce Support Team

Kruki commented 1 year ago

Our IP: 51.107.58.162

VivaWalletCustomerSupport commented 1 year ago

Hello @Kruki,

Thank you for the information. We do not detect any restriction on this IP. We would like to suggest that you make an API request using the sample code we offer. If the problem persists, please let us know. If the order code is generated normally, we kindly suggest checking your implementation.

Kind regards, Viva Wallet E-commerce Support Team

VivaWalletCustomerSupport commented 1 year ago

Hello @Kruki,

We just wanted to follow up on the reply we sent. We were simply wondering if you read our response.

In any case this ticket will remain active for at least 24 hours, so that you can come back if you wish.

However, if you have any questions, please don't hesitate to reply here and we'd be happy to help!

Kind regards, Viva Wallet E-commerce Support Team

Kruki commented 1 year ago

Hi, we will set up a new VivaWallet account to try if the problem persists.

I cannot imagine, that the implementation on our side is a problem, because the request works fine when i send it from my local running webserver (which as i already said runs exactly the same code)

We can obviously not use the exact sample code because our webservice is running on .NET and not php.

Kind Regards, Tobias

VivaWalletCustomerSupport commented 1 year ago

Hello @Kruki,

Thank you for your message. Please inform us after the tests you will do. If the error persists, kindly generate a bearer token, and send it to us so we can perform some tests. Thank you in advance.

Kind regards, Viva Wallet E-commerce Support Team

VivaWalletCustomerSupport commented 1 year ago

Hello @Kruki,

We just wanted to follow up on the reply we sent. We were simply wondering if you read our response.

In any case this ticket will remain active for at least 24 hours, so that you can come back if you wish.

However, if you have any questions, please don't hesitate to reply here and we'd be happy to help!

Kind regards, Viva Wallet E-commerce Support Team

VivaWalletCustomerSupport commented 1 year ago

Hello @Kruki,

This ticket will close for now. Please don't hesitate to raise a new ticket if you need further assistance.

Kind regards, Viva Wallet E-commerce Support Team