Crear un checkout

Crear una orden con las opciones disponibles para Checkout.

Argumentos

Tipo

Descripción

name

String

Motivo del cobro.

type

String

Este campo representa el tipo de checkout, podría ser Integration o HostedPayment.

success_url

String

Url de redirección de vuelta hacia el sitio en caso pago exitoso, aplica solamente para HostedPayment.

failure_url

String

Url de redirección de vuelta hacia el sitio en caso pago fallido, aplica solamente para HostedPayment.

expires_at

integer (32-bit unix timestamp)

Timestamp de la fecha de expiración del checkout.

allowed_payment_methods

Array

Son los métodos de pago disponibles para este link.

needs_shipping_contact

Boolean

Esta bandera permite llenar la información de envío en el checkout.

monthly_installments_enabled

Boolean

Esta bandera permite especificar si estará activo meses sin intereses.

monthly_installments_options

Array

Indicar los meses sin intereses activos, por ejemplo 3, 6, 9, 12, 18 meses.

on_demand_enabled

Boolean

Habilitar guardado de tarjetas

planId

String

Identificador del plan asociado al checkout para la Suscripción. (opcional en caso de crear Suscripciones)

Crear un checkout
curl -H "Accept: application/vnd.conekta-v2.0.0+json" \
     -H "Content-type: application/json" \
     -u key_eYvWV7gSDkNYXsmr: \
     -X POST -d '{
        "currency": "MXN",
        "customer_info": {
           "customer_id": "cus_2oAokFrKM7CyVxGJm"
        },
       "line_items": [{
           "name": "Box of Cohiba S1s",
           "unit_price": 300000,
           "quantity": 1
       }],
       "shipping_lines": [{
           "amount": 0
       }],
       "checkout": {
           "allowed_payment_methods": ["cash", "card", "bank_transfer"],
           "monthly_installments_enabled": true,
           "monthly_installments_options": [3,6,9,12,18],
           "expires_at": 1597276799,
           "type": "Integration",
           “planId: “gold-plan”
       },
       "shipping_contact": {
          "phone": "+5215555555555",
          "receiver": "Marvin Fuller",
          "address": {
            "street1": "Nuevo Leon 4",
            "country": "MX",
            "postal_code": "06100"
          }
       }
}' https://api.conekta.io/orders
<?php 

$validOrderWithCheckout =
array(
  'line_items'=> array(
    array(
      'name'=> 'Box of Cohiba S1s',
      'description'=> 'Imported From Mex.',
      'unit_price'=> 120000,
      'quantity'=> 1,
      'sku'=> 'cohbs1',
      'category'=> 'food',
      'tags' => array('food', 'mexican food')
    )
  ),
  'checkout'    => array(
    'type' => 'Integration',
    'allowed_payment_methods' => array("cash", "card", "bank_transfer"),
    'monthly_installments_enabled' => true,
    'monthly_installments_options' => array(3, 6, 9, 12),
    'planId' => 'gold-plan'
  ),
  'customer_info' => array(
    'customer_id' =>  'cus_2oAokFrKM7CyVxGJm'
  ),
  'currency'    => 'mxn',
  'metadata'    => array('test' => 'extra info')
);
$order = Order::create($validOrderWithCheckout);
print_r($order->checkout);
valid_order_with_checkout =
  {
    line_items: [
      {
        name: 'Box of Cohiba S1s',
        description: 'Imported From Mex.',
        unit_price: 120000,
        quantity: 1,
        sku: 'cohbs1',
        category: 'food',
        tags: ['food', 'mexican food']
      }
    ],
    checkout: {
      type: 'Integration',
      allowed_payment_methods: ["cash", "card", "bank_transfer"],
      monthly_installments_enabled: true,
      monthly_installments_options: [3, 6, 9, 12],
      plan_id: 'gold-plan',
    },
    customer_info: {
      customer_id: 'cus_2oAokFrKM7CyVxGJm'
    },
    currency: 'mxn',
    metadata: {'test' => 'extra info'}
  }
