📃
Developer Docs
  • Overview
  • Integration Options
  • Webhooks
    • Build a webhook endpoint
    • Check signature
  • Getting Started
    • 1. Creating User Accounts
    • 2. User Account Types & Permissions
    • 3. Generate Access Tokens
    • 4. Choose Integration Options
    • 5. Securing Embedded UIs
      • 5a. Securing Embedded UIs Using HMAC (deprecated)
    • 6. Loading the frontend library
      • 6a. Preloading PayEngine Web-Component in SPA
    • 7. Custom styling the Web-Components
    • 8. Handling Callbacks from Web-Components
    • 9. Available Web-Components
    • 10. Available Webhooks
  • Merchant Onboarding
    • Overview
    • Integration Options
    • Onboarding/Payments Application Workflow
    • Embedded Onboarding UI
    • Merchant onboarding APIs
    • Partner's Onboarding UI
    • Merchant Lifecycle
    • Onboarding to Partner Relationships
  • Processing Payments
    • Introduction
      • Transaction Flow and Status
    • SecureFields JS
      • SecureFields Bank Account
      • Using tokens
    • Credit Card Form
    • Connect with Plaid
    • Connect Mailgun
    • 3D Secure
    • Payments API
    • Searching Transactions
    • Registering a cloud connected device
    • Apple Pay
      • Apple Pay in your native app
    • Google Payâ„¢
    • Level 2 and Level 3 Data
    • Fraud Prevention
    • Reporting
    • PCI Compliance
    • Address Verification Service (AVS) Check
    • Hosted Payments
    • Tap to Pay
  • Card Account Updater
  • ORCHESTRATION SYSTEM
    • Orchestration Overview
    • Onboarding Orchestration
    • Transactions Orchestration
    • Omnicommerce Orchestration
    • Merchant Servicing
    • Universal Reporting
  • TOKENIZATION
    • Automatic Network Tokenization
    • Token Migration Process
  • DISPUTE MANAGEMENT
    • Retrieval Requests & Chargebacks
  • Certification
    • Partner Certification
  • Data Sharing
    • Secure Data Sharing with PayEngine
  • eCommerce Integration
    • PayEngine Payment Gateway for WooCommerce
Powered by GitBook
On this page
  • React
  • Vue.js
  1. Getting Started

7. Custom styling the Web-Components

Previous6a. Preloading PayEngine Web-Component in SPANext8. Handling Callbacks from Web-Components

Last updated 9 months ago

Web-Components are the most convenient way to integrate functionalities in your application. Like any other UI elements in your application we provide simple ways to style these Web-Components so they become part of your application for a seamless user experience.

Below you will find examples in some popular frontend frameworks.

The library must be loaded before custom styling can be used in your application. To enable the library, please refer to our guide .

For a complete list of customizable style elements please refer to our guide section.

React

Step 1. Install the npm package

npm install payengine

Step 2. Create CSS module file for your component (MyComponent.module.css)

Important: CSS Modules are turned on for files ending with .module.css extension. This is required for styling to function properly.

/*
    MyComponent.module.css
*/

.pf-transaction-table .tabulator-col-title-holder {
    border: 1px red solid;
}

.pf-transactions-table-col-title {
    font-size: 0.8rem;
}

Step 3. Import and apply styles in your React component

/*
    MyComponent.js
*/

import { loadPayengine, payengineStyles } from "payengine";
import overrideStyle from "MyComponenet.module.css";

const MyComponent = () => {

    useEffect(() => {
        // Load Payengine on first render only
        loadPayengine({
            publicKey: <your PAYENGINE_PUBLIC_KEY>,        
        }).then((pe) => {
            // Your sucess handler goes here.
        });  
    }, []);
 
    return (
    <>
    <pay-engine 
      type="boarding" 
      merchant-id="<payengine_merchant_id>" 
      hash="<HMAC_hash_of_payengine_merchant_id>"
      styleModule={{payengineStyles(overrideStyle)}}>
    </pay-engine>        
    </>
    )   
}

Vue.js

With Vue.js we have two options available and you can choose what best fits your application architecture.

Step 1. Install the npm package

npm install payengine

Step 2. Create modular <style> in your component and apply to Web-Component

Option1 - Via style module within your .vue file

/*
    MyComponent.vue
*/

<template>
<div>
    <pay-engine 
      type="boarding" 
      merchant-id="<payengine_merchant_id>" 
      hash="<HMAC_hash_of_payengine_merchant_id>">
      :styleModule="payengineStyles(payengineOverrides)"
    </pay-engine>        
</div>
</template>

<script>
import { loadPayengine, payengineStyles } from "payengine";

export default {
    name: "MyComponent",
    methods: {
        payengineStyles
    },
    created() {    
        try {
             loadPayengine({
                publicKey: <your PAYENGINE_PUBLIC_KEY>,
            });
        } catch (e) {
            // error handling
        }
    }
}

</script>

<style>
/*
    Your Vue.js component's style
*/
</style>

<style module="payengineOverrides">
.pf-transaction-table .tabulator-col-title-holder {
    border: 1px red solid;
}

.pf-transactions-table-col-title {
    font-size: 0.8rem;
}
</style>

Option 2 - CSS module file for your component (MyComponent.module.css)

Important: CSS Modules are turned on for files ending with .module.css extension. This is required for styling to function properly if you decide to use this option.

  1. Create MyComponent.module.css

/*
    MyComponent.module.css
*/

.pf-transaction-table .tabulator-col-title-holder {
    border: 1px red solid;
}

.pf-transactions-table-col-title {
    font-size: 0.8rem;
}

2. Create MyComponent.vue

/*
    MyComponent.vue
*/

<template>
<div>
    <pay-engine 
      type="boarding" 
      merchant-id="<payengine_merchant_id>" 
      hash="<HMAC_hash_of_payengine_merchant_id>">
      :styleModule="payengineStyles(payengineOverrides)"
    </pay-engine>        
</div>
</template>

<script>
import { loadPayengine, payengineStyles } from "payengine";
import payengineOverrides from "MyComponenet.module.css";

export default {
    name: "MyComponent",
    methods: {
        payengineStyles
    },
    created() {    
        try {
             loadPayengine({
                publicKey: <your PAYENGINE_PUBLIC_KEY>,
            });
        } catch (e) {
            // error handling
        }
    }
}

</script>

<style>
/*
    Your Vue.js component's style
*/
</style>

Loading the frontend library
JS Client Library Properties and Styling