Gateway - Procesamiento
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 { "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" } } uso de la respuesta para procesar en modo transparente se debe obtener "data installments reference"