<div id="app"></app>
html, body { height: 100%; }

body {
  background: #FFF;
  font-family: Helvetica Neue;
  width: 90%;
  max-width: 714px;
  margin: 0 auto;
}
import React, { useEffect } from 'https://esm.sh/react@18.2.0'
import ReactDOM from 'https://esm.sh/react-dom@18.2.0'

const FinixForm = () => {
  useEffect(() => {
    const onSubmit = () => {
      form.submit('sandbox', 'APgPDQrLD52TYvqazjHJJchM', function (err, res) {
        // get token ID from response
        const tokenData = res.data || {};
        const token = tokenData.id;
        
        alert("Your token ID is: " + token);
      });
    }
    
    const form = Finix.CardTokenForm('form', {
      showAddress: true,
      onSubmit,
    });
  }, [])
  
  return (
    <div id='form' />
  );
}

ReactDOM.render(<FinixForm />, document.getElementById('app'));
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://js.finix.com/v/1/finix.js