Clientes

Clientes te permite crear suscripciones y guardar métodos de pago para usuarios que requieren pagos automáticos.

Objeto Cliente

Atributos

Industria: Transporte
TipoDescripción
idstringIdentificador único de la orden asignado al azar.
namestringNombre del cliente. Longitud máxima de 250 caracteres, no acepta caracteres especiales.
phonestringTeléfono del cliente (formato internacional).
emailstringEmail del cliente.
plan_idstringid secundario de algún plan.
payment_sourcesarrayArreglo de las tarjetas que ya se tokenizaron o están por ser guardadas. Ve a la sección de métodos de pago para más detalles
corporatebooleanIndica si un usuario es corporativo o no.
shipping_contactsarrayInformación de contacto el envío a cliente. Ve a la sección de Contactos de envío para más detalles.
subscriptionsobjectSubscripciones a las que puede estar asociado el cliente. Ve a la sección de Suscripciones para más detalles.
antifraud_infohashInformación relevante de la actividad de la empresa.
account_created_atinteger (32-bit unix timestamp)Fecha de cuando fue creada la cuenta. (opcional si se envía 'id')
first_paid_atinteger (32-bit unix timestamp)Fecha de la primera compra exitosa del cliente. (opcional si se envía 'id')
puts customer.inspect

{
    id: "cus_zzmjKsnM9oacyCwV3",
    object: "customer",
    livemode: false,
    created_at: 1597069683,
    name: "Mario perez",
    email: "[email protected]",
    phone: "+5215555555555",
    corporate: true,
    antifraud_info: {
        account_created_at: 1484040996,
        first_paid_at: 1483544128
    },
    default_shipping_contact_id: "ship_cont_afbur73vpdhdjwgo",
    default_payment_source_id: "src_2fw8YeLSqoaGEYTn3",
    payment_sources: {
        has_more: false,
        object: "list",
        total: 1,
        data: [{
            id: "src_2fw8YeLSqoaGEYTn3",
            name: "Jorge Lopez",
            exp_month: 12,
            exp_year: 19,
            object: "payment_source",
            type: "card",
            created_at: 1597069683,
            last4: "4242",
            brand: "visa",
            parent_id: "cus_zzmjKsnM9oacyCwV3"
        }]
    },
    shipping_contacts: {
        has_more: false,
        object: "list",
        total: 1,
        data: [{
            id: "ship_cont_afbur73vpdhdjwgo",
            object: "shipping_contact",
            created_at: 1597069683,
            phone: "55-5555-5555",
            receiver: "Marvin Fuller",
            between_streets: "Morelos Campeche",
            address: {
                object: "shipping_address",
                street1: "Nuevo Leon 4",
                city: "Ciudad de Mexico",
                state: "Ciudad de Mexico",
                country: "Mexico",
                postal_code: "06100",
                residential: true
            },
            parent_id: "cus_zzmjKsnM9oacyCwV3"
        }]
    },
    subscription: {
        id: "sub_GG1Hk9oRm1DsoCvXW",
        status: "in_trial",
        object: "subscription",
        start: 1385608474,
        billing_cycle_start: 1385608474,
        plan: "gold-plan",
        card: "card_TCuBjUEcy9r41Fk2"
    }
}
{
    "id": "cus_zzmjKsnM9oacyCwV3",
    "object": "customer",
    "livemode": false,
    "created_at": 1597069683,
    "name": "Mario perez",
    "email": "[email protected]",
    "phone": "+5215555555555",
    "corporate": true,
    "antifraud_info":{
        "account_created_at": 1484040996,
        "first_paid_at": 1483544128
    },
    "default_shipping_contact_id": "ship_cont_afbur73vpdhdjwgo",
    "default_payment_source_id": "src_2fw8YeLSqoaGEYTn3",
    "payment_sources": {
        "has_more": false,
        "object": "list",
        "total": 1,
        "data": [{
            "id": "src_2fw8YeLSqoaGEYTn3",
            "name": "Jorge Lopez",
            "exp_month": 12,
            "exp_year": 19,
            "object": "payment_source",
            "type": "card",
            "created_at": 1597069683,
            "last4": "4242",
            "brand": "visa",
            "parent_id": "cus_zzmjKsnM9oacyCwV3"
        }]
    },
    "shipping_contacts": {
        "has_more": false,
        "object": "list",
        "total": 1,
        "data": [{
            "id": "ship_cont_afbur73vpdhdjwgo",
            "object": "shipping_contact",
            "created_at": 1597069683,
            "phone": "55-5555-5555",
            "receiver": "Marvin Fuller",
            "between_streets": "Morelos Campeche",
            "address": {
                "object": "shipping_address",
                "street1": "Nuevo Leon 4",
                "city": "Ciudad de Mexico",
                "state": "Ciudad de Mexico",
                "country": "Mexico",
                "postal_code": "06100",
                "residential": true
            },
            "parent_id": "cus_zzmjKsnM9oacyCwV3"
        }]
    },
    "subscription":{
        "id":"sub_GG1Hk9oRm1DsoCvXW",
        "status":"in_trial",
        "object":"subscription",
        "start":1385608474,
        "billing_cycle_start":1385608474,
        "plan":"gold-plan",
        "card":"card_TCuBjUEcy9r41Fk2"
    }
}
echo $customer

