NAV
bash javascript

Getting Started with our API

Base urls

The base URLs for the TuCuota API are - https://www.tucuota.com/ for live - https://sandbox.tucuota.com/ for sandbox

The API is only available over HTTPS. Attempting to access the API over an unsecured HTTP connection will return a tls_required error.

Authentication

For creating api keys please go to the developers section of our dashboard. You can add api tokens for accesing and consuming the TuCuota API.

Click on Crear nuevo token de acceso. This will give you a token: eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjcxYThhNWMxYjY5ODc1MmRiZDc1NzZhM2Y5MDI3YWY1MDhiY2FlY2E5ZDZjZTczMDgwZWZiY2U4ODUzZjc1NzMzYWY2YjEyM2VmM2JhYmE0In0.eyJhdWQiOiIxIiwianRpIjoiNzFhOG…

After creating an access token in the dashboard, you must provide it in an Authorization request header (using the bearer authentication scheme) when making API requests.

Authorization: Bearer {YOUR_SECRET_ACCESS_TOKEN}

Versions

Every request must specify a TuCuota-Version header, with a released API version.

Api-Version: v1

Webhooks

To start receiving webhooks, you’ll need to add webhook endpoints from your Dashboard here.

Example webhook:
{
  "id": "EVPYeJeyeJ7r",
  "created_at": "2019-05-23T20:18:28-0300",
  "data": {
    "object": {
      "id": "PY6b3Rr6nRMo",
      "paid": false,
      "amount": 1600,
      "status": "pending_submission",
      "gateway": "GWEmGgbZgy2R",
      "currency": "ARS",
      "customer": {
        "id": "CSOjzw1Aw94E",
        "name": "Máximo Irizarry",
        "email": "mirrizarry@paez.com",
        "livemode": true,
        "metadata": [],
        "created_at": "2018-05-01T11:45:14-0300",
        "updated_at": "2018-05-01T11:45:14-0300",
        "external_id": "xPre4FXy",
        "mobile_number": "+5493812596655",
        "identification_type": "",
        "identification_number": ""
      },
      "livemode": true,
      "metadata": [],
      "retryable": false,
      "created_at": "2019-05-15T11:45:16-0300",
      "updated_at": "2019-05-23T20:18:26-0300",
      "charge_date": "2019-05-15",
      "description": "Pago extra",
      "subscription": null,
      "payment_method": {
        "id": "PM4b8W5wVDG6",
        "bank": "Bbva Banco Francés S.A.",
        "brand": "cbu",
        "livemode": true,
        "created_at": "2018-05-01T11:45:14-0300",
        "updated_at": "2018-05-01T11:45:14-0300",
        "last_four_digits": "9437"
      },
      "updated_status": "2019-05-23",
      "response_message": "",
      "effective_charged_date": null,
      "estimated_accreditation_date": null
    }
  },
  "livemode": true,
  "resource": "payment",
  "resource_id": "PY6b3Rr6nRMo",
  "type": "payment.retrying"
}

When an event occurs in your account, we’ll send it to every enabled webhook endpoint as a POST request.

Webhooks types

Testing the webhooks in local environments

You can easy create test webhooks using https://webhook.site/ With that you will be able to see what we are sending to our API consumers.

Also, to start integrating the webhooks, your code will need to be accessible from the internet so TuCuota can reach it with HTTP requests. If you’re working locally, the easiest way to do this is with ngrok .

Testing card/cbu numbers

In sandbox mode the following test cards and CBUs can be used to create payments that produce specific responses useful for testing different scenarios.

Brand Number Result
cbu 2859363672283668188432 approved
cbu 2852656051819605126406 rejected
cbu 2858814288841490615567 failed
cbu 0110022831266917230013 will_retry
mastercard 5447651834106668 approved
mastercard 5457948807868523 rejected
mastercard 5292525121482410 failed
visa 4024007127322104 approved
visa 4556854712355908 rejected
visa 4485388690536078 failed

Payments statuses

Status Meaning
pending_submission The payment has been issued, but still not submitted to the finnancial entity
cancelled The payment has been manually cancelled
submitted The payment is succesfully submitted and being processing in the finnancial entity
failed Couldn't be submitted to the finnancial entity. There is an error in the request
will_retry The attempt failed, but the finnancial entity will make a new attempt
approved Submitted OK and approved
rejected Submitted OK but couldn't make the collection

Subscriptions statuses

