This file contains 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
php artisan serve |
This file contains 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
<?php | |
require_once('config.php'); | |
$request = 'USER='.$USER; | |
$request .= '&VENDOR='.$VENDOR ; | |
$request .= '&PARTNER='.$PARTNER; | |
$request .= '&PWD='.$PWD; | |
$request .= '&TENDER=C'; | |
$request .= '&TRXTYPE=D' ; // D => delay capture | |
$request .= '&AMT=60'; | |
$request .= '&CURRENCY=USD'; |
This file contains 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
<?php | |
require_once('config.php'); | |
$request = 'USER='.$USER; | |
$request .= '&VENDOR='.$VENDOR ; | |
$request .= '&PARTNER='.$PARTNER; | |
$request .= '&PWD='.$PWD; | |
$request .= '&TENDER=C'; | |
$request .= '&TRXTYPE=S' ; // S => sale transaction | |
$request .= '&AMT=40'; | |
$request .= '&CURRENCY=USD'; |
This file contains 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
npx create-react-app client | |
cd client | |
npm start |
This file contains 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
REACT_APP_APLLICATION_ID=Application Id |
This file contains 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, useEffect } from 'react'; | |
import './App.css'; | |
import Square from './Component/Square'; | |
const App = () => { | |
const [isLoad, setLoad] = useState(false); | |
useEffect(() => { | |
let sqPaymentScript = document.createElement("script"); | |
// sandbox: https://js.squareupsandbox.com/v2/paymentform | |
// production: https://js.squareup.com/v2/paymentform |
This file contains 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
button { | |
border: 0; | |
font-weight: 500; | |
} | |
fieldset { | |
margin: 0; | |
padding: 0; | |
border: 0; | |
} |
This file contains 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', |
This file contains 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(); | |
} |