{
    "id": "cus_zzmjKsnM9oacyCwV3",
    "object": "customer",
    "livemode": false,
    "created_at": 1597069683,
    "name": "Mario perez",
    "email": "[email protected]",
    "phone": "+5215555555555",
    "corporate": true,
    "antifraud_info":{
        "account_created_at": 1484040996,
        "first_paid_at": 1483544128
    },
    "default_shipping_contact_id": "ship_cont_afbur73vpdhdjwgo",
    "default_payment_source_id": "src_2fw8YeLSqoaGEYTn3",
    "payment_sources": {
        "has_more": false,
        "object": "list",
        "total": 1,
        "data": [{
            "id": "src_2fw8YeLSqoaGEYTn3",
            "name": "Jorge Lopez",
            "exp_month": 12,
            "exp_year": 19,
            "object": "payment_source",
            "type": "card",
            "created_at": 1597069683,
            "last4": "4242",
            "brand": "visa",
            "parent_id": "cus_zzmjKsnM9oacyCwV3"
        }]
    },
    "shipping_contacts": {
        "has_more": false,
        "object": "list",
        "total": 1,
        "data": [{
            "id": "ship_cont_afbur73vpdhdjwgo",
            "object": "shipping_contact",
            "created_at": 1597069683,
            "phone": "55-5555-5555",
            "receiver": "Marvin Fuller",
            "between_streets": "Morelos Campeche",
            "address": {
                "object": "shipping_address",
                "street1": "Nuevo Leon 4",
                "city": "Ciudad de Mexico",
                "state": "Ciudad de Mexico",
                "country": "Mexico",
                "postal_code": "06100",
                "residential": true
            },
            "parent_id": "cus_zzmjKsnM9oacyCwV3"
        }]
    },
    "subscription":{
        "id":"sub_GG1Hk9oRm1DsoCvXW",
        "status":"in_trial",
        "object":"subscription",
        "start":1385608474,
        "billing_cycle_start":1385608474,
        "plan":"gold-plan",
        "card":"card_TCuBjUEcy9r41Fk2"
    }
}
console.log(customer);

{
    "id": "cus_zzmjKsnM9oacyCwV3",
    "object": "customer",
    "livemode": false,
    "created_at": 1597069683,
    "name": "Mario perez",
    "email": "[email protected]",
    "phone": "+5215555555555",
    "corporate": true,
    "antifraud_info":{
        "account_created_at": 1484040996,
        "first_paid_at": 1483544128
    },
    "default_shipping_contact_id": "ship_cont_afbur73vpdhdjwgo",
    "default_payment_source_id": "src_2fw8YeLSqoaGEYTn3",
    "payment_sources": {
        "has_more": false,
        "object": "list",
        "total": 1,
        "data": [{
            "id": "src_2fw8YeLSqoaGEYTn3",
            "name": "Jorge Lopez",
            "exp_month": 12,
            "exp_year": 19,
            "object": "payment_source",
            "type": "card",
            "created_at": 1597069683,
            "last4": "4242",
            "brand": "visa",
            "parent_id": "cus_zzmjKsnM9oacyCwV3"
        }]
    },
    "shipping_contacts": {
        "has_more": false,
        "object": "list",
        "total": 1,
        "data": [{
            "id": "ship_cont_afbur73vpdhdjwgo",
            "object": "shipping_contact",
            "created_at": 1597069683,
            "phone": "55-5555-5555",
            "receiver": "Marvin Fuller",
            "between_streets": "Morelos Campeche",
            "address": {
                "object": "shipping_address",
                "street1": "Nuevo Leon 4",
                "city": "Ciudad de Mexico",
                "state": "Ciudad de Mexico",
                "country": "Mexico",
                "postal_code": "06100",
                "residential": true
            },
            "parent_id": "cus_zzmjKsnM9oacyCwV3"
        }]
    },
    "subscription":{
        "id":"sub_GG1Hk9oRm1DsoCvXW",
        "status":"in_trial",
        "object":"subscription",
        "start":1385608474,
        "billing_cycle_start":1385608474,
        "plan":"gold-plan",
        "card":"card_TCuBjUEcy9r41Fk2"
    }
}
print customer

