My Products
Help
kashyap
PARTNER

How to know any type of orders are paid or not? How to complete order via API?

by kashyap

We are integrating new APIs in our integrations.

 

1. We are fetching orders using API https://integration.visma.net/API/controller/api/v2/salesorder?pageNumber=0&pageSize=1000&orderType=SO&status=Open

 

Here  I would like to take only those sales orders which are not paid and open. There is no way to know sales order or any type of order are paid via API.

 

2. Later want to register the payment for above sales order or any type of order using API  https://integration.visma.net/API/controller/api/v1/customerPayment

Below is the sample body request

 

{
    "referenceNumber": {
        "value": "DUELL-119141-78-789554"
    },
    "type": {
        "value": "Payment" 
    },
    "hold": {
        "value": false
    },
    "applicationDate": {
        "value": "2024-08-27T00:00:00"
    },
    "paymentRef": {
        "value": "text paymenbt refff"
    },
    "customer": {
        "value": "10137"
    },
    "location": {
        "value": "Main"
    },
    "paymentMethod": {
        "value": "1"
    },
    "cashAccount": {
        "value": "1910"
    },
    "currency": {
        "value": "NOK"
    },
    "paymentAmount": {
        "value": "148.3500"
    },
    "invoiceText": {
        "value": "invoice text ccc"
    },
    "ordersToApply": [
        {
            "operation": "Insert",
            "orderType": {
                "value": "SO"
            },
            "orderNumber": {
                "value": "00000040000072"
            },
            "appliedToOrder": {
                "value": "148.3500"
            }
        }
    ]
}

 


After payment register, we are trying release the payment using API https://integration.visma.net/API/controller/api/v1/customerPayment/400004/action/release

 

{
  "type": {
    "value": "Payment"
  }
}

 



I am able to see payment details in UI but not in API. How can I see the payment details or know how order paid?

Also the status of the order not getting completed. How can I complete order using API?

8 REPLIES 8
kashyap
PARTNER

by kashyap

We need to know below things to start working

  1. How we can know order(sales or invoice) is open?
  2. How we can complete or change the status of order (sales or invoice)? So it will not come again in list of remaining payment orders.
  3. How we can know order(sales or invoice) have not received any payment? So we can know its partial paid or full paid.


Marten Voort
VISMA

by Marten Voort

Hi! A salesorder first needs to be shipped or at least invoiced to be able to be paid, without outstanding invoice a payment to an order would be more like a prepayment.

 

So to answer your questions:

1. It is best to check for the field Status. Bear in mind an order is completed when all lines are completely shipped and invoiced. This does not tell you anything about the payments. 

2. The completion of salesorders is not so much a technical action, but more a logistical action. The order needs to be shipped and invoiced.

3. You are unable to see if the payments are done, for this information you need to see the invoices, but you have to do more requests for that.

 

It seems your questions are related to the business process of the company, I suggest you take this up with a consulting partner of your Visma.net client to make sure the salesorder implementation is properly configured. 

kashyap
PARTNER

by kashyap

Regarding invoices, How can I register the payment for invoice? Is there any API like voucher or register payment?
Any fields available to check invoice paid or partial paid or not paid?

Marten Voort
VISMA

by Marten Voort

Yes, sure, if you POST or PUT a customerpayment, under paymentlines, you wil find the fields to insert an invoice and the amount to be paid for this invoice. 

 

Under the Customerinvoice endpoint you see the field Status, that tells you among other statusses that the invoice is open or closed, and field Balance shows what is still to be paid. Does this help you?

kashyap
PARTNER

by kashyap

I have customer invoice

 

