# createOrder(JSON dataOrder)

Al invocar este método, se encarga de crear un pedido para el cliente en la plataforma onDelivery

<div id="bkmrk-a-continuaci%C3%B3n-se-de"><details class="mb-m" id="bkmrk-a-continuaci%C3%B3n-se-de-0"><summary class="text-muted">A continuación se describen los atributos que se reciben como respuesta del JSON:</summary>

<div></div><div><table class="table" style="height: 1117px; width: 619px;" width="811"><tbody><tr style="height: 41px;"><th style="width: 320px; height: 41px;">Atributos</th><th style="width: 301px; height: 41px;">Definición </th></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**inicio**</td><td style="width: 301px; height: 41px;">Hora de entrega / Inicio</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**fin**</td><td style="width: 301px; height: 41px;">Hora de entrega / Final

</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**idcliente\_od**</td><td style="width: 301px; height: 41px;">ID del cliente con el que se identifica en el sistema</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**idstatus\_pedido\_od**</td><td style="width: 301px; height: 41px;">ID del estatus del pedido con el que se identifica en el sistema</td></tr><tr style="height: 58px;"><td style="width: 320px; height: 58px;">**num\_factura**</td><td style="width: 301px; height: 58px;">Número de la factura del pedido</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**comentario**</td><td style="width: 301px; height: 41px;">Comentario sobre el pedido

</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**tiempo\_servicio**</td><td style="width: 301px; height: 41px;">Tiempo que le deberá tomar al operador realizar la entrega en minutos</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**numero\_pedido**</td><td style="width: 301px; height: 41px;">Número del pedido</td></tr><tr style="height: 58px;"><td style="width: 320px; height: 58px;">**cantidad**</td><td style="width: 301px; height: 58px;">Cantidad de productos en el pedido</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**idalmacen\_od**</td><td style="width: 301px; height: 41px;">ID del almacén con el que se identifica en el sistema</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**iddomicilio**</td><td style="width: 301px; height: 41px;">ID del domicilio con el que se identifica en el sistema

</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**afecta\_inventario**</td><td style="width: 301px; height: 41px;">?</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**detalle\_productos**</td><td style="width: 301px; height: 41px;">Bandera de si se uso (1) o no (0) la opción de detalle de pedido</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**peso\_total**</td><td style="width: 301px; height: 41px;">Peso total del pedido (Puede ir vació si y solo si detalle\_productos es '1')</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**volumen\_total**</td><td style="width: 301px; height: 41px;">Volumen total del pedido (Puede ir vació si y solo si detalle\_productos es '1')</td></tr><tr style="height: 58px;"><td style="width: 320px; height: 58px;">**costo\_total**</td><td style="width: 301px; height: 58px;">Costo total del pedido</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**detalle**</td><td style="width: 301px; height: 41px;">Arreglo con los productos seleccionados para el pedido</td></tr></tbody></table>

</div></details></div>##### Ejemplo de JSON:

```JavaScript
let dataOrder = {
'inicio':'2021-01-22 09:00:00',
'fin':'2021-01-22 18:00:00',
'idcliente_od':'1457',
'idstatus_pedido_od':'1',
'num_factura':'123',
'comentario':'comentarios del pedido',
'tiempo_servicio':'10',
'numero_pedido':'1',
'cantidad':'1',
'idalmacen_od':'0',
'iddomicilio':'1589',
'afecta_inventario':'1',
'detalle_productos':'0',
'peso_total':'5',
'volumen_total':'10',
'costo_total':'500',
'detalle':[]
}
```

<div id="bkmrk-ejemplo-de-solicitud"><span style="color: #bbbbbb; font-size: 1.4em; font-weight: 400;">Ejemplo de solicitud en JS:</span></div>```JavaScript
try {
      const order  = await _gpsApiv2.createOrder(dataOrder); 
 	} catch (error) {
	  console.error(error);
	}
```

<details class="mb-m" id="bkmrk-body-parametersparam"><summary class="text-muted">A continuación se describen los atributos que se reciben como respuesta de la solicitud en JSON:</summary>

<div></div><div><table class="table" style="height: 1117px; width: 619px;" width="811"><tbody><tr style="height: 41px;"><th style="width: 320px; height: 41px;">Atributos</th><th style="width: 301px; height: 41px;">Definición </th></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**cantidad**</td><td style="width: 301px; height: 41px;">Cantidad de productos en el pedido</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**codigo\_rastreo**</td><td style="width: 301px; height: 41px;">Código de rastreo del pedido

