My Products
Help
Quan Pham
PARTNER

Problem creating supplier payment

by Quan Pham

Hi,

 

I'm trying to create a supplierpayment with crossrate.

Please see my json below. I can create the payment in Visma without any problems.

QuanPham_0-1687161024644.png

 

When trying to create via the API im getting this error message:

Do you have any suggestions to fix this?

 

{
    "message""Error creating payment. Error: Inserting  'Payment' record raised at least one error. Please review the errors.\r\nThe document is out of the balance.\r\n"
}

 

{
    "branch": {
        "Value": "1"
    },
    "supplier": {
        "Value": "50072"
    },
    "type": {
        "Value": "Payment"
    },
    "paymentRef": {
        "Value": "Nettan reglering"
    },
    "cashAccount": {
        "Value": "1963 "
    },
    "paymentMethod": {
        "Value": "4"
    },
    "paymentAmount": {
        "Value": 32030.27
    },
    "applicationDate": {
        "Value": "2023-06-15T00:00:00.000Z"
    },
    "paymentLines": [{
            "refNbr": {
                "Value": "201945"
            },
            "documentType": {
                "Value": "Invoice"
            },
            "amountPaid": {
                "Value": 32030.27
            },
            "crossRate": {
                "Value": 7.45446484
            },
            "operation": "Insert",
            "cashDiscountTaken": {
                "Value": 0.0
            },
            "withholdingTax": {
                "Value": 0.0
            },
            "applicationDate": {
                "Value": "0001-01-01T00:00:00.000Z"
            },
            "date": {
                "Value": "0001-01-01T00:00:00.000Z"
            },
            "dueDate": {
                "Value": "0001-01-01T00:00:00.000Z"
            },
            "cashDiscountDate": {
                "Value": "0001-01-01T00:00:00.000Z"
            }
        }
    ],
    "appliedAmount": {
        "Value": 0.0
    },
    "financeCharges": {
        "Value": 0.0
    },
    "hold": {
        "Value": false
    },
    "released": {
        "Value": false
    },
    "unappliedBalance": {
        "Value": 0.0
    }
}

 

7 REPLIES 7

by Yıldırım

Hi, this might be related to the CrossRate amount that may cause difference in the total. In the first place, we'd recommend removing the fields with value 0 and dates such as "0001-01-01T00:00:00.000Z"

 

Afterwards, please try manually creating a Supplier Payment for that Invoice via the ERP UI to see what balance/values calculated. 

Supplier payments.jpg

Quan Pham
PARTNER

by Quan Pham (Updated ‎22-06-2023 15:09 by Quan Pham PARTNER )

Hi,

 

I've already tried both the suggestions unfortunately. Please see my screenshot above.

 

 

by Yıldırım

Please try saving the document in the UI. 

Visma Community.jpg

and send us the latest version of the JSON you've tried. 

Quan Pham
PARTNER

by Quan Pham

I tried to save it and it was fine.

 

Please see below for the lateset JSON.

 

{
    "supplier": {
        "Value": "50072"
    },
    "type": {
        "Value": "Payment"
    },
    "paymentRef": {
        "Value": "Nettan reglering"
    },
    "cashAccount": {
        "Value": "1963 "
    },
    "paymentMethod": {
        "Value": "4"
    },
    "paymentAmount": {
        "Value": 32030.27
    },
    "applicationDate": {
        "Value": "2023-06-15T00:00:00.000Z"
    },
    "paymentLines": [{
            "refNbr": {
                "Value": "201945"
            },
            "documentType": {
                "Value": "Invoice"
            },
            "amountPaid": {
                "Value": 32030.27
            },
            "crossRate": {
                "Value": 7.45446484
            }
        }
    ]
}

by Magnus Johnsen

Hi,

You are missing the line operation, the below JSON (modified for use in local company works on our end):

{
    "supplier": {
        "Value": "50072"
    },
    "type": {
        "Value": "Payment"
    },
    "paymentRef": {
        "Value": "Nettan reglering"
    },
    "cashAccount": {
        "Value": "1963 "
    },
    "paymentMethod": {
        "Value": "4"
    },
    "paymentAmount": {
        "Value": 32030.27
    },
    "applicationDate": {
        "Value": "2023-06-15T00:00:00.000Z"
    },
    "paymentLines": [{
            "operation": "Insert",
            "refNbr": {
                "Value": "201945"
            },
            "documentType": {
                "Value": "Invoice"
            },
            "amountPaid": {
                "Value": 32030.27
            },
            "crossRate": {
                "Value": 7.45446484
            }
        }
    ]
}

 

 

Quan Pham
PARTNER

by Quan Pham

Hi, 

 

I've tried with and without operation and it failed for both calls.

The invoice is now closed so i can't try with the same invoice again.

 

I tried with another company and it works, so I guess it was something wrong in that specific company. I'll have to wait and i'll get back to you when i have a new invoice to test.

by Magnus Johnsen

Alright, please do.

Thank you.