Órdenes

Una orden representa una compra. Incluye todos los detalles relacionados a ella, como método de pago, envío, productos comprados, cargos, descuentos e impuestos.

Objeto Orden

Atributos

TipoDescripción
idstringIdentificador único de la orden asignado al azar.
objectstringClase del objeto. En este caso, "order".
created_atinteger (32-bit unix timestamp)Fecha de creación de la orden.
updated_atinteger (32-bit unix timestamp)Fecha de la última actualización de la orden.
currencystringDivisa con la cual se realizará el cobro. Utiliza el código de 3 letras del Estándar Internacional ISO 4217.
line_itemslistLista de los productos que se venden en la orden. Debe tener al menos un producto.
shipping_lineslistLista de los costos de envío. Si la tienda en línea ofrece productos digitales, este parámetro es opcional.
tax_lineslist (opcional)Lista de los impuestos que se pagan.
discount_lineslist (opcional)Lista de los descuentos que se aplican a la orden.
livemodebooleantrue: Modo de producción. false: Modo de prueba
metadatahashHash en donde el usuario puede enviar información adicional para la orden.
shipping_contacthashDetalles del envío, obligatorio en caso de mandar un shipping_line. Si no recibimos un shipping_contact en la orden, se utilizará el shipping_contact del customer por default.
amountintegerCantidad que se calcula por el sistema a partir de 'line_items', 'shipipng_lines', 'tax_lines' y 'discount_lines'.
amount_refundedintegerCantidad a la cual se hizo un refund a través de la llamada a orders/:order_id/refund.
payment_statusstringEl status del pago de la orden. Este campo es controlado por el sistema y puede ser pending_payment, declined, expired, paid, refunded, partially_refunded, charged_back, pre_authorized y voided.
customer_infohashHash que contiene la información del cliente.
customer_idstringID del cliente. Es obligatorio cuando no se envían los otros campos de customer_info.
namestringNombre del cliente. (opcional si se envía el id)
phonestringTeléfono del cliente. (opcional si se envía el id)
emailstringEmail del cliente. (opcional si se envía el id)
corporatebooleanBooleano que indica si el usuario es corporativo o no, el default es false. (opcional)
antifraud_infohashInformación relevante de la actividad de la empresa.
paid_transactionsintegerNúmero de transacciones del cliente.
account_created_atinteger (32-bit unix timestamp)Fecha de cuando fue creada la cuenta. (opcional si se envía 'customer'.)
first_paid_atinteger (32-bit unix timestamp)Fecha de la primera compra exitosa del cliente. (opcional si se envía 'customer'_info.)
chargeslistLista de los cargos que se generaron para cubrir el monto de la orden.
puts order.inspect

{
  id: "ord_2fw8EWJusiRrxdPzT",
  object: "order",
  livemode: false,
  amount: 35000,
  amount_refunded: 0,
  payment_status: "paid",
  currency: "MXN",
  customer_info: {
    object: "customer_info",
    customer_id: "cus_zzmjKsnM9oacyCwV3",
    name: "Mario Perez",
    email: "[email protected]",
    phone: "+5215555555555",
    antifraud_info: {
      account_created_at: 1484040996,
      first_paid_at: 1485151007,
      paid_transactions: 4
    }
  },
  created_at: 1597069682,
  updated_at: 1597069682,
  line_items: {
    object: "list",
    has_more: false,
    total: 1,
    data: [{
      id: "line_item_2fw8EWJusiRrxdPzR",
      object: "line_item",
      name: "Box of Cohiba S1s",
      unit_price: 35000,
      quantity: 1,
      parent_id: "ord_2fw8EWJusiRrxdPzT",
      antifraud_info: {
        trip_id: "12345",
        driver_id: "driv_1231",
        ticket_type: "economic",
        pickup_latlon: "23.4323456,-123.1234567",
        dropoff_latlon: "23.4323456,-123.1234567"
      },
      metadata: {}
    }]
  },
  charges: {
    object: "list",
    has_more: false,
    total: 1,
    data: [{
      id: "589026bbedbb6e56430016ad",
      object: "charge",
      livemode: false,
      created_at: 1597069682,
      status: "paid",
      amount: 35000,
      paid_at: 1485842112,
      currency: "MXN",
      fee: 1467,
      customer_id: "",
      order_id: "ord_2fw8EWJusiRrxdPzT",
      payment_method: {
        object: "card_payment",
        type: "credit",
        name: "Jorge Lopez",
        exp_month: "12",
        exp_year: "19",
        auth_code: "490884",
        last4: "4242",
        brand: "visa",
        issuer: "",
        account_type: "",
        country: "MX",
        fraud_score: 29,
        fraud_indicators: []
      }
    }]
  },
  metadata: {}
}
{
  "id": "ord_2fw8EWJusiRrxdPzT",
  "object": "order",
  "livemode": false,
  "amount": 35000,
  "amount_refunded": 0,
  "payment_status": "paid",
  "currency": "MXN",
  "customer_info": {
    "object": "customer_info",
    "customer_id": "cus_zzmjKsnM9oacyCwV3",
    "name": "Mario Perez",
    "email": "[email protected]",
    "phone": "+5215555555555",
    "antifraud_info":{
      "account_created_at": 1484040996,
      "first_paid_at": 1485151007,
      "paid_transactions": 4
    }
  },
  "created_at": 1597069682,
  "updated_at": 1597069682,
  "line_items": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "id": "line_item_2fw8EWJusiRrxdPzR",
      "object": "line_item",
      "name": "Box of Cohiba S1s",
      "unit_price": 35000,
      "quantity": 1,
      "parent_id": "ord_2fw8EWJusiRrxdPzT",
      "antifraud_info": {
        "trip_id": "12345",
        "driver_id": "driv_1231",
        "ticket_class": "economic",
        "pickup_latlon": "23.4323456,-123.1234567",
        "dropoff_latlon": "23.4323456,-123.1234567"
      },
      "metadata": {}
    }]
  },
  "charges": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "id": "589026bbedbb6e56430016ad",
      "object": "charge",
      "livemode": false,
      "created_at": 1597069682,
      "status": "paid",
      "amount": 35000,
      "paid_at": 1485842112,
      "currency": "MXN",
      "fee": 1467,
      "customer_id": "",
      "order_id": "ord_2fw8EWJusiRrxdPzT",
      "payment_method": {
        "object": "card_payment",
        "type": "credit",
        "name": "Jorge Lopez",
        "exp_month": "12",
        "exp_year": "19",
        "auth_code": "490884",
        "last4": "4242",
        "brand": "visa",
        "issuer": "",
        "account_type": "",
        "country": "MX",
        "fraud_score": 29,
        "fraud_indicators": []
      }
    }]
  },
  "metadata": {}
}
echo $order

