PHP library

The library requires data in utf-8. For example, if you have data in windows-1250, you need to convert it to utf-8 before passing to the library, e.g., using iconv.

For a description of how to install the library, visit the e-shop administration integration section.

class Address

Address::__construct (name, street, city, zipcode, country, phone_number)

Argumenttype
namestring
streetstring
citystring
zipcodestring
countrystring
phone_numberstring

class Customer

Customer::__construct (email, [name], [facebook_id], [company_id], [vat_id])

Argumenttype
emailstring
namestring
facebook_idstring
company_idstring
vat_idstring

class Invoice

Invoice::__construct (twisto, invoice_id)

Argumenttype
twistoTwisto
invoice_idstring

Invoice::get ()

Fetch invoice data from API

Invoice::cancel ()

Perform cancel invoice API request

Invoice::activate ()

Perform activate invoice API request

Invoice::save ()

Save invoice items

Invoice::create (twisto, transaction_id, [eshop_invoice_id])

Create new invoice using transaction_id from check

Argumenttype
twistoTwisto
transaction_idstring
eshop_invoice_idstring

Invoice::returnItems (items, [discounts])

Perform invoice return API request

Argumenttype
itemsItemReturn[]
discountsItemDiscountReturn[]

Invoice::returnAll ()

Perform invoice return all API request

Invoice::refund (amount)

Performs invoice refund API request

Argumenttype
amountfloat

Invoice::splitItems (items)

Request for Invoice API split. Returns new Invoice object.

Argumenttype
itemsItemSplit[]

class Item

Item::__construct (type, name, product_id, quantity, price_vat, vat, [ean_code], [isbn_code], [issn_code], [heureka_category])

Argumenttype
typeint
namestring
product_idstring
quantityint
price_vatfloat
vatfloat
ean_codestring
isbn_codestring
issn_codestring
heureka_categoryint

class Order

Order::__construct (date_created, billing_address, delivery_address, total_price_vat, items)

Argumenttype
date_createdDateTime
billing_addressBaseAddress
delivery_addressBaseAddress
total_price_vatfloat
itemsItem[]

class Twisto

Twisto::Twisto ([public_key])

Argumenttype
public_keystring

Twisto::setSecretKey (key)

Argumenttype
keystring

Twisto::setPublicKey (key)

Argumenttype
keystring

Twisto::setApiUrl (api_url)

Argumenttype
api_urlstring

Twisto::requestJson (method, url, [data])

Perform API request and decode response JSON

Argumenttype
methodstring
urlstring
dataarray

Twisto::request (method, url, [data])

Perform API request

Argumenttype
methodstring
urlstring
dataarray

Twisto::getCheckPayload (customer, order, previous_orders)

Create check payload

Argumenttype
customerCustomer
orderOrder
previous_ordersOrder[]