{
    "id": "cus_zzmjKsnM9oacyCwV3",
    "object": "customer",
    "livemode": false,
    "created_at": 1597069683,
    "name": "Mario perez",
    "email": "[email protected]",
    "phone": "+5215555555555",
    "corporate": true,
    "antifraud_info":{
        "account_created_at": 1484040996,
        "first_paid_at": 1483544128
    },
    "default_shipping_contact_id": "ship_cont_afbur73vpdhdjwgo",
    "default_payment_source_id": "src_2fw8YeLSqoaGEYTn3",
    "payment_sources": {
        "has_more": false,
        "object": "list",
        "total": 1,
        "data": [{
            "id": "src_2fw8YeLSqoaGEYTn3",
            "name": "Jorge Lopez",
            "exp_month": 12,
            "exp_year": 19,
            "object": "payment_source",
            "type": "card",
            "created_at": 1597069683,
            "last4": "4242",
            "brand": "visa",
            "parent_id": "cus_zzmjKsnM9oacyCwV3"
        }]
    },
    "shipping_contacts": {
        "has_more": false,
        "object": "list",
        "total": 1,
        "data": [{
            "id": "ship_cont_afbur73vpdhdjwgo",
            "object": "shipping_contact",
            "created_at": 1597069683,
            "phone": "55-5555-5555",
            "receiver": "Marvin Fuller",
            "between_streets": "Morelos Campeche",
            "address": {
                "object": "shipping_address",
                "street1": "Nuevo Leon 4",
                "city": "Ciudad de Mexico",
                "state": "Ciudad de Mexico",
                "country": "Mexico",
                "postal_code": "06100",
                "residential": true
            },
            "parent_id": "cus_zzmjKsnM9oacyCwV3"
        }]
    },
    "subscription":{
        "id":"sub_GG1Hk9oRm1DsoCvXW",
        "status":"in_trial",
        "object":"subscription",
        "start":1385608474,
        "billing_cycle_start":1385608474,
        "plan":"gold-plan",
        "card":"card_TCuBjUEcy9r41Fk2"
    }
}
System.out.println(customer.toString());

{
    id = cus_zzmjKsnM9oacyCwV3,
    object = customer,
    livemode = false,
    created_at = 1597069683,
    name = Mario perez,
    email = [email protected],
    phone = +5215555555555,
    corporate = true,
    antifraud_info ={
        account_created_at = 1484040996,
        first_paid_at = 1483544128
    },
    default_shipping_contact_id = ship_cont_afbur73vpdhdjwgo,
    default_payment_source_id = src_2fw8YeLSqoaGEYTn3,
    payment_sources = {
        has_more = false,
        object = list,
        total = 1,
        data = [{
            id = src_2fw8YeLSqoaGEYTn3,
            name = Jorge Lopez,
            exp_month = 12,
            exp_year = 19,
            object = payment_source,
            type = card,
            created_at = 1597069683,
            last4 = 4242,
            brand = visa,
            parent_id = cus_zzmjKsnM9oacyCwV3
        }]
    },
    shipping_contacts = {
        has_more = false,
        object = list,
        total = 1,
        data = [{
            id = ship_cont_afbur73vpdhdjwgo,
            object = shipping_contact,
            created_at = 1597069683,
            phone = 55-5555-5555,
            receiver = Marvin Fuller,
            between_streets = Morelos Campeche,
            address = {
                object = shipping_address,
                street1 = Nuevo Leon 4,
                city = Ciudad de Mexico,
                state = Ciudad de Mexico,
                country = Mexico,
                postal_code = 06100,
                residential = true
            },
            parent_id = cus_zzmjKsnM9oacyCwV3
        }]
    },
    subscription ={
        id =sub_GG1Hk9oRm1DsoCvXW,
        status =in_trial,
        object =subscription,
        start =1385608474,
        billing_cycle_start =1385608474,
        plan =gold-plan,
        card =card_TCuBjUEcy9r41Fk2
    }
}
System.Console.WriteLine(customer);

