React JS Library
skrape-react-v1
A React library for integrating Skrape payments into your web application.
Installation
Integration
There are two methods of integration available:
As a component
Into your code directly as hooks
Usage
To use the library, import the SkrapeButton
component or the useSkrapePayment
hook from the package.
As a Component
To use the SkrapeButton component, simply import it and pass in the required configuration object.
Then, create a new configuration object by spreading the config object and adding some more options, such as the text that appears on the button, the button size, callback url and function, and onClose function.
As a hook
Finally, call the useSkrapePayment
hook with the configuration object, and assign the returned value to a variable. This variable can then be used as the event handler for a button or other interactive element to trigger the Skrape payment modal.
Parameters
Configuration
The config
object passed to the component or hook must contain the following properties:
api_key
: Your Skrape API key.token_name
: The token you wish to use for the transaction (e.g. "USDT").tx_ref
: A unique reference for the transaction.amount
: The amount to be charged.customer
: An object containing the customer's first and last name, and email.customization
: An object containing the title and description of the payment modal.
Additionally, you can pass the following properties to the hook:
text
: The text to be displayed on the buttonbtnSize
: The size of the button to be displayedcallback_url
: The callback URL to which the response will be sentcallback
: A callback function to handle the responseonClose
: A callback function to handle when the modal is closed
Note
Make sure you have an account with Skrape and have created an API Key. Also, when testing, it is recommended to use test API Key.
Support
If you have any issues or questions, please reach out to support@skrape.io
Last updated