My Products
Help
Flashnode-developers
CONTRIBUTOR *

Correct way to add a payment to an order

by Flashnode-developers

Hi,

 

I am bit confused which is the correct way to add a payment to an order. I have searched the forums and tried on the UI. On the example payloads here in the forum I can see that you can add a paymentMethod to the create SalesOrder endpoint (I couldn't get it to work, it says payment method not found even it is added to the system, the Id should match too) or you can use the CustomerPayment endpoint (couldn't get that to work either with an added paymentMethod, it says always cashAccount cannot be empty, even if it is added)

 

So I do need a bit help, can you hint me in the right direction? I just need to add a simple payment to an order so that it is already paid.

1 REPLY 1
Accepted solution
Yıldırım
VISMA

by Yıldırım (Updated ‎16-01-2023 13:07 by Yıldırım VISMA )

Hello, 

to be able to add PaymentMethod & Cash account combinations, those assets should be registered in the Company > Branch you're working with. 

 

For example, checking the availability of the desired Payment Method and the Cash Account in the Sales Order > Payment settings tab.

available_Sales orders.jpg

 

 

Please see the transactions below for POST Sales Order with PaymentMethod & Cash Account, then creating a payment via API for that Sales Order. 

 

1) POST Sales Order <https://integration.visma.net/API/controller/api/v2/salesorder>

 

{
    "lines": [
        {
            "operation": "Insert",
            "inventoryNumber": {
                "value": "1"
            },
            "quantity": {
                "value": 2.0
            },
            "unitPrice": {
                "value": 39.00
            },
            "lineDescription": {
                "value": "test"
            }
        }
    ],
    "orderType": {
        "value": "SO"
    },
    "hold": {
        "value": false
    },
    "date": {
        "value": "2023-01-16"
    },
    "customer": {
        "value": "01235"
    },
    "currency": {
        "value": "NOK"
    },
    "description": {
        "value": "test"
    },
    "paymentMethod": {
        "value": "4"
    },
    "cashaccount": {
        "value": "1900"
    }
}

 


Financials ERP UI Output

POST_Sales orders.jpg

 

2) POST Customer Payment for the recently created Sales Order

 

{
    "type": {
        "value": "Payment"
    },
    "hold": {
        "value": false
    },
    "paymentRef": {
        "value": "123456"
    },
    "customer": {
        "value": "01235"
    },
    "paymentMethod": {
        "value": "4"
    },
    "cashAccount": {
        "value": "1900"
    },
    "currency": {
        "value": "NOK"
    },
    "paymentAmount": {
        "value": 78
    },
    "ordersToApply": [
        {
            "operation": "Insert",
            "orderType": {
                "value": "SO"
            },
            "orderNumber": {
                "value": "000536"
            },
            "appliedToOrder": {
                "value": 0
            }
        }
    ]
}

 

 Financials ERP UI Output

paymentOutput.jpg