[
  {
    "creditTerms": {
      "id": "14",
      "description": "14 dager netto"
    },
    "documentDueDate": "2024-09-12T00:00:00",
    "cashDiscountDate": "2024-08-29T00:00:00",
    "exchangeRate": 1.00000000,
    "attachments": [],
    "taxDetails": [
      {
        "taxId": "3",
        "vatRate": 25.000000,
        "taxableAmount": 1440.0000,
        "vatAmount": 360.0000
      }
    ],
    "invoiceLines": [
      {
        "lineType": "GN",
        "lineNumber": 1,
        "inventoryNumber": "0014spicychicken",
        "description": "Spicy Chicken",
        "quantity": 10.000000,
        "unitPrice": 64.000000,
        "unitPriceInCurrency": 64.000000,
        "manualAmount": 640.000000,
        "manualAmountInCurrency": 640.000000,
        "amount": 640.0000,
        "cost": 0.0000,
        "amountInCurrency": 640.0000,
        "account": {
          "type": "Income",
          "number": "3000",
          "description": "Salgsinntekter, avg.pliktig høy sats"
        },
        "vatCode": {
          "id": "3",
          "description": "Utgående mva, høy sats"
        },
        "uom": "STK",
        "discountPercent": 0.000000,
        "discountAmount": 0.0000,
        "discountAmountInCurrency": 0.0000,
        "manualDiscount": false,
        "subaccount": {
          "subaccountNumber": "00A1000",
          "subaccountId": 1,
          "description": "None",
          "lastModifiedDateTime": "2020-01-29T13:02:18.967",
          "active": true,
          "segments": [
            {
              "segmentId": 1,
              "segmentDescription": "Avdeling",
              "segmentValue": "0",
              "segmentValueDescription": "(Default)"
            },
            {
              "segmentId": 2,
              "segmentDescription": "Project",
              "segmentValue": "0",
              "segmentValueDescription": "p1"
            },
            {
              "segmentId": 3,
              "segmentDescription": "Dynamic",
              "segmentValue": "A1000",
              "segmentValueDescription": "A1"
            }
          ]
        },
        "deferralSchedule": 0,
        "branchNumber": {
          "number": "1",
          "name": "Panteon AS"
        }
      },
      {
        "lineType": "GN",
        "lineNumber": 2,
        "inventoryNumber": "005deluxeveggie",
        "description": "Deluxe Veggie",
        "quantity": 10.000000,
        "unitPrice": 80.000000,
        "unitPriceInCurrency": 80.000000,
        "manualAmount": 800.000000,
        "manualAmountInCurrency": 800.000000,
        "amount": 800.0000,
        "cost": 0.0000,
        "amountInCurrency": 800.0000,
        "account": {
          "type": "Income",
          "number": "3000",
          "description": "Salgsinntekter, avg.pliktig høy sats"
        },
        "vatCode": {
          "id": "3",
          "description": "Utgående mva, høy sats"
        },
        "uom": "STK",
        "discountPercent": 0.000000,
        "discountAmount": 0.0000,
        "discountAmountInCurrency": 0.0000,
        "manualDiscount": false,
        "subaccount": {
          "subaccountNumber": "00A1000",
          "subaccountId": 1,
          "description": "None",
          "lastModifiedDateTime": "2020-01-29T13:02:18.967",
          "active": true,
          "segments": [
            {
              "segmentId": 1,
              "segmentDescription": "Avdeling",
              "segmentValue": "0",
              "segmentValueDescription": "(Default)"
            },
            {
              "segmentId": 2,
              "segmentDescription": "Project",
              "segmentValue": "0",
              "segmentValueDescription": "p1"
            },
            {
              "segmentId": 3,
              "segmentDescription": "Dynamic",
              "segmentValue": "A1000",
              "segmentValueDescription": "A1"
            }
          ]
        },
        "deferralSchedule": 0,
        "branchNumber": {
          "number": "1",
          "name": "Panteon AS"
        }
      }
    ],
    "sendToAutoInvoice": false,
    "roundingDiff": 0.0000,
    "customerVatZone": {
      "id": "01",
      "description": "Salg innenlands, avgiftspliktig"
    },
    "childRecord": {},
    "directDebitMandate": {},
    "hold": false,
    "discountTotal": 0.0000,
    "discountTotalInCurrency": 0.0000,
    "detailTotal": 1440.0000,
    "detailTotalInCurrency": 1440.0000,
    "vatTaxableTotal": 1440.0000,
    "vatTaxableTotalInCurrency": 1440.0000,
    "vatExemptTotal": 0.0000,
    "vatExemptTotalInCurrency": 0.0000,
    "paymentReference": "100140000348",
    "invoiceAddress": {
      "addressId": 10,
      "addressLine1": "Langmyrveien 197",
      "postalCode": "0874",
      "city": "OSLO",
      "country": {
        "id": "NO",
        "name": "NORGE"
      },
      "county": {
        "id": "0301",
        "name": "OSLO"
      },
      "overrideAddress": false
    },
    "invoiceContact": {
      "contactId": 10,
      "businessName": "kashyap",
      "email": "kashyap@gmail.com",
      "phone1": "99999999",
      "overrideContact": false
    },
    "applications": [],
    "dontPrint": false,
    "dontEmail": true,
    "revoked": false,
    "customer": {
      "number": "10014",
      "name": "kashyap"
    },
    "documentType": "Invoice",
    "referenceNumber": "000034",
    "postPeriod": "082024",
    "financialPeriod": "202408",
    "documentDate": "2024-08-29T00:00:00",
    "origInvoiceDate": "2024-08-29T00:00:00",
    "status": "Balanced",
    "currencyId": "NOK",
    "amount": 1800.0000,
    "amountInCurrency": 1800.0000,
    "balance": 1800.0000,
    "balanceInCurrency": 1800.0000,
    "cashDiscount": 0.0000,
    "cashDiscountInCurrency": 0.0000,
    "paymentMethod": {
      "id": "1",
      "description": "Innlandsbetalinger"
    },
    "lastModifiedDateTime": "2024-08-29T08:50:00.313",
    "createdDateTime": "2024-08-29T08:50:00.313",
    "note": "",
    "vatTotal": 360.0000,
    "vatTotalInCurrency": 360.0000,
    "location": {
      "countryId": "NO",
      "id": "Main",
      "name": "Primary location"
    },
    "branchNumber": {
      "number": "1",
      "name": "Panteon AS"
    },
    "cashAccount": "1910",
    "project": {
      "id": "X",
      "description": "Non-Project Code."
    },
    "account": {
      "type": "Asset",
      "number": "1500",
      "description": "Kundefordringer"
    },
    "subaccount": {
      "subaccountNumber": "00A1000",
      "subaccountId": 1,
      "description": "None",
      "lastModifiedDateTime": "2020-01-29T13:02:18.967",
      "active": true,
      "segments": [
        {
          "segmentId": 1,
          "segmentDescription": "Avdeling",
          "segmentValue": "0",
          "segmentValueDescription": "(Default)"
        },
        {
          "segmentId": 2,
          "segmentDescription": "Project",
          "segmentValue": "0",
          "segmentValueDescription": "p1"
        },
        {
          "segmentId": 3,
          "segmentDescription": "Dynamic",
          "segmentValue": "A1000",
          "segmentValueDescription": "A1"
        }
      ]
    },
    "metadata": {
      "totalCount": 1,
      "maxPageSize": 1000
    }
  }
]

 


