# API · Create payments

> Create payments: POST /api/v1/collect/set/payments.

- kind: api-operation
- status: stable
- api_version: v1
- last_verified: 2026-10-20
- url: https://tilopay.com/en/developers/api/cobros-tarjetas-guardadas/set-payments

```http
POST /api/v1/collect/set/payments
```

## What it does [#que-hace]

Create payments.

## Authentication [#autenticacion]

Host: `https://app.tilopay.com`. Requires the API bearer token in `Authorization: Bearer <token>` and the integration key in the body (`key`).

[Get the API token](/en/developers/api/autenticacion/token-api).

## Parameters [#parametros]

<Param id="set-payments-parametro-key" name="key" type="string" required>
Integration key.
</Param>

<Param id="set-payments-parametro-capture" name="capture" type="integer">
1 captures; 0 only authorizes.
</Param>

<Param id="set-payments-parametro-reason" name="reason" type="string" required>
Payment reason.
</Param>

<Param id="set-payments-parametro-users" name="users" type="array">
Affiliates: array of `{id, amount, currency, date}`.
</Param>

<Param id="set-payments-parametro-groups" name="groups" type="array">
Groups: array of `{id, amount, currency, date}`; amount is per affiliate.
</Param>

The `date` field is empty for immediate charges or `YYYY-MM-DD` for scheduled charges. In `groups`, `amount` is per affiliate.

## Request example [#ejemplo-request]

`<api_key>` is the placeholder for your integration key.

```json
{
  "key": "<api_key>",
  "capture": 1,
  "reason": "Cobro mensualidad",
  "users": [
    {
      "id": "5",
      "amount": "500.00",
      "currency": "CRC",
      "date": ""
    },
    {
      "id": "32",
      "amount": "1000.00",
      "currency": "CRC",
      "date": "2024-06-20"
    },
    {
      "id": "25",
      "amount": "10.00",
      "currency": "USD",
      "date": "2024-06-20"
    }
  ],
  "groups": [
    {
      "id": "10",
      "amount": "25.00",
      "currency": "USD",
      "date": ""
    }
  ]
}
```

## Response [#respuesta]

batch is the batch code for get/massive/detail. Empty date = immediate; YYYY-MM-DD = scheduled. Repeating this operation creates another charge.

<Param id="set-payments-respuesta-status" name="status" type="unknown">
`status`.
</Param>

<Param id="set-payments-respuesta-errors" name="errors" type="unknown">
`errors`.
</Param>

<Param id="set-payments-respuesta-users_errors" name="users_errors" type="string | array">
`users_errors`.
</Param>

<Param id="set-payments-respuesta-groups_errors" name="groups_errors" type="string | array">
`groups_errors`.
</Param>

<Param id="set-payments-respuesta-programeds" name="programeds" type="object">
`programeds`.
</Param>

<Param id="set-payments-respuesta-batch" name="batch" type="unknown">
`batch`.
</Param>

```json
{
  "status": 200,
  "errors": "",
  "users_errors": "",
  "groups_errors": "",
  "programeds": {
    "users": [
      "5",
      "32",
      "25"
    ],
    "groups": [
      "10"
    ]
  },
  "batch": "SGZqbHlHalJiWmRNSEszd3ZEZHo4dz09"
}
```

```schema
{
  "type": "object",
  "properties": {
    "status": {
      "type": "integer"
    },
    "errors": {
      "type": "string"
    },
    "users_errors": {
      "type": [
        "string",
        "array"
      ],
      "items": {}
    },
    "groups_errors": {
      "type": [
        "string",
        "array"
      ],
      "items": {}
    },
    "programeds": {
      "type": "object",
      "properties": {
        "users": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "groups": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "batch": {
      "type": "string"
    }
  }
}
```

## Error response [#respuestas-de-error]

HTTP 400:

```json
{
  "status": "400",
  "errors": "Please verify the data sent",
  "users_errors": [
    {
      "id": "32",
      "amount": "1000.00",
      "currency": "CRC",
      "date": "invalidDate"
    }
  ],
  "groups_errors": [
    {
      "id": "10",
      "amount": "25.00",
      "currency": null,
      "date": null
    }
  ]
}
```

[Safe retries](/en/developers/reintentos-seguros).
