¿Cuales son todos los webhooks que podría inscribir?

Los eventos que pueden registrarse son:

  • 'interaction.incoming': Interaction entrante desde un Customer hacia Toku.
  • 'interaction.outgoing': Interaction saliente desde Toku hacia un Customer.
  • 'payment_method.attached': Customer ha inscrito un método de pago en la plataforma.
  • 'payment_method.attached_products': Customer ha inscrito un método de pago en la plataforma y envía una lista de los productos asociados. (Recomendado para organizaciones en modo suscription)
  • 'payment_intent.succeeded': Intento de pago exitoso de un Invoice.
  • 'payment_intent.payment_failed': Intento de pago fallido de un Invoice.
  • 'payment_intent.succeeded_batch': Resumen de pagos exitosos para una lista de Invoices. Se utiliza en procesos de cobro automático masivos
  • 'payment_intent.payment_failed_batch': Resumen de intentos de pagos fallidos para una lista de Invoices. Se utiliza en procesos de cobro automático masivos
  • 'payment_intent.payment_pending_batch': Resumen de intentos de pagos que se encuentran pendientes para una lista de Invoices. Se utiliza en procesos de cobro automático masivos
  • 'payment.succeeded': Pago realizado exitosamente de un Invoice. Esto aplica solo para pagos ejecutados manualmente a través de Toku. Si quieres escuchar los pagos procesados a través de Toku, debes utilizar payment_intent.succeeded.

Para registrar un **Webhook Endpoint, debes poseer un endpoint que pueda recibir datos a través de una request POST, y que confirme su recepción retornando un status code HTTP 2xx.

👍

Solo es necesario inscribir una vez el endpoint. Después de inscrito, notificará los eventos inscritos.

👍

Si ya tienes todo instalado puedes probar webhook de prueba aquí

Ejemplos de todos los webhooks que tiene habilitados Toku

interaction.outgoing

{
    "id": "eve_ARC6o7o3xEHvYTw8o7fq74r2tLq-2tAS",
    "event_type": "interaction.outgoing",
    "interaction": {
        "id": "inter_tgK-vdZo8J8UH7E9Ng_K7Jejn_PYykch",
        "customer": "cus_lq1wGjwgFyqQm4ACZx0QjE84qKm8fffa",
        "created_at": "2022-01-01 20:03:07.963677",
        "channel": "wsp",
        "type": "outgoing",
        "sender_contact": "+15614186678",
        "customer_contact": "+56989934148",
        "message": "test outgoing",
        "subject": null
    }
}

interaction.incoming

{
    "id": "eve_dDWgyidyo3so0yPhHc-Wyx27xOfXxnQc",
    "event_type": "interaction.incoming",
    "interaction": {
        "id": "inter_XUc55FMipFh3-kucknWQR_1rv_AR942L",
        "customer": "cus_lq1wGjwgFyqQm4ACZx0QjE84qKm8fffa",
        "created_at": "2022-01-01 20:16:29.648457",
        "channel": "wsp",
        "type": "outgoing",
        "sender_contact": "+15614186678",
        "customer_contact": "+56989934148",
        "message": "test incoming",
        "subject": null
    }
}

payment_method.attached Transbank

{
    "id": "eve_MOnNVXKNYDCZXzI9slA3smhASQmuRleM",
    "event_type": "payment_method.attached",
    "payment_method": {
        "id": "pm_9tN0ZtjUDjS1qi8qZQ3uJHJbwtcXYH9d",
        "customer": "cus_lq1wGjwgFyqQm4ACZx0QjE84qKm8fffa",
        "id_account": "acc_l8ojrji3k8SC7iLbVBxxgwVeOLRRbkEc",
        "gateway": "transbank_oneclick",
        "card_type": "Visa",
        "card_number": "XXXXXXXXXXXX6623",
        "status": "chargeable",
        "additional": {}
    }
}

payment_method.attached PAC

