Ir al contenido

tys.orders.create()

Esta página aún no está disponible en tu idioma.

Method@tryyoursize/node

create(order: OutcomeOrderInput, options?: RequestOptions): Promise<OutcomeOrderResult>
orderOutcomeOrderInputObligatorio
Propiedades
idstringObligatorio

Your order ID.

ordered_atstringObligatorio
currencystringOpcional

ISO 4217, e.g. EUR.

visitor_idstringOpcional

The SDK's anonymous visitor ID ((await tys.experiment())?.visitorId), saved with the cart. TryYourSize recomputes the A/B arm from it and stores only its hash. Never a customer ID.

experiment_arm"treatment" | "holdout"Opcional

The arm, when you cannot send visitor_id.

linesOutcomeLineInput[]Obligatorio
Propiedades
idstringObligatorio

Your order line ID (unique within the order).

productstringObligatorio

Your product ID (the one you pass to the SDK).

variantstringOpcional
sizestringObligatorio

The size bought, in your labels.

quantityintegerObligatorio
unit_price_minorintegerOpcional

Price of one unit in minor units (5995 = 59.95). Optional; used for the refund value estimate.

tys_shownbooleanOpcional

A TryYourSize element was shown for this purchase.

recommended_sizestringOpcional

The size TryYourSize recommended (the SDK's recommendation event, or the _tys_size cart line property).

attribution"cart_attribute" | "sdk" | "api"Opcional

Where recommended_size came from.

optionsRequestOptionsOpcional

Promise<OutcomeOrderResult>: What was recorded.

idstringObligatorio
external_idstringObligatorio
createdbooleanObligatorio

False when the order already existed and was updated.

experiment_arm"treatment" | "holdout"Opcional
linesintegerObligatorio
await tys.orders.create({
id: "1001", // your order ID: re-sending updates it
ordered_at: new Date().toISOString(),
currency: "EUR",
visitor_id, // from tys.experiment() in the browser, saved with the cart
lines: [
{ id: "1", product: "TEE-001", size: "M", quantity: 1, recommended_size: "M", tys_shown: true },
],
});

¿Te ha resultado útil esta página?