---
title: Tokenización
slug: tokenizacion
description: Learn how to process payments using a wallet or tokenized card with this comprehensive document. It includes step-by-step instructions for generating a new checkout, obtaining essential information, and processing the transaction. Explore code examples in
icon: 🎒
createdAt: 2022-01-25T12:32:07.000Z
---

# Procesamiento con Wallet o Tarjeta Tokenizada



```mermaid
sequenceDiagram
    participant Sistema
    participant Mobbex
    Sistema->>Mobbex: Crear Operacion
    Note right of Mobbex: Utilizar Private Key
    Sistema->>Mobbex: Generar Cobro
    Note right of Mobbex: Utilizar Public Key
```



1. Generar un nuevo Checkout desde el lado Servidor utilizando Llave Privada.
2. Obtener desde el Objeto wallet.it ( intent\_token ) y wallet.installments.reference
3. Procesar la Operación como en el Punto 4. Se debe enviar securityCode como parametro adicional en Body.

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://api.sugaway.com/p/operations/{{intent_token}}",
  "name": "Procesamiento con Wallet",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "installment",
        "type": "string",
        "description": "Reference Obtenido desde las cuotas calculadas para la tarjeta elegida en wallet."
      },
      {
        "kind": "optional",
        "name": "securityCode",
        "type": "string",
        "description": "Código de Seguridad de la tarjeta elegida."
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "iZcM6V04rEU9totmGgCPA",
        "code": "{\n    \"id\": \"kS6D18unD\",\n    \"status\": {\n        \"code\": \"200\",\n        \"text\": \"Aprobado\",\n        \"message\": \"Transacción Aprobada\"\n    }\n}",
        "language": "200"
      }
    ],
    "selectedLanguageId": "iZcM6V04rEU9totmGgCPA"
  },
  "examples": {
    "languages": [
      {
        "id": "BsL0HGxN8KCuz8-FPRH5J",
        "language": "curl",
        "code": "curl --location -g --request POST 'https://api.sugaway.com/p/operations/{{intent_token}}' \\\n--header 'Accept: application/json' \\\n--data-raw '{\"installment\":\"string\",\"securityCode\":\"string\"}'",
        "customLabel": ""
      },
      {
        "id": "XpvV4xdwOcVXLsLq0hSeV",
        "language": "nodejs",
        "code": "var request = require('request');\nvar options = {\n   'method': 'POST',\n   'url': 'https://api.sugaway.com/p/operations/{{intent_token}}',\n   'headers': {\n      'Accept': 'application/json'\n   },\n   body: '{\"installment\":\"string\",\"securityCode\":\"string\"}'\n\n};\nrequest(options, function (error, response) {\n   if (error) throw new Error(error);\n   console.log(response.body);\n});\n",
        "customLabel": ""
      },
      {
        "id": "lMYyOyGfoC550c05aXK66",
        "language": "javascript",
        "code": "var myHeaders = new Headers();\nmyHeaders.append(\"Accept\", \"application/json\");\n\nvar raw = \"{\\\"installment\\\":\\\"string\\\",\\\"securityCode\\\":\\\"string\\\"}\";\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.sugaway.com/p/operations/{{intent_token}}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));",
        "customLabel": ""
      },
      {
        "id": "oIdquqHHHDNjdujqePaoU",
        "language": "python",
        "code": "import requests\n\nurl = \"https://api.sugaway.com/p/operations/{{intent_token}}\"\n\npayload = \"{\\\"installment\\\":\\\"string\\\",\\\"securityCode\\\":\\\"string\\\"}\"\nheaders = {\n   'Accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n",
        "customLabel": ""
      },
      {
        "id": "hz3GWA97WUkc9EqR3nsMm",
        "language": "ruby",
        "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.sugaway.com/p/operations/{{intent_token}}\")\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.body = \"{\\\"installment\\\":\\\"string\\\",\\\"securityCode\\\":\\\"string\\\"}\"\n\nresponse = https.request(request)\nputs response.read_body\n",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "BsL0HGxN8KCuz8-FPRH5J"
  },
  "description": "Permite procesar una Tarjeta Previamente Guardada.",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "autoGeneratedAnchorSlug": "procesamiento-con-wallet",
  "legacyHash": "s8cTqs6b-vb9w3-QRPP1P"
}
```
:::

***



## Códigos de Respuesta



**Ver: [https://www.sugaway.dev/codigos-de-estado](https://www.sugaway.dev/codigos-de-estado)**

***

# Uso del SDK para Javascript



:::hint{type="warning"}
## Importante

Tenga en cuenta que integrity ( SRI ) es obligatorio, de lo contrario sus credenciales pueden ser canceladas.
:::



```html
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<meta
			name="viewport"
			content="width=device-width, initial-scale=1, shrink-to-fit=no"
		/>
		<title>Mobbex SDK</title>
	</head>
	<body>
		<noscript> You need to enable JavaScript to run this app. </noscript>
		<div id="root">
			<form id="source-form">
				<input
					data-mobbex="card_number"
					type="text"
					placeholder="Numero de Tarjeta"
				/>
				<br />
				<input
					data-mobbex="cardholder_name"
					type="text"
					placeholder="Nombre en la Tarjeta"
				/>
				<br />
				<input
					data-mobbex="expiration"
					type="text"
					placeholder="Vencimiento"
				/>
				<br />
				<input
					data-mobbex="cardholder_identification"
					type="text"
					placeholder="DNI"
				/>
				<br />
        
        <!-- The Security Code must always be PASSWORD Type -->
				<input
					data-mobbex="security_code"
					type="password"
					placeholder="Codigo de Seguridad"
				/>
				<br />
			</form>

			<br />
      <!-- The button must not be in the FORM!! -->
			<button id="mobbex-pay" type="button">Pagar</button>
    </div>
		<script>
      	function attachForm() {
            window.MobbexJS.form.attach(
                "{{ intentToken }}",
                {
                    formEl: "#source-form",
                    submitEl: "#mobbex-pay",
                    onSourceDetected: (data) => {
                        console.info(data);

                        window.MobbexJS.form.setInstallment(
                            data.installments[0].reference
                        );
                    },
                    onResult: (result) => {
                        console.info(result);
                    },
                    onError: (err) => {
                        console.error(err);
                    },
                }
            );
        };
	    </script>
    
        <script src="https://res.mobbex.com/js/sdk/mobbex@1.1.0.js" integrity="sha384-7CIQ1hldcQc/91ZpdRclg9KVlvtXBldQmZJRD1plEIrieHNcYvlQa2s2Bj+dlLzQ" crossorigin="anonymous" onload="attachForm" async></script>
	</body>
</html>
```