Status Meaning
active The subscription is active and generating payments
paused The subscription have been manually paused and won't generate payments until is resumed.
cancelled The subscription have been manually cancelled.
finished The subscription is completed: all the payments were collected succesfully. Only for subscriptions with a numbers of payments specified (count field)

Brands

APIs for managing brands

List available brands

Returns a list of the available brands for processing payments.

Example request:

curl -X GET -G "https://www.tucuota.com/api/brands" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/brands");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response:

null

HTTP Request

GET api/brands

Update available brands

Updates the available brands for processing payments. It requires to have the appropiate gateway for each brand.

Example request:

curl -X POST "https://www.tucuota.com/api/brands" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "brands"="["visa-credito", "cbu", "nativa", "mastercard"]" 
const url = new URL("https://www.tucuota.com/api/brands");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "brands": "["visa-credito", "cbu", "nativa", "mastercard"]",
})

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/brands

Body Parameters

Parameter Type Status Description
brands array required The payment method or brand (cbu, visa-credito, visa-debito, mastercard, argencard, diners-club, mastercard-debit, nativa, maestro, lider, cmr-falabella, cencosud, cordobesa, jcb, naranja).

Customers

APIs for managing customers

Create a customer

Creates a new customer object

Example request:

curl -X POST "https://www.tucuota.com/api/customers" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "external_id"="yourcustomername@mail.com" \
    -d "name"="Juan Méndez" \
    -d "email"="yourcustomername@mail.com" \
    -d "identification_type"="DNI" \
    -d "identification_number"="31.022.123" \
    -d "mobile_number"="+54 351 425 5666" \
    -d "metadata"="{"additional": "Data"}" 
const url = new URL("https://www.tucuota.com/api/customers");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "external_id": "yourcustomername@mail.com",
    "name": "Juan Méndez",
    "email": "yourcustomername@mail.com",
    "identification_type": "DNI",
    "identification_number": "31.022.123",
    "mobile_number": "+54 351 425 5666",
    "metadata": "{"additional": "Data"}",
})

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/customers

Body Parameters

Parameter Type Status Description
external_id string optional External reference of your customer. If empty will autogenerate a random value.
name string required Name of the customer
email string required Email
identification_type string optional Kind of identification
identification_number string optional Kind of identification.
mobile_number string optional Complete mobile phone number
metadata array optional Reference, additional information (max 3 keys, 100 chars each).

Validate batch

Validate a batch of customers

Example request:

curl -X POST "https://www.tucuota.com/api/customers/validate" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "array"="quae" 
const url = new URL("https://www.tucuota.com/api/customers/validate");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "array": "quae",
})

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/customers/validate

Body Parameters

Parameter Type Status Description
array required optional Array of customers to validate.

List customers

Returns a list of all your customers.

Example request:

curl -X GET -G "https://www.tucuota.com/api/customers" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/customers");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response:

null

HTTP Request

GET api/customers

Get a single customer

Example request:

curl -X GET -G "https://www.tucuota.com/api/customers/{customer}" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/customers/{customer}");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response:

null

HTTP Request

GET api/customers/{customer}

Update a customer

Updates the information of a customer

Example request:

curl -X PUT "https://www.tucuota.com/api/customers/{customer}" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "external_id"="31.555.214" \
    -d "name"="Juan Méndez" \
    -d "email"="yourcustomername@mail.com" \
    -d "identification_type"="DNI" \
    -d "identification_number"="31.022.123" \
    -d "mobile_number"="+54 351 425 5666" \
    -d "metadata"="[additional: 'Data']" 
const url = new URL("https://www.tucuota.com/api/customers/{customer}");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "external_id": "31.555.214",
    "name": "Juan Méndez",
    "email": "yourcustomername@mail.com",
    "identification_type": "DNI",
    "identification_number": "31.022.123",
    "mobile_number": "+54 351 425 5666",
    "metadata": "[additional: 'Data']",
})

