Skip to main content

MONEI Components

MONEI Components is a set of rich, prebuilt UI components that help you create your own checkout flows across desktop and mobile.

Components are available for vanilla JavaScript and all major frameworks:

PackageFramework
@monei-js/componentsVanilla JSThis page
@monei-js/react-componentsReact 17+React guide
@monei-js/vue-componentsVue 3.3+Vue guide
@monei-js/angular-componentsAngular 14+Angular guide
@monei-js/svelte-componentsSvelte 5+Svelte guide

Components include:

  • CardInput — secure card number, expiry and CVC input
  • Bizum — Bizum payment button with phone verification
  • PayPal — PayPal checkout button
  • PaymentRequest — Apple Pay / Google Pay button
  • Payment Modal — full in-page checkout modal

Setup monei.js

Include monei.js on your checkout page by adding the script tag to the head of your HTML file, or by installing it from npm:

<script src="https://js.monei.com/v3/monei.js"></script>

Card Input Component

The Card Input Component lets you collect card information all within one component. It includes a dynamically-updating card brand icon as well as inputs for number, expiry and CVC.

Card Input Component is completely customizable. You can style it to match the look and feel of your site, providing a seamless checkout experience for your customers. It's also possible to style various input states, for example when the input has focus.

Other Components

Bizum

The Bizum component renders a Bizum payment button. When the customer clicks it, a phone verification modal opens to complete the payment.

const bizum = monei.Bizum({
paymentId: '{{payment_id}}',
async onSubmit(result) {
if (result.token) {
await monei.confirmPayment({
paymentId: '{{payment_id}}',
paymentToken: result.token
});
}
},
onError(error) {
console.error(error);
}
});

bizum.render('#bizum-container');

PayPal

The PayPal component renders a PayPal checkout button. When the customer approves, you receive a token to confirm the payment.

const paypal = monei.PayPal({
paymentId: '{{payment_id}}',
async onSubmit(result) {
if (result.token) {
await monei.confirmPayment({
paymentId: '{{payment_id}}',
paymentToken: result.token
});
}
},
onError(error) {
console.error(error);
}
});

paypal.render('#paypal-container');

PaymentRequest (Apple Pay / Google Pay)

The PaymentRequest component renders an Apple Pay or Google Pay button depending on the customer's browser and device.

note

Apple Pay requires domain verification in both development and production.

const paymentRequest = monei.PaymentRequest({
paymentId: '{{payment_id}}',
async onSubmit(result) {
if (result.token) {
await monei.confirmPayment({
paymentId: '{{payment_id}}',
paymentToken: result.token
});
}
},
onError(error) {
console.error(error);
}
});

paymentRequest.render('#payment-request-container');

Payment Modal

Calling monei.confirmPayment() without a paymentToken opens the MONEI Payment Modal — a full in-page checkout where the customer can select a payment method and complete the payment.

const result = await monei.confirmPayment({
paymentId: '{{payment_id}}'
});
// Payment completed — check result.status
console.log(result);
important

Apple Pay is not available in the Payment Modal. Use the PaymentRequest component instead.

See Use Payment Modal for the full integration guide.

Next steps