Detección de Medio de Pago
2 min
Este endpoint le permite detectar una tarjeta durante el pago. Nuestra API no sólo detectará la tarjeta sino que si lo indica también calculará las cuotas basadas en nuestro módulo de Cuotas. Esta detección es opcional aunque recomendada
Detección de Medios de Pago
Permite detectar el Medio de pago actual y calcular sus Cuotas si están disponibles.
POST
https://api.sugaway.com/p/sources/detect/{{intent_token}}
Query Parameters
- intent_tokenstringDescription
Header Parameters
- api-keystringDescription
Body Parameters
- typestringrequiredDescription
- dataObjectDescription
- data.binstringDescription
- optionsObjectDescription
- options.installmentsBooleanDescription
curl
curl --location -g --request POST 'https://api.sugaway.com/p/sources/detect/{{intent_token}}?intent_token=string' \
--header 'Accept: application/json' \
--header 'api-key: string' \
--data-raw '{"type":"string","data":"Object","data.bin":"string","options":"Object","options.installments":"Boolean"}'nodejs
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.sugaway.com/p/sources/detect/{{intent_token}}?intent_token=string',
'headers': {
'Accept': 'application/json',
'api-key': 'string'
},
body: '{"type":"string","data":"Object","data.bin":"string","options":"Object","options.installments":"Boolean"}'
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
javascript
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("api-key", "string");
var raw = "{\"type\":\"string\",\"data\":\"Object\",\"data.bin\":\"string\",\"options\":\"Object\",\"options.installments\":\"Boolean\"}";
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.sugaway.com/p/sources/detect/{{intent_token}}?intent_token=string", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));python
import requests
url = "https://api.sugaway.com/p/sources/detect/{{intent_token}}?intent_token=string"
payload = "{\"type\":\"string\",\"data\":\"Object\",\"data.bin\":\"string\",\"options\":\"Object\",\"options.installments\":\"Boolean\"}"
headers = {
'Accept': 'application/json',
'api-key': 'string'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
ruby
require "uri"
require "net/http"
url = URI("https://api.sugaway.com/p/sources/detect/{{intent_token}}?intent_token=string")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["api-key"] = "string"
request.body = "{\"type\":\"string\",\"data\":\"Object\",\"data.bin\":\"string\",\"options\":\"Object\",\"options.installments\":\"Boolean\"}"
response = https.request(request)
puts response.read_body
200
{
"result": true,
"data": {
"type": "card",
"source": {
"references": ["visa"],
"reference": "visa",
"generic": "visa",
"compatReference": "visa",
"name": "Visa",
"shortName": "Visa",
"currency": "*",
"card": {
"level": "classic",
"product": {
"name": "Visa",
"shortName": "Visa",
"variant": "credit",
"lengths": [16],
"gaps": [4, 8, 12],
"code": {
"name": "CVV",
"length": 3,
"position": 1
},
"logo": "https://res.mobbex.com/images/sources/png/visa.png",
"validation": ["length", "exp", "cvv", "luhn"]
},
"issuer": {
"shortName": "Visa",
"name": "Visa",
"color": "#122d98",
"logo": "https://res.mobbex.com/images/sources/png/visa.png"
}
}
},
"installments": [{
"name": "1 Pago",
"description": "1 Pago",
"sourceReference": "",
"count": 1,
"reference": "1",
"totals": {
"currency": {
"value": "TEST",
"label": "Test Money",
"symbol": "T$",
"hidden": false
},
"installment": {
"amount": 5,
"count": 1
},
"total": 5,
"financial": {
"percentage": 0,
"amount": 0
}
}
}, {
"name": "3 Cuotas",
"description": "3 Cuotas",
"sourceReference": "",
"count": 3,
"reference": "3",
"totals": {
"currency": {
"value": "TEST",
"label": "Test Money",
"symbol": "T$",
"hidden": false
},
"installment": {
"amount": 1.92,
"count": 3
},
"total": 5.75,
"financial": {
"percentage": 15,
"amount": 0.75
}
}
}, {
"name": "6 Cuotas",
"description": "6 Cuotas",
"sourceReference": "",
"count": 6,
"reference": "6",
"totals": {
"currency": {
"value": "TEST",
"label": "Test Money",
"symbol": "T$",
"hidden": false
},
"installment": {
"amount": 1.08,
"count": 6
},
"total": 6.5,
"financial": {
"percentage": 30,
"amount": 1.5
}
}
}, {
"name": "9 Cuotas",
"description": "9 Cuotas",
"sourceReference": "",
"count": 9,
"reference": "9",
"totals": {
"currency": {
"value": "TEST",
"label": "Test Money",
"symbol": "T$",
"hidden": false
},
"installment": {
"amount": 0.81,
"count": 9
},
"total": 7.25,
"financial": {
"percentage": 45,
"amount": 2.25
}
}
}, {
"name": "Ahora 12",
"description": "",
"sourceReference": "",
"count": 12,
"reference": "ahora_12",
"totals": {
"currency": {
"value": "TEST",
"label": "Test Money",
"symbol": "T$",
"hidden": false
},
"installment": {
"amount": 0.48,
"count": 12
},
"total": 5.75,
"financial": {
"percentage": 15,
"amount": 0.75
}
}
}, {
"name": "Ahora 18",
"description": "",
"sourceReference": "",
"count": 18,
"reference": "ahora_18",
"totals": {
"currency": {
"value": "TEST",
"label": "Test Money",
"symbol": "T$",
"hidden": false
},
"installment": {
"amount": 0.35,
"count": 18
},
"total": 6.25,
"financial": {
"percentage": 25,
"amount": 1.25
}
}
}]
}
}Uso de la Respuesta
Para procesar en modo transparente se debe obtener "data.installments.reference".