Crear Link de Pago

Crea un nuevo link de pago.

Argumentos

Tipo

Descripción

name

String

Motivo de cobro.

type

String

Este campo representa el tipo de checkout, podría ser PaymentLink.

recurrent

Boolean

false: un solo uso.
true: multiples pagos.

payments_limit_count

Integer

Número máximo de pagos, aplica solamente para links recurrentes.

expires_at

integer (32-bit unix timestamp)

Timestamp de la fecha de expiración del link de pago. El rango válido es de 2 a 365 días (el rango válido se tomará a partir del siguiente día de fecha de creación a las 00:01 hrs)

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.

order_template

Object

Mantiene los atributos con los cuales se creará la orden al recibir un nuevo pago.

line_items

Object

Son los productos a comprar.

customer_info

Object

La información del customer: email, name y phone.

metadata

Object

Es un hash de tipo llave/valor que puede mantener campos custom. Máximo 100 elementos y permite caracteres especiales.

curl --request POST \
  --url https://api.conekta.io/checkouts \
  --header 'accept: application/vnd.conekta-v2.0.0+json' \
  -u key_eYvWV7gSDkNYXsmr: \
  --header 'content-type: application/json' \
  --data '{
    "name": "Payment Link Name",
    "type": "PaymentLink",
    "recurrent": false,
    "expires_at": 1590882634,
    "allowed_payment_methods": ["cash", "card", "bank_transfer"],
    "needs_shipping_contact": true,
    "monthly_installments_enabled": true,
    "monthly_installments_options": [3, 6, 9, 12],
    "order_template": {
        "line_items": [{
            "name": "Red Wine",
            "unit_price": 1000,
            "quantity": 10
        }],
        "currency": "MXN",
        "customer_info": {
            "name": "Juan Perez",
            "email": "[email protected]",
            "phone": "5566982090"
        },
        "metadata": {
            "my_custom_customer_id": "abc123"
        }
    }
 }'
<?php

$checkout = Checkout::create([
  'name' => "Payment Link Name",
  'type' => "PaymentLink",
  'recurrent' => false,
  'expires_at' => 1600882634,
  'allowed_payment_methods' => ["cash", "card", "bank_transfer"],
  'needs_shipping_contact' => true,
  'monthly_installments_enabled' => true,
  'monthly_installments_options' => [3, 6, 9, 12],
  'order_template' => [
    'line_items' => [[
       'name' => "Red Wine",
       'unit_price' => 1000,
       'quantity' => 10
    ]],
    'metadata' => [
      'mycustomkey' => "12345",
      'othercustomkey' => "abcd"
    ],
    'currency' => "MXN",
    'customer_info' => [
      'name' => "Juan Perez",
      'email' => "[email protected]",
         'phone' => "5566982090"
    ],
    'metadata' => [
      'my_custom_customer_id' => 'abc123'
    ]
  ]
 ]);
checkout = Conekta::Checkout.create({
  name: "Payment Link Name",
  type: "PaymentLink",
  recurrent: false,
  expires_at: 1607848572,
  allowed_payment_methods: ["cash", "card", "bank_transfer"],
  needs_shipping_contact: true,
  monthly_installments_enabled: true,
  monthly_installments_options: [3, 6, 9, 12],
  order_template: {
    line_items: [{
      name: "Red Wine",
      unit_price: 200000,
      quantity: 1
    }],
    metadata: {
      mycustomkey: "12345",
      othercustomkey: "abcd"
    },
    currency: "MXN",
    customer_info: {
      name: "Juan Perez",
      email: "[email protected]",
      phone: "5566982090"
    },
    metadata: {
      my_custom_customer_id: "abc123"
    }
  }
})
checkout = conekta.Checkout.create({
   {
       "name": "Payment Link Name",
       "type": "PaymentLink",
       "recurrent": False,
       "expires_at": 1590882634,
       "allowed_payment_methods": ["cash", "card", "bank_transfer"],
       "needs_shipping_contact": True,
       "monthly_installments_enabled": True,
       "monthly_installments_options": [3, 6, 9, 12],
       "order_template": {
           "line_items": [{
               "name": "Red Wine",
               "unit_price": 1000,
               "quantity": 10
           }],
       "currency": "MXN",
       "customer_info": {
          "name": "Juan Perez",
          "email": "[email protected]",
          "phone": "5566982090"
       },
       "metadata": {
          "my_custom_customer_id": "abc123"
       }
     }
   }
})
conekta.Checkout.create({
   {
       "name": "Payment Link Name",
       "type": "PaymentLink",
       "recurrent": false,
       "expires_at": 1590882634,
       "allowed_payment_methods": ["cash", "card", "bank_transfer"],
       "needs_shipping_contact": true,
       "monthly_installments_enabled": true,
       "monthly_installments_options": [3, 6, 9, 12],
       "order_template": {
           "line_items": [{
               "name": "Red Wine",
               "unit_price": 1000,
               "quantity": 10
           }],
       "currency": "MXN",
       "customer_info": {
          "name": "Juan Perez",
          "email": "[email protected]",
          "phone": "5566982090"
       },
       "metadata": {
          "my_custom_customer_id": "abc123"
       }
     }
   }
}, function(err, res) {
  if(err){
    console.log(err);
    return;
  }
  console.log(res.toObject());
});
using Newtonsoft.Json;

