0.0.3 • Published 2 years ago
pepetopo-credit-card v0.0.3
Tokenizador de tarjetas
Componente de react que permite tokenizar tarjetas usando cualquier proveedor de medios de pago.
Uso básico
Un ejemplo usando MercadoPago como proveedor
const MercadopagoIntegration = ({ api_key }) => {
const { paymentValues, setPaymentValues } = usePayment();
const [showToken, setShowToken] = useState(false);
const mp = new MercadoPago(api_key || "INSERT_YOUR_API_KEY", {
locale: "es-AR",
advancedFraudPrevention: true,
});
const amount = "14500.35";
useEffect(() => {
if (paymentValues?.token) {
setShowToken(true);
}
}, [paymentValues?.token]);
return showToken ? (
<div className="box">{paymentValues?.token}</div>
) : (
<CardForm
userConfig={MercadoPagoConfig(mp)}
amount={amount}
setPaymentValues={setPaymentValues}
/>
);
};
Ese ejmplo de ve así:
Licensing
This sofware is covered by the MIT license, see LICENSE.