{
  "id": "cus_zzmjKsnM9oacyCwV3",
  "object": "customer",
  "livemode": false,
  "created_at": 1597069683,
  "name": "Mario Perez",
  "email": "[email protected]",
  "phone": "+5215544443333",
  "corporate": true,
  "antifraud_info": {
    "account_created_at":1484040996,
    "first_paid_at": 1485151007
  },
  "default_shipping_contact_id": "ship_cont_afbur73vpdhdjwgo",
  "default_payment_source_id": "src_2fw8YeLSqoaGEYTn3",
  "payment_sources": {
    "has_more": false,
    "object": "list",
    "total": 1,
    "data": [{
            "id": "src_2fw8YeLSqoaGEYTn3",
            "name": "Jorge Lopez",
            "exp_month": 12,
            "exp_year": 19,
            "object": "payment_source",
            "type": "card",
            "created_at": 1597069683,
            "last4": "4242",
            "brand": "visa",
            "parent_id": "cus_zzmjKsnM9oacyCwV3"
        }]
  },
  "shipping_contacts": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "receiver": "Marvin Fuller",
      "phone": "+5215555555555",
      "between_streets": "Morelos Campeche",
      "address": {
        "street1": "Nuevo Leon 4",
        "street2": "fake street",
        "city": "Ciudad de Mexico",
        "state": "Ciudad de Mexico",
        "country": "mx",
        "residential": true,
        "object": "shipping_address",
        "postal_code": "06100"
      },
      "id": "ship_cont_afbur73vpdhdjwgo",
      "object": "shipping_contact",
      "created_at": 1597069683,
      "parent_id": "cus_zzmjKsnM9oacyCwV3",
      "default": true
    }]
  },
  "subscription": {
    "id": "sub_2fw8YeLSqoaGEYTn4",
    "status": "in_trial",
    "object": "subscription",
    "created_at": 1597069683,
    "subscription_start": 1485843532,
    "trial_end": 1487139532,
    "plan_id": "gold-plan",
    "customer_id": "cus_zzmjKsnM9oacyCwV3",
    "card_id": "src_2fw8YeLSqoaGEYTn3"
  },
}
{
    "id": "cus_zzmjKsnM9oacyCwV3",
    "object": "customer",
    "livemode": false,
    "created_at": 1597069683,
    "name": "Mario perez",
    "email": "[email protected]",
    "phone": "+5215555555555",
    "corporate": true,
    "antifraud_info":{
        "account_created_at": 1484040996,
        "first_paid_at": 1483544128
    },
    "default_shipping_contact_id": "ship_cont_afbur73vpdhdjwgo",
    "default_payment_source_id": "src_2fw8YeLSqoaGEYTn3",
    "payment_sources": {
        "has_more": false,
        "object": "list",
        "total": 1,
        "data": [{
            "id": "src_2fw8YeLSqoaGEYTn3",
            "name": "Jorge Lopez",
            "exp_month": 12,
            "exp_year": 19,
            "object": "payment_source",
            "type": "card",
            "created_at": 1597069683,
            "last4": "4242",
            "brand": "visa",
            "parent_id": "cus_zzmjKsnM9oacyCwV3"
        }]
    },
    "shipping_contacts": {
        "has_more": false,
        "object": "list",
        "total": 1,
        "data": [{
            "id": "ship_cont_afbur73vpdhdjwgo",
            "object": "shipping_contact",
            "created_at": 1597069683,
            "phone": "55-5555-5555",
            "receiver": "Marvin Fuller",
            "between_streets": "Morelos Campeche",
            "address": {
                "object": "shipping_address",
                "street1": "Nuevo Leon 4",
                "city": "Ciudad de Mexico",
                "state": "Ciudad de Mexico",
                "country": "Mexico",
                "postal_code": "06100",
                "residential": true
            },
            "parent_id": "cus_zzmjKsnM9oacyCwV3"
        }]
    },
    "subscription":{
        "id":"sub_GG1Hk9oRm1DsoCvXW",
        "status":"in_trial",
        "object":"subscription",
        "start":1385608474,
        "billing_cycle_start":1385608474,
        "plan":"gold-plan",
        "card":"card_TCuBjUEcy9r41Fk2"
    }
}