Tokenización
5 min
Procesamiento con Wallet o Tarjeta Tokenizada
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
- Generar un nuevo Checkout desde el lado Servidor utilizando Llave Privada.
- Obtener desde el Objeto wallet.it ( intent_token ) y wallet.installments.reference
- Procesar la Operación como en el Punto 4. Se debe enviar securityCode como parametro adicional en Body.
Procesamiento con Wallet
Permite procesar una Tarjeta Previamente Guardada.
POST
https://api.sugaway.com/p/operations/{{intent_token}}
curl --location -g --request POST 'https://api.sugaway.com/p/operations/{{intent_token}}' \
--header 'Accept: application/json' \
--data-raw '{"installment":"string","securityCode":"string"}'
Códigos de Respuesta
Uso del SDK para Javascript
Importante
Tenga en cuenta que integrity ( SRI ) es obligatorio, de lo contrario sus credenciales pueden ser canceladas.
<!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/[email protected]" integrity="sha384-7CIQ1hldcQc/91ZpdRclg9KVlvtXBldQmZJRD1plEIrieHNcYvlQa2s2Bj+dlLzQ" crossorigin="anonymous" onload="attachForm" async></script>
</body>
</html>