Navegación Navbar
cURL PHP Ruby Node.js Python
  • Introducción
  • Autenticación
  • Errores
  • Paginación, filtros y orden
  • Webhooks
  • Pruebas y Sandbox
  • Clientes
  • Tarjetas
  • Planes
  • Suscripciones
  • Transacciones
  • Retiros
  • Eventos
  • Webpay Plus
  • Introducción

     _          _ _
    | |__   ___| | | ___
    | '_ \ / _ \ | |/ _ \
    | | | |  __/ | | (_) |
    |_| |_|\___|_|_|\___/     _
    __      _____  _ __| | __| |
    \ \ /\ / / _ \| '__| |/ _` |
     \ V  V / (_) | |  | | (_| |
      \_/\_/ \___/|_|  |_|\__,_|
    

    Bienvenido a la API de QVO. Puedes usar nuestra API para acceder a los distintos endpoints de QVO, donde podrás generar y gestionar pagos mediante distintos métodos y obtener información de ellos.

    El API esta organizado alrededor de REST. Nuestra API posee URLs predecibles y orientadas a recursos, y utiliza códigos de respuesta HTTP para indicar el resultado de la llamada. Todas las respuestas de la API retornan objetos JSON, incluyendo los errores, sin embargo, nuestros SDK convertirán las respuestas a objetos específicos de cada lenguaje.

    Utilizamos características incluidas en el protocolo HTTP, como autenticación y verbos, los cuales son soportados por la gran mayoría de los clientes HTTP. Soportamos CORS, lo cual permite interactuar de manera segura con nuestra API desde una aplicación web desde el lado del cliente.

    Tenemos bindings para cURL, PHP, Ruby, Node.js y Python! Puedes ver ejemplos de código en el área a la derecha, y puedes cambiar el lenguaje de los ejemplos arriba a la derecha.

    Autenticación

    QVO utiliza Token Based Authentication sobre HTTPS para la autenticación. Para tener acceso a nuestra API, accede a tu cuenta en nuestro panel y utiliza el token que se encuentra en la sección API. Si no tienes una cuenta, puedes crearla aquí. Los request no autenticados retornarán una respuesta HTTP 401. Las llamadas sobre HTTP simple también fallarán.

    Header de autenticación

    El header Authorization debe verse así:

    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA
    

    Este tiene el siguiente formato:

    Authorization: Bearer <api_token>

    Donde api_token es el asociado a la cuenta del comercio.

    Errores

    Ejemplo de respuesta

    {
      "error": {
        "type": "invalid_request_error",
        "message": "amount parameter required",
        "param": "amount"
      }
    }
    

    QVO usa respuestas HTTP convencionales para indicar el éxito o fracaso de un request. En general, códigos en el rango de los 2xx indican éxito, códigos en el rango 4xx indican un error que falló debido a la información proporcionada (ej: un parámetro requerido fue omitido, un pago falló, etc.), y códigos en el rango de los 5xx indican un error con los servidores de QVO (estos son raros).

    Atributos

    type

    string

    El tipo de error. Puede ser: api_error, authentication error, invalid_request_error o rate_limit_error.
    message

    string

    opcional

    Un mensaje legible que provee mas detalles acerca del error.
    param

    string

    opcional

    El parámetro al cual se relaciona el error.

    Códigos de error

    400

    Bad Request

    Hay un problema con tu request 🙈
    401

    Unauthorized

    Tu api key es incorrecta 🔐
    403

    Forbidden

    No tienes permiso para ver esta página 🚫
    404

    Not Found

    El recurso especificado no fue encontrado 😔
    405

    Method Not Allowed

    Trataste de ingresar a un recurso con un método inválido
    406

    Not Acceptable

    Solicistaste un formato que no es json 😣
    410

    Gone

    El recurso solicitado fue removido de nuestros servidores 🏃
    418 Soy una tetera 😗☕️
    422

    Unprocessable Entity

    No podemos procesar tu solicitud, revísala. 👀️
    429

    Too Many Requests

    Estas solicitando muchos recursos! Detente! ✋
    500

    Internal Server Error

    Tuvimos un problema con nuestro servidor. 😰 Inténtalo nuevamente mas tarde (estos son raros)
    503

    Service Unavailable

    Estamos offline por mantenimiento. Inténtalo nuevamente mas tarde ‍👷🛠

    Paginación, filtros y orden

    Ejemplo

      curl -x GET https://api.qvo.cl/transactions \
        -d 'page=1' \
        -d 'per_page=10' \
        -d 'where={"amount": {">": 2000}}' \
        -d 'order_by=amount DESC'
    

    Todos los recursos que retornen un arreglo o lista, soportan paginación, filtros y orden. Por defecto, los valores se ordenan por fecha de creación, donde los mas recientes se ubicarán primero en el arreglo.

    Paginación

    La paginación se realiza definiendo el número de entradas por página a través del parámetro per_page y se navega mediante el parámetro page.

    Por ejemplo, para obtener la segunda página desplegando 20 entradas por página:

    GET /recurso&page=1&per_page=20

    Para facilitar la navegación y el despliegue de número de páginas, en la respuesta existen los headers X-Page, X-Per-Page y X-Total que representan la página actual, la cantidad de entradas por página y el total de entradas respectivamente.

    Por ejemplo si X-Page = 2, X-Per-Page = 10 y X-Total = 45, es fácil definir que se trata de 5 páginas en total.

    Filtros

    Ejemplo de filtro

    {
      "amount" : {
        ">=" : 1000,
        "<" : 8000
      },
      "status": {
        "=": "successful"
      }
    }
    

    El parámetro where acepta un hash para filtrar el contenido con respecto a una serie de reglas. La sintáxis corresponde a un objeto JSON de la siguiente manera:

    { ":atributo": { ":operador": ":variable" } }

    Cabe mencionar que múltiples atributos y múltiples operadores por atributo son soportados.

    Orden

    Se puede definir el orden de despligue de las entradas mediante el parámetro order_by. Este acepta un string con la siguiente estructura:

    :atributo :orden

    El órden sólo se puede aplicar sobre un argumento y no soporta órdenes anidados.

    Por ejemplo, si deseamos ordenar un recurso por fecha de creación de manera ascendente, realizamos:

    created_at ASC

    Atributos

    page

    integer

    Número de página
    per_page

    integer

    Número de entradas por página.
    where

    hash

    Corresponde a un conjunto de reglas (ej: {"amount": {">": 2000}})
    order_by

    string

    Orden de despliegue de las entradas

    Webhooks

    Los Webhooks son callbacks que notifican cuando ocurren eventos en tu cuenta.

    Por ejemplo: Cuando se genera un cobro recurrente de una suscripción, un Webhook te permite recibir una notificación para que puedas tomar una acción, como enviar un email de agradecimiento al usuario.

    Los Webhooks son útiles en dos situaciones:

    Cuando un evento ocurre, QVO crea un objeto de evento. Este objeto contiente toda la información relevante de lo ocurrido. QVO luego envía el objeto de evento a través de una llamada HTTP POST a una URL que tú definas para ese propósito. Puedes registar la URL aquí y ver la lista completa de eventos aquí.

    Algunos casos de uso son:

    Sólo necesitas utilizar Webhooks para operaciones que ocurren "tras-bambalinas". El resultado de la mayoría de las llamadas de QVO, son reportados de manera síncrona a tu código y no necesitan de un Webhook para su verificación. Por ejemplo, cuando se cobra una tarjeta, una vez realizado el pago existosamente, se retornará inmediatamente la transacción, o si falla, se retornará un error.

    Recibiendo una notificación webhook

    // Using Express
    app.post("/my/webhook/url", function(request, response) {
      // Retrieve the request's body and parse it as JSON
      const event_json = JSON.parse(request.body);
    
      // Do something with event_json
    
      response.send(200);
    });
    
    require "json"
    
    # Using Sinatra
    post "/my/webhook/url" do
      # Retrieve the request's body and parse it as JSON
      event_json = JSON.parse request.body.read
    
      # Do something with event_json
    
      status 200
    end
    
    import json
    from django.http import HttpResponse
    
    # Using Django
    def my_webhook_view(request):
      # Retrieve the request's body and parse it as JSON
      event_json = json.loads(request.body)
    
      # Do something with event_json
    
      return HttpResponse(status=200)
    
    <?php
    $body = @file_get_contents('php://input');
    $event_json = json_decode($body);
    
    // Do Something with $event_json
    
    http_response_code(200);
    
    // if PHP < 5.4
    // header("HTTP/1.1 200 OK");
    ?>
    

    Crear un endpoint para recibir webhooks, no es distinto a crear cualquier otra página en tu sitio. Basta con crear una nueva ruta con la URL deseada.

    Los datos del webhook son enviado en formato JSON en el body o cuerpo de la llamada POST. Todos los detalles del evento están incluidos y pueden ser usados diréctamente (luego de parsear el JSON).

    Respondiendo a un webhook

    Para acusar recibo del webhook, tu endpoint debe retornar un estado HTTP 200. Cualquier otra información retornada en la cabecera o cuerpo de la llamada será ignorada. Cualquier respuesta que no sea código 200, incluyendo códigos en el rango 3xx, indicará a QVO que no se recibió el webhook.

    Si un webhook no es recibido con éxito por cualquier razón, QVO continuará tratando de enviar el webhook cada hora por 7 días. Luego de este periodo, los webhooks no podrán volver a enviarse, pero se puede consultar la lista de eventos para reconciliar la información por eventos faltantes.

    Buenas prácticas

    Antes de ir a producción, prueba que tu webhook esta funcionando de manera adecuada.

    Si tu endpoint para webhooks ejecuta lógica compleja o realiza llamadas HTTP, es posible que se produzca un timeout antes de que QVO pueda ser notificado de la recepción. Por esta razón, es mejor acusar recibo inmediatamente del webhook retornando un código HTTP 200 y luego realizar el resto de las tareas.

    Los endpoints de webhook pueden ocacionalmente recibir los mismos eventos más de una vez. Aconsejamos considerar estos casos para evitar la duplicación de los eventos, lo que puede provocar resultados inesperados.

    Por razones de seguridad, se aconseja siempre verificar que la información proporcionada en el evento realmente existe y el evento ocurrió. Para ello simplemente basta con enviar un request a nuestra API a la ruta correspondiente del evento para corroborar que el recurso señalado se modificó. Este chequeo sirve para verifcar que la información viene desde QVO, evitando que potenciales atacantes envíen webhooks con información falsa.

    Pruebas y Sandbox

    Para facilitar el proceso de integración y permitirte hacer pruebas de las diferentes acciones que puedes realizar con QVO, puedes utilizar un ambiente de prueba. El entorno de pruebas funciona exactamente igual que el de producción, sin embargo ninguna de las operaciones que realices generarán un cargo real. Esto significa que las transacciones realizadas en este entorno de prueba son únicamente válidas en este ambiente.

    El ambiente de sandbox se encuentra ubicado en la URL

    https://playground.qvo.cl.

    Luego, para realizar pruebas, basta con apuntar las llamadas a esa URL.

    Tarjetas de prueba

    VISA

    Débito

    Aprobar o rechazar

    Num: 4051885600446623
    Emisor: Test Commerce Bank
    MasterCard

    Débito

    Siempre rechaza

    Num: 5186059559590568
    Emisor: Test Commerce Bank
    VISA

    Crédito

    Aprobar o rechazar

    Num: 4051885600446623
    Fechas: Cualquiera
    CVV: 123
    MasterCard

    Crédito

    Siempre rechaza

    Num: 5186059559590568
    Fechas: Cualquiera
    CVV: 123

    Credenciales de prueba

    Interfaz Webpay

    Banco prueba

    RUT : 11.111.111-1
    Password : 123

    Clientes

    Los objetos de clientes permiten realizar cobros recurrentes y tener un registro de los mútliples cobros que estan asociados a un mismo cliente. El API permite crear, actualizar y eliminar clientes. Se puede obtener un cliente en particular, así como también una lista de clientes.

    El objeto cliente

    Ejemplo de respuesta

    {
      "id": "cus_qos_6r3-4I4zIiou2BVMHg",
      "default_payment_method": {
        "id": "woc_m_c3zyh5BEl8EITxvLbMzw",
        "last_4_digits": "4242",
        "card_type": "VISA",
        "payment_type": "CD",
        "failure_count": 0
      },
      "name": "Jon Snow",
      "email": "dabastard@thewatch.org",
      "phone": "+56987654321",
      "metadata": {
        "role": "Lord Commander"
      },
      "address": {
        "line1": "The Wall",
        "line2": "Castle Black",
        "city": "Queenscrown",
        "country": "Westeros",
        "region_or_state": "The Gift",
        "postal_code": "4607"
      },
      "credits": 0,
      "created_at": "2017-05-17T19:12:55.535Z",
      "updated_at": "2017-05-17T19:12:57.123Z",
      "subscriptions": [
        {
          "id": "sub_HnKU4UmU5GtymRulcVOEow",
          "status": "active",
          "plan": {
            "id": "test-plan-03",
            "name": "Test plan 03",
            "price": "3000.0",
            "currency": "CLP"
          },
          "current_period_start": "2017-05-17T19:12:57.185Z",
          "current_period_end": "2017-06-17T19:12:57.185Z",
          "created_at": "2017-05-17T19:12:57.189Z",
          "updated_at": "2017-05-17T19:12:57.189Z"
        }
      ],
      "cards": [
        {
          "id": "woc_m_c3zyh5BEl8EITxvLbMzw",
          "last_4_digits": "4242",
          "card_type": "VISA",
          "payment_type": "CD",
          "failure_count": 0
        }
      ],
      "transactions": [
        {
          "id": "trx_Vk7WJYL-wYi4bjXmAaLyaw",
          "amount": 3000,
          "gateway": "Webpay Oneclick",
          "credits": 0,
          "status": "successful",
          "created_at": "2017-05-17T19:12:57.759Z"
        }
      ]
    }
    

    Atributos

    id

    string

    Identificador único del objeto.
    default_payment_method

    Card

    Medio de pago por defecto del cliente. Describe una tarjeta.
    name

    string

    Nombre del cliente.
    email

    string

    Dirección email del cliente.
    phone

    string

    Teléfono del cliente.
    metadata

    hash

    Conjunto de pares clave-valor que puedes adjuntar a este objeto. Esto puede ser útil para almacenar información adicional acerca del cliente en un formato estructurado.
    address

    Address

    Dirección del cliente. Útil para envíos y facturación. Describe una dirección.
    credits

    integer

    Créditos en CLP del cliente.
    subscriptions

    Array<Subscription>

    Subscripciones activas del cliente.
    cards

    Array<Card>

    Tarjetas activas del cliente.
    transactions

    Array<Transaction>

    Transacciones vinculadas al cliente.
    created_at

    datetime

    Fecha de creación del objeto.
    updated_at

    datetime

    Fecha de la última actualización del objeto.

    El objeto dirección

    {
      "line1": "3828 Piermont Dr",
      "line2": "",
      "city": "Albuquerque",
      "country": "US",
      "region_or_state": "New Mexico",
      "postal_code": "87112"
    }
    

    Atributos

    line1

    string

    Línea de dirección 1 (Calle/Nombre de empresa).
    line2

    string

    Línea de dirección 2 (Departamento/Unidad/Edificio/Block/Piso).
    city

    string

    Ciudad/Pueblo/Villa.
    country

    string

    País.
    region_or_state

    string

    Región/Estado/Provincia.
    postal_code

    string

    Código postal o ZIP.

    Crear un cliente

    Ejemplo de llamada

    curl --request POST "https://api.qvo.cl/customers" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA" \
      -d email="theimp@lannistercorp.gov" \
      -d name="Tyrion Lannister" \
      -d phone="+56987654321"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/customers', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      },
      body: {
        email: "theimp@lannistercorp.gov",
        name: "Tyrion Lannister",
        phone: "+56987654321"
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.post 'https://api.qvo.cl/customers', {
        email: "theimp@lannistercorp.gov",
        name: "Tyrion Lannister",
        phone: "+56987654321"
      }, {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.post('https://api.qvo.cl/customers', params={
      'email': 'theimp@lannistercorp.gov',
      'name': 'Tyrion Lannister',
      'name': '+56987654321'
    }, headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('POST', 'https://api.qvo.cl/customers', [
      'json' => [
        'email' => 'theimp@lannistercorp.gov',
        'name' => 'Tyrion Lannister',
        'phone' => '+56987654321',
      ],
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "id": "cus_I-ZNs9TlY2FmdOUByQ5Ieg",
      "default_payment_method": null,
      "name": "Tyrion Lannister",
      "email": "theimp@lannistercorp.gov",
      "phone": "+56987654321",
      "metadata": null,
      "address": null,
      "credits": 0,
      "created_at": "2017-05-19T02:42:03.563Z",
      "updated_at": "2017-05-19T02:42:03.563Z",
      "subscriptions": [],
      "cards": [],
      "transactions": []
    }
    

    POST /customers

    Crea un nuevo objeto cliente

    Parámetros

    email

    Único

    Requerido

    string

    Dirección email del cliente.
    name

    string

    Nombre del cliente.
    phone

    string

    Teléfono del cliente.
    metadata

    hash

    Conjunto de pares clave-valor que puedes adjuntar a este objeto. Esto puede ser útil para almacenar información adicional acerca del cliente en un formato estructurado.
    address

    Address

    Dirección del cliente.

    Respuesta

    Retorna un objeto de cliente si la llamada es exitosa. Si existe otro cliente con el mismo email, retornará un error.

    Obtener un cliente

    Ejemplo de llamada

    curl -X get "https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg', {
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.get 'https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.get('https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('GET', 'https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "id": "cus_I-ZNs9TlY2FmdOUByQ5Ieg",
      "default_payment_method": null,
      "name": "Tyrion Lannister",
      "email": "theimp@lannistercorp.gov",
      "phone": "+56987654321",
      "metadata": null,
      "address": null,
      "credits": 0,
      "created_at": "2017-05-19T02:42:03.563Z",
      "updated_at": "2017-05-19T02:42:03.563Z",
      "subscriptions": [],
      "cards": [],
      "transactions": []
    }
    

    GET /customers/{customer_id}

    Obtiene los detalles de un cliente existente. Se necesita proporcionar sólo el identificador único del cliente el cual fue retornado al momento de su creación.

    Parámetros

    customer_id

    Requerido

    string

    Identificador único del cliente.

    Respuesta

    Retorna un objeto de cliente si se provee de un identificador válido.

    Actualizar un cliente

    Ejemplo de llamada

    curl --request PUT "https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA" \
      -d email="theimp@lannistercorp.gov" \
      -d name="Tyrion Lannister"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg', {
      method: 'PUT',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      },
      body: {
        email: "theimp@lannistercorp.gov",
        name: "Tyrion Lannister"
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.put 'https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg', {
        email: "theimp@lannistercorp.gov",
        name: "Tyrion Lannister"
      }, {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.put('https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg', params={
      'email': 'theimp@lannistercorp.gov',
      'name': 'Tyrion Lannister'
    }, headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('PUT', 'https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg', [
      'json' => [
        'email' => 'theimp@lannistercorp.gov',
        'name' => 'Tyrion Lannister'
      ],
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "id": "cus_I-ZNs9TlY2FmdOUByQ5Ieg",
      "default_payment_method": null,
      "name": "Tyrion Lannister",
      "email": "theimp@lannistercorp.gov",
      "phone": "+56987654321",
      "metadata": null,
      "address": null,
      "credits": 0,
      "created_at": "2017-05-19T02:42:03.563Z",
      "updated_at": "2017-05-19T02:42:03.563Z",
      "subscriptions": [],
      "cards": [],
      "transactions": []
    }
    

    PUT /customers/{customer_id}

    Actualiza el cliente especificado con los parametros provistos. Cualquier parámetro que no se provea quedará inalterado. Por ejemplo, si se provee el parametro name, este será el nuevo nombre del cliente.

    Parámetros

    customer_id

    Requerido

    string

    Identificador único del cliente.
    nombre

    string

    Nombre.
    email

    string

    Dirección email.
    phone

    string

    Teléfono.
    default_payment_method_id

    string

    Identificador del medio de pago por defecto. Debe ser perteneciente a la lista de tarjetas del cliente.

    Respuesta

    Retorna el objeto del cliente si la actualización es exitosa. Retorna un error si algun parámetro de actualización es inválido (ej: identificador de medio de pago inválido).

    Eliminar un cliente

    Ejemplo de llamada

    curl -x DELETE "https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg', {
      method: 'DELETE',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.delete 'https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.delete('https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('DELETE', 'https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    DELETE /customers/{customer_id}

    Elimina permanentemente un cliente. Esta acción es irreversible. Si existieran suscripciones activas asociadas al cliente, estas se cancelarán inmediatamente.

    Parámetros

    customer_id

    Requerido

    string

    Identificador único del cliente.

    Respuesta

    Retorna una respuesta sin contenido si el cliente fue eliminado con éxito. Si el identificador del cliente no es válido, retornará un error.

    Obtener una lista de clientes

    Ejemplo de llamada

    curl --request GET "https://api.qvo.cl/customers" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/customers', {
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.get 'https://api.qvo.cl/customers', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.get('https://api.qvo.cl/customers', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('GET', 'https://api.qvo.cl/customers', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    [
      {
        "id": "cus_qos_6r3-4I4zIiou2BVMHg",
        "default_payment_method": {
          "id": "woc_m_c3zyh5BEl8EITxvLbMzw",
          "last_4_digits": "4242",
          "card_type": "VISA",
          "payment_type": "CD"
        },
        "name": "Jon Snow",
        "email": "dabastard@thewatch.org",
        "phone": "",
        "metadata": null,
        "address": null,
        "credits": 0,
        "created_at": "2017-05-17T19:12:55.535Z",
        "updated_at": "2017-05-17T19:12:57.123Z",
        "subscriptions": [
          {
            "id": "sub_HnKU4UmU5GtymRulcVOEow",
            "status": "active",
            "plan": {
              "id": "test-plan-03",
              "name": "Test plan 03",
              "price": "3000.0",
              "currency": "CLP"
            },
            "current_period_start": "2017-05-17T19:12:57.185Z",
            "current_period_end": "2017-06-17T19:12:57.185Z",
            "created_at": "2017-05-17T19:12:57.189Z",
            "updated_at": "2017-05-17T19:12:57.189Z"
          }
        ],
        "cards": [
          {
            "id": "woc_m_c3zyh5BEl8EITxvLbMzw",
            "last_4_digits": "4242",
            "card_type": "VISA",
            "payment_type": "CD"
          }
        ],
        "transactions": [
          {
            "id": "trx_Vk7WJYL-wYi4bjXmAaLyaw",
            "amount": 3000,
            "gateway": "Webpay Oneclick",
            "credits": 0,
            "status": "successful",
            "created_at": "2017-05-17T19:12:57.759Z"
          }
        ]
      }
    ]
    

    GET /customers

    Retorna una lista de clientes. Los clientes se encuentran ordenados por defecto por la fecha de creación, donde los mas recientes aparecerán primero.

    Respuesta

    Un arreglo donde cada entrada representa a un cliente con su respectiva información.

    Tarjetas

    Es posible inscribir múltiples tarjetas para un cliente para luego cobrar.

    El objeto tarjeta

    Ejemplo de respuesta

    {
      "id": "woc_m_c3zyh5BEl8EITxvLbMzw",
      "last_4_digits": "4242",
      "card_type": "VISA",
      "payment_type": "CD",
      "failure_count": 0,
      "created_at": "2017-05-17T19:12:57.108Z"
    }
    

    Atributos

    id

    string

    Identificador único del objeto.
    last_4_digits

    string

    Los últimos 4 dígitos de la tarjeta.
    card_type

    string

    Tipo de tarjeta. Puede ser: VISA o MASTERCARD
    payment_type

    string

    Tipo de pago de la tarjeta. Puede ser: CD (crédito) o DB (débito)
    failure_count

    integer

    Contador de número de fallos de la tarjeta. El contador sube cuando existe un cobro fallido con la tarjeta y vuelve a 0 cuando se ejecuta un cobro correctamente.
    created_at

    datetime

    Fecha de creación del objeto.

    Crear una inscripción de tarjeta

    Ejemplo de llamada

    curl -X POST "https://api.qvo.cl/customers/cus_qos_6r3-4I4zIiou2BVMHg/cards/inscriptions" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA" \
      -d return_url="http://example.com/return"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/customers/cus_qos_6r3-4I4zIiou2BVMHg/cards/inscriptions', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      },
      body: {
        return_url: "http://example.com/return"
      }
    })
    .then(function(response) {
      console.log(response)
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.post 'https://api.qvo.cl/customers/cus_qos_6r3-4I4zIiou2BVMHg/cards/inscriptions', {
        return_url: "http://example.com/return"
      }, {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.post('https://api.qvo.cl/customers/cus_qos_6r3-4I4zIiou2BVMHg/cards/inscriptions', params={
      'return_url': 'http://example.com/return'
    }, headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('POST', 'https://api.qvo.cl/customers/cus_qos_6r3-4I4zIiou2BVMHg/cards/inscriptions', [
      'json' => [
        'return_url' => "http://example.com/return",
      ],
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "inscription_uid": "woi_WZa9DgYQPzPtUqMsQdoNhQ",
      "redirect_url": "https://api.qvo.cl/webpay_oneclick/init_inscription/woi_WZa9DgYQPzPtUqMsQdoNhQ",
      "expiration_date": "2017-05-19T17:15:20.832Z"
    }
    

    POST /customers/{customer_id}/cards/inscriptions

    Crea una inscripción de tarjeta para el cliente.

    Permite a un cliente inscribir su tarjeta mediante la interfaz de Webpay Oneclick. Esto se divide en 3 pasos:

    1. Realizar la llamada y redirigir al cliente

    Una vez realizada la llamada de inscripción de tarjeta, es necesario redirigir al cliente a el redirect_url retornado por la llamada, para iniciar el proceso de inscripción.

    2. Capturar la respuesta

    Una vez terminado paso 1, se retornará el cliente con una llamada GET a el return_url proporcionado como parámetro en el paso 1. Esta llamada, irá acompañada de un parámetro llamado uid ubicado en la ruta, que representa el identificador único de la inscripción de tarjeta.

    Por ejemplo, para return_url = "http://www.example.com/return se retornará el cliente a:

    GET http://www.example.com/return?uid=woi_WZa9DgYQPzPtUqMsQdoNhQ

    donde uid es igual a woi_WZa9DgYQPzPtUqMsQdoNhQ

    3. Obtener el resultado

    Para verificar si la inscripción fue exitosa, se debe realizar una llamada a obtener inscripción de tarjeta, utilizando el identificador único de inscripción uid retornado en el paso 2.

    Parámetros

    customer_id

    Requerido

    string

    Identificador único del cliente.
    return_url

    Requerido

    string

    URL de retorno de la inscripción.

    Respuesta

    Retorna los parámetros para iniciar una inscripción de tarjeta.

    Obtener una inscripción de tarjeta

    Ejemplo de llamada

    curl -X GET "https://api.qvo.cl/customers/cus_qos_6r3-4I4zIiou2BVMHg/cards/inscriptions/woi_WZa9DgYQPzPtUqMsQdoNhQ" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/customers/cus_qos_6r3-4I4zIiou2BVMHg/cards/inscriptions/woi_WZa9DgYQPzPtUqMsQdoNhQ', {
      method: 'GET',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.get 'https://api.qvo.cl/customers/cus_qos_6r3-4I4zIiou2BVMHg/cards/inscriptions/woi_WZa9DgYQPzPtUqMsQdoNhQ', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.get('https://api.qvo.cl/customers/cus_qos_6r3-4I4zIiou2BVMHg/cards/inscriptions/woi_WZa9DgYQPzPtUqMsQdoNhQ', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('GET', 'https://api.qvo.cl/customers/cus_qos_6r3-4I4zIiou2BVMHg/cards/inscriptions/woi_WZa9DgYQPzPtUqMsQdoNhQ', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "uid": "woi_WZa9DgYQPzPtUqMsQdoNhQ",
      "status": "succeeded",
      "card": {
        "id": "woc_bMz2iAH1mJ8M4cvv0b7IMA",
        "last_4_digits": "6623",
        "card_type": "Visa",
        "payment_type": "CD",
        "failure_count": 0,
        "created_at": "2017-05-19T17:07:01.924Z"
      },
      "created_at": "2017-05-19T17:05:20.820Z",
      "updated_at": "2017-05-19T17:07:01.953Z"
    }
    

    GET /customers/{customer_id}/cards/inscriptions/{inscription_uid}

    Obtiene el resultado de una inscripción de tarjeta para un cliente.

    Parámetros

    customer_id

    Requerido

    string

    Identificador único del cliente.
    inscription_uid

    Requerido

    string

    Identificador único de la inscripción.

    Respuesta

    Retorna el estado de la inscripción y una tarjeta de haber creado una.

    Esta puede tener status:

    Obtener una tarjeta

    Ejemplo de llamada

    curl -X GET "https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg/cards/woc_1Flhy3a-5UnARb7S4Ho3FQ" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg/cards/woc_1Flhy3a-5UnARb7S4Ho3FQ', {
      method: 'GET',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.get 'https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg/cards/woc_1Flhy3a-5UnARb7S4Ho3FQ', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.get('https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg/cards/woc_1Flhy3a-5UnARb7S4Ho3FQ', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('GET', 'https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg/cards/woc_1Flhy3a-5UnARb7S4Ho3FQ', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "id": "woc_1Flhy3a-5UnARb7S4Ho3FQ",
      "last_4_digits": "0789",
      "card_type": "Visa",
      "payment_type": "CD",
      "failure_count": 0,
      "created_at": "2017-05-19T01:37:44Z"
    }
    

    GET /customers/{customer_id}/cards/{card_id}

    Obtiene los detalles de una tarjeta existente para el ciente. Se necesita proporcionar sólo el identificador único de la tarjeta el cual fue retornado al momento de su creación en la inscripción.

    Parámetros

    customer_id

    Requerido

    string

    Identificador único del cliente.
    card_id

    Requerido

    string

    Identificador único de la tarjeta.

    Respuesta

    Retorna un objeto de tarjeta si se provee de un identificador válido.

    Cobrar a una tarjeta

    Ejemplo de llamada

    curl -X POST "https://api.qvo.cl/customers/cus_qos_6r3-4I4zIiou2BVMHg/cards/woc_bMz2iAH1mJ8M4cvv0b7IMA/charge" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA" \
      -d amount=3000 \
      -d description="For the watch"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/customers/cus_qos_6r3-4I4zIiou2BVMHg/cards/woc_bMz2iAH1mJ8M4cvv0b7IMA/charge', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      },
      body: {
        amount: 3000,
        description: 'For the watch'
      }
    }).then(function(resposne) {
      console.log(resposne);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.post 'https://api.qvo.cl/customers/cus_qos_6r3-4I4zIiou2BVMHg/cards/woc_bMz2iAH1mJ8M4cvv0b7IMA/charge', {
        amount: 3000,
        description: 'For the watch'
      }, {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.post('https://api.qvo.cl/customers/cus_qos_6r3-4I4zIiou2BVMHg/cards/woc_bMz2iAH1mJ8M4cvv0b7IMA/charge', params={
      'amount': 3000,
      'description': 'For the watch'
    }, headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('POST', 'https://api.qvo.cl/customers/cus_qos_6r3-4I4zIiou2BVMHg/cards/woc_bMz2iAH1mJ8M4cvv0b7IMA/charge', [
      'json' => [
        'amount' => 3000,
        'description' => 'For the watch'
      ],
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta:

    {
      "id": "trx_Vk7WJYL-wYi4bjXmAaLyaw",
      "created_at": "2017-05-17T19:12:57.759Z",
      "amount": 3000,
      "currency": "CLP",
      "description": "For the watch",
      "gateway": "webpay_oneclick",
      "credits": 0,
      "status": "successful",
      "customer": {
        "id": "cus_qos_6r3-4I4zIiou2BVMHg",
        "name": "Jon Snow",
        "email": "dabastard@winterfell.com",
        "metadata": null,
        "address": null
      },
      "payment": {
        "amount": 3000,
        "gateway": "webpay_oneclick",
        "payment_type": "credit",
        "fee": 106,
        "installments": 0,
        "payment_method": {
          "id": "woc_bMz2iAH1mJ8M4cvv0b7IMA",
          "last_4_digits": "6623",
          "card_type": "Visa",
          "payment_type": "CD"
        }
      },
      "refund": null,
      "gateway_response": {
        "status": "success",
        "message": "successful transaction"
      }
    }
    

    POST /customers/{customer_id}/cards/{card_id}/charge

    Este endpoint permite autorizar un cobro para una tarjeta en específico.

    Parámetros

    customer_id

    Requerido

    string

    Identificador único del cliente.
    card_id

    Requerido

    string

    Identificador único de la tarjeta del cliente.
    amount

    Requerido

    integer

    Monto a cobrar.
    description

    string

    Descripción de la transacción.

    Respuesta

    De ser exitosa la llamada, retorna una transacción. De lo contrario, retornará un error.

    Eliminar una tarjeta

    Ejemplo de llamada

    curl -X DELETE "https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg/cards/woc_1Flhy3a-5UnARb7S4Ho3FQ" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg/cards/woc_1Flhy3a-5UnARb7S4Ho3FQ', {
      method: 'DELETE',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.delete 'https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg/cards/woc_1Flhy3a-5UnARb7S4Ho3FQ', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    p JSON.parse(result)
    
    import requests
    
    r = requests.delete('https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg/cards/woc_1Flhy3a-5UnARb7S4Ho3FQ', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('DELETE', 'https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg/cards/woc_1Flhy3a-5UnARb7S4Ho3FQ', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    DELETE /customers/{customer_id}/cards/{card_id}

    Elimina permanentemente una tarjeta de un cliente. Esta acción es irreversible.

    Parámetros

    customer_id

    Requerido

    string

    Identificador único del cliente.
    card_id

    Requerido

    string

    Identificador único de la tarjeta.

    Respuesta

    Retorna una respuesta sin contenido si la tarjeta fue eliminada con éxito. Si el identificador de la tarjeta no es válido, retornará un error.

    Obtener una lista de tarjetas

    Ejemplo de llamada

    curl -X get "https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg/cards" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg/cards', {
      method: 'GET',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.get 'https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg/cards', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.get('https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg/cards', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('GET', 'https://api.qvo.cl/customers/cus_I-ZNs9TlY2FmdOUByQ5Ieg/cards', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    [
      {
        "id": "woc_1Flhy3a-5UnARb7S4Ho3FQ",
        "last_4_digits": "0789",
        "card_type": "Visa",
        "payment_type": "CD",
        "failure_count": 0,
        "created_at": "2017-05-19T01:37:44Z"
      }
    ]
    

    GET /customers/{customer_id}/cards

    Retorna una lista de tarjetas para un cliente.

    Parámetros

    customer_id

    Requerido

    string

    Identificador único del cliente.

    Respuesta

    Un arreglo donde cada entrada representa a una tarjeta del cliente con su respectiva información.

    Planes

    Un plan de suscripción contiene la información para el cobro recurrente de un servicio o producto. Por ejemplo, puedes tener una plan de CLP$20.000 al mes por caracterísitcas básicas y otro de CLP$40.000 por características premium.

    El objeto plan

    Ejemplo de respuesta

    {
      "id": "oro",
      "name": "Plan oro",
      "price": "3000.0",
      "currency": "CLP",
      "interval": "month",
      "interval_count": 1,
      "trial_period_days": 0,
      "default_cycle_count": 12,
      "status": "active",
      "subscriptions": [
        {
          "id": "sub_HnKU4UmU5GtymRulcVOEow",
          "status": "active",
          "current_period_start": "2017-05-17T19:12:57.185Z",
          "current_period_end": "2017-06-17T19:12:57.185Z",
          "created_at": "2017-05-17T19:12:57.189Z",
          "updated_at": "2017-05-17T19:12:57.189Z",
          "customer": {
            "id": "cus_qos_6r3-4I4zIiou2BVMHg",
            "name": "Jon Snow",
            "email": "dabastard@thewatch.org",
            "metadata": null,
            "address": null
          }
        }
      ],
      "created_at": "2017-05-17T19:12:55.450Z",
      "updated_at": "2017-05-17T19:12:55.450Z"
    }
    

    Atributos

    id

    string

    Identificador único del objeto.
    name

    string

    El nombre de despliegue del plan.
    price

    decimal

    El precio del plan.
    currency

    string

    Código correpondiente a la moneda. Puede ser: CLP o UF
    interval

    string

    Intervalo del plan. Puede ser: day día, week semana, month mes o year año.
    interval_count

    integer

    Cantidad del intervalo del plan. Por ejemplo, si este valor es 3 e interval es igual a week, el plan tendrá un periodo de 3 semanas.
    trial_period_days

    integer

    Número de días de prueba otorgados cuando se suscribe un cliente al plan. Es 0 si no tiene un periodo definido.
    default_cycle_count

    integer

    Número de ciclos por defecto de las suscripciones.
    status

    string

    Estado del plan. Puede ser: active o inactive.
    subscriptions

    Array<Subscription>

    Suscripciones activas relacionadas al plan.
    created_at

    datetime

    Fecha de creación del objeto.
    updated_at

    datetime

    Fecha de la última actualización del objeto.

    Crear un plan

    Ejemplo de llamada

    curl --request POST "https://api.qvo.cl/plans" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA" \
      -d id="oro" \
      -d name="Plan oro"
      -d price=15000,
      -d currency="CLP",
      -d trial_period_days=10
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/plans', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      },
      body: {
        id: "oro",
        name: "Plan Oro",
        price: 15000,
        currency: "CLP",
        trial_period_days: 10
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.post 'https://api.qvo.cl/plans', {
        id: "oro",
        name: "Plan Oro",
        price: 15000,
        currency: "CLP",
        trial_period_days: 10
      }, {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.post('https://api.qvo.cl/plans', params={
      'id': 'oro',
      'name': 'Plan Oro',
      'price': 15000,
      'currency': 'CLP',
      'trial_period_days': 10
    }, headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('POST', 'https://api.qvo.cl/plans', [
      'json' => [
        'id' => 'oro',
        'name' => 'Plan Oro',
        'price' => 15000,
        'currency' => 'CLP',
        'trial_period_days' => 10
      ],
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "id": "oro",
      "name": "Plan oro",
      "price": "15000.0",
      "currency": "CLP",
      "interval": "month",
      "interval_count": 1,
      "trial_period_days": 10,
      "default_cycle_count": 6,
      "status": "active",
      "subscriptions": [],
      "created_at": "2017-05-17T19:12:55.450Z",
      "updated_at": "2017-05-17T19:12:55.450Z"
    }
    

    POST /plans

    Crea un nuevo objeto plan.

    Parámetros

    id

    Único

    Requerido

    string

    Identificador único del plan.
    name

    Requerido

    string

    Nombre de despliegue del plan.
    price

    Requerido

    integer or decimal

    Precio del plan. Ciertas monedas soportan decimal como UF, pero en general es un integer
    currency

    Requerido

    string

    Código correspondiente a la moneda. Puede ser: CLP o UF.
    interval

    string

    Intervalo del plan. Puede ser: day día, week semana, month mes o year año. Si no se especifica, el valor por defecto es month.
    interval_count

    integer

    Cantidad del intervalo del plan. Debe ser un entero positivo mayor o igual a 1. Por ejemplo, si este valor es 3 e interval es igual a week, el plan tenrá un periodo de facturación de 3 semanas. El valor por defecto es 1.
    trial_period_days

    integer

    Especifica el número de días de prueba del plan. Si incluyes un periodo de prueba, al cliente no se le cobrará hasta que termine este periodo.
    default_cycle_count

    integer

    Especifica el número de ciclos por defecto de las suscripciones. Por ejemplo si el intervalo del plan es de 1 mes y el número de ciclos es 6, la suscripciones terminarán por defecto a los 6 meses después de creadas.

    Respuesta

    Retorna un objeto de plan si la llamada es exitosa. Si existe otro plan con el mismo id, retornará un error.

    Obtener un plan

    Ejemplo de llamada

    curl --request GET "https://api.qvo.cl/plans/oro" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/plans/oro', {
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.get 'https://api.qvo.cl/plans/oro', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.get('https://api.qvo.cl/plans/oro', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('GET', 'https://api.qvo.cl/plans/oro', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ]);->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "id": "oro",
      "name": "Plan oro",
      "price": "15000.0",
      "currency": "CLP",
      "interval": "month",
      "interval_count": 1,
      "trial_period_days": 10,
      "default_cycle_count": null,
      "status": "active",
      "subscriptions": [],
      "created_at": "2017-05-17T19:12:55.450Z",
      "updated_at": "2017-05-17T19:12:55.450Z"
    }
    

    GET /plans/{plan_id}

    Obtiene los detalles de un plan existente. Se necesita proporcionar sólo el identificador único del plan el cual fue retornado al momento de su creación.

    Parámetros

    plan_id

    Requerido

    string

    Identificador único del plan.

    Respuesta

    Retorna un objeto de plan si se provee de un identificador válido.

    Actualizar un plan

    Ejemplo de llamada

    curl --request PUT "https://api.qvo.cl/plans/oro" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA" \
      -d name="Di Oro"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/plans/oro', {
      method: 'PUT',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      },
      body: {
        name: "Di Oro"
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.put 'https://api.qvo.cl/plans/oro', {
        name: "Di Oro"
      }, {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.put('https://api.qvo.cl/plans/oro', params={
      'name': 'Di Oro'
    }, headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('PUT', 'https://api.qvo.cl/plans/oro', [
      'json' => [
        'name' => "Di Oro"
      ],
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "id": "oro",
      "name": "Di Oro",
      "price": "15000.0",
      "currency": "CLP",
      "interval": "month",
      "interval_count": 1,
      "trial_period_days": 10,
      "default_cycle_count": null,
      "status": "active",
      "subscriptions": [],
      "created_at": "2017-05-17T19:12:55.450Z",
      "updated_at": "2017-05-17T19:12:55.450Z"
    }
    

    PUT /plans/{plan_id}

    Actualiza el plan especificado con los parametros provistos. Cualquier parámetro que no se provea quedará inalterado.

    Parámetros

    plan_id

    Requerido

    string

    Identificador único del plan.
    name

    string

    Nombre de despliegue del plan.

    Respuesta

    Retorna el objeto de plan si la actualización es exitosa. Retorna un error si algun parámetro de actualización es inválido.

    Eliminar un plan

    Ejemplo de llamada

    curl -x DELETE "https://api.qvo.cl/plans/oro" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/plans/oro', {
      method: 'DELETE',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.delete 'https://api.qvo.cl/plans/oro', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.delete('https://api.qvo.cl/plans/oro', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('DELETE', 'https://api.qvo.cl/plans/oro', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    DELETE /plans/{plan_id}

    Elimina permanentemente un plan. Esta acción es irreversible. Si existieran suscripciones activas asociadas al plan, este no se podrá eliminar

    Parámetros

    plan_id

    Requerido

    string

    Identificador único del plan.

    Respuesta

    Retorna una respuesta sin contenido si el plan fue eliminado con éxito. Si el identificador del plan no es válido, retornará un error.

    Obtener una lista de planes

    Ejemplo de llamada

    curl --request GET "https://api.qvo.cl/plans" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/plans', {
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.get 'https://api.qvo.cl/plans', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.get('https://api.qvo.cl/plans', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('GET', 'https://api.qvo.cl/plans', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    [
      {
        "id": "oro",
        "name": "Plan Oro",
        "price": "15000.0",
        "currency": "CLP",
        "interval": "month",
        "interval_count": 1,
        "trial_period_days": 10,
        "default_cycle_count": null,
        "status": "active",
        "subscriptions": [
          {
            "id": "sub_HnKU4UmU5GtymRulcVOEow",
            "status": "active",
            "current_period_start": "2017-05-17T19:12:57.185Z",
            "current_period_end": "2017-06-17T19:12:57.185Z",
            "created_at": "2017-05-17T19:12:57.189Z",
            "updated_at": "2017-05-17T19:12:57.189Z",
            "customer": {
              "id": "cus_qos_6r3-4I4zIiou2BVMHg",
              "name": "Jon Snow",
              "email": "dabastard@winterfell.com",
              "metadata": null,
              "address": null
            }
          }
        ],
        "created_at": "2017-05-17T19:12:55.450Z",
        "updated_at": "2017-05-17T19:12:55.450Z"
      }
    ]
    

    GET /plans

    Retorna una lista de planes. Los planes se encuentran ordenados por defecto por la fecha de creación, donde los mas recientes aparecerán primero.

    Respuesta

    Un arreglo donde cada entrada representa a un plan con su respectiva información.

    Suscripciones

    Las suscripciones permiten cobrar a un cliente de manera recurrente. Una suscripción vincula un cliente con un plan previamente creado.

    El objeto suscripción

    Ejemplo de respuesta

    {
      "id": "sub_HnKU4UmU5GtymRulcVOEow",
      "status": "active",
      "debt": 0,
      "start": "2017-05-17T19:12:57.185Z",
      "end": "2018-05-17T19:12:57.185Z",
      "prorate": true,
      "cycle_count": 12,
      "current_period_start": "2017-05-17T19:12:57.185Z",
      "current_period_end": "2017-06-17T19:12:57.185Z",
      "customer": {
        "id": "cus_qos_6r3-4I4zIiou2BVMHg",
        "name": "Jon Snow",
        "email": "dabastad@thewatch.org",
        "metadata": null,
        "address": null
      },
      "plan": {
        "id": "oro",
        "name": "Plan Oro",
        "price": "15000.0",
        "currency": "CLP",
        "interval": "month",
        "interval_count": 1
      },
      "transactions": [
        {
          "id": "trx_t0dM-kSdEXs0g3YHY4sASQ",
          "gateway": "webpay_oneclick",
          "amount": 15000,
          "currency": "CLP",
          "status": "successful",
          "created_at": "2017-05-17T19:12:57.185Z"
        }
      ],
      "tax_name": "IVA",
      "tax_percent": "19.0",
      "created_at": "2017-05-17T19:12:57.189Z",
      "updated_at": "2017-05-17T19:12:57.189Z"
    }
    

    Atributos

    id

    string

    Identificador único del objeto
    status

    string

    El estado de la suscripción. Puede ser: active, canceled, trialing, retrying, inactive y unpaid. Una suscripción que está en periodo de prueba, se encuentra en trialing y se mueve a active cuando el periodo de prueba termina. Cuando se falla un cobro para renovar la suscripción, pasa al estado retrying donde se reintentarán los cobros por un periodo determinado. Una vez que acaban los re-intentos pasará al estado unpaid. Cuando una suscripción tiene una fecha de inicio en el futuro, esta inactive y pasará a active o trialing cuando llege esa fecha. Cuando una suscripción termina su número de ciclos y llega la fecha de fin descrita en end, pasará a ended. Cuando se cancela una suscripción, tiene el estado canceled.
    debt

    integer

    Deuda asociada a al suscripción.
    start

    datetime

    Fecha de inicio de la suscripción.
    end

    datetime

    Fecha de fin de la suscripción. Al llegar a esta fecha, la suscripción terminará.
    prorate

    boolean

    Por omisión true. Corresponde al prorrateo de la suscripción cuando se cambia el plan asociado, otorgando créditos al cliente o deuda a la suscripción dependiendo del nuevo precio del plan y el tiempo utilizado. Si es false, no se realizarán ajustes de prorrateo.
    cycle_count

    integer

    Número de ciclos de la suscripción.
    current_period_start

    datetime

    Fecha de inicio del ciclo de facturación.
    current_period_end

    datetime

    Fecha de término del ciclo de facturación. Al final de este periodo se realizará un cobro.
    customer

    Customer

    El cliente asociado a la suscripción.
    plan

    Plan

    El plan asociado a la suscripción.
    transactions

    Array<Transaction>

    Las transacciones asociadas a la suscripción.
    tax_name

    string

    Nombre del impuesto de la suscripción.
    tax_percent

    decimal

    El porcentaje de impuesto de la suscripción. Si existe, cada cobro generado por esta suscripción se aplicará este porcentaje por sobre el total, aumentando el monto cobrado al cliente.
    created_at

    datetime

    Fecha de creación del objeto
    updated_at

    datetime

    Fecha de la última actualización del objeto

    Crear una suscripción

    Ejemplo de llamada

    curl --request POST "https://api.qvo.cl/subscriptions" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA" \
      -d customer_id="cus_qos_6r3-4I4zIiou2BVMHg" \
      -d plan_id="oro"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/subscriptions', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      },
      body: {
        customer_id: "cus_qos_6r3-4I4zIiou2BVMHg",
        plan_id: "oro"
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.post 'https://api.qvo.cl/subscriptions', {
        customer_id: "cus_qos_6r3-4I4zIiou2BVMHg",
        plan_id: "oro"
      }, {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.post('https://api.qvo.cl/subscriptions', params={
      'customer_id': "cus_qos_6r3-4I4zIiou2BVMHg",
      'plan_id': "oro"
    }, headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('POST', 'https://api.qvo.cl/subscriptions', [
      'json' => [
        'customer_id' => 'cus_qos_6r3-4I4zIiou2BVMHg',
        'plan_id' => 'oro'
      ],
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "id": "sub_HnKU4UmU5GtymRulcVOEow",
      "status": "active",
      "debt": 0,
      "start": "2017-05-17T19:12:57.185Z",
      "end": null,
      "prorate": true,
      "cycle_count": null,
      "current_period_start": "2017-05-17T19:12:57.185Z",
      "current_period_end": "2017-06-17T19:12:57.185Z",
      "customer": {
        "id": "cus_qos_6r3-4I4zIiou2BVMHg",
        "name": "Jon Snow",
        "email": "dabastad@thewatch.org",
        "metadata": null,
        "address": null
      },
      "plan": {
        "id": "oro",
        "name": "Plan Oro",
        "price": "15000.0",
        "currency": "CLP",
        "interval": "month",
        "interval_count": 1
      },
      "tax_name": null,
      "tax_percent": null,
      "created_at": "2017-05-17T19:12:57.189Z",
      "updated_at": "2017-05-17T19:12:57.189Z"
    }
    

    POST /subscriptions

    Crea una nueva suscripción para un cliente existente.

    Al momento de crear una suscripción, se cobrará automáticamente el costo del plan al medio de pago por defecto del cliente, a menos que el plan posea días de prueba, sea gratis (precio igual a 0) o tenga una fecha de inicio en el futuro.

    Parámetros

    customer_id

    Requerido

    string

    Identificador único de un cliente.
    plan_id

    Requerido

    string

    Identificador único de un plan.
    start

    datetime

    Fecha de inicio de la suscripción. Debe ser una fecha en el futuro.
    prorate

    boolean

    Por omisión true. Corresponde al prorrateo de la suscripción cuando se cambia el plan asociado, otorgando créditos al cliente o deuda a la suscripción dependiendo del nuevo precio del plan y el tiempo utilizado. Si es false, no se realizarán ajustes de prorrateo.
    cycle_count

    integer

    Número de ciclos de la suscripción. Debe ser un entero positivo. Por ejemplo si la suscripción pertenece a un plan mensual y cycle_count es igual a 6, la suscripción durará por 6 meses. Este parámetro sobrescribirá default_cycle_plan definido por el Plan.
    tax_name

    string

    Nombre del impuesto que se mostrará en el detalle de la transacción. Por ejemplo: IVA.
    tax_percent

    decimal

    Un decimal no negativo entre 0 y 100. Esto representa el porcentaje de impuesto que se aplicará en el cobro de esta suscripción. Por ejemplo para un plan que cobra $10.000 con un tax_percent de 19.0, se cobrará $11.900.

    Respuesta

    Retorna un objeto de suscripción si la llamada es exitosa. Si el cliente no posee un medio de pago asociado por defecto o el cobro falla, retornará un error, a menos que el plan sea gratis o posea un periodo de prueba.

    Obtener una suscripción

    Ejemplo de llamada

    curl --request GET "https://api.qvo.cl/subscriptions/sub_HnKU4UmU5GtymRulcVOEow" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/subscriptions/sub_HnKU4UmU5GtymRulcVOEow', {
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.get 'https://api.qvo.cl/subscriptions/sub_HnKU4UmU5GtymRulcVOEow', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.get('https://api.qvo.cl/subscriptions/sub_HnKU4UmU5GtymRulcVOEow', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('GET', 'https://api.qvo.cl/subscriptions/sub_HnKU4UmU5GtymRulcVOEow', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "id": "sub_HnKU4UmU5GtymRulcVOEow",
      "status": "active",
      "debt": 0,
      "start": "2017-05-17T19:12:57.185Z",
      "end": null,
      "cycle_count": null,
      "current_period_start": "2017-05-17T19:12:57.185Z",
      "current_period_end": "2017-06-17T19:12:57.185Z",
      "customer": {
        "id": "cus_qos_6r3-4I4zIiou2BVMHg",
        "name": "Jon Snow",
        "email": "dabastad@thewatch.org",
        "metadata": null,
        "address": null
      },
      "plan": {
        "id": "oro",
        "name": "Plan Oro",
        "price": "15000.0",
        "currency": "CLP",
        "interval": "month",
        "interval_count": 1
      },
      "tax_name": "IVA",
      "tax_percent": "19.0",
      "created_at": "2017-05-17T19:12:57.189Z",
      "updated_at": "2017-05-17T19:12:57.189Z"
    }
    

    GET /subscriptions/{subscription_id}

    Obtiene los detalles de una suscripción existente. Se necesita proporcionar sólo el identificador único de la suscripción el cual fue retornado al momento de su creación.

    Parámetros

    subscription_id

    Requerido

    string

    Identificador único de la suscripción.

    Respuesta

    Retorna un objeto de suscripción si se provee de un identificador válido.

    Actualizar una suscripción

    Ejemplo de llamada

    curl --request PUT "https://api.qvo.cl/subscriptions/sub_HnKU4UmU5GtymRulcVOEow" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA" \
      -d plan_id="platino"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/subscriptions/sub_HnKU4UmU5GtymRulcVOEow', {
      method: 'PUT',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      },
      body: {
        plan_id: "platino"
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.put 'https://api.qvo.cl/subscriptions/sub_HnKU4UmU5GtymRulcVOEow', {
        plan_id: "platino"
      }, {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.put('https://api.qvo.cl/subscriptions/sub_HnKU4UmU5GtymRulcVOEow', params={
      'plan_id': 'platino'
    }, headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('PUT', 'https://api.qvo.cl/subscriptions', [
      'json' => [
        'plan_id' => 'platino'
      ],
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "id": "sub_HnKU4UmU5GtymRulcVOEow",
      "status": "active",
      "debt": 35000,
      "start": "2017-05-17T19:12:57.185Z",
      "end": null,
      "prorate": true,
      "cycle_count": null,
      "current_period_start": "2017-05-17T19:12:57.185Z",
      "current_period_end": "2017-06-17T19:12:57.185Z",
      "customer": {
        "id": "cus_qos_6r3-4I4zIiou2BVMHg",
        "name": "Jon Snow",
        "email": "dabastad@thewatch.org",
        "metadata": null,
        "address": null
      },
      "plan": {
        "id": "platino",
        "name": "Plan Platino",
        "price": "50000.0",
        "currency": "CLP",
        "interval": "month",
        "interval_count": 1
      },
      "tax_name": "IVA",
      "tax_percent": "19.0",
      "created_at": "2017-05-17T19:12:57.189Z",
      "updated_at": "2017-05-17T19:12:57.185Z"
    }
    

    PUT /subscriptions/{subscription_id}

    Actualiza la suscripción especificada con los parámetros provistos. Cualquier parámetro que no se provea quedará inalterado.

    Cuando se cambia un plan de mayor precio, es necesario cobrar la diferencia del uso del nuevo plan por el periodo restante, el cual va desde fecha de actualización hasta la fecha de término del ciclo de facturación. Esto se almacenará en la suscripción como una deuda o debt y se cobrará al término del ciclo de facturación.

    En el caso contrario, en el que el plan es de menor precio, se le otorgará al cliente créditos que serán descontados del próximo cobro.

    Parámetros

    subscription_id

    Requerido

    string

    Identificador único de la suscripción.
    plan_id

    string

    Identificador único de un plan existente.
    cycle_count

    integer

    Número de ciclos de la suscripción. Debe ser un entero positivo. Por ejemplo si la suscripción pertenece a un plan mensual y cycle_count es igual a 6, la suscripción durará por 6 meses.
    tax_name

    string

    Nombre del impuesto que se mostrará en el detalle de la transacción. Por ejemplo: IVA.
    tax_percent

    decimal

    Un decimal no negativo entre 0 y 100. Esto representa el porcentaje de impuesto que se aplicará en el cobro de esta suscripción. Por ejemplo para un plan que cobra $10.000 con un tax_percent de 19.0, se cobrará $11.900.
    prorate

    boolean

    Corresponde al prorrateo de la suscripción cuando se cambia el plan asociado, otorgando créditos al cliente o deuda a la suscripción dependiendo del nuevo precio del plan y el tiempo utilizado. Si es false, no se realizarán ajustes de prorrateo.

    Respuesta

    Retorna el objeto de suscripción si la actualización es exitosa. Retorna un error si algún parámetro de actualización es inválido.

    Cancelar una suscripción

    Ejemplo de llamada

    curl -x DELETE "https://api.qvo.cl/subscriptions/sub_HnKU4UmU5GtymRulcVOEow" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/subscriptions/sub_HnKU4UmU5GtymRulcVOEow', {
      method: 'DELETE',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.delete 'https://api.qvo.cl/subscriptions/sub_HnKU4UmU5GtymRulcVOEow', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.delete('https://api.qvo.cl/subscriptions/sub_HnKU4UmU5GtymRulcVOEow', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('DELETE', 'https://api.qvo.cl/subscriptions/sub_HnKU4UmU5GtymRulcVOEow', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "id": "sub_HnKU4UmU5GtymRulcVOEow",
      "status": "active",
      "start": "2017-05-17T19:12:57.185Z",
      "end": null,
      "prorate": true,
      "cycle_count": null,
      "current_period_start": "2017-05-17T19:12:57.185Z",
      "current_period_end": "2017-06-17T19:12:57.185Z",
      "cancel_at_period_end": true,
      "customer": {
        "id": "cus_qos_6r3-4I4zIiou2BVMHg",
        "name": "Jon Snow",
        "email": "dabastad@thewatch.org",
        "metadata": null,
        "address": null
      },
      "plan": {
        "id": "oro",
        "name": "Plan Oro",
        "price": "15000.0",
        "currency": "CLP",
        "interval": "month",
        "interval_count": 1
      },
      "tax_name": "IVA",
      "tax_percent": "19.0",
      "created_at": "2017-05-17T19:12:57.189Z",
      "updated_at": "2017-05-17T19:12:57.189Z"
    }
    

    DELETE /subscriptions/{subscription_id}

    Cancela una suscripción. Por defecto, esta se cancelará (pasará al estado canceled) en la fecha especificada por el final del periodo de facturación o current_period_end. Si envías el parámetro cancel_at_period_end como false o la suscripción estaba con estado inactive, se cancelará de inmediato.

    Parámetros

    subscription_id

    Requerido

    string

    Identificador único de la suscripción.
    cancel_at_period_end

    boolean

    Indicador de cancelación al final del periodo. Si se suministra como false se cancelará de inmediato, de otra manera se cancelará por omisión al final del periodo.

    Respuesta

    Si la operación fue exitosa, retorna la suscripción actualizada. Si el identificador de la suscripción no es válido, retornará un error.

    Obtener una lista de suscripciones

    Ejemplo de llamada

    curl --request GET "https://api.qvo.cl/subscriptions" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/subscriptions', {
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.get 'https://api.qvo.cl/subscriptions', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.get('https://api.qvo.cl/subscriptions', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('GET', 'https://api.qvo.cl/subscriptions', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    [
      {
        "id": "sub_HnKU4UmU5GtymRulcVOEow",
        "status": "active",
        "start": "2017-05-17T19:12:57.185Z",
        "end": null,
        "prorate": true,
        "cycle_count": null,
        "current_period_start": "2017-05-17T19:12:57.185Z",
        "current_period_end": "2017-06-17T19:12:57.185Z",
        "customer": {
          "id": "cus_qos_6r3-4I4zIiou2BVMHg",
          "name": "Jon Snow",
          "email": "dabastad@thewatch.org",
          "metadata": null,
          "address": null
        },
        "plan": {
          "id": "oro",
          "name": "Plan Oro",
          "price": "15000.0",
          "currency": "CLP",
          "interval": "month",
          "interval_count": 1
        },
        "tax_name": "IVA",
        "tax_percent": "19.0",
        "created_at": "2017-05-17T19:12:57.189Z",
        "updated_at": "2017-05-17T19:12:57.189Z"
      }
    ]
    

    GET /subscriptions

    Retorna una lista de suscripciones activas. Las suscripciones se encuentran ordenadas por defecto por la fecha de creación, donde las mas recientes aparecerán primero.

    Respuesta

    Un arreglo donde cada entrada representa a una suscripción con su respectiva información.

    Transacciones

    Las transacciones representan movimientos en el sistema en torno a pagos. Estos pueden ser transaccionales o vinculados a un "transable", como una suscripción. Estos almacenan información como pagos, reembolsos y comisiones.

    El objeto transacción

    {
      "id": "trx_Vk7WJYL-wYi4bjXmAaLyaw",
      "created_at": "2017-05-17T19:12:57.759Z",
      "amount": 3000,
      "currency": "CLP",
      "description": "For the Watch",
      "gateway": "webpay_oneclick",
      "credits": 0,
      "status": "successful",
      "customer": {
        "id": "cus_qos_6r3-4I4zIiou2BVMHg",
        "name": "Jon Snow",
        "email": "lordcommander@thewatch.org",
        "phone": null,
        "metadata": null,
        "address": null,
      },
      "payment": {
        "amount": 3000,
        "gateway": "webpay_oneclick",
        "payment_type": "credit",
        "fee": 106,
        "installments": 0,
        "payment_method": {
          "id": "woc_m_c3zyh5BEl8EITxvLbMzw",
          "last_4_digits": "4242",
          "card_type": "VISA",
          "payment_type": "CD"
        }
      },
      "refund": null,
      "transable": {
        "type": "Subscription",
        "id": "sub_HnKU4UmU5GtymRulcVOEow",
        "status": "active",
        "current_period_start": "2017-05-17T19:12:57.185Z",
        "current_period_end": "2017-06-17T19:12:57.185Z",
        "plan": {
          "id": "oro",
          "name": "Plan Oro",
          "price": "3000.0",
          "currency": "CLP"
        },
        "created_at": "2017-05-17T19:12:57.189Z",
        "updated_at": "2017-05-17T19:12:57.189Z"
      },
      "gateway_response": {
        "status": "success",
        "message": "successful transaction"
      }
    }
    

    Atributos

    id

    string

    Identificador único del objeto.
    amount

    integer

    Monto de la transacción.
    currency

    string

    Código correspondiente a la moneda. Puede ser: CLP o USD.
    description

    string

    Corresponde a la descripción de la transacción. Puede ser útil para identificar un producto u orden de compra del comercio.
    gateway

    string

    Corresponde a la vía de pago por la cual se efectuó la transacción. Puede ser: webpay_plus, webpay_oneclick o olpays.
    credits

    integer

    Créditos utilizados en la transacción.
    status

    string

    Estado de la transacción. Puede ser: successful, rejected, unable_to_charge, refunded, waiting_response o response_timeout. Una transacción que está esperando el pago está waiting_response y pasa a successful si el pago es exitoso. Si no es exitoso, puede pasar a unable_to_charge si existió un problema con la vía de pago o rejected si fue rechazado por la misma. Por último, una transacción está en refunded si se ha reembolsado la totalidad del monto. Si el tiempo de espera en el estado waiting_response supera los 20 minutos, pasará al estado response_timeout.
    customer

    Customer

    Cliente asociado a la transacción.
    payment

    Payment

    Pago asociado a la transacción. Puede ser null.
    refund

    Refund

    Reembolzo asociado a la transacción. Puede ser null.
    transable

    hash

    Objeto transado en la transacción. Puede ser Suscripción. Puede ser null.
    gateway_response

    hash

    Respuesta obtenida de la vía de la transacción. Contiene status y message. Es acá donde se expondrán detalles en caso de un error en la transacción.
    created_at

    datetime

    Fecha de creación del objeto.
    updated_at

    datetime

    Fecha de la última actualización del objeto.

    El objeto pago

    {
      "amount": 3000,
      "gateway": "webpay_oneclick",
      "payment_type": "credit",
      "fee": 106,
      "installments": 0,
      "payment_method": {
        "id": "woc_m_c3zyh5BEl8EITxvLbMzw",
        "last_4_digits": "4242",
        "card_type": "VISA",
        "payment_type": "CD"
      }
    }
    

    Atributos

    amount

    integer

    Monto del pago.
    gateway

    string

    Vía de pago. Puede ser: webpay_plus, webpay_oneclick o olpays.
    payment_type

    string

    Tipo de pago. Puede ser: credit (crédito) o debit (débito)
    fee

    integer

    Comisión del pago. Corresponde a lo descontado por QVO + IVA.
    installments

    integer

    Número de cuotas (sólo aplica a crédito).
    payment_method

    Card

    Medio de pago utilizado. Describe una tarjeta.

    El objeto reembolso

    {
      "amount": 3000,
      "created_at": "2017-05-17T19:12:57.189Z"
    }
    

    Atributos

    amount

    integer

    Monto del reembolso.
    created_at

    datetime

    Fecha de creación del reembolso.

    Obtener una transacción

    Ejemplo de llamada

    curl --request GET "https://api.qvo.cl/transactions/trx_Vk7WJYL-wYi4bjXmAaLyaw" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/transactions/trx_Vk7WJYL-wYi4bjXmAaLyaw', {
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.get 'https://api.qvo.cl/transactions/trx_Vk7WJYL-wYi4bjXmAaLyaw', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.get('https://api.qvo.cl/transactions/trx_Vk7WJYL-wYi4bjXmAaLyaw', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('GET', 'https://api.qvo.cl/transactions/trx_Vk7WJYL-wYi4bjXmAaLyaw', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "id": "trx_Vk7WJYL-wYi4bjXmAaLyaw",
      "created_at": "2017-05-17T19:12:57.759Z",
      "amount": 3000,
      "currency": "CLP",
      "gateway": "webpay_oneclick",
      "credits": 0,
      "status": "successful",
      "customer": {
        "id": "cus_qos_6r3-4I4zIiou2BVMHg",
        "name": "Jon Snow",
        "email": "dabastard@winterfell.com",
        "phone": null,
        "metadata": null,
        "address": null
      },
      "payment": {
        "amount": 3000,
        "fee": 106,
        "gateway": "webpay_oneclick",
        "payment_type": "credit",
        "installments": 0,
        "payment_method": {
          "id": "woc_m_c3zyh5BEl8EITxvLbMzw",
          "last_4_digits": "4242",
          "card_type": "VISA",
          "payment_type": "CD"
        }
      },
      "refund": null,
      "transable": {
        "type": "Subscription",
        "id": "sub_HnKU4UmU5GtymRulcVOEow",
        "status": "active",
        "current_period_start": "2017-05-17T19:12:57.185Z",
        "current_period_end": "2017-06-17T19:12:57.185Z",
        "plan": {
          "id": "oro",
          "name": "Plan Oro",
          "price": "3000.0",
          "currency": "CLP"
        },
        "created_at": "2017-05-17T19:12:57.189Z",
        "updated_at": "2017-05-17T19:12:57.189Z"
      },
      "gateway_response": {
        "status": "success",
        "message": "successful transaction"
      }
    }
    

    GET /transactions/{transaction_id}

    Obtiene los detalles de una transacción existente.

    Parámetros

    transaction_id

    Requerido

    string

    Identificador único de la transacción.

    Respuesta

    Retorna un objeto de transacción si se provee de un identificador válido. De lo contrario, retornará un error.

    Reembolsar una transacción

    Ejemplo de llamada

    curl --request POST "https://api.qvo.cl/tramsactions/trx_Vk7WJYL-wYi4bjXmAaLyaw/refund" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA" \
      -d amount=1000
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/transactions/trx_Vk7WJYL-wYi4bjXmAaLyaw/refund', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      },
      body: {
        amount: 1000
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.post 'https://api.qvo.cl/transactions/trx_Vk7WJYL-wYi4bjXmAaLyaw/refund', {
        amount: 1000
      }, {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.post('https://api.qvo.cl/transactions/trx_Vk7WJYL-wYi4bjXmAaLyaw/refund', params={
      'amount': 1000
    }, headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('POST', 'https://api.qvo.cl/transactions/trx_Vk7WJYL-wYi4bjXmAaLyaw/refund', [
      'json'=> [
        'amount' => 1000
      ],
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "id": "trx_Vk7WJYL-wYi4bjXmAaLyaw",
      "created_at": "2017-05-17T19:12:57.759Z",
      "amount": 3000,
      "currency": "CLP",
      "gateway": "webpay_oneclick",
      "credits": 0,
      "status": "refunded",
      "customer": {
        "id": "cus_qos_6r3-4I4zIiou2BVMHg",
        "name": "Jon Snow",
        "email": "lordcommander@thewatch.org",
        "phone": null,
        "metadata": null,
        "address": null
      },
      "payment": {
        "amount": 3000,
        "gateway": "webpay_oneclick",
        "payment_type": "credit",
        "fee": 106,
        "installments": 0,
        "payment_method": {
          "id": "woc_m_c3zyh5BEl8EITxvLbMzw",
          "last_4_digits": "4242",
          "card_type": "VISA",
          "payment_type": "CD"
        }
      },
      "refund" : {
        "amount": 3000,
        "created_at": "2017-05-17T19:12:57.189Z"
      },
      "transable": {
        "type": "Subscription",
        "id": "sub_HnKU4UmU5GtymRulcVOEow",
        "status": "active",
        "current_period_start": "2017-05-17T19:12:57.185Z",
        "current_period_end": "2017-06-17T19:12:57.185Z",
        "plan": {
          "id": "oro",
          "name": "Plan Oro",
          "price": "3000.0",
          "currency": "CLP"
        },
        "created_at": "2017-05-17T19:12:57.189Z",
        "updated_at": "2017-05-17T19:12:57.189Z"
      },
      "gateway_response": {
        "status": "success",
        "message": "successful transaction"
      }
    }
    

    POST /transactions/{transaction_id}/refund

    Crea un reembolso para una transacción existente. Se reembolzará la totalidad del monto pagado y los créditos correspondientes. Sólo se soportan reembolosos para los pagos en crédito de los gateway webpay_plus y webpay_oneclick

    Parámetros

    transaction_id

    Requerido

    string

    Identificador único de una transacción.

    Respuesta

    Retorna un objeto de transacción con el objeto refund si la llamada es exitosa. Si la vía de pago no soporta reembolsos, retornará un error.

    Obtener una lista de transacciones

    Ejemplo de llamada

    curl --request GET "https://api.qvo.cl/transactions" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/transactions', {
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.get 'https://api.qvo.cl/transactions', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.get('https://api.qvo.cl/transactions', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('GET', 'https://api.qvo.cl/transactions', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    [
      {
        "id": "trx_Vk7WJYL-wYi4bjXmAaLyaw",
        "created_at": "2017-05-17T19:12:57.759Z",
        "amount": 3000,
        "currency": "CLP",
        "gateway": "webpay_oneclick",
        "credits": 0,
        "status": "successful",
        "customer": {
          "id": "cus_qos_6r3-4I4zIiou2BVMHg",
          "name": "Jon Snow",
          "email": "dabastard@winterfell.com",
          "phone": null,
          "metadata": null,
          "address": null
        },
        "payment": {
          "amount": 3000,
          "gateway": "webpay_oneclick",
          "payment_type": "credit",
          "fee": 106,
          "installments": 0,
          "payment_method": {
            "id": "woc_m_c3zyh5BEl8EITxvLbMzw",
            "last_4_digits": "4242",
            "card_type": "VISA",
            "payment_type": "CD"
          }
        },
        "refund": null,
        "transable": {
          "type": "Subscription",
          "id": "sub_HnKU4UmU5GtymRulcVOEow",
          "status": "active",
          "current_period_start": "2017-05-17T19:12:57.185Z",
          "current_period_end": "2017-06-17T19:12:57.185Z",
          "plan": {
            "id": "oro",
            "name": "Plan Oro",
            "price": "3000.0",
            "currency": "CLP"
          },
          "created_at": "2017-05-17T19:12:57.189Z",
          "updated_at": "2017-05-17T19:12:57.189Z"
        },
        "gateway_response": {
          "status": "success",
          "message": "successful transaction"
        }
      }
    ]
    

    GET /transactions

    Retorna una lista de transacciones. Las transacciones se encuentran ordenadas por defecto por la fecha de creación, donde las mas recientes aparecerán primero.

    Respuesta

    Un arreglo donde cada entrada representa a una transacción con su respectiva información.

    Retiros

    Los retiros permiten extraer dinero del sistema a la cuenta especificada por el comercio en la configuración. Al momento de ser aprobados, existe un plazo de máximo 72 horas hábiles en que se realizará la transferencia a la cuenta del comercio.

    El objeto retiro

    Ejemplo de respuesta

    {
      "id": "wdl_nPe9BeVau5rQyV2h7Env0A",
      "amount": 1000,
      "status": "processing",
      "created_at": "2017-05-21T22:55:14.975Z",
      "updated_at": "2017-05-21T22:55:14.975Z"
    }
    

    Atributos

    id

    string

    Identificador único del objeto.
    amount

    integer

    Monto de retiro.
    status

    string

    Estado del retiro. Puede ser: processing, rejected y transfered.
    created_at

    datetime

    Fecha de creación del objeto.
    updated_at

    datetime

    Fecha de la última actualización del objeto.

    Crear un retiro

    Ejemplo de llamada

    curl --request POST "https://api.qvo.cl/withdrawals" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA" \
      -d amount=1000
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/withdrawals', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      },
      body: {
        amount: 1000
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.post 'https://api.qvo.cl/withdrawals', {
        amount: 1000
      }, {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.post('https://api.qvo.cl/withdrawals', params={
      'amount': 1000
    }, headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('POST', 'https://api.qvo.cl/withdrawals', [
      'json' => [
        'amount' => 1000
      ],
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "id": "wdl_nPe9BeVau5rQyV2h7Env0A",
      "amount": 1000,
      "status": "processing",
      "created_at": "2017-05-21T22:55:14.975Z",
      "updated_at": "2017-05-21T22:55:14.975Z"
    }
    

    POST /withdrawals

    Crea un nuevo objeto retiro.

    Parámetros

    amount

    Requerido

    integer

    Monto del retiro.

    Respuesta

    Retorna un objeto de retiro si la llamada es exitosa.

    Obtener un retiro

    Ejemplo de llamada

    curl --request GET "https://api.qvo.cl/withdrawals/wdl_nPe9BeVau5rQyV2h7Env0A" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/withdrawals/wdl_nPe9BeVau5rQyV2h7Env0A', {
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result = RestClient.get 'https://api.qvo.cl/withdrawals/wdl_nPe9BeVau5rQyV2h7Env0A'
    p JSON.parse(result)
    
    import requests
    
    r = requests.get('https://api.qvo.cl/withdrawals/wdl_nPe9BeVau5rQyV2h7Env0A', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('GET', 'https://api.qvo.cl/withdrawals/wdl_nPe9BeVau5rQyV2h7Env0A', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "id": "wdl_nPe9BeVau5rQyV2h7Env0A",
      "amount": 1000,
      "status": "processing",
      "created_at": "2017-05-21T22:55:14.975Z",
      "updated_at": "2017-05-21T22:55:14.975Z"
    }
    

    GET /withdrawals/{withdrawal_id}

    Obtiene los detalles de un retiro existente. Se necesita proporcionar sólo el identificador único del retiro el cual fue retornado al momento de su creación.

    Parámetros

    withdrawal_id

    Requerido

    string

    Identificador único del retiro.

    Respuesta

    Retorna un objeto de retiro si se provee de un identificador válido.

    Obtener una lista de retiros

    Ejemplo de llamada

    curl --request GET "https://api.qvo.cl/withdrawals" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/withdrawals', {
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result = RestClient.get 'https://api.qvo.cl/withdrawals'
    p JSON.parse(result)
    
    import requests
    
    r = requests.get('https://api.qvo.cl/withdrawals', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('GET', 'https://api.qvo.cl/withdrawals', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    [
      {
        "id": "wdl_nPe9BeVau5rQyV2h7Env0A",
        "amount": 1000,
        "status": "processing",
        "created_at": "2017-05-21T22:55:14.975Z",
        "updated_at": "2017-05-21T22:55:14.975Z"
      }
    ]
    

    GET /withdrawals

    Retorna una lista de retiros. Los retiros se encuentran ordenados por defecto por la fecha de creación, donde los mas recientes aparecerán primero.

    Respuesta

    Un arreglo donde cada entrada representa a un retiro con su respectiva información.

    Eventos

    Los eventos nos permiten comunicarte cambios relevantes en el sistema. Cuando ocurre un evento interesante, se crea un objeto evento. Por ejemplo, cuando se cobra una suscripción, se crea un evento transaction.payment_succeeded; cuando un pago falla, se crea un objeto transaction.payment_failed. Cabe mencionar que una llamada a la API puede generar 1 o más eventos. Por ejemplo, cuando se crea una nueva suscripción para un cliente, se crearán los eventos customer.subscription.created y transaction.payment_succeeded.

    Los eventos pueden ser enviados diréctamente a tu servidor a través de la utilización de webhooks. Puedes adminstrarlos en la configuración de tu cuenta.

    El objeto evento

    Ejemplo de respuesta

    {
      "id": "evt_fdyXA5uWS9F8mEwMXBPcNg",
      "type": "customer.updated",
      "data": {
        "customer": {
          "id": "cus_hi9ycVF8p9WYLrvWkCCilg",
          "default_payment_method": null,
          "name": "No One",
          "email": "arya@stark.com",
          "phone": null,
          "metadata": null,
          "address": null,
          "created_at": "2017-05-22T20:39:10.370Z",
          "updated_at": "2017-05-22T20:55:47.860Z",
          "subscriptions": [],
          "cards": [],
          "transactions": []
        }
      },
      "previous": {
        "customer": {
          "id": "cus_hi9ycVF8p9WYLrvWkCCilg",
          "default_payment_method": null,
          "name": "Arya Stark",
          "email": "arya@stark.com",
          "phone": null,
          "metadata": null,
          "address": null,
          "created_at": "2017-05-22T20:39:10.370Z",
          "updated_at": "2017-05-22T20:39:10.370Z",
          "subscriptions": [],
          "cards": [],
          "transactions": []
        }
      },
      "created_at": "2017-05-22T20:55:47.872Z"
    }
    

    Atributos

    id

    string

    Identificador único del objeto.
    type

    string

    Descripción de el evento (ej: transaction.payment_succeeded, customer.card.created, etc.).
    data

    hash

    Objeto que contiene la información de los objetos asociados al evento.
    previous

    hash

    Objeto que contiene la información previa de los objetos asociados al evento. Se encuentra en eventos donde se produce la actualización de un objeto.
    created_at

    datetime

    Fecha de creación del objeto.

    Tipos de evento

    customer.created Se creó un objeto de cliente.
    customer.updated Se actualizó un objeto de cliente.
    customer.deleted Se eliminó un objeto de cliente.
    plan.created Se creó un objeto de plan.
    plan.updated Se actualizó un objeto de plan.
    plan.deleted Se eliminó un objeto de plan.
    customer.card.created Se creó un objeto de tarjeta para un cliente.
    customer.card.deleted Se eliminó un objeto de tarjeta para un cliente.
    customer.subscription.created Se creó un objeto de suscripción para un cliente.
    customer.subscription.updated Se actualizó un objeto de suscripción para un cliente.
    customer.subscription.deleted Se eliminó un objeto de suscripción para un cliente.
    transaction.payment_succeeded Pago exitoso para una transacción.
    transaction.payment_failed Ocurrió un error en el pago de una transacción.
    transaction.refunded Ocurrió un reembolso en una trasacción.
    transaction.response_timeout La transacción agotó el tiempo de espera.

    Obtener un evento

    Ejemplo de llamada

    curl --request GET "https://api.qvo.cl/events/evt_fdyXA5uWS9F8mEwMXBPcNg" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/events/evt_fdyXA5uWS9F8mEwMXBPcNg', {
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.get 'https://api.qvo.cl/events/evt_fdyXA5uWS9F8mEwMXBPcNg', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.get('https://api.qvo.cl/events/evt_fdyXA5uWS9F8mEwMXBPcNg', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('GET', 'https://api.qvo.cl/events/evt_fdyXA5uWS9F8mEwMXBPcNg', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "id": "evt_fdyXA5uWS9F8mEwMXBPcNg",
      "type": "customer.updated",
      "data": {
        "customer": {
          "id": "cus_hi9ycVF8p9WYLrvWkCCilg",
          "default_payment_method": null,
          "name": "No One",
          "email": "arya@stark.com",
          "phone": null,
          "metadata": null,
          "address": null,
          "created_at": "2017-05-22T20:39:10.370Z",
          "updated_at": "2017-05-22T20:55:47.860Z",
          "subscriptions": [],
          "cards": [],
          "transactions": []
        }
      },
      "previous": {
        "customer": {
          "id": "cus_hi9ycVF8p9WYLrvWkCCilg",
          "default_payment_method": null,
          "name": "Arya Stark",
          "email": "arya@stark.com",
          "phone": null,
          "metadata": null,
          "address": null,
          "created_at": "2017-05-22T20:39:10.370Z",
          "updated_at": "2017-05-22T20:39:10.370Z",
          "subscriptions": [],
          "cards": [],
          "transactions": []
        }
      },
      "created_at": "2017-05-22T20:55:47.872Z"
    }
    

    GET /events/{event_id}

    Obtiene los detalles de un evento existente.

    Parámetros

    event_id

    Requerido

    string

    Identificador único del evento.

    Respuesta

    Retorna un objeto de evento si se provee de un identificador válido. De lo contrario, retornará un error.

    Obtener una lista de eventos

    Ejemplo de llamada

    curl --request GET "https://api.qvo.cl/events" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/events', {
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.get 'https://api.qvo.cl/events', {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.get('https://api.qvo.cl/events', headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('GET', 'https://api.qvo.cl/events', [
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    [
      {
        "id": "evt_fdyXA5uWS9F8mEwMXBPcNg",
        "type": "customer.updated",
        "data": {
          "customer": {
            "id": "cus_hi9ycVF8p9WYLrvWkCCilg",
            "default_payment_method": null,
            "name": "No One",
            "email": "arya@stark.com",
            "phone": null,
            "metadata": null,
            "address": null,
            "created_at": "2017-05-22T20:39:10.370Z",
            "updated_at": "2017-05-22T20:55:47.860Z",
            "subscriptions": [],
            "cards": [],
            "transactions": []
          }
        },
        "previous": {
          "customer": {
            "id": "cus_hi9ycVF8p9WYLrvWkCCilg",
            "default_payment_method": null,
            "name": "Arya Stark",
            "email": "arya@stark.com",
            "phone": null,
            "metadata": null,
            "address": null,
            "created_at": "2017-05-22T20:39:10.370Z",
            "updated_at": "2017-05-22T20:39:10.370Z",
            "subscriptions": [],
            "cards": [],
            "transactions": []
          }
        },
        "created_at": "2017-05-22T20:55:47.872Z"
      }
    ]
    

    GET /events

    Retorna una lista de eventos. Los eventos se encuentran ordenadas por defecto por la fecha de creación, donde las mas recientes aparecerán primero.

    Respuesta

    Un arreglo donde cada entrada representa a un evento con su respectiva información.

    Webpay Plus

    El sistema permite generar cobros con Webpay Plus.

    Generar un cobro webpay plus

    Ejemplo de llamada

    curl --request POST "https://api.qvo.cl/webpay_plus/charge" \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA" \
      -d amount=2000 \
      -d return_url="http://www.example.com/return" \
      -d customer_id="cus_VhiEhjVHoYui_6ykz9fOsg" \
      -d description="Cobro de Prueba"
    
    const fetch = require('node-fetch-json');
    
    fetch('https://api.qvo.cl/webpay_plus/charge', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      },
      body: {
        amount: 2000,
        return_url: "http://www.example.com/return",
        customer_id: "cus_VhiEhjVHoYui_6ykz9fOsg"
      }
    }).then(function(response) {
      console.log(response);
    });
    
    require 'rest-client'
    require 'json'
    
    result =
      RestClient.post 'https://api.qvo.cl/webpay_plus/charge', {
        amount: 2000,
        return_url: "http://www.example.com/return",
        customer_id: "cus_VhiEhjVHoYui_6ykz9fOsg"
      }, {
        Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      }
    
    p JSON.parse(result)
    
    import requests
    
    r = requests.post('https://api.qvo.cl/webpay_plus/charge', params={
      'amount': 2000,
      'return_url': "http://www.example.com/return",
      'customer_id': "cus_VhiEhjVHoYui_6ykz9fOsg"
    }, headers={
      'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
    })
    
    print r.json()
    
    <?php
    require 'guzzle.phar';
    
    $client = new GuzzleHttp\Client();
    
    $body = $client->request('POST', 'https://api.qvo.cl/webpay_plus/charge', [
      'json' => [
        'amount' => 2000,
        'return_url' => "http://www.example.com/return",
        'customer_id' => "cus_VhiEhjVHoYui_6ykz9fOsg"
      ],
      'headers' => [
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiVGVzdCBjb21tZXJjZSIsImFwaV90b2tlbiI6dHJ1ZX0.AXt3ep_r23w9rSPTv-AnK42s2m-1O0okMYrYYDlRyXA'
      ]
    ])->getBody();
    
    $response = json_decode($body);
    
    var_dump($response);
    ?>
    

    Ejemplo de respuesta

    {
      "transaction_id": "trx_fzmNpXvJJZBWwGbH5fW8cw",
      "redirect_url": "https://api.qvo.cl/webpay_plus/init_transaction/wpt_y7CUkd3EqiLB8TV1O7fhGQ",
      "expiration_date": "2017-05-21T23:43:41.332Z"
    }
    

    POST /webpay_plus/charge

    Crea una cobro utilizando Webpay Plus.

    Permite realizar un cobro mediante la interfaz de Webpay Plus. El proceso se divide en 3 pasos:

    1. Realizar la llamada y redirigir al cliente

    Realiza la llamada de cobro POST /webpay_plus/charge. Una vez realizada la llamada, es necesario redirigir al cliente a el redirect_url retornado por la llamada, para iniciar el proceso de cobro.

    2. Capturar la respuesta

    Una vez terminado paso 1, se retornará el cliente con una llamada GET a el return_url proporcionado como parámetro en el paso 1. Esta llamada, irá acompañada de un parámetro llamado transaction_id ubicado en la ruta, que representa el identificador único de la transacción.

    Por ejemplo, para return_url = "http://www.example.com/return se retornará el cliente a:

    GET http://www.example.com/return?transaction_id=trx_fzmNpXvJJZBWwGbH5fW8cw

    donde transaction_id es igual a trx_fzmNpXvJJZBWwGbH5fW8cw

    3. Obtener el resultado

    Para verificar si la transacción fue exitosa, se debe realizar una llamada a obtener una transacción, utilizando el identificador único de la transacción transaction_id. retornado en el paso 2.

    Parámetros

    amount

    Requerido

    integer

    El monto de la transacción
    return_url

    Requerido

    string

    URL de retorno de la transacción
    customer_id

    string

    Identificador único de cliente.
    description

    string

    Descripción de la transacción.

    Respuesta

    Retorna los parámetros para iniciar un cobro con Webpay Plus.