1.0.143 β€’ Published 10 months ago

@paywithclay/inline-js v1.0.143

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

ClayHQ: One Code, All Payments β€” Simplifying Integration for Developers

NPM Downloads License

Clay InlineJS is a simple, open-source JavaScript library that helps developers integrate multiple payment gateways with minimal code. Whether you're working with Paystack, Flutterwave, or other supported gateways, Clay simplifies the process by offering a unified interface for payments.


⚠️ Important Notice:

This library is currently in early development and is still being worked on. Although it already supports basic payment integration, it is not yet ready for production use. Please use it for testing and development purposes only.


πŸš€ Features

  • Unified Payments: Easily integrate with multiple gateways like Paystack and Flutterwave using a single code base.
  • Minimal Setup: Just include the library and use a few lines of code to add a payment button.
  • Popup Payment Modal: Initiates payment using a non-intrusive modal without redirecting the user.
  • Customizable: Customize the look and feel of the payment button and modal.
  • Open Source: Constantly evolving with community feedback.

πŸ“¦ Installation

You can start experimenting by installing Clay InlineJS via npm:

npm install @paywithclay/inline-js

πŸ› οΈ Basic Usage

Once installed, simply include the script in your HTML or JavaScript file and set up the payment button as shown below:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Clay Payment Example</title>
    <script src="https://unpkg.com/@paywithclay/inline-js"></script>
</head>
<body>
    <h1>Welcome to Clay Payment System</h1>
    <div onClick="clay.clayPop()">Pay 15000 with Clay</div>
    <script>
        const clay = new Clay(15000, "NGN", "CLAY_TEST-E8F5jLh6AQyGf78Dhmk2Yt7yPs3UkFdR4qS9GvLxWcO", {
            email: "favourafula@gmail.com",
            name: "Favour Afula"
        });
        clay.onClayPopOpen(() => {
            console.log("Clay pop open");
        });

        clay.onClayPopClose(() => {
            console.log("Clay pop close");
        });
    </script>
</body>
</html>

Or if you prefer to initialize it via JavaScript:

// Example usage in JavaScript
const paymentButton = new Clay(1000, 'NGN', 'CLAY_PUBLIC_KEY').createPaymentButton();
document.body.appendChild(paymentButton);

This will create a payment button on your webpage. When clicked, it will open a payment modal for users to complete the transaction.

πŸ“‹ API Documentation

To use Clay InlineJS, you can call the Clay() constructor with the following parameters:

  • amount: Amount to be paid in the smallest currency unit (e.g., kobo for NGN).
  • currency: The currency in which the payment is made (e.g., NGN, USD).
  • key: Your public key from the payment gateway (e.g., Paystack or Flutterwave).
  • theme: Optional. You can choose between "dark" or "light" for the button style.

Example:

const paymentButton = new Clay(
  5000,          // Amount in currency subunit (e.g., 5000 kobo = ₦50)
  'NGN',         // Currency
  'CLAY_PUBLIC_KEY',  // Your clay public key
  'dark'         // Theme (optional)
);
paymentButton.createPaymentButton();  // Create and append button

🎯 Supported Gateways

  • Paystack
  • Flutterwave
  • (More gateways to be added soon)

🚧 Roadmap

  • Support for additional gateways (Stripe, Razorpay, etc.)
  • Enhanced error handling and event hooks
  • Subscription payments
  • Detailed documentation and examples

πŸ’¬ Contributions

We appreciate contributions from the community! If you would like to help improve Clay InlineJS, feel free to open an issue or submit a pull request. Contributions are welcome, whether it’s a feature request, bug report, or improvement.

πŸ› οΈ Community Support

For questions, suggestions, or feedback, reach out to us via:

You can also raise an issue on our GitHub repository.

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for more details.


Reminder:

Clay InlineJS is still under development and is not yet recommended for production use. Please feel free to experiment with it in a test or development environment and provide feedback as we continue to improve the library.

1.0.143

10 months ago

