---
page_title: Backend Setup
product: SmartGateway Kits Integration
platform: Web
page_source: https://smartgateway.hdfc.bank.in/docs/smartgateway-kits-integration/web/sample-project-setup/backend-setup
llms_txt: https://smartgateway.hdfc.bank.in/docs/llms.txt
product_llms_txt: https://smartgateway.hdfc.bank.in/docs/smartgateway-kits-integration/llms.txt
---


# Generate Keys and Run Sample Project




## 1. Generate the API Key



> **Note**
> API Key must be securely kept in a crypto vault on the merchant servers. The API key should never flow to the client.




### Step 1.1. Generate the Keys on SmartGateway Dashboard


1. Login to [SmartGateway Dashboard](https://dashboarduat.smartgatewayuat.hdfcbank.com/settings/Security) and navigate to API Keys
   
   Login → Payments → Settings → Security → API Keys
2. Click on ‘Create New API Key’ button
   
   ![Image](https://dth95m2xtyv8v.cloudfront.net/tesseract/assets/smartgateway-sdk-basic-auth/JWT%20key.png)
3. Click on ‘Yes, create it’ as shown below:
   
   ![Image](https://dth95m2xtyv8v.cloudfront.net/tesseract/assets/smartgateway-sdk-basic-auth/APIkey.png)
4. Your API Key will be there in your ‘Downloads’ folder as shown below:
   
   ![Image](https://dth95m2xtyv8v.cloudfront.net/tesseract/assets/smartgateway-sdk-basic-auth/config.png)
5. API Key will appear on the SmartGateway Dashboard as shown below:
   
   ![Image](https://dth95m2xtyv8v.cloudfront.net/tesseract/assets/smartgateway-sdk-basic-auth/.png)




## 2. Run the Sample Project




### Step 2.1 Download the Sample Project file for Java


Click [here](https://github.com/juspay/Integration-kit/archive/refs/heads/JavaBackendKit-ApiKey.zip) or click on the ‘Download’ button on the top right hand side of the page



#### Code Snippets: -

#### Java Code Snippet:

```java
{"success":false,"message":"Failed to fetch snippet"}
```



### Step 2.1 Download the Sample Project file for PHP


Click [here](https://github.com/juspay/Integration-kit/archive/refs/heads/phpBackendKit-ApiKey.zip)or click on the ‘Download’ button on the top right hand side of the page



#### Code Snippets: -

#### PHP Code Snippet:

```php
{"success":false,"message":"Failed to fetch snippet"}
```



### Step 2.2 Input File Paths for Keys in 'config.json' file


**Option 1**  -

Step 1 : Open the JAVA project in your JAVA environment and **replace**  the config.json file already present in the project folder with the config.json file downloaded from the dashboard.

Step 2 : Add your API key**** to the**** JAVA project folder

**Option 2**  - Open the JAVA project in your JAVA environment and input the file paths in following keys:


| Parameter | Description |
|---|---|
| API_KEY | Add the API key |
| MERCHANT_ID | Add the Merchant_ID provided by the bank file path for bank's public key obtained from the dashboard |
| PAYMENT_PAGE_CLIENT_ID | For Sandbox, add 'hdfcmaster' as your client_id |
| BASE_URL | Add the base url for the project |
| ENABLE_LOGGING | Pass true or false to enable or disable logging  |
| RESPONSE_KEY | Add the Response Key |




#### Code Snippets: -

#### Java Code Snippet:

```java
{"API_KEY": "5E191CBBAAA48B7A78A9CC8B4CA0E5:","MERCHANT_ID":"hdfctest1","PAYMENT_PAGE_CLIENT_ID":"hdfcmaster","BASE_URL":"https://smartgatewayuat.hdfcbank.com","ENABLE_LOGGING": false,"RESPONSE_KEY": "2E020FA4C5E486D9F9DAA975C0B680"}
```



### Step 2.3 Run the Server 


1. run `php -S localhost:5000` to run the server
2. In the browser load the website `http://localhost:5000/initiatePaymentDataForm.php`
   
   > **Warning**
   > Base URL will be different for Sandbox and Production environment
   > 
   > * For Sandbox - https://smartgateway.hdfcuat.bank.in
   > * For Production - https://smartgateway.hdfc.bank.in



#### Code Snippets: -

#### PHP Code Snippet:

```php
{"success":false,"message":"Failed to fetch snippet"}
```



### Step 2.3 Check the prerequisites


Check if the below mentioned prerequisites are in place:

* Java sdk >= 8
* Maven
* JAVA_HOME path configured



#### Code Snippets: -

#### Java Code Snippet:

```java
{"success":false,"message":"Failed to fetch snippet"}
```



### Step 2.4 Run the server


1. For other systems, use Jetty to run the following:

`mvn clean install`

`mvn clean package`

`mvn jetty:run`

2. In browser load the website 
   
   `http://localhost:8080/initiatePayment.html`



#### Code Snippets: -

#### Java Code Snippet:

```java
{"success":false,"message":"Failed to fetch snippet"}
```



### Step 2.1 Download the Sample Project file for .Net


Click [here](https://github.com/juspay/Integration-kit/archive/refs/heads/DotnetBackendKit-ApiKey.zip) or click on the ‘Download’ button on the top right hand side of the page.**NOTE: Please note that the minimum version supported are:** 1. **for .Net framework 4.5.1** 2.**for .Net 4.5.0** 



#### Code Snippets: -

#### .Net Code Snippet:

```.net
{"success":false,"message":"Failed to fetch snippet"}
```



### Step 2.2 Input File Paths for Keys in 'config.json' file


**Option 1**  -

Step 1 : Open the .net project in your .net environment and **replace**  the config.json file already present in the project folder with the config.json file downloaded from the dashboard.

Step 2 : Add your API key**** to the****  project folder

**Option 2**  - Open the project in your .net environment and input the file paths in following keys:


| Parameter | Description |
|---|---|
| API_KEY | Add the API key |
| MERCHANT_ID | Add the Merchant_ID provided by the bank file path for bank's public key obtained from the dashboard |
| PAYMENT_PAGE_CLIENT_ID | For Sandbox, add 'hdfcmaster' as your client_id |
| BASE_URL | Add the base url for the project |
| ENABLE_LOGGING | Pass true or false to enable or disable logging  |
| RESPONSE_KEY | Add the Response Key |




#### Code Snippets: -

#### .Net Code Snippet:

```.net
{"API_KEY": "VALUE:","MERCHANT_ID":"VALUE","PAYMENT_PAGE_CLIENT_ID":"hdfcmaster","BASE_URL":"https://smartgateway.hdfcuat.bank.in","ENABLE_LOGGING": true,"LOGGING_PATH": "./logs/PaymentHandler.log","RESPONSE_KEY": "VALUE"}

```



### Step 2.1 Download the Sample Project file for Node JS


Click [here](https://github.com/juspay/Integration-kit/archive/refs/heads/NodejsBackendKit-ApiKey.zip)or click on the ‘Download’ button on the top right hand side of the page



#### Code Snippets: -

#### NodeJS Code Snippet:

```nodejs
{"success":false,"message":"Failed to fetch snippet"}
```



### Step 2.2 Input File Paths for Keys in 'config.json' file


**Option 1**  -

Step 1 : Open the .net project in your .net environment and **replace**  the config.json file already present in the project folder with the config.json file downloaded from the dashboard.

Step 2 : Add your API key**** to the****  project folder

**Option 2**  - Open the project in your .net environment and input the file paths in following keys:


| Parameter | Description |
|---|---|
| API_KEY | Add the API key |
| MERCHANT_ID | Add the Merchant_ID provided by the bank file path for bank's public key obtained from the dashboard |
| PAYMENT_PAGE_CLIENT_ID | For Sandbox, add 'hdfcmaster' as your client_id |
| BASE_URL | Add the base url for the project |
| ENABLE_LOGGING | Pass true or false to enable or disable logging  |
| RESPONSE_KEY | Add the Response Key |




#### Code Snippets: -

#### NodeJS Code Snippet:

```nodejs
{
    "API_KEY": "VALUE",
    "MERCHANT_ID": "VALUE",
    "PAYMENT_PAGE_CLIENT_ID": "VALUE",
    "BASE_URL": "https://smartgateway.hdfc.bank.in",
    "ENABLE_LOGGING": true,
    "LOGGING_PATH": "./logs/PaymentHandler.log",
    "RESPONSE_KEY": "VALUE"
}

```


---

## Complete Code Reference

The following code files are referenced in the steps above:

### README.md

```
{"success":false,"message":"Failed to fetch snippet"}
```

### README.md

```
{"success":false,"message":"Failed to fetch snippet"}
```

### config.json

```
{"API_KEY": "5E191CBBAAA48B7A78A9CC8B4CA0E5:","MERCHANT_ID":"hdfctest1","PAYMENT_PAGE_CLIENT_ID":"hdfcmaster","BASE_URL":"https://smartgatewayuat.hdfcbank.com","ENABLE_LOGGING": false,"RESPONSE_KEY": "2E020FA4C5E486D9F9DAA975C0B680"}
```

### README.md

```
{"success":false,"message":"Failed to fetch snippet"}
```

### config.json

```
{"API_KEY": "VALUE:","MERCHANT_ID":"VALUE","PAYMENT_PAGE_CLIENT_ID":"hdfcmaster","BASE_URL":"https://smartgateway.hdfcuat.bank.in","ENABLE_LOGGING": true,"LOGGING_PATH": "./logs/PaymentHandler.log","RESPONSE_KEY": "VALUE"}

```

### README.md

```
{"success":false,"message":"Failed to fetch snippet"}
```

### config.json

```
{
    "API_KEY": "VALUE",
    "MERCHANT_ID": "VALUE",
    "PAYMENT_PAGE_CLIENT_ID": "VALUE",
    "BASE_URL": "https://smartgateway.hdfc.bank.in",
    "ENABLE_LOGGING": true,
    "LOGGING_PATH": "./logs/PaymentHandler.log",
    "RESPONSE_KEY": "VALUE"
}

```


---

## See Also

- [Pre-Requisites](https://smartgateway.hdfc.bank.in/docs/smartgateway-kits-integration/web/overview/pre-requisites)
- [Getting the Backend Setup](https://smartgateway.hdfc.bank.in/docs/smartgateway-kits-integration/web/how-to-integrate-kits/getting-the-backend-setup)