Now I am registering payment for this invoice as per your suggestion

 

{
    "referenceNumber": {
        "value": "000034"
    },
    "type": {
        "value": "Payment" 
    },
    "hold": {
        "value": false
    },
    "applicationDate": {
        "value": "2024-08-29T00:00:00"
    },
    "paymentRef": {
        "value": "Payment ref comment"
    },
    "customer": {
        "value": "10014"
    },
    "location": {
        "value": "Main"
    },
    "paymentMethod": {
        "value": "1"
    },
    "cashAccount": {
        "value": "1910"
    },
    "currency": {
        "value": "NOK"
    },
    "paymentAmount": {
        "value": "1800.00"
    },
    "invoiceText": {
        "value": "invoice text comment"
    },
    "paymentLines": [
        {
            "operation":"Insert",
            "documentType": {
                "value": "Invoice"
            },
            "refNbr": {
                "value": "000034"
            },
            "amountPaid": {
                "value": "1800.00"
            }
        }
    ]
}

 




This shows me error,

VismaId: 957a08d1-f072-4e6b-b5cb-72ed52247568.
Error creating payment. Error: AdjdRefNbr '000034' cannot be found in the system.







Marten Voort
VISMA

by Marten Voort

You are trying to register a payment for invoice 000034, but you cannot know for sure that is the number assigned to the invoice. I advise you to check the system for the number assigned and try to use that instead. That should work. 

kashyap
PARTNER

by kashyap

In above reply, what I am getting in API response and used in the another API.

I am not aware what system assigned number are you talking. Can you please advice me which field or number are you targeting?

kashyap_0-1724916133163.png

 

Marten Voort
VISMA

by Marten Voort

There is an option to use auto-numbering, in that case the invoicenumber is different from the number you POST in the initial invoice request (which is ignored then). But in your case the number seems to be the same, so that is good. The problem is that the invoice has the status balanced, which is a concept state. After you have released the invoice it should be able to be paid.