fetch(url, {
    method: "PUT",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

PUT api/customers/{customer}

Body Parameters

Parameter Type Status Description
external_id string optional External reference of your customer.
name string optional Name of the customer
email string optional Email
identification_type string optional Kind of identification
identification_number string optional Kind of identification.
mobile_number string optional Complete mobile phone number
metadata array optional Reference, additional information (max 3 keys, 100 chars each).

Archive a customer

Immediately restore the customer

Example request:

curl -X POST "https://www.tucuota.com/api/customers/{customer}/actions/archive" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/customers/{customer}/actions/archive");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "POST",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/customers/{customer}/actions/archive

Restore a customer

Immediately restore the customer

Example request:

curl -X POST "https://www.tucuota.com/api/customers/{customer}/actions/restore" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/customers/{customer}/actions/restore");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "POST",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/customers/{customer}/actions/restore

Events

APIs for managing events

List events

Returns a cursor-paginated list of your events.

Example request:

curl -X GET -G "https://www.tucuota.com/api/events" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/events");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response:

null

HTTP Request

GET api/events

Gateways

APIs for managing gateways

Create a gateway

Creates a new gateway object

Example request:

curl -X POST "https://www.tucuota.com/api/gateways" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "gatewaykind"="cbuGalicia" \
    -d "number"="14556" \
    -d "username"="username" \
    -d "password"="password12" \
    -d "retrying"="false" \
    -d "code_length"="8" 
const url = new URL("https://www.tucuota.com/api/gateways");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "gatewaykind": "cbuGalicia",
    "number": "14556",
    "username": "username",
    "password": "password12",
    "retrying": "",
    "code_length": "8",
})

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/gateways

Body Parameters

Parameter Type Status Description
gatewaykind string required The kind of gateway (visa, visaD, firstData, naranja, cbuGalicia).
number integer required The number of the agreement in the entity.
username string required The username of the gateway.
password string required The password of the gateway.
retrying boolean optional If the gateway will retry the payment if rejected (only for cbuGalicia and visaD).
code_length integer optional If the gateway has a length of ids specified (only for cbuGalicia).

List gateways

Returns a list of all your gateways.

Example request:

curl -X GET -G "https://www.tucuota.com/api/gateways" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/gateways");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response:

null

HTTP Request

GET api/gateways

Get a single gateway

Example request:

curl -X GET -G "https://www.tucuota.com/api/gateways/{gateway}" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/gateways/{gateway}");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response:

null

HTTP Request

GET api/gateways/{gateway}

Update a gateway

Updates the information of a gateway

Example request:

curl -X PUT "https://www.tucuota.com/api/gateways/{gateway}" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "username"="NewUsername" \
    -d "password"="ChangedPassword" \
    -d "retrying"="1" \
    -d "code_length"="6" 
const url = new URL("https://www.tucuota.com/api/gateways/{gateway}");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "username": "NewUsername",
    "password": "ChangedPassword",
    "retrying": "1",
    "code_length": "6",
})

fetch(url, {
    method: "PUT",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

PUT api/gateways/{gateway}

Body Parameters

Parameter Type Status Description
username string required The username of the gateway.
password string required The password of the gateway.
retrying boolean optional If the gateway will retry the payment if rejected.
code_length integer optional If the gateway has a length of ids specified. Only Galicia.

Disable a gateway

Immediately disables the gateway, no money can be paid out to a disabled gateway.

This will return a disable_failed error if the gateway has already been disabled.

Example request:

curl -X POST "https://www.tucuota.com/api/gateways/{gateway}/actions/disable" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/gateways/{gateway}/actions/disable");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "POST",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/gateways/{gateway}/actions/disable

PaymentMethods

APIs for managing payment methods

List payment methods

Returns a paginated list of your payment methods.

Example request:

curl -X GET -G "https://www.tucuota.com/api/paymentmethods" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/paymentmethods");

    let params = {
            "page": "3",
            "customer_id": "aliquam",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response:

null

HTTP Request

GET api/paymentmethods

Query Parameters

Parameter Status Description
page optional The number of the page Default: 1
customer_id optional Show only paymentmethods from a given customer

Get a single payment method

Retrieves the details of a single existing payment method.

Example request:

curl -X GET -G "https://www.tucuota.com/api/paymentmethods/{paymentmethod}" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/paymentmethods/{paymentmethod}");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response:

null

HTTP Request

GET api/paymentmethods/{paymentmethod}

Payments

APIs for managing payments

Create a payment

Creates a new payment object

Example request:

curl -X POST "https://www.tucuota.com/api/payments" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "amount"="1250.99" \
    -d "description"="Cuota Enero" \
    -d "customer_id"="31.555.214" \
    -d "customer_name"="Juan D'Elía" \
    -d "customer_email"="yournewclient@gmail.com" \
    -d "payment_method_brand"="mastercard" \
    -d "payment_method_number"="5031 7557 3453 0604" \
    -d "payment_method_id"="PMj1238888123" \
    -d "charge_date"="2019-01-31" \
    -d "metadata"="{"additional": "Data"}" 
const url = new URL("https://www.tucuota.com/api/payments");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "amount": "1250.99",
    "description": "Cuota Enero",
    "customer_id": "31.555.214",
    "customer_name": "Juan D'Elía",
    "customer_email": "yournewclient@gmail.com",
    "payment_method_brand": "mastercard",
    "payment_method_number": "5031 7557 3453 0604",
    "payment_method_id": "PMj1238888123",
    "charge_date": "2019-01-31",
    "metadata": "{"additional": "Data"}",
})

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/payments

Body Parameters

Parameter Type Status Description
amount float required The amount of the payment.
description string required The title of the payment.
customer_id string required External reference of your customer. If there is no client with this id, we will create a new one.
customer_name string optional Name of your customer. This field is required if there is no client with this id.
customer_email string optional Email of your customer. This field is required if there is no client with this id.
payment_method_brand string optional The payment method or brand (cbu, visa-credito, visa-debito, mastercard, argencard, diners-club, mastercard-debit, nativa, maestro, lider, cmr-falabella, cencosud, cordobesa, jcb, naranja). This field is required if payment_method_id is not given.
payment_method_number string optional The number of the card or cbu. This field is required if payment_method_id is not given.
payment_method_id string optional The token of the card or cbu. This field is required if payment_method_brand and payment_method_number is not given.
charge_date date optional A future date on which the payment should be collected. If not specified, the payment will be collected as soon as possible.
metadata array optional Reference, additional information (max 3 keys, 100 chars each).

Create batch

Creates a batch of payments

Example request:

curl -X POST "https://www.tucuota.com/api/payments/batch" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "array"="fuga" 
const url = new URL("https://www.tucuota.com/api/payments/batch");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "array": "fuga",
})

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/payments/batch

