My Products
Help
kimsandrehav
CONTRIBUTOR *

Problem adding PaymentLinesUpdateDto to CustomerPayment to connect it to an invoice

by kimsandrehav (Updated ‎17-05-2021 15:49 by Yıldırım VISMA )

Hi,

 

I want to update a customer payment of type Refund to connect it to a credit note invoice.

 

I can do this using the Web UI. Under Betalningsrader (paymentlines) click the + and fill in the Type to Kreditfaktura (Creditnote) and Fakturanr (invoicenr). After that it automatically fetches the amount from the specified invoice and shows other information from the invoice on that paymentline. It also updates the payment's head on "Matchat/faktura" and "Tillgängligt belopp". After this the payment balances and I can unpark it and release it.

 

Before the information about the credit note is fetched:

visma.net.jpg

 

After information about the credit note is fetched and populated into the paymentline:

visma.net2.jpg

I want to be able to do the same by using the endpoint: 

 

PUT /controller/api/v1/customerPayment/{paymentNumber}

 

I've tried many combinations of the posted body, for example:

 

{

    "type": {

        "value": "Refund"

    },

    "paymentRef": {

       "value": "0000000070"

    },

    "paymentLines": [

        {

            "cashDiscountTaken": {

                "value": 0.0000

            },

            "operation": {

                "value": "Insert"

            },

            "documentType": {

                "value": "CreditNote"

            },

            "refNbr": {

                "value": "100036"

            },

            "amountPaid": {

                "value": 6125.0000

            }

        }

    ]

}

 

I receive 204 No Content back, but the payment line wasn't added to the customer payment.

 

What to do to be able to add a payement line for a credit note to a customer payment (type: Refund) so the customer payment balances and can be released?

 

Hope someone can please help me out.

4 REPLIES 4
Accepted solution
Magnus Johnsen
VISMA

by Magnus Johnsen

Hi,

Sorry for the delay.

We are able to post the payment on our end:

 

Created payment of type refund in UI(Only customer set):

2021-06-16 16_00_48-Customer payments - Brave.png

 

Json sent to CustomerPayment:

 {
       "type": {
    "value": "Refund"
  },
    "paymentAmount": {
    "value": 12500
  },
     "paymentLines": [
    {
      "operation": "Insert",
      "documentType": {
        "value": "CreditNote"
      },
      "refNbr": {
        "value": "000059"
      },
      "amountPaid": {
        "value": 12500
      }
    }
  ]}
 
Result after posting:
2021-06-16 16_01_17-Customer payments - Brave.png
 
As you cannot save the payment when the document is out of balance, please try to include it on the document level as well.
 
kimsandrehav
CONTRIBUTOR *

Thanks, it works now! We accidently sent "operation": "Insert" as "operation": { "value": "Insert" }

Easy oversight, I did not notice that you had written the field that way either.

Glad that it works. 

by Magnus Johnsen

Hi,

We are looking in to this and will get back to you. 

I can't see any issues with your JSON straight away.