• Hi, I have been using the woocommerce API for about a year with no problems. For a few days now I have been trying to update the payment methods via API as well, but it seems that something is wrong.

    Basically I’m trying to update the Paypal email, but it doesn’t work. What happens is that the API call responds successfully, but the email field remains blank.

    The strange thing is that if I go to fill in the Paypal email field from the backend, it is obviously updated. But if I then pass him a new email via API, that field is cleared (i.e. emptied).

    This is the code I use (which, I repeat, does not return any errors. In fact the answer is correct, but then if I go to check in the woocommerce backend, this field is empty):

        def aggiornaPagamentoPayPal(idAzienda, emailPayPal):
            toReturn = False
            try:
                client = creaClient(idAzienda)
                daPassare = {
                    "enabled" : True,
                    "settings" : {
                        "email" : {
                            "value" : emailPayPal
                        },
                        "title" : {
                            "value" : "TESTO",
                            "type" : "text",
                            "id" : "title"
                        }
                    }
                }
                print("Dati da passare: " + str(daPassare))
                result = client.put('payment_gateways/paypal', daPassare).json()
                toReturn = not "code" in result
                if not toReturn:
                    print("Errore rilevato: " + str(result))
            except Exception as e:
                print("Errore in aggiornaPagamentoPayPal(): " + str(e))
            print("Aggiornamento PayPal: " + str(toReturn))
            return toReturn
  • The topic ‘Update payment gateway API don’t functionally’ is closed to new replies.