Body Parameters

Parameter Type Status Description
array required optional Array of payments to create.

Validate batch

Validate a batch of payments

Example request:

curl -X POST "https://www.tucuota.com/api/payments/validate" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "array"="ratione" 
const url = new URL("https://www.tucuota.com/api/payments/validate");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "array": "ratione",
})

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/payments/validate

Body Parameters

Parameter Type Status Description
array required optional Array of payments to validate.

List payments

Returns a paginated list of your payments.

Example request:

curl -X GET -G "https://www.tucuota.com/api/payments" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/payments");

    let params = {
            "page": "3",
            "customer_id": "ut",
            "status": "libero",
            "statuses": "fugit",
            "month": "non",
            "search": "repellendus",
            "subscription_id": "eveniet",
            "gateway": "quia",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response:

null

HTTP Request

GET api/payments

Query Parameters

Parameter Status Description
page optional The number of the page (Default: 1)
customer_id optional Show only payments from a given customer
status optional Show only payments that match a specific status
statuses optional Show only payments within an array of statuses
month optional Show only payments of a specific month (Format YYYY-MM)
search optional Show only payments that match a specific query
subscription_id optional Show only payments from a given subscription
gateway optional Show only payments from a given gateway

Get a single payment

Retrieves the details of a single existing payment.

Example request:

curl -X GET -G "https://www.tucuota.com/api/payments/{payment}" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/payments/{payment}");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response:

null

HTTP Request

GET api/payments/{payment}

Update a payment

Updates the information of a payment

Example request:

curl -X PUT "https://www.tucuota.com/api/payments/{payment}" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "amount"="2500.5" \
    -d "charge_date"="2019-01-31" \
    -d "description"="Cuota Febrero" \
    -d "metadata"="['additional' => 'Data']" 
const url = new URL("https://www.tucuota.com/api/payments/{payment}");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "amount": "2500.5",
    "charge_date": "2019-01-31",
    "description": "Cuota Febrero",
    "metadata": "['additional' => 'Data']",
})

fetch(url, {
    method: "PUT",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

PUT api/payments/{payment}

Body Parameters

Parameter Type Status Description
amount float optional The new amount of the payment. Only will work if the current status is 'pending_submission'.
charge_date date optional A future date on which the payment should be collected. Must be future than today.
description string optional The title of the payment.
metadata array optional Reference, additional information (max 3 keys, 100 chars each).

Cancel a payment

Cancels the payment if it has not already been submitted to the bank. Any metadata supplied to this endpoint will be stored on the payment cancellation event it causes.

Example request:

curl -X POST "https://www.tucuota.com/api/payments/{payment}/actions/cancel" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "metadata"="['notes' => 'Cancelled, paid in cash']" 
const url = new URL("https://www.tucuota.com/api/payments/{payment}/actions/cancel");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "metadata": "['notes' => 'Cancelled, paid in cash']",
})

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/payments/{payment}/actions/cancel

