to get a personalized navigation.
to get a personalized navigation.
Hi
I'm trying to create a payment of type credit memo in Visma using this endpoint in the API:
api/v1/customerPayment/
My body:
{
"referenceNumber": {"Value":"103446"},
"type":{"Value":"CreditNote"},
"applicationDate":{"Value":"2024-02-11T00:00:00"},
"paymentRef":null,
"customer":{"Value":"10003"},
"paymentAmount":{"Value":225.0},
"paymentLines":[{
"operation":"Insert",
"documentType":{ "Value":"Invoice"},
"refNbr":{"Value":"103445"},
"amountPaid":{"Value":225.0}
}]}
But I'm having this error response:
{"message":"VismaId: 35795f9d-7de5-47ec-ac62-c472309c7b32. Error creating payment. Cannot create a Payment of type 'CreditNote' or 'VoidPayment'"}
It's possible to create the same payment in the UI.
Am I missing something?
I see, then you need to change the type to Payment and documentType to creditNote.
Can you try to send it like this:
{
"referenceNumber": {"Value":"103446"},
"type":{"Value":"Payment"},
"applicationDate":{"Value":"2024-02-11T00:00:00"},
"paymentRef":null,
"customer":{"Value":"10003"},
"paymentAmount":{"Value":225.0},
"paymentLines":[{
"operation":"Insert",
"documentType":{ "Value":"CreditNote"},
"refNbr":{"Value":"103445"},
"amountPaid":{"Value":225.0}
}]}
This is the result that I was expecting in Visma:
The reference number is the credit note number. And the invoice is referenced in one line of the payment.
The type of the payment is CreditMemo.
Not sure why I'm not able to do that using the API.
Okey, I think I understand the scenario now. You will need to create it via the customerCreditNote endpoint, and then use that creditNote as a customerPayment against a customerInvoice.
{
"applicationDate": {
"value": "2024-01-25"
},
"applicationPeriod": {
"value": "202401"
},
"cashAccount": {
"value": "1930"
},
"customer": {
"value": "10015"
},
"currency": {
"value": "NOK"
},
"invoiceText": {
"value": "GRRRRRR"
},
"paymentAmount": {
"value": 1600
},
"paymentLines": [
{
"documentType": {
"value": "CreditNote"
},
"operation": "Insert",
"refNbr": {
"value": "000147"
}
},
{
"documentType": {
"value": "Invoice"
},
"operation": "Insert",
"refNbr": {
"value": "000148"
}
}
],
"paymentMethod": {
"value": "1"
},
"paymentRef": {
"value": "3416651"
},
"referenceNumber": {
"value": "28220162"
},
"type": {
"value": "payment"
}
}
I have tested this at my test-company and it works! 🙂👍
Thank you for taking the time to help me.
But the type of the payment needs to be set as CreditNote (in the UI is CreditMemo). The only row should be the invoice matched against the credit note. This is the way our customer does in Visma but for some reason in the API is not possible.
I need to have the same result using the API. Please don't mind the amounts cause is just an example.
But when I try to send the type as credit note I got the message:
"Error creating payment. Cannot create a Payment of type 'CreditNote' or 'VoidPayment'"}"
But in the swagger we have that option:
Could it be a bug in the API?
I'm trying to create a payment for the credit note, and not the credit note itself
Copyright © 2022 Visma.com. All rights reserved.