---
title: Detección de Medio de Pago
slug: deteccion-de-medio-de-pago
description: Learn how to use an API endpoint to effortlessly detect payment cards and determine available installments during a payment process. This practical document provides code examples in various programming languages and explains how the API's response includ
icon: 🔍
createdAt: 2022-01-24T15:19:55.000Z
---

*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*

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://api.sugaway.com/p/sources/detect/{{intent_token}}",
  "name": "Detección de Medios de Pago",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [
      {
        "kind": "optional",
        "name": "intent_token",
        "type": "string",
        "description": "Intent Token Obtenido al crear el Checkout"
      }
    ],
    "headerParameters": [
      {
        "kind": "optional",
        "name": "api-key",
        "type": "string",
        "description": "Llave Pública"
      }
    ],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "type",
        "type": "string",
        "description": "Fijo: \"card\""
      },
      {
        "kind": "optional",
        "name": "data",
        "type": "Object",
        "description": "Objeto de tipo JSON con datos de la Tarjeta."
      },
      {
        "kind": "optional",
        "name": "data.bin",
        "type": "string",
        "description": "Primeros 6 dígitos de la tarjeta."
      },
      {
        "kind": "optional",
        "name": "options",
        "type": "Object",
        "description": "Objeto de tipo JSON con opciones de detección"
      },
      {
        "kind": "optional",
        "name": "options.installments",
        "type": "Boolean",
        "description": "Habilita el cálculo de cuotas"
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "iSplS0wLD0_UWQkTMAgqs",
        "code": "{\n\t\"result\": true,\n\t\"data\": {\n\t\t\"type\": \"card\",\n\t\t\"source\": {\n\t\t\t\"references\": [\"visa\"],\n\t\t\t\"reference\": \"visa\",\n\t\t\t\"generic\": \"visa\",\n\t\t\t\"compatReference\": \"visa\",\n\t\t\t\"name\": \"Visa\",\n\t\t\t\"shortName\": \"Visa\",\n\t\t\t\"currency\": \"*\",\n\t\t\t\"card\": {\n\t\t\t\t\"level\": \"classic\",\n\t\t\t\t\"product\": {\n\t\t\t\t\t\"name\": \"Visa\",\n\t\t\t\t\t\"shortName\": \"Visa\",\n\t\t\t\t\t\"variant\": \"credit\",\n\t\t\t\t\t\"lengths\": [16],\n\t\t\t\t\t\"gaps\": [4, 8, 12],\n\t\t\t\t\t\"code\": {\n\t\t\t\t\t\t\"name\": \"CVV\",\n\t\t\t\t\t\t\"length\": 3,\n\t\t\t\t\t\t\"position\": 1\n\t\t\t\t\t},\n\t\t\t\t\t\"logo\": \"https://res.mobbex.com/images/sources/png/visa.png\",\n\t\t\t\t\t\"validation\": [\"length\", \"exp\", \"cvv\", \"luhn\"]\n\t\t\t\t},\n\t\t\t\t\"issuer\": {\n\t\t\t\t\t\"shortName\": \"Visa\",\n\t\t\t\t\t\"name\": \"Visa\",\n\t\t\t\t\t\"color\": \"#122d98\",\n\t\t\t\t\t\"logo\": \"https://res.mobbex.com/images/sources/png/visa.png\"\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"installments\": [{\n\t\t\t\"name\": \"1 Pago\",\n\t\t\t\"description\": \"1 Pago\",\n\t\t\t\"sourceReference\": \"\",\n\t\t\t\"count\": 1,\n\t\t\t\"reference\": \"1\",\n\t\t\t\"totals\": {\n\t\t\t\t\"currency\": {\n\t\t\t\t\t\"value\": \"TEST\",\n\t\t\t\t\t\"label\": \"Test Money\",\n\t\t\t\t\t\"symbol\": \"T$\",\n\t\t\t\t\t\"hidden\": false\n\t\t\t\t},\n\t\t\t\t\"installment\": {\n\t\t\t\t\t\"amount\": 5,\n\t\t\t\t\t\"count\": 1\n\t\t\t\t},\n\t\t\t\t\"total\": 5,\n\t\t\t\t\"financial\": {\n\t\t\t\t\t\"percentage\": 0,\n\t\t\t\t\t\"amount\": 0\n\t\t\t\t}\n\t\t\t}\n\t\t}, {\n\t\t\t\"name\": \"3 Cuotas\",\n\t\t\t\"description\": \"3 Cuotas\",\n\t\t\t\"sourceReference\": \"\",\n\t\t\t\"count\": 3,\n\t\t\t\"reference\": \"3\",\n\t\t\t\"totals\": {\n\t\t\t\t\"currency\": {\n\t\t\t\t\t\"value\": \"TEST\",\n\t\t\t\t\t\"label\": \"Test Money\",\n\t\t\t\t\t\"symbol\": \"T$\",\n\t\t\t\t\t\"hidden\": false\n\t\t\t\t},\n\t\t\t\t\"installment\": {\n\t\t\t\t\t\"amount\": 1.92,\n\t\t\t\t\t\"count\": 3\n\t\t\t\t},\n\t\t\t\t\"total\": 5.75,\n\t\t\t\t\"financial\": {\n\t\t\t\t\t\"percentage\": 15,\n\t\t\t\t\t\"amount\": 0.75\n\t\t\t\t}\n\t\t\t}\n\t\t}, {\n\t\t\t\"name\": \"6 Cuotas\",\n\t\t\t\"description\": \"6 Cuotas\",\n\t\t\t\"sourceReference\": \"\",\n\t\t\t\"count\": 6,\n\t\t\t\"reference\": \"6\",\n\t\t\t\"totals\": {\n\t\t\t\t\"currency\": {\n\t\t\t\t\t\"value\": \"TEST\",\n\t\t\t\t\t\"label\": \"Test Money\",\n\t\t\t\t\t\"symbol\": \"T$\",\n\t\t\t\t\t\"hidden\": false\n\t\t\t\t},\n\t\t\t\t\"installment\": {\n\t\t\t\t\t\"amount\": 1.08,\n\t\t\t\t\t\"count\": 6\n\t\t\t\t},\n\t\t\t\t\"total\": 6.5,\n\t\t\t\t\"financial\": {\n\t\t\t\t\t\"percentage\": 30,\n\t\t\t\t\t\"amount\": 1.5\n\t\t\t\t}\n\t\t\t}\n\t\t}, {\n\t\t\t\"name\": \"9 Cuotas\",\n\t\t\t\"description\": \"9 Cuotas\",\n\t\t\t\"sourceReference\": \"\",\n\t\t\t\"count\": 9,\n\t\t\t\"reference\": \"9\",\n\t\t\t\"totals\": {\n\t\t\t\t\"currency\": {\n\t\t\t\t\t\"value\": \"TEST\",\n\t\t\t\t\t\"label\": \"Test Money\",\n\t\t\t\t\t\"symbol\": \"T$\",\n\t\t\t\t\t\"hidden\": false\n\t\t\t\t},\n\t\t\t\t\"installment\": {\n\t\t\t\t\t\"amount\": 0.81,\n\t\t\t\t\t\"count\": 9\n\t\t\t\t},\n\t\t\t\t\"total\": 7.25,\n\t\t\t\t\"financial\": {\n\t\t\t\t\t\"percentage\": 45,\n\t\t\t\t\t\"amount\": 2.25\n\t\t\t\t}\n\t\t\t}\n\t\t}, {\n\t\t\t\"name\": \"Ahora 12\",\n\t\t\t\"description\": \"\",\n\t\t\t\"sourceReference\": \"\",\n\t\t\t\"count\": 12,\n\t\t\t\"reference\": \"ahora_12\",\n\t\t\t\"totals\": {\n\t\t\t\t\"currency\": {\n\t\t\t\t\t\"value\": \"TEST\",\n\t\t\t\t\t\"label\": \"Test Money\",\n\t\t\t\t\t\"symbol\": \"T$\",\n\t\t\t\t\t\"hidden\": false\n\t\t\t\t},\n\t\t\t\t\"installment\": {\n\t\t\t\t\t\"amount\": 0.48,\n\t\t\t\t\t\"count\": 12\n\t\t\t\t},\n\t\t\t\t\"total\": 5.75,\n\t\t\t\t\"financial\": {\n\t\t\t\t\t\"percentage\": 15,\n\t\t\t\t\t\"amount\": 0.75\n\t\t\t\t}\n\t\t\t}\n\t\t}, {\n\t\t\t\"name\": \"Ahora 18\",\n\t\t\t\"description\": \"\",\n\t\t\t\"sourceReference\": \"\",\n\t\t\t\"count\": 18,\n\t\t\t\"reference\": \"ahora_18\",\n\t\t\t\"totals\": {\n\t\t\t\t\"currency\": {\n\t\t\t\t\t\"value\": \"TEST\",\n\t\t\t\t\t\"label\": \"Test Money\",\n\t\t\t\t\t\"symbol\": \"T$\",\n\t\t\t\t\t\"hidden\": false\n\t\t\t\t},\n\t\t\t\t\"installment\": {\n\t\t\t\t\t\"amount\": 0.35,\n\t\t\t\t\t\"count\": 18\n\t\t\t\t},\n\t\t\t\t\"total\": 6.25,\n\t\t\t\t\"financial\": {\n\t\t\t\t\t\"percentage\": 25,\n\t\t\t\t\t\"amount\": 1.25\n\t\t\t\t}\n\t\t\t}\n\t\t}]\n\t}\n}",
        "language": "200"
      }
    ],
    "selectedLanguageId": "iSplS0wLD0_UWQkTMAgqs"
  },
  "examples": {
    "languages": [
      {
        "id": "vwHx8h4KYeM2IEsMp7O0n",
        "language": "curl",
        "code": "curl --location -g --request POST 'https://api.sugaway.com/p/sources/detect/{{intent_token}}?intent_token=string' \\\n--header 'Accept: application/json' \\\n--header 'api-key: string' \\\n--data-raw '{\"type\":\"string\",\"data\":\"Object\",\"data.bin\":\"string\",\"options\":\"Object\",\"options.installments\":\"Boolean\"}'",
        "customLabel": ""
      },
      {
        "id": "DdAcKfCoqJxomMs3PDV_M",
        "language": "nodejs",
        "code": "var request = require('request');\nvar options = {\n   'method': 'POST',\n   'url': 'https://api.sugaway.com/p/sources/detect/{{intent_token}}?intent_token=string',\n   'headers': {\n      'Accept': 'application/json',\n      'api-key': 'string'\n   },\n   body: '{\"type\":\"string\",\"data\":\"Object\",\"data.bin\":\"string\",\"options\":\"Object\",\"options.installments\":\"Boolean\"}'\n\n};\nrequest(options, function (error, response) {\n   if (error) throw new Error(error);\n   console.log(response.body);\n});\n",
        "customLabel": ""
      },
      {
        "id": "OL5u3gvGtI9uXsVO6GdFa",
        "language": "javascript",
        "code": "var myHeaders = new Headers();\nmyHeaders.append(\"Accept\", \"application/json\");\nmyHeaders.append(\"api-key\", \"string\");\n\nvar raw = \"{\\\"type\\\":\\\"string\\\",\\\"data\\\":\\\"Object\\\",\\\"data.bin\\\":\\\"string\\\",\\\"options\\\":\\\"Object\\\",\\\"options.installments\\\":\\\"Boolean\\\"}\";\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.sugaway.com/p/sources/detect/{{intent_token}}?intent_token=string\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));",
        "customLabel": ""
      },
      {
        "id": "q_DRGiK-_BVcS5efT9Hjo",
        "language": "python",
        "code": "import requests\n\nurl = \"https://api.sugaway.com/p/sources/detect/{{intent_token}}?intent_token=string\"\n\npayload = \"{\\\"type\\\":\\\"string\\\",\\\"data\\\":\\\"Object\\\",\\\"data.bin\\\":\\\"string\\\",\\\"options\\\":\\\"Object\\\",\\\"options.installments\\\":\\\"Boolean\\\"}\"\nheaders = {\n   'Accept': 'application/json',\n   'api-key': 'string'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n",
        "customLabel": ""
      },
      {
        "id": "C2uwuog1VlFrZqLJysBrq",
        "language": "ruby",
        "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.sugaway.com/p/sources/detect/{{intent_token}}?intent_token=string\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Accept\"] = \"application/json\"\nrequest[\"api-key\"] = \"string\"\nrequest.body = \"{\\\"type\\\":\\\"string\\\",\\\"data\\\":\\\"Object\\\",\\\"data.bin\\\":\\\"string\\\",\\\"options\\\":\\\"Object\\\",\\\"options.installments\\\":\\\"Boolean\\\"}\"\n\nresponse = https.request(request)\nputs response.read_body\n",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "vwHx8h4KYeM2IEsMp7O0n"
  },
  "description": "Permite detectar el Medio de pago actual y calcular sus Cuotas si están disponibles.",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "autoGeneratedAnchorSlug": "deteccin-de-medios-de-pago",
  "legacyHash": "e1JUDafaKRMZbtJ5W3XeN"
}
```
:::

:::hint{type="success"}
## Uso de la Respuesta

Para procesar en modo transparente se debe obtener "data.installments.reference".
:::

###