Body Parameters

Parameter Type Status Description
metadata array optional Reference, additional information (max 3 keys, 100 chars each).

Retry a payment

Retries a failed or cancelled payment. You will receive a resubmission_requested webhook, but after that retrying the payment follows the same process as its initial creation, so you will receive a submitted webhook, followed by a confirmed or failed event. Any metadata supplied to this endpoint will be stored.

Example request:

curl -X POST "https://www.tucuota.com/api/payments/{payment}/actions/retry" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "metadata"="['notes' => 'Retrying again']" 
const url = new URL("https://www.tucuota.com/api/payments/{payment}/actions/retry");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "metadata": "['notes' => 'Retrying again']",
})

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/payments/{payment}/actions/retry

Body Parameters

Parameter Type Status Description
metadata array optional Reference, additional information (max 3 keys, 100 chars each).

Subscriptions

APIs for managing subscriptions

Create a subscription

Creates a new subscription object

Example request:

curl -X POST "https://www.tucuota.com/api/subscriptions" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "amount"="1200.5" \
    -d "description"="Taller verano" \
    -d "count"="3" \
    -d "customer_id"="31222222" \
    -d "customer_name"="Alberto D'Elía" \
    -d "customer_email"="juangimenez@gmail.com" \
    -d "payment_method_brand"="mastercard" \
    -d "payment_method_number"="5031 7557 3453 0604" \
    -d "payment_method_id"="PMj1238888123" \
    -d "start_date"="2019-01-31" \
    -d "interval_unit"="est" \
    -d "interval"="5" \
    -d "day_of_month"="1" \
    -d "day_of_week"="1" \
    -d "metadata"="["additional" => "Data"]" 
const url = new URL("https://www.tucuota.com/api/subscriptions");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "amount": "1200.5",
    "description": "Taller verano",
    "count": "3",
    "customer_id": "31222222",
    "customer_name": "Alberto D'Elía",
    "customer_email": "juangimenez@gmail.com",
    "payment_method_brand": "mastercard",
    "payment_method_number": "5031 7557 3453 0604",
    "payment_method_id": "PMj1238888123",
    "start_date": "2019-01-31",
    "interval_unit": "est",
    "interval": "5",
    "day_of_month": "1",
    "day_of_week": "1",
    "metadata": "["additional" => "Data"]",
})

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/subscriptions

Body Parameters

Parameter Type Status Description
amount float required The amount of each payment of the subscription.
description string required The title of each payment of the subscription.
count integer optional The total number of payments that should be taken by this subscription. If not specified the subscription will continue until you cancel it.
customer_id string required External reference of your customer. If there is no client with this id, we will create a new one.
customer_name string optional Name of your customer. This field is required if there is no client with this id.
customer_email string optional Email of your customer. This field is required only if is a new customer id.
payment_method_brand string optional The payment method or brand for each payment of the subscription (cbu, visa-credito, visa-debito, mastercard, argencard, diners-club, mastercard-debit, nativa, maestro, lider, cmr-falabella, cencosud, cordobesa, jcb, naranja). This field is required if payment_method_id is not given.
payment_method_number string optional The number of the card or cbu for each payment of the subscription. This field is required if payment_method_id is not given.
payment_method_id string optional The token of the card or cbu for each payment of the subscription. This field is required if payment_method_brand and payment_method_number is not given.
start_date date optional A future date on which the first payment of the subscription should be collected. If not specified, the first payment will be collected as soon as possible.
interval_unit string required The unit of time between customer charge dates. One of weekly, monthly or yearly. Example monthly
interval integer required Number of interval_units between customer charge dates. Must be greater than to 1. If interval_unit is weekly and interval is 2, then the customer will be charged every two weeks. Defaults to 1. Example 1
day_of_month integer optional Day of month, from 1 to 28. This field is required if interval_unit is set to monthly. Defaults to 1.
day_of_week integer optional Day of week number, from 0 (Sunday) to 6 (Saturday). This field is required if interval_unit is set to weekly.
metadata array optional Reference, additional information (max 3 keys, 100 chars each).

