.. meta:: :description: Wired Zak API read and insert a payment :keywords: api, pms, zak, kapi, payment, payments Zak API to read payments ************************ | These APIs allow you to read or insert payments on a zak property. Get payments ============ | This method provides payments of a zak property. | *To prevent overflow, the maximum limit of records is 100.* .. code-block:: html Url: https://kapi.wubook.net/kapi/payments/get_payments | The following input fields are all optional: | If *dfrom* filter is passed, it returns payments with date>= *dfrom*. | If *dto* filter is passed, it returns payments with date<= *dto*. | If *canceled* filter is passed, it returns payments that have been cancelled. | If *rcode* filter is passed, it returns the payments of the reservation. | If *inv_prefix* is passed, it returns payments of invoices with that associated prefix. | If *inv_num* is passed, it returns payments of invoices with that associated number. | If *inv_year* is passed, it returns payments of invoices of the specified year. | If pay_type_ filter is passed, it returns only the payments of the indicated type. | Response-data: list of payment data. | For every payment are provided the following data: .. table:: :widths: auto +--------------------------+-----------------------------------------------------------------------------------------+ | **Field name** | **Description** | +==========================+=========================================================================================+ | *date* | date of payment | +--------------------------+-----------------------------------------------------------------------------------------+ | *off* | the payment have been cancelled (cancellation date) | +--------------------------+-----------------------------------------------------------------------------------------+ | *payed* | the payment has been payed (payment date) | +--------------------------+-----------------------------------------------------------------------------------------+ | *value* | payment amount | +--------------------------+-----------------------------------------------------------------------------------------+ | *type* | payment type (*'Cash'*, *'Credit Card'*, *'Bank Transfer'*, ..) | +--------------------------+-----------------------------------------------------------------------------------------+ | *team_user* | who entered the payment | +--------------------------+-----------------------------------------------------------------------------------------+ | *remarks* | notes wrote on the payment | +--------------------------+-----------------------------------------------------------------------------------------+ | *currency* | payment amount currency | +--------------------------+-----------------------------------------------------------------------------------------+ | *invoice_num* | invoice number | +--------------------------+-----------------------------------------------------------------------------------------+ | *invoice_prefix* | prefix of invoice (it could be blank) | +--------------------------+-----------------------------------------------------------------------------------------+ | *invoice_date* | invoice date | +--------------------------+-----------------------------------------------------------------------------------------+ | *agency_name* | if the payment was made by an agency | +--------------------------+-----------------------------------------------------------------------------------------+ | *corporate_name* | if the payment was made by a corporate | +--------------------------+-----------------------------------------------------------------------------------------+ | *rsrvs* | reservations linked to the payment | +--------------------------+-----------------------------------------------------------------------------------------+ .. _pay_type: symbols.html#get-payment-types .. _123456: ../kapintro.html#authentication Example ------- | On each examples `123456`_ is used as **api-key** which is sent as *user*. curl: ..... .. code-block:: shell $ curl https://kapi.wubook.net/kapi/payments/get_payments -u 123456: -X POST \ -d rcode=CG-0001 {"data": [ {"date": "18/01/2019", "off": "", "payed": "18/01/2019", "value": 200.0, "type": "Cash", "team_user": "", "remarks": "volta la carta 200\u20ac", "currency": "EUR", "invoice_text": "", "invoice_num": "", "invoice_prefix": "", "invoice_date": "", "agency_name": "", "corporate_name": "", "rsrvs": "KG-0003"} ] } python code: ............ .. code-block:: python import requests uspw=(123456, None) data= {'rcode': 'CG-0001'} response= requests.post('https://kapi.wubook.net/kapi/payments/get_payments', data, auth= uspw) print(response.text) Do payment ========== | Enter a payment record on a zak_property. .. code-block:: html Url: https://kapi.wubook.net/kapi/payments/do_payment | Payment Form is represented as JSON object | Input fields: The following fields are mandatory: .. table:: :widths: auto +--------------------------+-----------------------------------------------------------------------------------------+ | **Field name** | **Description** | +==========================+=========================================================================================+ | *pay_type* | Name of one pay_type_ | +--------------------------+-----------------------------------------------------------------------------------------+ | *value* | Amount of the payment | +--------------------------+-----------------------------------------------------------------------------------------+ The following fields are optional: .. table:: :widths: auto +--------------------------+-----------------------------------------------------------------------------------------+ | **Field name** | **Description** | +==========================+=========================================================================================+ | *date* | Payment date | +--------------------------+-----------------------------------------------------------------------------------------+ | *remarks* | Notes text | +--------------------------+-----------------------------------------------------------------------------------------+ | *rcode* | Reservation code | +--------------------------+-----------------------------------------------------------------------------------------+ | *payed* | payment date | +--------------------------+-----------------------------------------------------------------------------------------+ | *currency* | payment amoun currency | +--------------------------+-----------------------------------------------------------------------------------------+ | *year_inv* | year of payment invoice | +--------------------------+-----------------------------------------------------------------------------------------+ | *num_inv* | number of payment invoice | +--------------------------+-----------------------------------------------------------------------------------------+ | *prefix_inv* | prefix of payment invoice | +--------------------------+-----------------------------------------------------------------------------------------+ | It is mandatory to send the *rcode* or *number and invoice year*, | they can not both be omitted: *'invoice or reservation must be provided'*. | | Response-data: *'payment done'*. Example ------- curl: ..... .. code-block:: shell curl https://kapi.wubook.net/kapi/payments/do_payment -u 123456: \ -X POST \ -d pay_type="Credit Card" -d value="150.00" -d date="20/02/2019" -d payed="20/02/2019" -d remarks="Reservation payment" -d rcode="KG-0003" -d currency="EUR" {"data": "payment created"} python code: ............ .. code-block:: python import json import requests data= { "pay_type":"Credit Card", "value":"150.00", "date":"20/02/2019", "payed":"20/02/2019", "remarks":"Invoice 5/2019 payment", "currency":"EUR", "num_inv":"5", "year_inv":"2019" } jdata=json.dumps(data) uspw=('123456', None) response= requests.post('https://kapi.wubook.net/kapi/payments/do_payment', jdata, auth= uspw) print(response.text)