Métodos de Pago

El objeto Payment Source describe el método de pago. Pueden ser pagos en efectivo, con tarjeta de débito o crédito y transferencias. Recuerda que tendrás que agregar un webhook listener para los pagos en efectivo.

Objeto Método de Pago

Atributos

TipoDescripción
idstringIdentificador único asignado al azar.
objectstringClase del objeto. En este caso "payment_source".
typestringTipo del método de pago. Por el momento los único tipos permitido son "card" y "oxxo_recurrent".
created_atinteger (32-bit unix timestamp)Fecha de creación del método de pago.
last4stringÚltimos 4 números de la tarjeta.
namestringNombre del tarjeta habiente.
exp_monthstringMes de expiración de la tarjeta.
exp_yearstringAño de expiración de la tarjeta.
brandstringMarca de la tarjeta.
parent_idstringIdentificador único del cliente al que pertenece el método de pago.
puts payment_source.inspect

{
  id: "src_2fw8YeLSqoaGEYTn3",
  object: "payment_source",
  type: "card",
  address: {
    street1: "Tamesis",
    street2: "114",
    city: "Monterrey",
    state: "Nuevo Leon 4",
    country: "mx",
    object: "address",
    postal_code: "64700"
  },
  created_at: 1597069683,
  last4: "4242",
  bin: "424242",
  exp_month: "12",
  exp_year: "20",
  brand: "VISA",
  name: "Mario perez",
  parent_id: "cus_zzmjKsnM9oacyCwV3",
  default: false
}
{
  "id": "src_2fw8YeLSqoaGEYTn3",
  "object": "payment_source",
  "type": "card",
  "address": {
    "street1": "Tamesis",
    "street2": "114",
    "city": "Monterrey",
    "state": "Nuevo Leon 4",
    "country": "mx",
    "object": "address",
    "postal_code": "64700"
  },
  "created_at": 1597069683,
  "last4": "4242",
  "bin": "424242",
  "exp_month": "12",
  "exp_year": "20",
  "brand": "VISA",
  "name": "Mario perez",
  "parent_id": "cus_zzmjKsnM9oacyCwV3",
  "default": false
}
echo $payment_source;

{
  "id": "src_2fw8YeLSqoaGEYTn3",
  "object": "payment_source",
  "type": "card",
  "address": {
    "street1": "Tamesis",
    "street2": "114",
    "city": "Monterrey",
    "state": "Nuevo Leon 4",
    "country": "mx",
    "object": "address",
    "postal_code": "64700"
  },
  "created_at": 1597069683,
  "last4": "4242",
  "bin": "424242",
  "exp_month": "12",
  "exp_year": "20",
  "brand": "VISA",
  "name": "Mario perez",
  "parent_id": "cus_zzmjKsnM9oacyCwV3",
  "default": false
}
console.log(payment_source);

{
  "id": "src_2fw8YeLSqoaGEYTn3",
  "object": "payment_source",
  "type": "card",
  "address": {
    "street1": "Tamesis",
    "street2": "114",
    "city": "Monterrey",
    "state": "Nuevo Leon 4",
    "country": "mx",
    "object": "address",
    "postal_code": "64700"
  },
  "created_at": 1597069683,
  "last4": "4242",
  "bin": "424242",
  "exp_month": "12",
  "exp_year": "20",
  "brand": "VISA",
  "name": "Mario perez",
  "parent_id": "cus_zzmjKsnM9oacyCwV3",
  "default": false
}
print payment_source

{
  "id": "src_2fw8YeLSqoaGEYTn3",
  "object": "payment_source",
  "type": "card",
  "address": {
    "street1": "Tamesis",
    "street2": "114",
    "city": "Monterrey",
    "state": "Nuevo Leon 4",
    "country": "mx",
    "object": "address",
    "postal_code": "64700"
  },
  "created_at": 1597069683,
  "last4": "4242",
  "bin": "424242",
  "exp_month": "12",
  "exp_year": "20",
  "brand": "VISA",
  "name": "Mario perez",
  "parent_id": "cus_zzmjKsnM9oacyCwV3",
  "default": false
}
System.out.println(payment_source.toString());

{
  id: src_2fw8YeLSqoaGEYTn3,
  object: payment_source,
  type: card,
  address: {
    street1: Tamesis,
    street2: 114,
    city: Monterrey,
    state: Nuevo Leon 4,
    country: mx,
    object: address,
    postal_code: 64700
  },
  "created_at": 1597069683,
  last4: 4242,
  bin: 424242,
  exp_month: 12,
  exp_year: 20,
  brand: VISA,
  name: Mario perez,
  parent_id: cus_zzmjKsnM9oacyCwV3,
  default: false
}
System.Console.WriteLine(customer);
{
  "id": "src_2fw8YeLSqoaGEYTn3",
  "object": "payment_source",
  "type": "card",
  "address": {
    "street1": "Tamesis",
    "street2": "114",
    "city": "Monterrey",
    "state": "Nuevo Leon 4",
    "country": "mx",
    "object": "address",
    "postal_code": "64700"
  },
  "created_at": 1597069683,
  "last4": "4242",
  "bin": "424242",
  "exp_month": "12",
  "exp_year": "20",
  "brand": "VISA",
  "name": "Mario perez",
  "parent_id": "cus_zzmjKsnM9oacyCwV3",
  "default": false
}
{
  "id": "src_2fw8YeLSqoaGEYTn3",
  "object": "payment_source",
  "type": "card",
  "address": {
    "street1": "Tamesis",
    "street2": "114",
    "city": "Monterrey",
    "state": "Nuevo Leon 4",
    "country": "mx",
    "object": "address",
    "postal_code": "64700"
  },
  "created_at": 1597069683,
  "last4": "4242",
  "bin": "424242",
  "exp_month": "12",
  "exp_year": "20",
  "brand": "VISA",
  "name": "Mario perez",
  "parent_id": "cus_zzmjKsnM9oacyCwV3",
  "default": false
}