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.
class Twisto
Twisto constructor
Creates new Twisto object
Twisto::__construct([public_key])| Arguments | Data Type | Description |
|---|---|---|
public_key | String | Public API key |
Twisto setSecretKey
Sets your secret key
Twisto::setSecretKey(key)| Arguments | Data Type | Description |
|---|---|---|
key | Array | Your secret API key |
Twisto setPublicKey
Sets your secret key
Twisto::setPublicKey(key)| Arguments | Data Type | Description |
|---|---|---|
key | Array | Your public API key |
Twisto getPrecheckPayload
Serializes and encrypts data for the JS precheck function
Twisto::getPrecheckPayload(customer, orders)| Arguments | Data Type | Description |
|---|---|---|
customer | Customer | Anonymous customer information |
orders | Array<BareOrder> | Customer order data |
Twisto getCheckPayload
Serializes and encrypts data for the JS check function
Twisto::getCheckPayload(customer, orders)| Arguments | Data Type | Description |
|---|---|---|
customer | BareCustomer | Anonymous customer information |
orders | Array<Order> | Customer order data |
Twisto createInvoice
Makes an API call with a request to create an invoice. A TwistoError exception is thrown on an error.
Twisto::createInvoice(transaction_id, customer, order)| Arguments | Data Type | Description |
|---|---|---|
transaction_id | String | The transaction identifier from the customer evaluation |
customer | Customer | Anonymous customer information |
orders | Order | Customer order data |
class CheckResponse
CheckResponse constructor
Creates new CheckResponse object
CheckResponse::__construct()CheckResponse add
Serializes and passes data about the customer and their orders for the webhook request check
CheckResponse::add(customer, orders)| Arguments | Data Type | Description |
|---|---|---|
customer | BareCustomer | Anonymous customer information |
orders | Array<Order> | Customer order data |
class BareCustomer
BareCustomer constructor
Creates new BareCustomer object
BareCustomer::__construct(data)| Arguments | Data Type | Description |
|---|---|---|
data | Object {email, facebook_id} | Email and facebook_id of customer |
BareCustomer serialize
Prepares the data to be sent to the Twisto server
BareCustomer::serialize()class BareOrder
BareOrder constructor
Creates a new BareOrder object
BareOrder::__construct(data)| Arguments | Description |
|---|---|
order_id | Order ID |
created | Date and time of order creation |
billing_address | Billing address |
delivery_address | Delivery address |
total_price | Total price of order |
is_paid | Information if order has been paid or not |
is_shipped | Information if order has been shipped to customer |
is_delivered | Information if order has been already delivered to customer |
is_returned | Information if order has been returned |
BareOrder serialize
Prepares the data to be sent to the Twisto server
BareOrder::serialize()class BareAddress
BareAddress constructor
Creates a new BareAddress object
BareAddress::__construct(data)| Arguments | Description |
|---|---|
name | Full name |
street | Street |
city | City |
zipcode | Zip code |
country | Country code |
phones | Contact phone numbers |
BareAddress serialize
Prepares the data to be sent to the Twisto server
BareAddress::serialize()class Customer
Customer constructor
Creates new Customer object
Customer::__construct(data)| Arguments | Description |
|---|---|
name | Full name of customer |
email | Customer's email |
facebook_id | Customer's Facebook ID |
date_registered | Date and time of registration |
promo_score | Score of customer |
Customer serialize
Prepares the data to be sent to the Twisto server
Customer::serialize()class Order
Order constructor
Creates new Order object
Order::__construct(data)| Arguments | Description |
|---|---|
order_id | Order ID |
created | Date and time of Order creation |
billing_address | Billing address |
delivery_address | Delivery address |
is_paid | Information if order has been paid or not |
is_shipped | Information if order has been shipped to customer |
is_delivered | Information if order has been already delivered to customer |
is_returned | Information if order has been returned |
items | Items from order |
Order serialize
Prepares the data to be sent to the Twisto server
Order::serialize()class Address
Address constructor
Creates new Address object
Address::__construct(data)| Arguments | Description |
|---|---|
name | Full name |
street | Street |
city | City |
zipcode | Zip code |
country | Country code |
phones | Contact phone numbers |
Address serialize
Prepares the data to be sent to the Twisto server
Address::serialize()class OrderItem
OrderItem constructor
Creates new OrderItem object
OrderItem::__construct(data)| Arguments | Description |
|---|---|
quantity | Quantity of items |
name | Name of product |
price_vat | Price incl. VAT(DPH) |
vat | VAT(DPH) |
is_shipment | The item represents a shipping fee |
is_payment | The item represents the payment fee |
is_discount | Item represents discount o |
categories | Category tree |
ean_code | EAN code of the product |
OrderItem serialize
Prepares the data to be sent to the Twisto server
OrderItem::serialize()class NewOrder
NewOrder constructor
Creates new NewOrder object
NewOrder::__construct(data)| Arguments | Description |
|---|---|
billing_address | Billing address |
delivery_address | Delivery address |
items | Items of order |
NewOrder serialize
Prepares the data to be sent to the Twisto server
NewOrder::serialize()