Wallpay React SDK is a set of tools to easily integrate your app with Wallpay's payment gateway (learn more at https://sites.google.com/goblockchain.io/wallpay/home)
- Intall the SDK as a dependency of your React application
npm install wallpay-react-sdk
or
yarn add wallpay-react-sdk
- Create a
wallpay.ts
file such as below
import WallpaySDK from 'wallpay-react-sdk';
const wallpaySDK = WallpaySDK('MY_PRIVATE_KEY');
export default wallpaySDK;
- Use the exported tools through wallpaySDK
import wallpaySDK from 'src/utils/wallpay';
const {
PaymentModal,
PaymentProvider,
usePayment,
} = wallpaySDK;
<PaymentModal
onClose={onClose}
paymentData={{
PriceBRL: paymentData.fiatPrice,
fixedPrice: paymentData.price,
itemName: paymentData.itemName,
itemImage: paymentData.itemImage,
}}
/>
<PaymentProvider>
<Component />
</PaymentProvider>
const { onOpenPaymentModal } = usePayment();
- Clone this repo
git clone https://github.com/goblockchain/wallpay-react-sdk.git
- Go to the folder of the cloned repo
- Install its dependencies
yarn install
- Build the package
yarn run build
- Register its link
yarn link
- Go to your React application's folder
- Create a link to the package's folder
yarn link wallpay-react-sdk
- Add wallpay-react-sdk as one of your app's dependencies like below
"dependencies": {
[... other dependencies]
"wallpay-react-sdk": "your/path/to/wallpay-react-sdk"
}
- Install the app's dependencies
yarn install
and it's ready to be used by the app
Whenever a change is made to the local version of the SDK, follow the next steps to properly update the codebase being used as a dependency of your app:
- Go to the folder where of the SDK repo
- Build the package
yarn run build
- Go to the folder where of the React application
- Remove wallpay-react-sdk from
yarn.lock
- Install the dependencies again
yarn install