
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
mollie-component-react-wrapper
Advanced tools
π **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.
π 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.
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
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.
MollieCardForm
ComponentMollieCardForm
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
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
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.
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 |
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')} />
FAQs
π **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.
We found that mollie-component-react-wrapper demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.