npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

Iโ€™ve always been into building performant and accessible sites, but lately Iโ€™ve been taking it extremely seriously. So much so that Iโ€™ve been building a tool to help me optimize and monitor the sites that I build to make sure that Iโ€™m making an attempt to offer the best experience to those who visit them. If youโ€™re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, ๐Ÿ‘‹, Iโ€™m Ryan Hefnerย  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If youโ€™re interested in other things Iโ€™m working on, follow me on Twitter or check out the open source projects Iโ€™ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soonโ€“ish.

Open Software & Tools

This site wouldnโ€™t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you ๐Ÿ™

ยฉ 2025 โ€“ย Pkg Stats / Ryan Hefner

mollie-component-react-wrapper

v0.1.0

Published

๐Ÿš€ **Unofficial React Wrapper for Mollie.js**\ This package provides a **React-friendly integration** for [Mollie Components](https://docs.mollie.com/docs/mollie-components), enabling secure and PCI-compliant card payment forms.

Readme

Mollie Component React Wrapper

๐Ÿš€ Unofficial React Wrapper for Mollie.js
This package provides a React-friendly integration for Mollie Components, enabling secure and PCI-compliant card payment forms.

๐Ÿ’ก Note: This is an unofficial wrapper and is not maintained or endorsed by Mollie.


๐Ÿ“ฆ Installation

Install the package via npm:

npm install mollie-component-react-wrapper

Ensure you have React and ReactDOM installed as peer dependencies:

npm install react react-dom

๐Ÿš€ Usage

1๏ธโƒฃ Initialize Mollie with MollieComponentProvider

Wrap your application with MollieComponentProvider to initialize Mollie.js:

import React from 'react';
import ReactDOM from 'react-dom/client';
import { MollieComponentProvider } from 'mollie-component-react-wrapper';
import App from './App';

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);

root.render(
  <MollieComponentProvider profileId="your_profile_id" options={{ locale: 'en_US' }}>
    <App />
  </MollieComponentProvider>
);

Replace your_profile_id with your Mollie Profile ID.


2๏ธโƒฃ Using the Standalone MollieCardForm Component

MollieCardForm provides a fully integrated UI for collecting card details. It manages its own state and event handling.

import { MollieForm, MollieCardForm, useMollie } from 'mollie-component-react-wrapper';

const PaymentForm = () => {
  const { isLoaded } = useMollie();
  const handlePayment = (token: string) => {
    console.log('Received token:', token);
  };

  if (!isLoaded) return <h2>Loading...</h2>;

  return (
    <div>
      <h2>Complete Payment</h2>
      <MollieForm onSubmit={handlePayment}>
        <MollieCardForm />
      </MollieForm>
    </div>
  );
};

export default PaymentForm;

โœ” Handles all card input fields internally
โœ” Automatic validation and error handling
โœ” Generates a token upon submission


3๏ธโƒฃ Using Individual Input Components

For custom layouts, use individual input components with forwardRef support:

import { MollieForm, MollieCardNumberInput, MollieCardHolderInput, MollieExpiryDateInput, MollieVerificationCodeInput } from 'mollie-component-react-wrapper';
import { useRef } from 'react';

const PaymentForm = () => {
  const cardNumberRef = useRef(null);
  const expiryDateRef = useRef(null);

  const handleSubmit = (token: string) => {
    console.log('Token received:', token);
  };

  return (
    <MollieForm onSubmit={handleSubmit}>
      <MollieCardNumberInput ref={cardNumberRef} onChange={() => console.log('Card number changed')} />
      <MollieCardHolderInput onBlur={() => console.log('Card holder field blurred')} />
      <MollieExpiryDateInput ref={expiryDateRef} onChange={() => console.log('Expiry date changed')} />
      <MollieVerificationCodeInput onBlur={() => console.log('CVC field blurred')} />
      <button type="submit">Pay Now</button>
    </MollieForm>
  );
};

export default PaymentForm;

โœ” Customizable layout
โœ” Event listeners available (onChange, onBlur, etc.)
โœ” Supports ref forwarding for better control


๐ŸŽจ Styling Inputs

You can customize the input styles using the styles prop:

const inputStyle = {
  styles: {
    base: {
      color: '#333',
      fontSize: '16px',
      padding: '10px',
    }
  }
};

<MollieCardNumberInput styles={inputStyle} />

For more details, refer to Mollieโ€™s Styling Guide.


โšก API Reference

๐Ÿ”น MollieComponentProvider

| Prop | Type | Required | Description | | ----------- | -------- | -------- | ----------------- | | profileId | string | โœ… Yes | Mollie Profile ID | | options | object | โŒ No | Additional Mollie configuration options |

๐Ÿ”น useMollie

| Prop | Type | Description | | ----------- | --------- | ------------------------------------ | | isLoaded | boolean | Loading state of mollie object | | _mollie | object | A shallow reference to mollie object |

๐Ÿ”น MollieForm

| Prop | Type | Required | Description | | ---------- | ------------------------- | -------- | ------------------------------------------ | | onSubmit | (token: string) => void | โœ… Yes | Callback when a payment token is generated |

๐Ÿ”น Input Components

| Component | Description | | ----------------------------- | ----------------------------------- | | MollieCardNumberInput | Captures the card number | | MollieCardHolderInput | Captures the cardholder's name | | MollieExpiryDateInput | Captures the card's expiration date | | MollieVerificationCodeInput | Captures the CVV security code |

๐Ÿ”น Event Listeners for Inputs

| Event | Description | | ---------- | ------------------------------------ | | onChange | Triggered when input value changes | | onBlur | Triggered when the input loses focus | | onFocus | Triggered when the input gains focus |

Example:

<MollieCardNumberInput onChange={() => console.log('Card number updated')} />

๐Ÿ” Security Considerations

  • Do NOT store raw card details.
  • Always use tokenized payments for PCI compliance.
  • Use HTTPS for secure data transmission.