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
Tipo | Descripción | |
---|---|---|
id | string | Identificador único asignado al azar. |
object | string | Clase del objeto. En este caso "payment_source". |
type | string | Tipo del método de pago. Por el momento los único tipos permitido son "card" y "oxxo_recurrent". |
created_at | integer (32-bit unix timestamp) | Fecha de creación del método de pago. |
last4 | string | Últimos 4 números de la tarjeta. |
name | string | Nombre del tarjeta habiente. |
exp_month | string | Mes de expiración de la tarjeta. |
exp_year | string | Año de expiración de la tarjeta. |
brand | string | Marca de la tarjeta. |
parent_id | string | Identificador ú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
}