Create batch

Creates a batch of subscriptions

Example request:

curl -X POST "https://www.tucuota.com/api/subscriptions/batch" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "array"="laborum" 
const url = new URL("https://www.tucuota.com/api/subscriptions/batch");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "array": "laborum",
})

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/subscriptions/batch

Body Parameters

Parameter Type Status Description
array required optional Array of subscriptions to create.

Validate batch

Validate a batch of subscriptions

Example request:

curl -X POST "https://www.tucuota.com/api/subscriptions/validate" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "array"="asperiores" 
const url = new URL("https://www.tucuota.com/api/subscriptions/validate");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "array": "asperiores",
})

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/subscriptions/validate

Body Parameters

Parameter Type Status Description
array required optional Array of subscriptions to validate.

List subscriptions

Returns a paginated list of your subscriptions.

Example request:

curl -X GET -G "https://www.tucuota.com/api/subscriptions" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/subscriptions");

    let params = {
            "page": "6",
            "all": "quo",
            "statuses": "similique",
            "search": "laudantium",
            "customer_id": "in",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response:

null

HTTP Request

GET api/subscriptions

Query Parameters

Parameter Status Description
page optional The number of the page Default: 1
all optional Include cancelled subscriptions. Example /api/subscriptions?all=1
statuses optional Include only subscriptions in statuses. Example /api/subscriptions?statuses[]=paused
search optional Show only payments that match a specific query
customer_id optional Show only subscriptions from a given customer

Get a single subscription

Retrieves the details of a single existing subscription.

Example request:

curl -X GET -G "https://www.tucuota.com/api/subscriptions/{subscription}" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/subscriptions/{subscription}");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response:

null

HTTP Request

GET api/subscriptions/{subscription}

Update a subscription

Updates the information of a subscription

Example request:

curl -X PUT "https://www.tucuota.com/api/subscriptions/{subscription}" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "amount"="1200.5" \
    -d "description"="Taller verano" \
    -d "count"="3" \
    -d "payment_method_brand"="mastercard" \
    -d "payment_method_number"="5031 7557 3453 0604" \
    -d "payment_method_id"="PMj1238888123" \
    -d "start_date"="2019-01-31" \
    -d "interval_unit"="ratione" \
    -d "interval"="17" \
    -d "day_of_month"="1" \
    -d "day_of_week"="1" \
    -d "metadata"="["additional" => "Data"]" 
const url = new URL("https://www.tucuota.com/api/subscriptions/{subscription}");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "amount": "1200.5",
    "description": "Taller verano",
    "count": "3",
    "payment_method_brand": "mastercard",
    "payment_method_number": "5031 7557 3453 0604",
    "payment_method_id": "PMj1238888123",
    "start_date": "2019-01-31",
    "interval_unit": "ratione",
    "interval": "17",
    "day_of_month": "1",
    "day_of_week": "1",
    "metadata": "["additional" => "Data"]",
})

fetch(url, {
    method: "PUT",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

PUT api/subscriptions/{subscription}

Body Parameters

Parameter Type Status Description
amount float required The amount of each payment of the subscription.
description string required The title of each payment of the subscription.
count integer optional The total number of payments that should be taken by this subscription. If not specified the subscription will continue until you cancel it.
payment_method_brand string optional The payment method or brand for each payment of the subscription (cbu, visa-credito, visa-debito, mastercard, argencard, diners-club, mastercard-debit, nativa, maestro, lider, cmr-falabella, cencosud, cordobesa, jcb, naranja). This field is required if payment_method_id is not given.
payment_method_number string optional The number of the card or cbu for each payment of the subscription. This field is required if payment_method_id is not given.
payment_method_id string optional The token of the card or cbu for each payment of the subscription. This field is required if payment_method_brand and payment_method_number is not given.
start_date date optional A future date on which the first payment of the subscription should be collected. If not specified, the first payment will be collected as soon as possible.
interval_unit string required The unit of time between customer charge dates. One of weekly, monthly or yearly. Example monthly
interval integer required Number of interval_units between customer charge dates. Must be greater than to 1. If interval_unit is weekly and interval is 2, then the customer will be charged every two weeks. Defaults to 1. Example 1
day_of_month integer optional Day of month, from 1 to 28. This field is required if interval_unit is set to monthly. Defaults to 1.
day_of_week integer optional Day of week number, from 0 (Sunday) to 6 (Saturday). This field is required if interval_unit is set to weekly.
metadata array optional Reference, additional information (max 3 keys, 100 chars each).

Cancel a subscription

Cancels an active subscription. A cancelled subscription will be archived. Any metadata supplied to this endpoint will be stored.

Example request:

curl -X POST "https://www.tucuota.com/api/subscriptions/{subscription}/actions/cancel" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "metadata"="['notes' => 'Cancelled, no a client anymore']" 
const url = new URL("https://www.tucuota.com/api/subscriptions/{subscription}/actions/cancel");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "metadata": "['notes' => 'Cancelled, no a client anymore']",
})

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/subscriptions/{subscription}/actions/cancel

