Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@mint-app/mint-webpay

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mint-app/mint-webpay

## Overview The `mint-webpay` widget is a versatile web component for handling payment integrations. This guide provides detailed steps and examples for consuming the widget in different environments: Vanilla JS, React, Vue, and Angular.

next
npmnpm
Version
1.0.2
Version published
Maintainers
0
Created
Source

MintWebPay Integration Guide

Overview

The mint-webpay widget is a versatile web component for handling payment integrations. This guide provides detailed steps and examples for consuming the widget in different environments: Vanilla JS, React, Vue, and Angular.

Installation

To use mint-webpay, install it via npm:

npm install @mint-app/mint-webpay

Alternatively, you can use the CDN link for quick integration:

<script src="https://cdn.jsdelivr.net/npm/@mint-app/mint-webpay/index.esm.js" type="module" defer></script>

Usage

Vanilla JS

Include the following HTML and JavaScript in your web page:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>mintPay</title>
</head>
<body>

<script src="https://cdn.jsdelivr.net/npm/@mint-app/mint-webpay/index.esm.js" type="module" defer></script>

<div id="mintPay"></div>

<script defer>
    document.addEventListener('DOMContentLoaded', () => {
        mintWebpay.init({
            theme: {
                primaryColor: 'red',
                secondaryColor: 'black',
            },
            container: mintPay
        });
    });
</script>

</body>
</html>

React

Integrate mint-webpay in a React component as follows:

import React, { useEffect, useRef } from 'react';
import { mintWebpay, PaymentMethods } from '@mint-app/mint-webpay';

const HostPaymentPage = () => {
    const mintRef = useRef(null);

    useEffect(() => {
        if (mintRef.current) {
            mintWebpay.init({
                theme: {
                    primaryColor: 'red',
                    secondaryColor: 'black',
                },
                container: mintRef.current,
                payments: [PaymentMethods.ZIP],
            });
        }
    }, [mintRef.current]);

    return <div ref={mintRef} />;
};

export default HostPaymentPage;

Vue

Integrate mint-webpay in a Vue component:

<template>
  <div ref="mintPay"></div>
</template>

<script>
import { mintWebpay, PaymentMethods } from '@mint-app/mint-webpay';

export default {
  name: 'HostPaymentPage',
  mounted() {
    mintWebpay.init({
      theme: {
        primaryColor: 'red',
        secondaryColor: 'black',
      },
      container: this.$refs.mintPay,
      payments: [PaymentMethods.ZIP],
    });
  },
};
</script>

Angular

Integrate mint-webpay in an Angular component:

  • Install the necessary packages:

    npm install @mint-app/mint-webpay
    
  • Use the component in your Angular project:

    // host-payment-page.component.ts
    import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
    import { mintWebpay, PaymentMethods } from '@mint-app/mint-webpay';
    
    @Component({
      selector: 'app-host-payment-page',
      template: `<div #mintPay></div>`,
    })
    export class HostPaymentPageComponent implements OnInit {
      @ViewChild('mintPay', { static: true }) mintPay!: ElementRef;
    
      ngOnInit() {
        mintWebpay.init({
          theme: {
            primaryColor: 'red',
            secondaryColor: 'black',
          },
          container: this.mintPay.nativeElement,
          payments: [PaymentMethods.ZIP],
        });
      }
    }
    
  • Add the component to your Angular module:

    // app.module.ts
    import { NgModule } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    import { AppComponent } from './app.component';
    import { HostPaymentPageComponent } from './host-payment-page/host-payment-page.component';
    
    @NgModule({
      declarations: [
        AppComponent,
        HostPaymentPageComponent
      ],
      imports: [
        BrowserModule
      ],
      providers: [],
      bootstrap: [AppComponent]
    })
    export class AppModule { }
    

FAQs

Package last updated on 04 Aug 2024

Did you know?

Socket

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.

Install

Related posts