/transactions/create
JS
JavaScript
JS JavaScript
💎 Ruby
1 const response = await fetch("https://api.tamio.com/v2/transactions/create" , {2 method: "POST" , 3 headers: { 4 "Authorization" : "Bearer YOUR_API_KEY" , 5 "Content-Type" : "application/json" 6 }, 7 body: JSON.stringify({ 8 "affiliate" : "d4e5f6a7-b8c9-0123-defg-456789012345" , 9 "currency" : "EUR" , 10 "locale" : "en" , 11 "no_discounts" : false, 12 "coupons" : [ 13 "SAVE20" , 14 "WELCOME10" 15 ], 16 "products" : [ 17 { 18 "id" : "f1a2b3c4-d5e6-7890-abcd-ef1234567890" , 19 "quantity" : 2, 20 "price" : 2500, 21 "name" : "Premium Widget" , 22 "variant" : "b2c3d4e5-f6a7-8901-bcde-f12345678901" , 23 "pack" : "c3d4e5f6-a7b8-9012-cdef-123456789012" 24 } 25 ], 26 "shipping" : { 27 "tamio" : "e5f6a7b8-c9d0-1234-efgh-567890123456" , 28 "nshift" : { 29 "valid" : false, 30 "deliveryCheckoutId" : "00000000-0000-0000-0000-000000000000" , 31 "selectedOptionId" : "00000000-0000-0000-0000-000000000000" , 32 "optionIds" : [], 33 "price" : 0, 34 "taxRate" : 0, 35 "selectedAddons" : [ 36 { 37 "id" : "string" , 38 "price" : 0 39 } 40 ], 41 "fields" : [] 42 } 43 }, 44 "fulfillment_options" : { 45 "stock" : true, 46 "accounting_systems" : true, 47 "merchant_emails" : true, 48 "customer_emails" : true, 49 "automations" : true, 50 "shipping_providers" : true 51 }, 52 "customer" : { 53 "id" : "c1d2e3f4-a5b6-7890-abcd-ef1234567890" , 54 "billing_address_id" : "966a8470-8250-45d7-9ae7-aeaeffc30f28" , 55 "shipping_address_id" : "ad5701b5-5470-44a3-9a56-af458f24f6b3" , 56 "same_shipping_address" : false, 57 "billing_information" : null, 58 "shipping_information" : null 59 }, 60 "new_customer" : { 61 "name" : "John" , 62 "last_name" : "Doe" , 63 "email" : "[email protected] " , 64 "company" : "Acme GmbH" , 65 "country" : "de" , 66 "phone" : "+49 123 456789" , 67 "timezone_offset" : "+02:00" , 68 "locale" : "en" , 69 "same_shipping_address" : false, 70 "teammate_id" : null, 71 "billing_information" : null, 72 "shipping_information" : null 73 } 74 }) 75 }); 76 const data = await response.json();
1 require "uri" 2 require "net/http" 3 require "json" 4 5 url = URI ("https://api.tamio.com/v2/transactions/create" ) 6 7 https = Net::HTTP .new(url.host, url.port) 8 https.use_ssl = true 9 10 request = Net::HTTP ::Post.new(url) 11 request["Accept" ] = "application/json" 12 request["Authorization" ] = "Bearer YOUR_API_KEY" 13 request["Content-Type" ] = "application/json" 14 request.body = { 15 affiliate: "d4e5f6a7-b8c9-0123-defg-456789012345" , 16 currency: "EUR" , 17 locale: "en" , 18 no_discounts: false , 19 coupons: ["SAVE20" , "WELCOME10" ], 20 products: [ 21 { 22 id: "f1a2b3c4-d5e6-7890-abcd-ef1234567890" , 23 quantity: 2, 24 price: 2500, 25 name: "Premium Widget" , 26 variant: "b2c3d4e5-f6a7-8901-bcde-f12345678901" , 27 pack: "c3d4e5f6-a7b8-9012-cdef-123456789012" 28 } 29 ], 30 shipping: { 31 tamio: "e5f6a7b8-c9d0-1234-efgh-567890123456" , 32 nshift: { 33 valid: false , 34 deliveryCheckoutId: "00000000-0000-0000-0000-000000000000" , 35 selectedOptionId: "00000000-0000-0000-0000-000000000000" , 36 optionIds: [], 37 price: 0, 38 taxRate: 0, 39 selectedAddons: [ 40 { 41 id: "string" , 42 price: 0 43 } 44 ], 45 fields: [] 46 } 47 }, 48 fulfillment_options: { 49 stock: true , 50 accounting_systems: true , 51 merchant_emails: true , 52 customer_emails: true , 53 automations: true , 54 shipping_providers: true 55 }, 56 customer: { 57 id: "c1d2e3f4-a5b6-7890-abcd-ef1234567890" , 58 billing_address_id: "966a8470-8250-45d7-9ae7-aeaeffc30f28" , 59 shipping_address_id: "ad5701b5-5470-44a3-9a56-af458f24f6b3" , 60 same_shipping_address: false , 61 billing_information: nil , 62 shipping_information: nil 63 }, 64 new_customer: { 65 name: "John" , 66 last_name: "Doe" , 67 email: "[email protected] " , 68 company: "Acme GmbH" , 69 country: "de" , 70 phone: "+49 123 456789" , 71 timezone_offset: "+02:00" , 72 locale: "en" , 73 same_shipping_address: false , 74 teammate_id: nil , 75 billing_information: nil , 76 shipping_information: nil 77 } 78 }.to_json 79 80 response = https.request(request) 81 puts response.read_body
Responses
{
"status": 200,
"transaction": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"object": "transaction",
"order_id": 10542,
"currency": "EUR",
"locale": "en",
"has_subscriptions": false,
"products": [
{
"id": "f1a2b3c4-d5e6-7890-abcd-ef1234567890",
"name": "Premium Widget",
"price": 2500,
"quantity": 2
}
],
"customer_information": {
"id": "c1d2e3f4-a5b6-7890-abcd-ef1234567890",
"email": "[email protected] ",
"name": "John",
"last_name": "Doe",
"country": "DE",
"billing_information": {
"id": "966a8470-8250-45d7-9ae7-aeaeffc30f28",
"object": "address",
"name": "John",
"representative": null,
"email": "[email protected] ",
"phone": "+49123456789",
"address": "Awesome Street 24",
"city": "Frankfurt",
"postcode": "60311",
"state": null,
"country": "de",
"locale": "en",
"is_company": false,
"vat": null,
"verified_vat": false,
"ip": null,
"shipping_address": false
},
"shipping_information": {
"id": "ad5701b5-5470-44a3-9a56-af458f24f6b3",
"object": "address",
"name": "John Doe",
"email": "[email protected] ",
"phone": "+49123456789",
"address": "Shipping Street 5",
"city": "Frankfurt",
"postcode": "60311",
"state": null,
"country": "de",
"locale": "en",
"shipping_address": true,
"message": null
}
},
"payments": {
"available": [
"stripe",
"mollie",
"bank_transfer"
],
"selected": "stripe"
},
"taxes": {
"total": 950,
"rate": 19,
"inclusive": false
},
"totals": {
"subtotal": 5000,
"tax": 950,
"shipping": 500,
"discount": 0,
"total": 6450
},
"shipping": {
"method": "Standard Shipping",
"cost": 500
},
"discounts": null,
"instalments": null,
"active_instalment_plan": null,
"merchant": {
"name": "Acme Corp",
"country": "DE"
},
"invoice": null,
"affiliate": null,
"payout": null
}
}