Installation
tip
Use react.new to create a new React project and test the package on your browser!
Requirements
- Node.js version >=14 or above (which can be checked by running
node -v
). You can use nvm for managing multiple Node versions on a single machine installed.- When installing Node.js, you are recommended to check all checkboxes related to dependencies.
Installation
- npm
- yarn
- pnpm
npm install --save react-square-web-payments-sdk
yarn add react-square-web-payments-sdk
pnpm add react-square-web-payments-sdk
Usage
Wrap your app in our provider to be able to access to the SDK in any part of your app.
import { PaymentForm } from 'react-square-web-payments-sdk';
export default function App() {
return (
<PaymentForm {...props}>
<MyApp />
</PaymentForm>
);
}
Now you can use any of the payment methods supported by the SDK.
import { CreditCard } from "react-square-web-payments-sdk";
export default HomePage() {
return (
<>
<CreditCard />
</>
)
}
Problems?
Ask for help on our GitHub repository.