{
    "id": "eve_MOnNVXKNYDCZXzI9slA3smhASQmuRleM",
    "event_type": "payment_method.attached",
    "payment_method": {
        "id": "pm_9tN0ZtjUDjS1qi8qZQ3uJHJbwtcXYH9d",
        "customer": "cus_lq1wGjwgFyqQm4ACZx0QjE84qKm8fffa",
    "id_account": "acc_l8ojrji3k8SC7iLbVBxxgwVeOLRRbkEc",
        "gateway": "toku_pac",
        "card_type": null,
        "card_number": null,
        "status": "chargeable",
        "additional": {
            "mandate_id": "489205",
            "holder_id": "18349385K",
            "account_type": "checking_account",
            "account_number": "00498540594",
            "institution_id": "cl_banco_estado",
            "institution_name": "Banco Estado",
            "institution_country": "cl",
            "limit_uf": 50,
            "voucher_url": "https://example.com/example.pdf"
        }
    }
}

Los campos institution_name e institution_id pueden tomar los siguientes valores:

institution_nameinstitution_id
Banco BCIcl_banco_bci
Banco de Chilecl_banco_de_chile
Banco Estadocl_banco_estado
Banco Falabellacl_banco_falabella
Banco Itaúcl_banco_itau
Banco Santandercl_banco_santander
Banco Scotiabankcl_banco_scotiabank

'payment_method.attached_products'

{  
  "id": "eve_NFMjlWEFasu7MTBm_bAFUz9ZmD5Cm1Pw",  
  "event_type": "payment_method.attached_products",  
  "payment_method": {  
    "id": "pm_dfs54g5sr4dv5sf",  
    "customer": "cus_dfs54g5sr4dv5sf",  
    "gateway": "transbank_oneclick",  
    "card_type": "Visa",  
    "card_number": "XXXXXXXXX1234",  
    "status": "chargeable",  
    "additional": {},  
    "product_ids": ["product-id-1"]  
  }  
}

payment_intent.succeeded

{
    "id": "eve_nsHM-5paB_ZTGGhWni49URhW1JEpQADW",
    "event_type": "payment_intent.succeeded",
    "payment_intent": {
        "id": "pi_JHjBcHZysyBj6dPDtt5OxFNydEtjw8L7",
        "invoice": "in_5tswGjwgAxrQm4ACZx0QjE84qKm8fgsw",
        "customer": "cus_lq1wGjwgFyqQm4ACZx0QjE84qKm8fffa",
        "id_account": "acc_l8ojrji3k8SC7iLbVBxxgwVeOLRRbkEc",
        "gateway": "transbank_oneclick",
        "payment_method": "pm_9tN0ZtjUDjS1qi8qZQ3uJHJbwtcXYH9d",
        "amount": "1000.0000",
        "transaction_date": "2021-07-26 20:28:00.717000",
        "card_detail": "6623",
        "buy_order": "1931280",
        "child_buy_order": "2931280",
        "status": "AUTHORIZED",
        "authorization_code": "1213",
        "payment_type_code": "VN",
        "response_code": 0,
        "installments_number": 0
    }
}

payment_intent.succeeded Transferencia

{
    "id": "eve_zwr5c8Ddcu0sW2zl57aTTeTFmovcysl-",
    "event_type": "payment_intent.succeeded",
    "payment_intent": {
        "id": "pi_cGuAf-JSoTrg7QhQlabJTsuhQaGborN4",
        "invoice": "in_poaFZEY8fgpxXhwhOYj4KBk1tjLQA-wa",
        "customer": "cus_HpnoeQFzNB-pOiAobqFrccfk7Kpwin_b",
        "id_account": "acc_l8ojrji3k8SC7iLbVBxxgwVeOLRRbkEc",
        "gateway": "khipu_transfer",
        "amount": "10000.0000",
        "status": "AUTHORIZED",
        "payment_method": "pm_AM4LvUGcqfxzgiUgxMocVuR-MD3xjb4N",
        "transaction_date": "2022-04-07 21:39:28.344703",
        "card_detail": null,
        "buy_order": "156967510939",
        "child_buy_order": null,
        "authorization_code": null,
        "payment_type_code": null,
        "response_code": null,
        "toku_response_code": null,
        "installments_number": null,
        "mc_order_id": null
    }
}

payment_intent.payment_failed

