Initiating Payment with Node.js Package: Step 3 – Initiate an iFramed/Embedded Payment Page

Posted by

Step 3 – Node.js Package | Initiating the payment

Step 3 – Node.js Package | Initiating the payment

Now that we have set up the necessary configurations and created a customer, it’s time to initiate the payment using Node.js Package.

1. Install the Node.js Package

To initiate the payment, first, make sure you have the Node.js package installed in your project. If not, you can install it using the following command:

        
            $ npm install --save 
        
    

2. Initialize the payment

Once the package is installed, you can initialize the payment by calling the necessary functions and passing the required parameters.

        
            const payment = require('payment-package');

            const paymentDetails = {
                amount: 100.00,
                currency: 'USD',
                customer_id: '12345',
                // Add any other required payment details
            };

            // Call the function to initiate the payment
            payment.initiatePayment(paymentDetails);
        
    

3. Initiate an iFramed/Embedded Payment Page

When initiating the payment, you can choose to display the payment page within an iFrame or as an embedded page on your website. This provides a seamless and secure payment experience for your customers.

To initiate an iFramed or embedded payment page, you can use the following code:

        
            const payment = require('payment-package');

            const paymentDetails = {
                amount: 100.00,
                currency: 'USD',
                customer_id: '12345',
                // Add any other required payment details
            };

            // Call the function to initiate the payment and display the page within an iFrame
            payment.initiateIframedPayment(paymentDetails);
        
    

With these steps, you can easily initiate a payment using the Node.js package and choose to display the payment page within an iFrame or as an embedded page on your website.