Suscripciones
Crear/Editar Suscripciones
POST
https://api.taca-taca.ar/p/subscriptions/{id}?
Path Parameters
- idstringDescription
Header Parameters
- x-api-keystringrequiredDescription
- x-access-tokenstringrequiredDescription
- Content-TypestringDescription
Body Parameters
- totalNumberrequiredDescription
- setupFeeNumberDescription
- currencystringrequiredDescription
- typestringrequiredDescription
- namestringrequiredDescription
- descriptionstringrequiredDescription
- intervalstringDescription
- trialNumberDescription
- limitIntegerrequiredDescription
- testBooleanDescription
- return_urlstringrequiredDescription
- webhookstringDescription
- featuresArrayDescription
- sourcesArrayDescription
- splitArrayDescription
- optionsObjectDescription
- options.themeObjectDescription
- options.embedBooleanDescription
- options.domainStringDescription
- referencestringDescription
- initialDayNumberDescription
- startOnInitialDayBooleanDescription
- notesstringDescription
curl
curl --location --request POST 'https://api.taca-taca.ar/p/subscriptions/' \
--header 'x-api-key: zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj' \
--header 'x-access-token: d31f0721-2f85-44e7-bcc6-15e19d1a53cc' \
--header 'Content-Type: application/json' \
--data-raw '{
"total": 100,
"setupFee": 0,
"currency": "ARS",
"type": "dynamic",
"name": "Suscripción Demo",
"description": "taca-taca",
"interval": "1m",
"trial": 0,
"test": false,
"limit": 0,
"return_url": "https://taca-taca.com",
"reference": "subscription_0001",
"features": [
"accept_no_funds"
],
"options": {
"theme": {
"type": "dark"
}
}
}'javascript
var data = JSON.stringify({"total":100,"setupFee":0,"currency":"ARS","type":"dynamic","name":"Suscripción Demo","description":"sugaway.dev","interval":"1m","trial":0,"test":false,"limit":0,"return_url":"https://sugaway.com","reference":"subscription_0001","features":["accept_no_funds"],"options":{"theme":{"type":"dark"}}});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.sugaway.com/p/subscriptions/");
xhr.setRequestHeader("x-api-key", "zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj");
xhr.setRequestHeader("x-access-token", "d31f0721-2f85-44e7-bcc6-15e19d1a53cc");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.sugaway.com/p/subscriptions/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"total": 100,
"setupFee": 0,
"currency": "ARS",
"type": "dynamic",
"name": "Suscripción Demo",
"description": "sugaway.dev",
"interval": "1m",
"trial": 0,
"test": false,
"limit": 0,
"return_url": "https://sugaway.com",
"reference": "subscription_0001",
"features": [
"accept_no_funds"
],
"options": {
"theme": {
"type": "dark"
}
}
}',
CURLOPT_HTTPHEADER => array(
'x-api-key: zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj',
'x-access-token: d31f0721-2f85-44e7-bcc6-15e19d1a53cc',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
python
import requests
url = "https://api.taca-taca.ar/p/subscriptions/"
payload="{\r\n \"total\": 100,\r\n \"setupFee\": 0,\r\n \"currency\": \"ARS\",\r\n \"type\": \"dynamic\",\r\n \"name\": \"Suscripción Demo\",\r\n \"description\": \"Mobbex.dev\",\r\n \"interval\": \"1m\",\r\n \"trial\": 0,\r\n \"test\": false,\r\n \"limit\": 0,\r\n \"return_url\": \"https://mobbex.com\",\r\n \"reference\": \"subscription_0001\",\r\n \"features\": [\r\n \"accept_no_funds\"\r\n ],\r\n \"options\": {\r\n \"theme\": {\r\n \"type\": \"dark\"\r\n }\r\n }\r\n}"
headers = {
'x-api-key': 'zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj',
'x-access-token': 'd31f0721-2f85-44e7-bcc6-15e19d1a53cc',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
{
"result": true,
"data": {
"uid": "NHQTDFOJLB137VL9IL",
"name": "Suscripción Demo",
"description": "taca-taca",
"limit": 0,
"interval": "1m",
"total": 100,
"trial": 0,
"url": "https://taca-taca.com/p/subscriptions/subscribe/NHQTDFOJLB137VL9IL",
"return_url": "https://taca-taca.com",
"shorten_url": "http://mbbx.co/7RJKoYJ"
}
}Ejemplos del nodo features:
- validate_id: Validate ID controlará el DNI del suscriptor contra el Tarjeta-Habiente rechazando la operación en caso de no coincidir.
- accept_no_funds: Accept No Funds aceptará los casos donde la tarjeta no posea fondos como un caso válido de tokenización.
- no_email: Desactivará los emails de aviso al Suscriptor pero no los emails de aviso al comercio.
- no_cc: Desactivará la cuenta corriente, por lo tanto si el cliente posee deuda no intentará recobrarla automáticamente. Sólo válido para suscripciones del tipo dynamic.
- no_retry: Desactivará el reintento de cobro automático. Si un cobro falla deberá ejecutarlo manualmente. Sólo válido para suscripciones del tipo dynamic.
- no_retry_with_secondary: Desactivará el reintento de cobro automático con el medio de pago secundario en caso de estar cargado.
- charge_on_first_source: Permite ejecutar el primer cobro de la suscripción automáticamente al cargar el primer medio de pago.
{
"features": ["validate_id", "accept_no_funds", "no_email", "no_cc", "no_retry"]
}Ejemplos del nodo sources:
{
"sources": ["visa", "mastercard"]
}Obtener Suscripciones
Permite obtener un listado de las primeras 15 suscripciones creadas en la entidad
GET
https://api.taca-taca.ar/p/subscriptions
Header Parameters
- x-api-keystringrequiredDescription
- x-access-tokenstringrequiredDescription
curl
curl --location --request GET 'https://api.taca-taca.ar/p/subscriptions/' \
--header 'x-api-key: zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj' \
--header 'x-access-token: d31f0721-2f85-44e7-bcc6-15e19d1a53cc'javascript
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.taca-taca.ar/p/subscriptions/");
xhr.setRequestHeader("x-api-key", "zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj");
xhr.setRequestHeader("x-access-token", "d31f0721-2f85-44e7-bcc6-15e19d1a53cc");
xhr.send();php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.taca-taca.ar/p/subscriptions/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'x-api-key: zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj',
'x-access-token: d31f0721-2f85-44e7-bcc6-15e19d1a53cc'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
200
{
"result": true,
"data": {
"docs": [
{
"uid": "qLLSnBV35",
"type": "dynamic",
"interval": "1m",
"limit": 4,
"trial": 0,
"initialDay": 1,
"shorten_url": "http://mbbx.co/j7zcKwR",
"return_url": "",
"webhook": "",
"currency": "ARS",
"status": "active",
"customerForm": "default",
"features": [
"validate_id",
"accept_no_funds",
"no_email"
],
"sources": [],
"entity": "5761a3dd8aad6c120042b287",
"name": "Mi suscripción 1",
"description": "Descripción de mi suscripción",
"reference": "qLLSnBV35",
"total": 2555,
"options": {
"button": false,
"embed": false,
"domain": null,
"theme": {
"type": "light",
"background": "",
"showHeader": true,
"showBack": true,
"header": false,
"colors": {
"primary": "#6f00ff"
}
}
},
"created": "2020-11-19T18:26:33.038Z",
"updated": "2020-11-19T18:26:33.041Z",
"agenda": [],
"__v": 0,
"url": "https://taca-taca.com/p/subscriptions/subscribe/qLLSnBV35",
"count": 1
},
]
}
}Filtrar Suscripciones
Permite obtener suscripciones de forma paginada y/o aplicando filtros.
GET
https://api.taca-taca.ar/p/subscriptions?
Query Parameters
- pageNumberDescription
- statusstringDescription
- searchstringDescription
Header Parameters
- x-api-keystringrequiredDescription
- x-access-tokenstringrequiredDescription
curl
curl --location --request GET 'https://api.taca-taca.ar/p/subscriptions?page=0' \
--header 'x-api-key: zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj' \
--header 'x-access-token: d31f0721-2f85-44e7-bcc6-15e19d1a53cc'javascript
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.taca-taca.ar/p/subscriptions?page=0");
xhr.setRequestHeader("x-api-key", "zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj");
xhr.setRequestHeader("x-access-token", "d31f0721-2f85-44e7-bcc6-15e19d1a53cc");
xhr.send();php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.taca-taca.ar/p/subscriptions?page=0',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'x-api-key: zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj',
'x-access-token: d31f0721-2f85-44e7-bcc6-15e19d1a53cc'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
200
{
"result": true,
"data": {
"docs": [
{
"uid": "HF53JXQ474A0MOJE5N",
"type": "dynamic",
"interval": "1m",
"limit": 12,
"trial": 0,
"initialDay": 1,
"shorten_url": "http://mbbx.co/2AjGnWA",
"return_url": "http://localhost:3000",
"webhook": "",
"setupFee": 0,
"test": false,
"intent": "payment.v2",
"currency": "ARS",
"status": "active",
"customerForm": "default",
"features": [],
"sources": [],
"entity": "5761a3dd8aad6c120042b287",
"name": "test",
"description": "test",
"reference": "c8226f3e-7b55-4d6b-9453-20b200df7a9b",
"total": 10,
"options": {
"button": false,
"embed": false,
"domain": null,
"theme": {
"type": "light",
"background": "",
"showHeader": true,
"showBack": true,
"header": false,
"colors": {
"primary": "#6f00ff"
}
}
},
"created": "2021-03-23T12:30:14.125Z",
"updated": "2021-03-23T12:30:14.128Z",
"split": [],
"agenda": [],
"__v": 0,
"url": "https://taca-taca.com/p/subscriptions/subscribe/HF53JXQ474A0MOJE5N",
"count": 0
}
],
"page": 1,
"prevPage": -1,
"nextPage": 2,
"limit": 15
}
}Obtener Suscripción
Permite obtener una suscripción en base a su ID
GET
https://api.taca-taca.ar/p/subscriptions/{id}
Query Parameters
- idstringrequiredDescription
Header Parameters
- x-api-keystringrequiredDescription
- x-access-tokenstringrequiredDescription
curl
curl --location --request GET 'https://api.taca-taca.ar/p/subscriptions/qLLSnBV35' \
--header 'x-api-key: zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj' \
--header 'x-access-token: d31f0721-2f85-44e7-bcc6-15e19d1a53cc'javascript
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.taca-taca.ar/p/subscriptions/qLLSnBV35");
xhr.setRequestHeader("x-api-key", "zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj");
xhr.setRequestHeader("x-access-token", "d31f0721-2f85-44e7-bcc6-15e19d1a53cc");
xhr.send();php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.taca-taca.ar/p/subscriptions/qLLSnBV37',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'x-api-key: zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj',
'x-access-token: d31f0721-2f85-44e7-bcc6-15e19d1a53cc'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
200
{
"result": true,
"data": {
"uid": "qLLsnBV37",
"type": "dynamic",
"interval": "1m",
"limit": 3,
"trial": 0,
"shorten_url": "http://mbbx.co/j7zcKwR",
"return_url": "https://demo.test.com/return",
"webhook": "https://demo.test.com/webhook",
"currency": "ARS",
"status": "active",
"customerForm": "default",
"features": [
"validate_id",
"accept_no_funds",
"no_email"
],
"sources": [],
"name": "Suscripción de Prueba",
"description": "102",
"reference": "qLLsnBV37",
"total": 1547,
"options": {
"button": false,
"embed": false,
"domain": null,
"theme": {
"type": "light",
"background": "",
"showHeader": true,
"showBack": true,
"header": false,
"colors": {
"primary": "#6f00ff"
}
}
},
"created": "2020-11-19T18:26:33.038Z",
"intent": "payment.v2",
"url": "https://taca-taca.com/p/subscriptions/subscribe/qLLsnBV37",
"count": 0
}
}
Cambiar estado de la suscripción
Activar Suscripción
Permite cambiar el estado de la suscripción a "Activo" y reanudar el cobro a todos sus suscriptores
POST
https://api.taca-taca.ar/p/subscriptions/${uid}/action/activate
Query Parameters
- idstringrequiredDescription
Header Parameters
- x-api-keystringrequiredDescription
- x-access-tokenstringrequiredDescription
curl
curl --location --request GET 'https://api.taca-taca.ar/p/subscriptions/qLLSnBV35/action/activate' \
--header 'x-api-key: zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj' \
--header 'x-access-token: d31f0721-2f85-44e7-bcc6-15e19d1a53cc'javascript
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.taca-taca.ar/p/subscriptions/qLLSnBV35/action/activate");
xhr.setRequestHeader("x-api-key", "zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj");
xhr.setRequestHeader("x-access-token", "d31f0721-2f85-44e7-bcc6-15e19d1a53cc");
xhr.send();php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.sugaway.com/p/subscriptions/qLLSnBV35/action/activate',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array(
'x-api-key: zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj',
'x-access-token: d31f0721-2f85-44e7-bcc6-15e19d1a53cc'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
200
{
"result": true
}Suspender Suscripción
Permite cambiar el estado de la suscripción a "Inactivo" y detener el cobro a todos sus suscriptores
POST
https://api.taca-taca.ar/p/subscriptions/${uid}/action/suspend
Query Parameters
- idstringrequiredDescription
Header Parameters
- x-api-keystringrequiredDescription
- x-access-tokenstringrequiredDescription
javascript
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.taca-taca.ar/p/subscriptions/qLLSnBV35/action/suspend");
xhr.setRequestHeader("x-api-key", "zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj");
xhr.setRequestHeader("x-access-token", "d31f0721-2f85-44e7-bcc6-15e19d1a53cc");
xhr.send();php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.sugaway.com/p/subscriptions/qLLSnBV35/action/delete',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'x-api-key: zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj',
'x-access-token: d31f0721-2f85-44e7-bcc6-15e19d1a53cc'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
200
{
"result": true
}Eliminar Suscripción
Permite hacer una eliminación lógica de una suscripción. Los suscriptores asociados no se modificarán de estado, pero los cobros no se ejecutarán a causa de la suscripción.
DELETE
https://api.taca-taca.ar/p/subscriptions/{id}/action/delete
Query Parameters
- idstringrequiredDescription
Header Parameters
- x-api-keystringrequiredDescription
- x-access-tokenstringrequiredDescription
javascript
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("DELETE", "https://api.taca-taca.ar/p/subscriptions/qLLSnBV35/action/delete");
xhr.setRequestHeader("x-api-key", "zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj");
xhr.setRequestHeader("x-access-token", "d31f0721-2f85-44e7-bcc6-15e19d1a53cc");
xhr.send();php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.sugaway.com/p/subscriptions/qLLSnBV35/action/delete',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'x-api-key: zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj',
'x-access-token: d31f0721-2f85-44e7-bcc6-15e19d1a53cc'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
200
{
"result": true
}