If you are the owner of an online store / landing page, which is yet to be supported (integrated) from/with MetaKocka, you can still send documents to MetaKocka. Those will be entered in the sales orders in the same way that they are transferred from the online stores. 

More information about API interface can be found at https://github.com/metakocka/metakocka_api_base/,or , while you can follow the instructions below:


Basic requests:

  • API key can be modified via configuration application - check http://blog.metakocka.si/dodatne-nastavitve-api/
  • POST is the type of all requests
  • All requests must have Header parameter Content-type : application/json configured
  • In case of an error, the response will contain opr_code > 0 and an error description in opr_desc
  • In case of MetaKocka not being reachable due to an update in process, bear in mind that sending might need to be redone


Generating a new order

Notes :


URL : https://main.metakocka.si/rest/eshop/v1/put_document

Request :

{
"secret_key": "TODO",
"company_id": "16",
"doc_type": "sales_order",
"doc_date": "2017-10-30+02:00",
"title": "#390",
"buyer_order": "#390",
"partner": {
"business_entity": "true",
"taxpayer": "true",
"foreign_county": "false",
"tax_id_number": "SI20000001",
"customer": "API partner 1",
"street": "Street 100",
"post_number": "1000",
"place": "Ljubljana",
"province": "Severna primorska",
"country": "Slovenia",
"partner_contact": {
"name": "Janez Novak",
"phone": "05 320 24 88",
"fax": "05 320 24 84",
"gsm": "071 333 444",
"email": "test@test.co.uk"
}
},
"receiver": {
"business_entity": "true",
"taxpayer": "true",
"foreign_county": "false",
"tax_id_number": "SI20000002",
"customer": "API partner 2",
"street": "Street 200",
"post_number": "1000",
"place": "Ljubljana",
"country": "Slovenia",
"partner_contact": {
"name": "Janez Novak",
"phone": "05 320 24 88",
"fax": "05 320 24 84",
"gsm": "071 333 444",
"email": "test@test.co.uk"
}
},
"currency_code": "EUR",
"delivery_type": "GLS",
"notes": "Custom extra message",
"method_of_payment": "PayPal",
"product_list": [
{
"code": "p1",
"name": "Product with tax 22%",
"name_desc" : "Extra description for product",
"amount": "1",
"price_with_tax": "100",
"unit" : "kos",
"sales" : true,
"tax": "EX4"
},
{
"code": "p2",
"name": "Product with tax 9,5%",
"name_desc" : "Extra description for product",
"amount": "1",
"price_with_tax": "100",
"unit" : "kos",
"sales" : true,
"tax": "EX3"
},
{
"code": "p3",
"name": "Product with tax 0%",
"name_desc" : "Extra description for product",
"amount": "1",
"price_with_tax": "100",
"unit" : "kos",
"sales" : true,
"tax": "000"
},
{
"code": "p4",
"name": "Delivery cost",
"amount": "1",
"price_with_tax": "5",
"unit" : "stor",
"sales" : true,
"service": true,
"tax": "EX4"
}
]
}


Response :

{
"opr_code": "0",
"opr_time_ms": "87",
"partner": {
"mk_id": "1600000073"
},
"receiver": {
"mk_id": "1600000076"
},
"mk_id": "1600000100",
"count_code": "2/2017"
}


Additional payment

If your application checks whether a particular order has been paid, you can send the information to MK that order has already been paid.


Notes :


URL : https://main.metakocka.si/rest/eshop/v1/put_transaction

Request :

{
"secret_key": "TODO",
"company_id": "16",
"doc_type" : "sales_order",
"mk_id":"1600000073",
"payment_mode" : "payment",
"payment_type" : "PayPal",
"date" : "2017-10-30+02:00",
"price" : "305"
}


Response :

{
"opr_code": "0",
"opr_time_ms": "0"
}


Meaning of Type of payment and Payment method

Two terms are used for order payments:

  • Type of payment - how the order should be paid? Indicated by the customer in the online store (for example, COD, Credit Card, PayPal, etc.). 
  • Payment method - how the order was actually paid (payment instrument, date)


Both kinds of payments are possible to configure in Settings ->Registers. Their names are ''Type of payment'' and ''Payment method'' respectively.


For payment instruments that collect cash directly after placing the order (for example PayPal, credit cards), two API calls are made - put_document (method_of_payment field used for Type of payment) and then put_transaction (payment name is entered in payment_type). For the orders that are paid by customers with cash on delivery, one call is made - put_document, while the method_of_payment field should be configured accordingly.


FAQ


1. How to check recorded orders in MetaKocka?


The recorded orders are located under sales orders. Select ''Refresh list'' to display any new orders.




2. How to check the amount paid in the sales order?




3. Error received: "Paramether 'payment_type' has invalid value : PayPal. Valid values : Transakcijski račun,Gotovina,Prenos preplačila,Kartica BA"

Adding additional payment instrument by the name of PayPal is necessary.




Note :

  • If invoices with that payment instrument are sent to FURS, mark them as Type of payment = The rest. If you do not want them to be sent to FURS, set Bank account as their Type of payment.