{
  "id": "ord_2fw8EWJusiRrxdPzT",
  "object": "order",
  "livemode": false,
  "amount": 35000,
  "amount_refunded": 0,
  "payment_status": "paid",
  "currency": "MXN",
  "customer_info": {
    "object": "customer_info",
    "customer_id": "cus_zzmjKsnM9oacyCwV3",
    "name": "Mario Perez",
    "email": "[email protected]",
    "phone": "+5215555555555",
    "antifraud_info":{
      "account_created_at": 1484040996,
      "first_paid_at": 1485151007,
      "paid_transactions": 4
    }
  },
  "created_at": 1597069682,
  "updated_at": 1597069682,
  "line_items": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "id": "line_item_2fw8EWJusiRrxdPzR",
      "object": "line_item",
      "name": "Box of Cohiba S1s",
      "unit_price": 35000,
      "quantity": 1,
      "parent_id": "ord_2fw8EWJusiRrxdPzT",
      "antifraud_info": {
        "trip_id": "12345",
        "driver_id": "driv_1231",
        "ticket_class": "economic",
        "pickup_latlon": "23.4323456,-123.1234567",
        "dropoff_latlon": "23.4323456,-123.1234567"
      },
      "metadata": {}
    }]
  },
  "charges": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "id": "589026bbedbb6e56430016ad",
      "object": "charge",
      "livemode": false,
      "created_at": 1597069682,
      "status": "paid",
      "amount": 35000,
      "paid_at": 1485842112,
      "currency": "MXN",
      "fee": 1467,
      "customer_id": "",
      "order_id": "ord_2fw8EWJusiRrxdPzT",
      "payment_method": {
        "object": "card_payment",
        "type": "credit",
        "name": "Jorge Lopez",
        "exp_month": "12",
        "exp_year": "19",
        "auth_code": "490884",
        "last4": "4242",
        "brand": "visa",
        "issuer": "",
        "account_type": "",
        "country": "MX",
        "fraud_score": 29,
        "fraud_indicators": []
      }
    }]
  },
  "metadata": {}
}
console.log(order);

{
  "id": "ord_2fw8EWJusiRrxdPzT",
  "object": "order",
  "livemode": false,
  "amount": 35000,
  "amount_refunded": 0,
  "payment_status": "paid",
  "currency": "MXN",
  "customer_info": {
    "object": "customer_info",
    "customer_id": "cus_zzmjKsnM9oacyCwV3",
    "name": "Mario Perez",
    "email": "[email protected]",
    "phone": "+5215555555555",
    "antifraud_info":{
      "account_created_at": 1484040996,
      "first_paid_at": 1485151007,
      "paid_transactions": 4
    }
  },
  "created_at": 1597069682,
  "updated_at": 1597069682,
  "line_items": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "id": "line_item_2fw8EWJusiRrxdPzR",
      "object": "line_item",
      "name": "Box of Cohiba S1s",
      "unit_price": 35000,
      "quantity": 1,
      "parent_id": "ord_2fw8EWJusiRrxdPzT",
      "antifraud_info": {
        "trip_id": "12345",
        "driver_id": "driv_1231",
        "ticket_class": "economic",
        "pickup_latlon": "23.4323456,-123.1234567",
        "dropoff_latlon": "23.4323456,-123.1234567"
      },
      "metadata": {}
    }]
  },
  "charges": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "id": "589026bbedbb6e56430016ad",
      "object": "charge",
      "livemode": false,
      "created_at": 1597069682,
      "status": "paid",
      "amount": 35000,
      "paid_at": 1485842112,
      "currency": "MXN",
      "fee": 1467,
      "customer_id": "",
      "order_id": "ord_2fw8EWJusiRrxdPzT",
      "payment_method": {
        "object": "card_payment",
        "type": "credit",
        "name": "Jorge Lopez",
        "exp_month": "12",
        "exp_year": "19",
        "auth_code": "490884",
        "last4": "4242",
        "brand": "visa",
        "issuer": "",
        "account_type": "",
        "country": "MX",
        "fraud_score": 29,
        "fraud_indicators": []
      }
    }]
  },
  "metadata": {}
}
print order

{
  "id": "ord_2fw8EWJusiRrxdPzT",
  "object": "order",
  "livemode": false,
  "amount": 35000,
  "amount_refunded": 0,
  "payment_status": "paid",
  "currency": "MXN",
  "customer_info": {
    "object": "customer_info",
    "customer_id": "cus_zzmjKsnM9oacyCwV3",
    "name": "Mario Perez",
    "email": "[email protected]",
    "phone": "+5215555555555",
    "antifraud_info":{
      "account_created_at": 1484040996,
      "first_paid_at": 1485151007,
      "paid_transactions": 4
    }
  },
  "created_at": 1597069682,
  "updated_at": 1597069682,
  "line_items": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "id": "line_item_2fw8EWJusiRrxdPzR",
      "object": "line_item",
      "name": "Box of Cohiba S1s",
      "unit_price": 35000,
      "quantity": 1,
      "parent_id": "ord_2fw8EWJusiRrxdPzT",
      "antifraud_info": {
        "trip_id": "12345",
        "driver_id": "driv_1231",
        "ticket_class": "economic",
        "pickup_latlon": "23.4323456,-123.1234567",
        "dropoff_latlon": "23.4323456,-123.1234567"
      },
      "metadata": {}
    }]
  },
  "charges": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "id": "589026bbedbb6e56430016ad",
      "object": "charge",
      "livemode": false,
      "created_at": 1597069682,
      "status": "paid",
      "amount": 35000,
      "paid_at": 1485842112,
      "currency": "MXN",
      "fee": 1467,
      "customer_id": "",
      "order_id": "ord_2fw8EWJusiRrxdPzT",
      "payment_method": {
        "object": "card_payment",
        "type": "credit",
        "name": "Jorge Lopez",
        "exp_month": "12",
        "exp_year": "19",
        "auth_code": "490884",
        "last4": "4242",
        "brand": "visa",
        "issuer": "",
        "account_type": "",
        "country": "MX",
        "fraud_score": 29,
        "fraud_indicators": []
      }
    }]
  },
  "metadata": {}
}
System.out.println(order.toString());

{
  id = ord_2fw8EWJusiRrxdPzT,
  object = order,
  livemode = false,
  amount = 35000,
  amount_refunded = 0,
  payment_status = paid,
  currency = MXN,
  customer_info = {
    object = customer_info,
    customer_id = cus_zzmjKsnM9oacyCwV3,
    name = Mario Perez,
    email = [email protected],
    phone = +5215555555555,
    antifraud_info ={
      account_created_at = 1484040996,
      first_paid_at = 1485151007,
      paid_transactions = 4
    }
  },
  created_at = 1597069682,
  updated_at = 1597069682,
  line_items = {
    object = list,
    has_more = false,
    total = 1,
    data = [{
      id = line_item_2fw8EWJusiRrxdPzR,
      object = line_item,
      name = Box of Cohiba S1s,
      unit_price = 35000,
      quantity = 1,
      parent_id = ord_2fw8EWJusiRrxdPzT,
      antifraud_info = {
        trip_id = 12345,
        driver_id = driv_1231,
        ticket_class = economic,
        pickup_latlon = 23.4323456,-123.1234567,
        dropoff_latlon = 23.4323456,-123.1234567
      },
      metadata = {}
    }]
  },
  charges = {
    object = list,
    has_more = false,
    total = 1,
    data = [{
      id = 589026bbedbb6e56430016ad,
      object = charge,
      livemode = false,
      created_at = 1597069682,
      status = paid,
      amount = 35000,
      paid_at = 1485842112,
      currency = MXN,
      fee = 1467,
      customer_id = ,
      order_id = ord_2fw8EWJusiRrxdPzT,
      payment_method = {
        object = card_payment,
        type = credit,
        name = Jorge Lopez,
        exp_month = 12,
        exp_year = 19,
        auth_code = 490884,
        last4 = 4242,
        brand = visa,
        issuer = ,
        account_type = ,
        country = MX,
        fraud_score = 29,
        fraud_indicators = []
      }
    }]
  },
  metadata = {}
}
System.Console.WriteLine(order);