Body Parameters

Parameter Type Status Description
metadata array optional Reference, additional information (max 3 keys, 100 chars each).

Pause a subscription

Pauses an active subscription. A paused subscription won't generate new payments but can be resumed later. Any metadata supplied to this endpoint will be stored.

Example request:

curl -X POST "https://www.tucuota.com/api/subscriptions/{subscription}/actions/pause" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "metadata"="['notes' => 'Paused for six months']" 
const url = new URL("https://www.tucuota.com/api/subscriptions/{subscription}/actions/pause");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "metadata": "['notes' => 'Paused for six months']",
})

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/subscriptions/{subscription}/actions/pause

Body Parameters

Parameter Type Status Description
metadata array optional Reference, additional information (max 3 keys, 100 chars each).

Resume a subscription

Resumes a paused subscription. This will turn the subscription active again and will generate payments if necessary. Any metadata supplied to this endpoint will be stored.

Example request:

curl -X POST "https://www.tucuota.com/api/subscriptions/{subscription}/actions/resume" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "metadata"="['notes' => 'Came back again']" 
const url = new URL("https://www.tucuota.com/api/subscriptions/{subscription}/actions/resume");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "metadata": "['notes' => 'Came back again']",
})

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/subscriptions/{subscription}/actions/resume

Body Parameters

Parameter Type Status Description
metadata array optional Reference, additional information (max 3 keys, 100 chars each).

Webhooks

APIs for managing webhook endpoints

Create a webhook

Creates a new webhook

Example request:

curl -X POST "https://www.tucuota.com/api/webhooks" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "enabled_events"="['*']" \
    -d "url"="https://yoursite.com/tucuota_webhook" 
const url = new URL("https://www.tucuota.com/api/webhooks");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "enabled_events": "['*']",
    "url": "https://yoursite.com/tucuota_webhook",
})

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/webhooks

Body Parameters

Parameter Type Status Description
enabled_events array optional The list of events to enable for this endpoint (defaults to ['*'])
url required optional The URL of the wendpoint

List webhooks

Returns a list of all your webhooks.

Example request:

curl -X GET -G "https://www.tucuota.com/api/webhooks" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/webhooks");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response:

null

HTTP Request

GET api/webhooks

Get a single webhook

Example request:

curl -X GET -G "https://www.tucuota.com/api/webhooks/{webhook}" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/webhooks/{webhook}");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response:

null

HTTP Request

GET api/webhooks/{webhook}

Update a webhook

Updates the information of a webhook

Example request:

curl -X PUT "https://www.tucuota.com/api/webhooks/{webhook}" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1" \
    -d "enabled_events"="['*']" \
    -d "url"="https://yoursite.com/tucuota_webhook" 
const url = new URL("https://www.tucuota.com/api/webhooks/{webhook}");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

let body = JSON.stringify({
    "enabled_events": "['*']",
    "url": "https://yoursite.com/tucuota_webhook",
})

fetch(url, {
    method: "PUT",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

PUT api/webhooks/{webhook}

Body Parameters

Parameter Type Status Description
enabled_events array optional The list of events to enable for this endpoint.
url required optional The URL of the wendpoint

Delete a webhook

Delete a webhook endpoint

Example request:

curl -X DELETE "https://www.tucuota.com/api/webhooks/{webhook}" \
    -H "Authorization: Bearer: {{ API_KEY }}" \
    -H "Content-Type: application/json" \
    -H "Api-Version: v1"
const url = new URL("https://www.tucuota.com/api/webhooks/{webhook}");

let headers = {
    "Authorization": "Bearer: {{ API_KEY }}",
    "Content-Type": "application/json",
    "Api-Version": "v1",
    "Accept": "application/json",
}

fetch(url, {
    method: "DELETE",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

DELETE api/webhooks/{webhook}