order = Conekta::Order.create(valid_order_with_checkout)
checkout = conekta.Checkout.create({
   {
       "name": "Payment Link Name",
       "type": "PaymentLink",
       "recurrent": false,
       "expired_at": 1590882634,
       "allowed_payment_methods": ["cash", "card", "bank_transfer"],
       "needs_shipping_contact": true,
       "monthly_installments_enabled": false,
       "monthly_installments_options": [3, 6, 9, 12],
       "order_template": {
           "line_items": [{
               "name": "Red Wine",
               "unit_price": 1000,
               "quantity": 10
           }],
       "currency": "MXN",
       "customer_info": {
             "customer_id": "cus_2oAokFrKM7CyVxGJm"
       }
     }
   }
}, function(err, checkout) {
    console.log(checkout.toObject());
})
checkout = conekta.Checkout.create({
   {
       "name": "Payment Link Name",
       "type": "PaymentLink",
         "plan_id": "gold-plan",
       "recurrent": False,
       "expired_at": 1590882634,
       "allowed_payment_methods": ["cash", "card", "bank_transfer"],
       "needs_shipping_contact": True,
       "monthly_installments_enabled": False,
       "monthly_installments_options": [3, 6, 9, 12],
       "order_template": {
           "line_items": [{
               "name": "Red Wine",
               "unit_price": 1000,
               "quantity": 10
           }],
       "currency": "MXN",
       "customer_info": {
             "customer_id": "cus_2oAokFrKM7CyVxGJm"
       }
     }
   }
})
using Newtonsoft.Json;

var validOrderWithCheckout = new
  {
    line_items = new 
      [
        new
        {
          name = "Box of Cohiba S1s",
          description = "Imported From Mex.",
          unit_price = 120000,
          quantity = 1,
          sku = "cohbs1",
          category = "food",
          tags = new string[] 
            { 
                "food", 
                "mexican food"
            }
        }
      ],
    checkout = new
      {
        type = "Integration",
        plan_id = "gold-plan",
        allowed_payment_methods = new string[] 
          {
            "cash", 
            "card", 
            "bank_transfer"
          },
        monthly_installments_enabled = true,
        monthly_installments_options = new int[]
          {
            3, 
            6, 
            9, 
            12
          }
      },
    customer_info = new 
      {
        customer_id = "cus_2oAokFrKM7CyVxGJm"
      },
    currency: "mxn",
    metadata: new 
      {
        test = "extra info"
      }
  };

var order = new Order()
  .create(JsonConvert.SerializeObject(validOrderWithCheckout));
import  (
    conekta "github.com/conekta/conekta-go"
    "github.com/conekta/conekta-go/checkout"
)

checkoutParams := &conekta.Checkout{
        Name:                       "Payment Link Name",
        Type:                       "PaymentLink",
        Recurrent:                  false,
        ExpiredAt:                  time.Now().Unix() + int64(259200) + int64(rand.Float64()*3600),
        AllowedPaymentMethods:      []string{"cash", "card", "bank_transfer"},
        NeedsShippingContact:       true,
        MonthlyInstallmentsEnabled: false,
        MonthlyInstallmentsOptions: []int64{3, 6, 9, 12},
        OrderTemplate: &OrderParams{
            Currency: "MXN",
            LineItems: []*LineItemsParams{
                {
                    Name:      "Red Wine",
                    UnitPrice: 1000,
                    Quantity:  10,
                },
            },
            CustomerInfo: &CustomerParams{
                Name:  "Juan Perez",
                Email: "[email protected]",
                Phone: "5566982090",
            },
        },
}

order.Create(checkoutParams)
Checkout.create(new JSONObject("{" +
    "    'name': 'Payment Link Name'," +
    "    'type': 'PaymentLink'," +
    "    'recurrent': false," +
    "    'expired_at': " + Long.toString(System.currentTimeMillis() / 1000L + 259200L) + "," +
    "    'allowed_payment_methods': ['cash', 'card', 'bank_transfer']," +
    "    'needs_shipping_contact': true," +
    "    'monthly_installments_enabled': false," +
    "    'monthly_installments_options': [3, 6, 9, 12]," +
    "    'order_template': {" +
    "      'line_items': [{" +
    "        'name': 'Red Wine'," +
    "        'unit_price': 1000," +
    "        'quantity': 10" +
    "      }]," +
    "      'currency': 'MXN'," +
    "      'customer_info': {" +
    "        'customer_id': 'cus_2oAokFrKM7CyVxGJm'" +
    "      }" +
    "    }" +
    "  }"));