Suscripción con DEBIN

DEBIN o Débito Inmediato es el reemplazo natural del Débito Directo utilizado durante tantos años. La principal ventaja es que es totalmente digital, administrado por el usuario y seguro ya que puede ser controlado por el usuario directamente desde su banco.
En este documento enseñaremos cómo utilizar esta valiosisima herramienta en nuestro módulo de suscripciones permitiendo cobrar tus suscripciones directamente desde una Cuenta Bancacia (CBU) o una Cuenta Virtual (CVU). Antes de comenzar, es necesario verificar que el medio de pago DEBIN se encuentre activo en tu consola.
Primeros Pasos
- Crear o actualizar un Suscriptor: es sumamente importante que tu Suscriptor tenga correctamente configurado en el objeto "customer" en "identification" su CUIT o CUIL ya que si utilizás sólo el DNI este medio de pago no funcionará. Podes ver nuestra documentación acá
- Crear la intención para cambiar el medio de pago del Suscriptor
- Crear un Token de Tipo Cuenta Bancaria
- Ejecutar el cambio de método de pago.
Creando una Intención para cambiar el medio de pago
- idstringrequiredDescription
- sidstringrequiredDescription
- prioritystringrequiredDescription
- x-api-keystringrequiredDescription
- x-access-tokenstringrequiredDescription
- intentobjectDescription
- tokenstringDescription
curl --location --globoff 'https://api.mobbex.com/p/subscriptions/{id}/subscriber/{sid}/source/{priority}}/{id}/{sid}/{priority}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.mobbex.com/p/subscriptions/{id}/subscriber/{sid}/source/{priority}}/{id}/{sid}/{priority}',
'headers': {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.mobbex.com/p/subscriptions/{id}/subscriber/{sid}/source/{priority}}/{id}/{sid}/{priority}", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));import requests
import json
url = "https://api.mobbex.com/p/subscriptions/{id}/subscriber/{sid}/source/{priority}}/{id}/{sid}/{priority}"
payload = {}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
require "uri"
require "json"
require "net/http"
url = URI("https://api.mobbex.com/p/subscriptions/{id}/subscriber/{sid}/source/{priority}}/{id}/{sid}/{priority}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
response = https.request(request)
puts response.read_body
{
"result": true,
"data": {
"id": "7XVD7ZVKA6LBDILGI3",
"sid": "7376XDPMMW33MQ59NE",
"priority": "primary",
"status": "active",
"sourcePriority": "primary",
"intent": {
"token": "ab5fa79f-2d5f-4c04-a85f-bea9db3e4e20"
}
}
}De este endpoint deberás tomar el Token generado dentro de "data" => "intent" => "token". Esto será importante para crear tu Token de la cuenta Bancaria.
Creando un Token de Tipo Cuenta Bancaria
- itstringrequiredDescription
- api-keystringDescription
- x-api-keystringDescription
- x-access-tokenstringDescription
- sourceObjectrequiredDescription
- bankObjectDescription
- cbustringDescription
- cvustringDescription
- identificationstringrequiredDescription
- referencestringrequiredDescription
curl --location --globoff 'https://api.mobbex.com/p/sources/token/{it}/{it}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"source": {
"bank": {
"cbu": "String",
"cvu": "String",
"identification": "String"
},
"reference": "arg.debin"
}
}'var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.mobbex.com/p/sources/token/{it}/{it}',
'headers': {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"source": {
"bank": {
"cbu": "String",
"cvu": "String",
"identification": "String"
},
"reference": "arg.debin"
}
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"source": {
"bank": {
"cbu": "String",
"cvu": "String",
"identification": "String"
},
"reference": "arg.debin"
}
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.mobbex.com/p/sources/token/{it}/{it}", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));import requests
import json
url = "https://api.mobbex.com/p/sources/token/{it}/{it}"
payload = json.dumps({
"source": {
"bank": {
"cbu": "String",
"cvu": "String",
"identification": "String"
},
"reference": "arg.debin"
}
})
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require "uri"
require "json"
require "net/http"
url = URI("https://api.mobbex.com/p/sources/token/{it}/{it}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"source": {
"bank": {
"cbu": "String",
"cvu": "String",
"identification": "String"
},
"reference": "arg.debin"
}
})
response = https.request(request)
puts response.read_body
{
"result": true,
"data": {
"token": "T:8SFZ95LOK9HDMTAMRAFKV9",
"description": "",
"source": {
"country": "arg",
"countries": [
"arg"
],
"references": [
"arg.debin"
],
"reference": "arg.debin",
"name": "DEBIN",
"shortName": "DEBIN",
"visibility": [
"direct"
],
"currency": "",
"type": "p2p",
"priority": 0,
"action": "cashin",
"installments": {
"enabled": true,
"method": "",
"numeric": false,
"custom": [
{
"charges": [],
"count": 1,
"countries": [],
"name": "1 Pago",
"reference": 1
}
]
},
"childSources": {}
}
}
}Del resultado de este endpoint debes capturar el token devuelto bajo "data" => "token"
Cambiando el método de pago con un DEBIN
- idstringrequiredDescription
- sidstringrequiredDescription
- x-api-keystringrequiredDescription
- x-access-tokenstringrequiredDescription
- tokenstringrequiredDescription
curl --location --globoff 'https://api.mobbex.com/p/subscriptions/{id}/subscriber/{sid}/source/{id}/{sid}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"token": "String"
}'var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.mobbex.com/p/subscriptions/{id}/subscriber/{sid}/source/{id}/{sid}',
'headers': {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"token": "String"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"token": "String"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.mobbex.com/p/subscriptions/{id}/subscriber/{sid}/source/{id}/{sid}", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));import requests
import json
url = "https://api.mobbex.com/p/subscriptions/{id}/subscriber/{sid}/source/{id}/{sid}"
payload = json.dumps({
"token": "String"
})
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require "uri"
require "json"
require "net/http"
url = URI("https://api.mobbex.com/p/subscriptions/{id}/subscriber/{sid}/source/{id}/{sid}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"token": "String"
})
response = https.request(request)
puts response.read_body
{
"result": true,
"data": {
"status": "success",
"code": "200",
"text": "Operación Exitosa!",
"operation": {
"view": "default",
"options": {},
"id": "CGFMHP3VQMXKOAJIOWPKFX",
"status": {
"code": "200",
"text": "Aprobado",
"message": "Transacción Aprobada",
"data": {},
"view": "default"
},
"total": 14.27,
"currency": {
"value": "ARS",
"label": "Peso Argentino",
"symbol": "$",
"locale": "es-AR",
"isoCode": "032",
"exponent": 2,
"hidden": false
},
"data": [],
"actions": []
}
}
}Si obtenes un Status 200 es que la operación fue exitosa y ya tenes tu suscriptor activo via DEBIN con su Cuenta Bancaria (CBU) o con su Cuenta Virtual (CVU).