6. Loading the frontend library
You are provided HTML/Javascript snippets that can be embedded in any frontend framework. Below you will find examples of this platform embedded in some popular frontend frameworks.
React
Step 1. Install the npm package
npm install payengineStep 2. Load the platform using react useEffect hook
useEffect hookimport { useEffect } from "react";
import { loadPayengine } from "payengine";
const MyComponent = () => {
useEffect(() => {
// Load Payengine on first render only
loadPayengine({
publicKey: config.PAYENGINE_PUBLIC_KEY,
}).then((pe) => {
console.log(pe)
});
}, []);
return (
<>
<pay-engine
type="boarding"
merchant-id="<payengine_merchant_id>"
</pay-engine>
</>
)
}React Native
Step 1. Install npm package https://www.npmjs.com/package/payengine-react-native
Attention Mac M1 users
Mac M1 architecture is not directly compatible with Cocoapods. If you encounter issues when installing pods, you can solve it by running:
sudo arch -x86_64 gem install ffiarch -x86_64 pod install
These commands install the ffi package, to load dynamically-linked libraries and let you run the pod install properly, and runs pod install with the proper architecture.
Step 2. Step 2. Load the platform
Vue.js
Step 1. Install the npm package
Step 2. Load the platform using Vue.js lifecycle created hook
created hookAngular
Step 1. Install the npm package
Step 2. Enable `CUSTOM_ELEMENTS_SCHEMA` mode
By default, Angular assumes that all custom HTML elements are Angular components and throws errors when encountering non-angular components. You need to enable custom elements by adding the CUSTOM_ELEMENTS_SCHEMA to the application module.
Following is an example of what a module file should look like with CUSTOM_ELEMENTS_SCHEMA added.
Step 3. Load the platform using lifecycle ngOnInit hook
ngOnInit hookStep 4. Add the respective HTML components to the Angular Components.
Plain HTML/Javascript
In HTML you can enable web components by adding a script tag pointing to javascript library. Once loaded, pay-engine web component are available to use anywhere in your HTML.
Flutter
The Flutter package can be downloaded from https://pub.dev/packages/payengine
Step 1. Configuration
Step 2. Displaying a credit card form
Step 3. Displaying a bank account form for ACH
Step 4 - Using other components.
Note that the type can be any of the web components:
iOS SDK
Please ask your technical contact to get access to iOS SDK.
Displaying secure form
Capturing card token
Displaying ACH form and capturing token
Lightweight Version (Optimized for Secure Fields)
For applications that don't require all web components, an optimized library version enables faster load times with access to only a limited set of components. This is advisable for those needing only secure fields or Plaid in their web application.
Last updated