North's iFrame JavaScript SDK is a type of hosted payment that lets you create a customized payment form and checkout experience on your website while keeping sensitive data out of your server environment.
The SDK generates an iframe that displays a payment gateway to customers on your site. It ensures secure payment processing by handling sensitive payment data within the iframe, which helps protect customer information and handles the scope of PCI DSS (Payment Card Industry Data Security Standard) compliance requirements on your behalf.
The iFrame JavaScript SDK provides a range of features, including multiple payment options (credit/debit card) as well as invoices, refunds, and voids. You can also customize the payment form fields based on your processing environment and business requirements.
The iFrame JavaScript SDK is designed to be easily integrated into applications built with any JavaScript framework. In this tutorial, you'll learn how to use the iFrame JS SDK to embed payments in your Vue application.
You can access the complete code for the Vue.js application and the Node.js server-side code on GitHub.

Prerequisites
To follow along with this tutorial, first review the Integration Guide, then make sure you have the following:
- npm, Yarn, pnpm, or any of your preferred package managers installed
- A globally accessible domain name as the SDK does not work on localhost
Create a new Vue project.
To start, you first need to create a new Vue project. This tutorial uses Vercel app to set up and deploy the Vue application you'll be using.
Follow this guide to set up and deploy a new Vue application.
Once you have completed all the steps, you should have access to your codebase via any of the Git platforms you use, and you should be able to access the Vue application via the URL that was assigned to it.
Register on North Developer and get credentials.
Next, you need to register on the North Developer if you have not done so before.
You can register here, then contact Sales Engineering for Sandbox credentials that can be used to try out this product in a test environment. We will ask that you provide us with the Domain Name (DNS) for the website which will be used to develop and test the integration.
After you perform all the steps required, your domain will be whitelisted. You will also get a test card for performing test transactions and an email notification regarding your request. For the purpose of this tutorial, take note of your Mid, DeveloperKey, Password, X-Nabwss-Appsource, and Gateway_public_key keys. You can find these keys in the Integrations page of your North Developer dashboard.
All testing and development should be conducted using the online testing domain that you created in the previous step.
Create a component that lists products.
Clone the Vue application from your repo, and ensure you install all the necessary dependencies to make it work.
Once the Vue application is up and running on your local computer and you can see the landing page, open your terminal, install the vue-router package with the npm install vue-router, and change the directory to the components folder:
Next, create a component called Products.vue:
The code snippet below represents the Vue component to display all products. Copy and paste it into the Products.vue file:
HTML
Create a component that prompts payment.
Open your terminal and change the directory to the components folder:
Next, create a component called MakePayment.vue:
The code snippet below represents a Vue component created to display product details and incorporate the payment form for accepting payments for the product. Copy and paste it into the MakePayment.vue file:
HTML
Next, go to src/App.vue and import the MakePayment component by replacing the src/App.vue code with the code snippet below:
HTML
Lastly, set up the router for the application. First, open your terminal and create a new directory called router in the src folder. Change the directory to the router folder with the cd src && mkdir router && cd src/router command.
Create a new file called index.js in the router folder, then copy and paste this code snippet that handles the routing system of the application into the file:
Open the src/main.js file and register the route by importing the index.js file you just created and replacing the createApp(App).mount('#app') line with the code snippet below:
Integrate the iFrame JavaScript SDK.
Now that you have created the payment component, you will integrate the iFrame JavaScript SDK.
To get started, you need to create an empty JavaScript file and copy North's JavaScript script into it. For better organization, you'll create a public/js directory and place the newly created JavaScript file inside it.
First, change the directory to /public:
Create a new folder named js:
Create a file named ph.js:
Copy North's script below and paste it to the file ph.js while paying attention to the comments:
The next step is to add the payment form to the product page you created in the MakePayment component. To do that, return to src/components/MakePayment.vue and add the code snippet below after the paragraph element with the product_price class:
HTML
Still in the MakePayment.vue file, add the code snippet below to the methods lifecycle:
To ensure that the JS SDK is initialized and the form iFrame shows the form inputs, add the code snippet below to the mounted() lifecycle:
In this snippet, replace Your MID with your North Merchant ID (MID) and Your_Gateway_Public_Key with your Gateway public key provided by North.
Finally, in the MakePayment.vue file, add the styles below to further style the payment form to the style tag:
Lastly, proceed to public/index.html and add the code snippet below after line 7:
HTML
Save all the changes and run the npm run serve command to compile your application. Once it is done compiling, open your browser and type in the URL you have in the terminal.
Set up the server-side script.
Once you are done setting up the payment form, you need to set up a server that will handle the form input and send the API requests to North. This tutorial uses Node.js for handling all the server-side logic.
Start by initializing a new node application and installing the following packages: express, axios, cors, and body-parser.
Next, add the script below to your index.js file:
The script handles the payment form input and makes all the necessary requests to North. These requests include a POST request to the auth URL to get the authentication token and a payment URL to initiate the payment. Pay attention to the comments in the script for more details.
Finally, follow this guide to deploy your Node.js application to Vercel.
Test your application.
Congratulations! You've set up the Vue.js application and the backend to handle the server-side logic, so all that's left now is to check whether it works as it should.
Open your browser and visit the whitelisted URL that leads to your application. Click on any of the listed products to visit the payment page.
To test your app, use the details on the test card you received when you were setting up your North account and any address of your choice. Click Pay Now to make a test payment in the North Sandbox.
Conclusion
This article showed you how simple it is to use North's iFrame JS SDK for embedding payments into a Vue.js application.
You can access the complete code for the Vue.js application and the Node.js server-side code on GitHub.
How To Get Started
North’s Sales Engineering team provides support to developers and business decision-makers to help select the best possible payment system. Contact us to learn more about how to connect your system to the North ecosystem.