# Payment gateway Add-on

#### Payment Gateway Integration Setup Guide&#x20;

The following installation guide provides a general process for setting up payment gateway integrations in SpurtCommerce. These steps are applicable to Razorpay, Stripe and PayPal.

The integration of this Addon will give your eCommerce portal with a payment option for the Customers to check out their shopping cart with  Payment Gateway.

Follow these steps to set up the Payment module on the front-end Next.js web store.

#### Setup Overview:

* Install the extension
* Update configuration
* Integrate the module
* Run the application
* Build the application

{% tabs %}
{% tab title="Next.js" %}

#### Step 1: Install the Extension

Locate the Spurtcommerce addon package, typically named addOns.zip.

Extract the zip file and copy the Payment folder into the addOns folder in your project.

&#x20;       projectFolder -> addOns

After this step, the structure should look like:

&#x20;       projectFolder -> addOns -> Payment

Once completed, proceed to update the configuration.

#### Step 2: Update the Configuration

After installing the extension, update the configuration in Spurtcommerce’s addonsconfig.js as follows:

1. Import the required line into addonsconfig.js.

```
import PaymentMethods from './Payment/Payment'
```

2. Add the PaymentMethods plugin to the specified object.

```
        export const AddonsComponent = {                                                                                                                                          PaymentMethods                                                                                                          }  


```

#### Step 3: Module Details

The Payment module includes the following components that you can utilize in any page within Spurtcommerce by sending the required product data as props:

* PaymentMethods Component

```
{ConnectPlugin.PaymentMethods &&
<ConnectPlugin.PaymentMethods disable={enableRetry} />}


```

**Note:** Use the PaymentMethods component by passing the product data as a prop:

```
        <ConnectPlugin.PaymentMethods disable={enableRetry} />
```

#### Step 4: Run the Application

Once you have integrated the Payment module, run the application using:

```
$ npm run dev
```

This command will launch Spurtcommerce with the integrated Payment module visible on the specified page.

#### Step 5: Build the Application

To prepare the application for deployment, execute the following command:

```
$ npm run build
```

or

```
$ yarn run build                                                                                                                             
```

The latest build files will then be ready for server deployment.
{% endtab %}

{% tab title="Second Tab" %}

### &#x20;                                              Payment Add-On

&#x20;

Follow these below steps are installing Payment addon

App setup

&#x20;           These are the steps that need to be followed to do the front end store setup.

·   Installing an extension

·   Update the configuration

·   Module Detail

·   Run the Application

·   Make the build

#### Step 1 : Installing an extension

These are the steps that need to be executed for installation of the extension.

Locate the Spurtcommerce addon package, typically named addons.zip.

Extract the zip file and copy the Payment folder into the addons folder in your project.

projectFolder->lib->module->add-ons

After this step, the structure should look like:

projectFolder->lib->module->add-ons->Payment

Once completed, proceed to update the configuration.

#### Step 2 : Update the configuration

After extracting the add on zip file for changing the configurations in addons.dart, you have to follow the steps below:

Go to

projectFolder->lib->module->add-ons->addonsshared.dart

Then inside addonsShared array paste the following content

```
{"SpurtPaymentMethod": SpurtPaymentMethod(), "data": ""}
```

After placing the above files it will look like this,

List addonsShared = \[

{"SpurtPaymentMethod": SpurtPaymentMethod(), "data": ""}

];

Then give the following imports

```
import 'package:spurtcommerce/module/add-ons/Payments/Page/payment.dart'; 
```

Or

There will be a popup for quick fix

#### Step 3 : Module details

After executing the above mentioned steps, we have to place these below lines in the module folder to show the Payment to the user.

Payment

Once you finished updating the configuration then in the projectFolder->lib->module->Tab->My-cart->pages->checkout.dart

Use this line for view the Payment

```
findMyClass("SpurtPaymentMethod", {
"myOrderPaymentDisable": false,
"page": widget.orderpage == "order",
})
 
```

After insert the line restart your application&#x20;

#### Step 4 : Run the application

After integrating the Payments Module into Spurt Commerce, you can use the following commands to run the application in terminal.

```
$ flutter run
```

Or

In Run menu select run without debugging

In case if throws any exception

```
$ flutter run –no-sound-null-safety
```

Once you execute the above command you can view the installed module in Spurt Commerce, within the page in which you have integrated

#### Step 5 : Make the build

In order to build, you need to run the following commands. In order to check the application, run the following commands and build the application.

```
$flutter build
```

If you want to split the abi then

```
$flutter build –split-per-abi
```

For bundle build

```
$flutter build appbundle
```

&#x20;

&#x20;
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.spurtcommerce.com/addons/catalogue-related-addons/payment-gateway-add-on.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
