Low Code JS
Fractal JS in depth
Welcome to the Widgets API documentation. This API allows you to integrate and interact with various payment widgets seamlessly. You can embed buttons for payments, request payments, and display transaction tables.
Widget Usage
Pay Link
Pay Button
HTML implementation
React/Vue js implementation
Description: This widget generates a button that, when clicked, opens a payment page for the amount 8.00
.
Parameters:
amount
(number): The amount of the widget to open the payment page for.
Example:
Request Link
Request Payment Button
HTML implementation
React/Vue js implementation
Description: This widget generates a button that, when clicked, sends a payment request to the specified phone number for the amount of 8.00
.
Parameters:
amount
(number): The value of the widget to send the payment request for.recipient_phone
(string): The phone number of the recipient.
Example:
React/Vue js
Transactions Table
Transactions Table
HTML implementation
React/Vue js implementation
Description: This widget generates a table to display complete transactions.
Parameters:
id
(string): The ID of the table element. In this case, it isfractal_complete_transactions
.
Example:
React/Vue.js
Installing JS & NPM Package
To use these widgets, include the following script tag in your HTML:
Replace {{merchant_public_key}}
with your actual merchant public key.
To use these widgets in a react/Vue.js app, install the following npm package:
To use the components in a react/Vue.js app, use the below line to import the proper npm function:
Error Handling and FAQs
Error Handling
Error Codes:
- 400 Bad Request: The request was invalid or cannot be otherwise served.
- 401 Unauthorized: Authentication is required and has failed or has not yet been provided.
- 404 Not Found: The requested resource could not be found.
- 500 Internal Server Error: An error occurred on the server.
FAQs and Troubleshooting
-
Q: What should I do if I receive a 401 Unauthorized error? A: Ensure that your API key is correct and included in the request header.
-
Q: How do I update the settings of a widget? A: Use the PUT /widgets/ endpoint with the new settings in the request body.