1.0.142

10 months ago

1.0.140

10 months ago

1.0.139

10 months ago

1.0.136

10 months ago

1.0.138

10 months ago

1.0.137

10 months ago

1.0.132

10 months ago

1.0.131

10 months ago

1.0.134

10 months ago

1.0.133

10 months ago

1.0.130

10 months ago

1.0.135

10 months ago

1.0.129

10 months ago

1.0.128

10 months ago

1.0.125

10 months ago

1.0.124

10 months ago

1.0.127

10 months ago

1.0.126

10 months ago

1.0.101

10 months ago

1.0.100

10 months ago

1.0.107

10 months ago

1.0.106

10 months ago

1.0.109

10 months ago

1.0.108

10 months ago

1.0.103

10 months ago

1.0.102

10 months ago

1.0.105

10 months ago

1.0.104

10 months ago

1.0.121

10 months ago

1.0.120

10 months ago

1.0.123

10 months ago

1.0.122

10 months ago

1.0.110

10 months ago

1.0.112

10 months ago

1.0.111

10 months ago

1.0.118

10 months ago

1.0.117

10 months ago

1.0.119

10 months ago

1.0.114

10 months ago

1.0.113

10 months ago

1.0.116

10 months ago

1.0.115

10 months ago

1.0.99

10 months ago

1.0.98

10 months ago

1.0.97

10 months ago

1.0.96

10 months ago

1.0.95

10 months ago

1.0.93

10 months ago

1.0.92

10 months ago

1.0.91

10 months ago

1.0.90

10 months ago

1.0.89

10 months ago

1.0.88

10 months ago

1.0.87

10 months ago

1.0.86

10 months ago

1.0.85

10 months ago

1.0.84

10 months ago

1.0.83

10 months ago

1.0.82

10 months ago

1.0.81

10 months ago

1.0.80

10 months ago

1.0.79

10 months ago

1.0.78

10 months ago

1.0.77

10 months ago

1.0.76

10 months ago

1.0.75

10 months ago

1.0.74

10 months ago

1.0.73

10 months ago

1.0.72

10 months ago

1.0.71

10 months ago

1.0.70

10 months ago

1.0.69

10 months ago

1.0.68

10 months ago

1.0.67

10 months ago

1.0.66

10 months ago

1.0.65

10 months ago

1.0.64

10 months ago

1.0.63

10 months ago

1.0.62

10 months ago

1.0.61

10 months ago

1.0.60

10 months ago

1.0.59

10 months ago

1.0.58

10 months ago

1.0.57

10 months ago

1.0.56

10 months ago

1.0.55

10 months ago

1.0.54

10 months ago

1.0.53

10 months ago

1.0.52

10 months ago

1.0.51

10 months ago

1.0.50

10 months ago

1.0.49

10 months ago

1.0.48

10 months ago

1.0.47

10 months ago

1.0.46

10 months ago

1.0.45

10 months ago

1.0.44

10 months ago

1.0.43

10 months ago

1.0.42

10 months ago

1.0.41

10 months ago

1.0.40

10 months ago

1.0.39

10 months ago

1.0.38

10 months ago

1.0.37

10 months ago

1.0.36

10 months ago

1.0.35

10 months ago

1.0.34

10 months ago

1.0.33

10 months ago

1.0.32

10 months ago

1.0.31

10 months ago

1.0.30

10 months ago

1.0.29

10 months ago

1.0.28

10 months ago

1.0.27

10 months ago

1.0.26

10 months ago

1.0.25

10 months ago

1.0.24

10 months ago

1.0.23

10 months ago

1.0.22

10 months ago

1.0.21

10 months ago

1.0.20

10 months ago

1.0.19

10 months ago

1.0.18

10 months ago

1.0.17

10 months ago

1.0.16

10 months ago

1.0.15

10 months ago

1.0.14

10 months ago

1.0.13

10 months ago

1.0.12

10 months ago

1.0.11

10 months ago

1.0.10

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.3

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago