Capturar Orden

Procesa una orden que ha sido previamente autorizada.

Argumentos

Tipo

Descripción

id

string

El ID de la orden.

order = Conekta::Order.find("ord_2fw8EWJusiRrxdPzT")
order.authorize_capture()

{
  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: {}
}
curl -H "Accept: application/vnd.conekta-v2.0.0+json" \
     -H "Content-type: application/json" \
     -u key_eYvWV7gSDkNYXsmr: \
     -X POST https://api.conekta.io/orders/ord_2fw8EWJusiRrxdPzT/capture
$order = \Conekta\Order::find("ord_2fw8EWJusiRrxdPzT")
$order->capture();

{
  "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": {}
}
conekta.Order.find('ord_2fw8EWJusiRrxdPzT', function (err, order) {
  if (err) {
    console.log(err);
    return;
  }
  order.capture(function (errCapture, capture) {
    console.log('errCapture', errCapture);
    console.log('capture', capture);
  });
});

{ 
  livemode: false,
  amount: 35000,
  currency: 'MXN',
  payment_status: 'paid',
  amount_refunded: 0,
  customer_info:
   { email: '[email protected]',
     phone: '+5215555555555',
     name: 'Mario Perez',
     corporate: false,
     customer_id: 'cus_zzmjKsnM9oacyCwV3',
     object: 'customer_info',
     antifraud_info: { paid_transactions: 4 } },
  object: 'order',
  id: 'ord_2fw8EWJusiRrxdPzT',
  metadata: {},
  "created_at": 1597069683,
  updated_at: 1597069683,
  line_items:
   { object: 'list', has_more: false, total: 1, data: [ [Object] ] },
  charges:
   { object: 'list', has_more: false, total: 1, data: [ [Object] ] }
 }
order = conekta.Order.find("ord_2fw8EWJusiRrxdPzT")
order.capture()

{
  "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": {}
}
Order order = Order.find("ord_2fw8EWJusiRrxdPzT");
order.capture();

{
  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 = {}
}
Order order = new Order().find("ord_2fw8EWJusiRrxdPzT");
order.capture();

{
  "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": {}
}
import  (
    conekta "github.com/conekta/conekta-go"
    "github.com/conekta/conekta-go/order"
)

order.Capture("ord_2fw8EWJusiRrxdPzT")