</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**comentarios**</td><td style="width: 301px; height: 41px;">Comentarios sobre el pedido</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**costo\_total**</td><td style="width: 301px; height: 41px;">Costo total del pedido</td></tr><tr style="height: 58px;"><td style="width: 320px; height: 58px;">**estado**</td><td style="width: 301px; height: 58px;">ID del estado en el que sen encuentra el pedido y con el que se identifica en el sistema</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**id**</td><td style="width: 301px; height: 41px;">ID del pedido creado con el que se identifica en el sistema

</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**idalmacen\_od**</td><td style="width: 301px; height: 41px;">ID del almacén con el que se identifica en el sistema</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**idcliente\_distribuidor**</td><td style="width: 301px; height: 41px;">ID del distribuidor con el que se identifica en el sistema</td></tr><tr style="height: 58px;"><td style="width: 320px; height: 58px;">**idcliente\_od**</td><td style="width: 301px; height: 58px;">ID del cliente con el que se identifica en el sistema de onDelivery</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**idcliente\_sistema**</td><td style="width: 301px; height: 41px;"> ID del cliente con el que se identifica en el sistema</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**iddomicilio\_cliente\_od**</td><td style="width: 301px; height: 41px;">ID del domicilio del cliente con el que se identifica en el sistema de onDelivery

</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**idmoneda**</td><td style="width: 301px; height: 41px;"> ID de la moneda con el que se identifica en el sistema</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**idstatus\_pedido\_od**</td><td style="width: 301px; height: 41px;">ID del estatus del pedido con el que se identifica en el sistema de onDelivery</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**idusuario\_sistema**</td><td style="width: 301px; height: 41px;">ID del usuario que creo el pedido con el que se identifica en el sistema</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**impuesto**</td><td style="width: 301px; height: 41px;">Valor del impuesto sobre el total del pedido</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**inventario\_afectado**</td><td style="width: 301px; height: 41px;">?</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**num\_factura**</td><td style="width: 301px; height: 41px;">Número de la factura del pedido</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**numero\_pedido**</td><td style="width: 301px; height: 41px;">Número del pedido</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**pagado**</td><td style="width: 301px; height: 41px;">Bandera (true, false) que indica si el pedido ya fue pagado o no</td></tr><tr style="height: 58px;"><td style="width: 320px; height: 58px;">**peso\_total**</td><td style="width: 301px; height: 58px;">Peso total del pedido</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**subtotal**</td><td style="width: 301px; height: 41px;">Subtotal del pedido</td></tr><tr style="height: 41px;"><td style="width: 320px; height: 41px;">**tiempo\_servicio**</td><td style="width: 301px; height: 41px;">Tiempo que le deberá tomar al operador realizar la entrega (minutos)</td></tr><tr><td style="width: 320px;">**timestamp\_fin**</td><td style="width: 301px;">Hora de entrega / Final</td></tr><tr><td style="width: 320px;">**timestamp\_inicio**</td><td style="width: 301px;">Hora de entrega / Inicio</td></tr><tr><td style="width: 320px;">**volumen\_total**</td><td style="width: 301px;">Volumen total del pedido</td></tr></tbody></table>

</div></details>##### Respuesta de ejemplo:

```JSON
{
	 status:'200'
	 data:'{'
		 idInterno_direccion: [
			 cantidad:'1'
			 codigo_rastreo:'0712041360994'
			 comentarios:'comentarios del pedido'
			 costo_total:'500'
			 estado:1
			 id:'1070'
			 idalmacen_od:'0'
			 idcliente_distribuidor:'4220'
			 idcliente_od:'1457'
			 idcliente_sistema:'4221'
			 iddomicilio_cliente_od:'1589'
			 idmoneda:'4'
			 idstatus_pedido_od:'1'
			 idusuario_sistema:'5163'
			 impuesto:'68.97'
			 inventario_afectado:'1'
			 num_factura:'123'
			 numero_pedido:'1'
			 pagado:false
			 peso_total:'5'
			 subtotal:'431.03'
			 tiempo_servicio:'10'
			 timestamp_fin:'2021-01-22 18:00:00'
			 timestamp_inicio:'2021-01-22 09:00:00'
			 volumen_total:'10'
		 ]
	 }
}

```