Skip to main content

Obtener factura

Para obtener una factura se debe llamar al recurso /invoice/get mediante un método GET.

apiKey
required
string

apiKey del comercio

invoiceId
required
number

Identificador del Invoice

s
required
string

La firma de los parámetros efectuada con su secretKey.

{
  • "apiKey": "string",
  • "invoiceId": 0,
  • "s": "string"
}

Firma de parámetros

Ejemplos de firmado de parámetros en diferentes lenguajes de programación
$secretKey = 'my secret'
$params = array(
'apiKey' => '1F90971E-8276-4715-97FF-2BLG5030EE3B',
'token' => 'AJ089FF5467367'
);
$keys = array_keys($params);
sort($keys);
$toSign = '';
foreach($keys as $key) {
$toSign .= $key . $params[$key];
};
$signature = hash_hmac('sha256', $toSign , $secretKey);

El servicio retorna el objeto invoice.

id
number

Identificador del importe

subscriptionId
string

Identificador de la suscripción

customerId
string

Identificador del cliente

created
string <yyyy-mm-dd hh:mm.ss>

Fecha de creación del importe

subject
string

Descripción del importe

currency
string

Moneda del importe

amount
number

Monto del importe

period_start
string <yyyy-mm-dd hh:mm.ss>

Fecha de inicio del período del importe

period_end
string <yyyy-mm-dd hh:mm.ss>

Fecha de término del período del importe

attemp_count
integer

Número de intentos de cobro del importe

attemped
integer

Si este importe se cobrará:

  • 1 Se cobrará
  • 0 No se cobrará
next_attemp_date
string <yyyy-mm-dd hh:mm.ss>

Fecha del siguiente intento de cobro

due_date
string <yyyy-mm-dd hh:mm.ss>

Fecha en que este importe será considerado moroso

status
integer

Estado del importe:

  • 0 impago
  • 1 pagado
  • 2 anulado
error
integer

Si se produjo un error al intentar cobrar el invoice:

  • 0 Sin error
  • 1 Con error
errorDate
string <yyyy-mm-dd hh:mm.ss>

Fecha en que se produjo el error o null si no hay error

errorDescription
string

Descripción de error o null si no hay error

Array of objects (InvoiceItem)

Items del invoice

object or null (PaymentStatus)

Objeto que representa un cobro y si está pagado su correspondiente pago

object or null (OutsidePayment)

Objeto que muestra los datos de un pago por fuera

paymentLink
string

Link de pago. Cuando el invoice no esta pagado

Array of objects (ChargeAttemps)

Intentos de cargo fallidos

{
  • "id": 1034,
  • "subscriptionId": "sus_azcyjj9ycd",
  • "customerId": "cus_eblcbsua2g",
  • "created": "2018-06-26 17:29:06",
  • "subject": "PlanPesos - período 2018-06-27 / 2018-06-27",
  • "currency": "CLP",
  • "amount": 20000,
  • "period_start": "2018-06-27 00:00:00",
  • "period_end": "2018-07-26 00:00:00",
  • "attemp_count": 0,
  • "attemped": 1,
  • "next_attemp_date": "2018-07-27 00:00:00",
  • "due_date": "2018-06-30 00:00:00",
  • "status": 0,
  • "error": 0,
  • "errorDate": "2018-06-30 00:00:00",
  • "errorDescription": "The minimum amount is 350 CLP",
  • "items": [
    ],
  • "payment": {
    },
  • "outsidePayment": {
    },
  • "chargeAttemps": [
    ]
}