Payments

Eliminar Payments

Changed on

Elimina pagos registrados sobre Invoices.

Se usa para revertir pagos informados por error. Acepta varios Payments en una sola llamada.

Cada Payment se referencia por el Invoice que salda, no por un identificador propio: envía invoice_external_id, o bien product_id y due_date para que Toku lo construya como {product_id}-{due_date}.

Por defecto los Invoices afectados vuelven a quedar impagos; envía set_invoices_as_unpaid en false para eliminar el Payment dejando el Invoice con su estado actual.

Cada Payment enviado se resuelve en uno de estos resultados:

  • success: el pago se eliminó.
  • duplicates: el Payment repite los identificadores de otro elemento del mismo lote. Solo se procesa el primero.
  • not_found: no existe un Invoice que coincida con los identificadores enviados, o ese Invoice no tiene un pago registrado que eliminar.

Que algunos elementos del lote fallen no convierte la respuesta en un error: se devuelve 200 con el recuento por resultado. Revisa esos contadores para saber qué pasó con cada Payment enviado.

delete/payments

Request

  • Base URL
    https://api.trytoku.com
  • URL
    https://api.trytoku.com/payments
  • Auth
    API key in header x-api-key

Headers

x-account-keystring

Llave de API de una Account, para operar sobre esa Account en lugar de la principal.

Request body

id_accountstring

Account bajo la cual se eliminan los Payments.

set_invoices_as_unpaidboolean

Si es true, los Invoices de los Payments eliminados vuelven a quedar impagos. Si es false, se elimina el Payment y el Invoice mantiene su estado.

Example request

{
  "id_account": "acc_2YPKc-NZPwxBYf6hnLsstaqG9JAZKxX4",
  "payments": [
    {
      "due_date": "202101",
      "invoice_external_id": "9897af7987d9245d-202101",
      "product_id": "9897af7987d9245d"
    }
  ]
}

Response

Recuento por resultado del lote.

duplicatesinteger

Payments repetidos dentro del mismo lote. Se procesa la primera aparición y las siguientes se descartan.

errorinteger

Payments que no pudieron procesarse por un error de negocio.

format_errorinteger

Payments rechazados por el formato de los datos enviados.

not_foundinteger

Payments cuyo Invoice no existe o no está disponible.

successinteger

Payments procesados correctamente.

Changes

    • breaking

      request body became required

    • breaking

      the // request property's minLength was increased from 0 to 1

    • breaking

      removed the media type text/plain for the response with the status

    • warning

      the // request property's maxLength was set to 32

    • warning

      the // request property's maxLength was set to 256

    • warning

      removed the request property //

    • warning

      removed the request property //

    • warning

      removed the request property //

    • info

      api operation id eliminar-payment removed and replaced with delete_payment

    • info

      api tag Payments added

    • info

      endpoint deprecated

    • info

      added the new optional header request parameter x-account-key

    • info

      added the new optional request property

    • info

      added the new optional request property //

    • info

      added the new optional request property

    • info

      added the media type application/json for the response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      removed the non-success response with the status