{
        "id": "eve_NFMjlWEFasu7MTBm_bAFUz9ZmD5Cm1Pw",
        "event_type": "payment_intent.payment_failed",
        "payment_intent": {
            "id": "pi_dsQ5-sNZPwxBYf6hnLsstaqG9JAZK432",
            "invoice": "in_1YPKc-NZPwxBYf6hnLsstaqG9JAZKxX9",
            "customer": "cus_1YPKc-NZPwxBYf6hnLsstaqG9JAZKxX9",
            "gateway": "toku_pac",
            "amount": "1000",
            "status": "FAILED",
            "payment_method": "pm_1YPKc-NZPwxBYf6hnLsstaqG9JAZKxX9",
            "transaction_date": "2021-04-22T14:03:39.410000",
            "card_detail": "1234",
            "buy_order": "bo-2-609bf894",
            "child_buy_order": "cbo-2-609bf894",
            "authorization_code": "1213",
            "payment_type_code": "VN",
            "response_code": -4,
            "toku_response_code": "SU0000",
            "installments_number": 0,
            "mc_order_id": "1234567"
        }
    }

payment.succeeded

{
    "id": "eve_nsHM-5paB_ZTGGhWni49URhW1JEpQADW",
    "event_type": "payment.succeeded",
    "payment": {
        "id": "pay_JHjBcHZysyBj6dPDtt5OxFNydEtjw8L7",
        "invoice": "in_5tswGjwgAxrQm4ACZx0QjE84qKm8fgsw",
        "customer": "cus_lq1wGjwgFyqQm4ACZx0QjE84qKm8fffa",
        "id_account": "acc_l8ojrji3k8SC7iLbVBxxgwVeOLRRbkEc",
        "gateway": "transbank_oneclick",
        "due_date": "2021-03-04",
        "product_id": "92792",
        "payment_amount": "1000.0000",
        "payment_date": "2021-07-26 20:28:00.717000",
        "payment_intent": "pi_JHjBcHZysyBj6dPDtt5OxFNydEtjw8L7",
        "buy_order": "1931280",
        "receipt": "rpt_JHjBcHZysyBj6dPDtt5OxFNydEtjw8L7",
    }
}

payment_intent.succeeded_batch

{
  "id": "eve_dDWgyidyo3so0yPhHc-Wyx27xOfXxnQc",
  "event_type": "payment_intent.succeeded_batch",
  "payment_intents": [
    {
      "id": "pi_dsQ5-sNZPwxBYf6hnLsstaqG9JAZK432",
      "invoice": "in_1YPKc-NZPwxBYf6hnLsstaqG9JAZKxX9",
      "customer": "cus_1YPKc-NZPwxBYf6hnLsstaqG9JAZKxX9",
      "gateway": "klap_oneclick",
      "amount": 1000,
      "payment_method": "pm_1YPKc-NZPwxBYf6hnLsstaqG9JAZKxX9",
      "transaction_date": "2021-04-22T14:03:39.410000",
      "toku_response_code": "SU0000",
      "status": "AUTHORIZED"
    },
    ...
  ]
}

payment_intent.payment_failed_batch

{
  "id": "eve_dDWgyidyo3so0yPhHc-Wyx27xOfXxnQc",
  "event_type": "payment_intent.payment_failed_batch",
  "payment_intents": [
    {
      "id": "pi_dsQ5-sNZPwxBYf6hnLsstaqG9JAZK432",
      "invoice": "in_1YPKc-NZPwxBYf6hnLsstaqG9JAZKxX9",
      "customer": "cus_1YPKc-NZPwxBYf6hnLsstaqG9JAZKxX9",
      "gateway": "klap_oneclick",
      "amount": 1000,
      "payment_method": "pm_1YPKc-NZPwxBYf6hnLsstaqG9JAZKxX9",
      "transaction_date": "2021-04-22T14:03:39.410000",
      "toku_response_code": "SU0000",
      "status": "FAILED"
    },
    ...
  ]
}

payment_intent.payment_pending_batch

{
  "id": "eve_dDWgyidyo3so0yPhHc-Wyx27xOfXxnQc",
  "event_type": "payment_intent.payment_pending_batch",
  "payment_intents": [
    {
      "id": "pi_dsQ5-sNZPwxBYf6hnLsstaqG9JAZK432",
      "invoice": "in_1YPKc-NZPwxBYf6hnLsstaqG9JAZKxX9",
      "customer": "cus_1YPKc-NZPwxBYf6hnLsstaqG9JAZKxX9",
      "gateway": "klap_oneclick",
      "amount": 1000,
      "payment_method": "pm_1YPKc-NZPwxBYf6hnLsstaqG9JAZKxX9",
      "transaction_date": "2021-04-22T14:03:39.410000",
      "toku_response_code": "SU0000",
      "status": "PAC_PENDING"
    },
    ...
  ]
}