{
  "id": "ord_2fw8EWJusiRrxdPzT",
  "object": "order",
  "livemode": false,
  "amount": 35000,
  "amount_refunded": 0,
  "payment_status": "paid",
  "currency": "MXN",
  "customer_info": {
    "object": "customer_info",
    "customer_id": "cus_zzmjKsnM9oacyCwV3",
    "name": "Mario Perez",
    "email": "[email protected]",
    "phone": "+5215555555555",
    "antifraud_info":{
      "account_created_at": 1484040996,
      "first_paid_at": 1485151007,
      "paid_transactions": 4
    }
  },
  "created_at": 1597069683,
  "updated_at": 1597069683,
  "line_items": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "id": "line_item_2fw8EWJusiRrxdPzR",
      "object": "line_item",
      "name": "Box of Cohiba S1s",
      "unit_price": 35000,
      "quantity": 1,
      "parent_id": "ord_2fw8EWJusiRrxdPzT",
      "antifraud_info": {
        "trip_id": "12345",
        "driver_id": "driv_1231",
        "ticket_class": "economic",
        "pickup_latlon": "23.4323456,-123.1234567",
        "dropoff_latlon": "23.4323456,-123.1234567"
      },
      "metadata": {}
    }]
  },
  "charges": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "id": "589026bbedbb6e56430016ad",
      "object": "charge",
      "livemode": false,
      "created_at": 1597069683,
      "status": "paid",
      "amount": 35000,
      "paid_at": 1485842112,
      "currency": "MXN",
      "fee": 1467,
      "customer_id": "",
      "order_id": "ord_2fw8EWJusiRrxdPzT",
      "payment_method": {
        "object": "card_payment",
        "type": "credit",
        "name": "Jorge Lopez",
        "exp_month": "12",
        "exp_year": "19",
        "auth_code": "490884",
        "last4": "4242",
        "brand": "visa",
        "issuer": "",
        "account_type": "",
        "country": "MX",
        "fraud_score": 29,
        "fraud_indicators": []
      }
    }]
  },
  "metadata": {}
}
{
  "id": "ord_2fw8EWJusiRrxdPzT",
  "object": "order",
  "livemode": false,
  "amount": 35000,
  "amount_refunded": 0,
  "payment_status": "paid",
  "currency": "MXN",
  "customer_info": {
    "object": "customer_info",
    "customer_id": "cus_zzmjKsnM9oacyCwV3",
    "name": "Mario Perez",
    "email": "[email protected]",
    "phone": "+5215555555555",
    "antifraud_info":{
      "account_created_at": 1484040996,
      "first_paid_at": 1485151007,
      "paid_transactions": 4
    }
  },
  "created_at": 1597069682,
  "updated_at": 1597069682,
  "line_items": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "id": "line_item_2fw8EWJusiRrxdPzR",
      "object": "line_item",
      "name": "Box of Cohiba S1s",
      "unit_price": 35000,
      "quantity": 1,
      "parent_id": "ord_2fw8EWJusiRrxdPzT",
      "antifraud_info": {
        "trip_id": "12345",
        "driver_id": "driv_1231",
        "ticket_class": "economic",
        "pickup_latlon": "23.4323456,-123.1234567",
        "dropoff_latlon": "23.4323456,-123.1234567"
      },
      "metadata": {}
    }]
  },
  "charges": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "id": "589026bbedbb6e56430016ad",
      "object": "charge",
      "livemode": false,
      "created_at": 1597069682,
      "status": "paid",
      "amount": 35000,
      "paid_at": 1485842112,
      "currency": "MXN",
      "fee": 1467,
      "customer_id": "",
      "order_id": "ord_2fw8EWJusiRrxdPzT",
      "payment_method": {
        "object": "card_payment",
        "type": "credit",
        "name": "Jorge Lopez",
        "exp_month": "12",
        "exp_year": "19",
        "auth_code": "490884",
        "last4": "4242",
        "brand": "visa",
        "issuer": "",
        "account_type": "",
        "country": "MX",
        "fraud_score": 29,
        "fraud_indicators": []
      }
    }]
  },
  "metadata": {}
}