var validCheckout = new
  {
    checkout = new
      {
        name = "Payment Link Name",
        type = "PaymentLink",
        recurrent = false,
            expires_at = 1607848572,
        allowed_payment_methods = new string[] 
          {
            "cash", 
            "card", 
            "bank_transfer"
          },
        needs_shipping_contact = true,
        monthly_installments_enabled = true,
        monthly_installments_options = new int[]
          {
            3, 
            6, 
            9, 
            12
          },
        order_template: new
          {
            line_items = new 
              [
                new
                {
                  name = "Red Wine",
                  unit_price = 200000,
                  quantity = 1
                }
              ],
            currency: "MXN",
            customer_info = new 
              {
                name = "Juan Perez",
                email = "[email protected]",
                phone = "5566982090"
              },
            metadata = new 
              {
                my_custom_customer_id = "abc123"
              }
          }
      }
  };

var checkout = new Checkout()
  .create(JsonConvert.SerializeObject(validCheckout));
import  (
    conekta "github.com/conekta/conekta-go"
    "github.com/conekta/conekta-go/checkout"
)
conekta.APIKey = "key_pMcnDF4zFyWKyLG15LuqwA"

checkoutParams := &conekta.Checkout{
        Name:                       "Payment Link Name",
        Type:                       "PaymentLink",
        Recurrent:                  false,
        ExpiresAt:                  time.Now().Unix() + int64(259200) + int64(rand.Float64()*3600),
        AllowedPaymentMethods:      []string{"cash", "card", "bank_transfer"},
        NeedsShippingContact:       true,
        MonthlyInstallmentsEnabled: true,
        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"
            },
        },
}

checkout.Create(checkoutParams)
try {
  Checkout checkout = Checkout.create(
      new JSONObject("{" +
                        "    'name': 'Payment Link Name'," +
                        "    'type': 'PaymentLink'," +
                        "    'recurrent': false," +
                        "    'expires_at': " + Long.toString(System.currentTimeMillis() / 1000L + 259200L) + "," +
                        "    'allowed_payment_methods': ['cash', 'card', 'bank_transfer']," +
                        "    'needs_shipping_contact': true," +
                        "    'monthly_installments_enabled': true," +
                        "    'monthly_installments_options': [3, 6, 9, 12]," +
                        "    'order_template': {" +
                        "      'line_items': [{" +
                        "        'name': 'Red Wine'," +
                        "        'unit_price': 1000," +
                        "        'quantity': 10" +
                        "      }]," +
                        "      'currency': 'MXN'," +
                        "      'customer_info': {" +
                        "        'name': 'Juan Perez'," +
                        "        'email': '[email protected]'," +
                        "        'phone': '5566982090'" +
                        "      }," +
                        "      'metadata': {" +
                        "        'my_custom_customer_id': 'abc123'" +
                        "      }" +
                        "    }" +
                        "  }")
    );
} catch (Conekta::Error e) {
   System.out.println(e.details.get(0).message);
}