This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body {font-family: Arial, Helvetica, sans-serif;} | |
* {box-sizing: border-box;} | |
.form-inline { | |
display: flex; | |
flex-flow: row wrap; | |
align-items: center; | |
} | |
.form-inline label { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import './styles.css' | |
class App extends React.Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
formValues: [{ name: "", email : "" }] | |
}; | |
this.handleSubmit = this.handleSubmit.bind(this) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react' | |
import './styles.css' | |
const App = () => { | |
const [formValues, setFormValues] = useState([{ name: "", email : ""}]) | |
let handleChange = (i, e) => { | |
let newFormValues = [...formValues]; | |
newFormValues[i][e.target.name] = e.target.value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let handleChange = (i, e) => { | |
let newFormValues = [...formValues]; | |
newFormValues[i][e.target.name] = e.target.value; | |
setFormValues(newFormValues); | |
} | |
let addFormFields = () => { | |
setFormValues([...formValues, { name: "", email: "" }]) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react' | |
const App = () => { | |
const [formValues, setFormValues] = useState([{ name: "", email : ""}]) | |
return ( | |
<form onSubmit={handleSubmit}> | |
{formValues.map((element, index) => ( | |
<div className="form-inline" key={index}> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const crypto = require('crypto'); | |
const squareConnect = require('square-connect'); | |
const dotenv = require('dotenv'); | |
dotenv.config(); | |
const app = express(); | |
const port = 4000; | |
var cors = require('cors'); | |
app.use(cors()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ACCESS_TOKEN=acess_token |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "sqpaymentform-nodejs-starterkit", | |
"version": "0.1.0", | |
"private": true, | |
"scripts": { | |
"start": "nodemon server.js" | |
}, | |
"dependencies": { | |
"body-parser": "^1.19.0", | |
"express": "^4.17.0", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import config from '../Utils/paymentForm'; | |
const Square = ({ paymentForm }) => { | |
paymentForm = new paymentForm(config); | |
paymentForm.build(); | |
const requestCardNonce = () =>{ | |
paymentForm.requestCardNonce(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const config = { | |
// Initialize the payment form elements | |
//TODO: Replace with your sandbox application ID | |
applicationId: process.env.REACT_APP_APLLICATION_ID, | |
inputClass: 'sq-input', | |
autoBuild: false, | |
// Customize the CSS for SqPaymentForm iframe elements | |
inputStyles: [{ | |
fontSize: '16px', |
NewerOlder