Transactions API
Estimate Transaction
this api endpoint (post) (post) estimates a transaction if the request succeeds, it returns a transaction object docid 0es5bvicbfmv7ocgcamez using estimates is a helpful way to get a basic idea of the costs involved in a potential order this includes any vat, payment methods you can use, and shipping fees however, it's important to remember that this estimate might not cover every possible cost for instance, with tamio, you can set up discounts that apply only when a customer chooses a specific way to pay similarly, there could be discounts or taxes that vary based on the payment method selected, account filters etc body parameters customer object configure the customer object if you like to create the invoice for an existing customer required if new customer is not set { "id" "bb7d96d5 6b43 4b01 9f8c 089b3d37d951", "shipping address id" "ad5701b5 5470 44a3 9a56 af458f24f6b3", "billing information" { "phone" "08421234", "name" "james doe" "representative" "representative doe", "email" "john doe\@tamio com", "address" "my street", "city" "frankfrt", "postcode" "abc1234", "country" "de", "locale" "en", "vat" "de1234567", "is company" true } id string the id of the customer billing address id string the id of the customer's billing address configuring a billing address is not required for most use cases but is recommended shipping address id string the id of the customer's shipping address required if the invoice has shipping requirements same shipping address boolean set it to true , if you like the shipping information to be the same as the billing information shipping information object create customer docid\ cuemhngxn3hftqavvmmtb configure this object if you like to save a new shipping address for the customer while creating the transaction billing information object create customer docid\ cuemhngxn3hftqavvmmtb configure this object if you like to save a new billing address for the customer while creating the transaction new customer object create customer docid\ cuemhngxn3hftqavvmmtb the customer details for the invoice required if customer is not set "new customer" { "name" "john", "last name" "doe", "email" "johndoe1\@example com", "country" "de", "billing information" { "phone" "08421234", "name" "james doe", "representative" "representative doe", "email" "john doe\@tamio com", "address" "my street", "city" "frankfrt", "postcode" "abc1234", "country" "de", "locale" "en", "vat" "de1234567", "is company" true }, "shipping information" { "phone" "08421234", "name" "james doe", "email" "john doe\@tamio com", "address" "my street", "city" "frankfrt", "postcode" "abc1234", "country" "de", "locale" "en" } } products array of objects the products to purchase you can offer your existing tamio products docid\ gaxf8cqa3te sjlpubl7a or create invoice items for this transaction example existing products #1 the example below shows how to configure the request for your tamio products the quantity parameter is optional; if not provided, it will default to 1 example "products" \[ { "id" "some product id" }, { "id" "some other product id", "quantity" 10 } ] example existing products #2 the example below shows how to configure the request for a tamio product with variants variants can be configured on physical products and services if a product has variants and a variant id is not provided in the request, it will be rejected from the transaction example "products" \[ { "variant" "some variant id" } ] example existing product selling packs #3 some products, such as physical goods, can be sold in packs the example below shows how to configure the request to purchase three packs of a specific product example "products" \[ { "pack" "some pack id", "quantity" 3 // the pack must allow multiples } ] example invoice item #4 the example below shows how to configure the request for an invoice item each invoice item must have a name and a price (in cents) the quantity attribute is optional the currency of the invoice item will always match the transaction currency exampe "products" \[ { "label" "my invoice iteam", "price" 10035 // cents "quantity" 10 } ] currency string appendix docid\ kfbmx4q3dxjtduqf75yx1 the currency of the transaction this is optional but the most basic way of configuring the currency of a transaction required if convert prices is not provided transactions can be created in any currency if activated on your account the currency affects which products are allowed to be included in the order, which discounts can be applied and what shipping methods can be used in the example below, the transaction currency is set to euros if the product's supported currencies include euros, it will be validated and included in the transaction example "currency" "eur", "products" \[ { "id" "some product id" } ] convert prices boolean in the example below, if the product does not support euros, its default price will be converted to euros example "convert prices" true, "currency" "eur", "products" \[ { "id" "some product id" } ] in the example below, if no common currency is found, the products' default currencies will be converted to your account's default currency example "convert prices" true, "products" \[ { "id" "some product id" } { "id" "some product id" } ] coupons array of strings an array of strings, each representing a coupon that you want to validate for this transaction require "uri" require "json" require "net/http" url = uri("https //api tamio com/v2/transactions/estimate") https = net http new(url host, url port) https use ssl = true request = net http post new(url) request\["accept"] = "application/json" request\["authorization"] = "bearer your publishable token here" data = { products \[ { id "bb7d96d5 6b43 4b01 9f8c 089b3d37d951" } ], customer { id "9c91c6eb 9146 4bf5 82da dc73aba59a46" } } request body = data to json response = https request(request) puts response read bodycurl location request post 'https //api tamio com/v2/transactions/create' \\ \ header 'accept application/json' \\ \ header 'authorization bearer your publishable token here' \\ \ data raw '{ "products" \[ { "id" "bb7d96d5 6b43 4b01 9f8c 089b3d37d951" } ], "customer" { "id" "9c91c6eb 9146 4bf5 82da dc73aba59a46" } }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("authorization", "bearer your publishable token here"); var data = { products \[ { id "bb7d96d5 6b43 4b01 9f8c 089b3d37d951" } ], customer { id "9c91c6eb 9146 4bf5 82da dc73aba59a46" } }; var body = json stringify(data); var requestoptions = { method 'post', headers myheaders, body body }; fetch("https //api tamio com/v2/transactions/estimate", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));{ "status" 200, "warnings" \[], "transaction" { "object" "transaction", "affiliate" null, "site" null, "customer information" { "name" "john", "email" "johndoe1\@example com", "country" "de", "locale" "en", "last name" "doe", "id" "9c91c6eb 9146 4bf5 82da dc73aba59a46", "stripe customer id" "cus mtonj9efexbggq", "billing information" { "id" "56602ee6 b92c 4054 9ab2 a7afe3bcc3cd", "phone" null, "object" "address", "name" "john", "representative" null, "email" "johndoe1\@example com", "address" "super street", "city" "frankfurt", "postcode" "abc123123", "state" null, "country" "de", "locale" "en", "shipping address" false, "ip" null, "is company" true }, "shipping information" { "id" "ad5701b5 5470 44a3 9a56 af458f24f6b3", "phone" "+123456678", "object" "address", "name" "john doe ltd", "representative" null, "email" "johndoe1\@example com", "address" "shipping street", "city" "frankfurt", "postcode" "123456", "state" null, "country" "de", "locale" "sv", "shipping address" true } }, "payments" \[ "stripe", "giropay", "eps", "przelewy24", "ideal", "bancontact", "sepa", "sofort", "googlepay", "klarna", "cash", "instalments" ], "locale" "en", "instalments" \[ { "interval" 1, "instalments" 3, "cycle" "week", "offset" 1, "id" "tmp id 0", "upfront amount" 2159, "upfront" 12 34, "instalments amount" 5113, "interest" 4038, "total amount" 17498 } ], "taxes" { "tax rates" \[ { "id" null, "rate percent" 19, "rate amount" null, "label" "mwst ", "tax" 1900, "moss" false, "jurisdiction" "de", "inclusive" false, "vat tax" true, "applies to" \[ "bb7d96d5 6b43 4b01 9f8c 089b3d37d951" ] } ], "shipping tax rates" \[ { "id" null, "rate percent" 19, "rate amount" null, "label" "shipping taxes", "tax" 249, "moss" false, "jurisdiction" "de", "inclusive" false, "vat tax" true, "applies to" \[ "bb7d96d5 6b43 4b01 9f8c 089b3d37d951" ] } ], "has vat" true }, "shipping" { "has shipping" true, "shipping rates" \[ { "id" "1dad3c8a 2e69 4d6a 8d75 237a78277509", "label" "great new shipment", "bundling" false, "type" "fixed", "cost" 1312, "convert from" "eur", "exchange rate" 1 } ], "item count" 1, "shipping method" { "id" "1dad3c8a 2e69 4d6a 8d75 237a78277509", "label" "great new shipment", "bundling" false, "type" "fixed", "cost" 1312, "convert from" "eur", "exchange rate" 1 } }, "currency" "eur", "products" \[ { "name" "big painting", "quantity" 1, "type" "physical product", "classification" "cell phones & accessories", "discount allowed" true, "is moss product" false, "currency" "eur", "id" "bb7d96d5 6b43 4b01 9f8c 089b3d37d951", "taxes" { "inclusive" false, "tax rates" \[ { "id" null, "rate percent" 19, "rate amount" null, "label" "mwst ", "tax" 1900, "moss" false, "jurisdiction" "de", "inclusive" false, "vat tax" true } ], "shipping tax rates" \[ { "id" null, "rate percent" 19, "rate amount" null, "label" "shipping taxes", "tax" 249, "moss" false, "jurisdiction" "de", "inclusive" false, "vat tax" true } ] }, "totals" { "unit price" 10000, "item total" 10000, "total" 13461, "discount" 0, "shipping subtotal" 1312, "shipping discount" 0, "shipping tax" 249, "shipping" 1312, "shipping total" 1561, "tax" 1900, "subtotal" 10000, "exchange rate" null, "price conversion" false, "moss taxable amount" 0, "moss tax total" 0, "item total with tax" 11900 }, "reservations" \[], "discounts" \[], "has shipping" true, "variation id" null, "is variant" false, "pack" null, "ean" null, "sku" null } ], "totals" { "tax" 1900, "shipping" 1312, "shipping tax" 249, "subtotal" 10000, "total" 13461, "discount" 0, "item count" 1, "shipping discount" 0, "item total with tax" 11900, "shipping subtotal" 1312, "price conversion" false, "item total" 10000, "moss tax total" 0, "moss taxable amount" 0, "trial deductions" 0, "shipping total" 1561 }, "discounts" \[] } }