> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidoc-v1.maniscloud.com/llms.txt.
> For full documentation content, see https://apidoc-v1.maniscloud.com/llms-full.txt.

# Save PSP credentials

PUT https://api/v1/merchants/credentials
Content-Type: application/json

This API allows a merchant to securely store credentials for a selected Payment Service Provider (PSP). Each PSP may require different credentials

**Request Body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `pspId` | string | Yes | Unique identifier of the Payment Service Provider |
| `credentialKey` | string | Yes | Credential key used to identify the specific credential type for the PSP |
| `credentialSecret` | string | Yes | The credential value or secret associated with the key |
| `pspClientId` | string | yes(nium only) | client id in nium |

Response Body

200 OK

| **Field** | **Type** |
| --- | --- |
| timestamp | date(yyyy-MM-dd'T'HH:mm:ss.SSS'Z') |
| message | string |

400 BAD REQUEST - 403 FORBIDDEN - 401 UNAUTHORIZED - 500 INTERNAL ERROR

| **Field** | type |
| --- | --- |
| timestamp | date(yyyy-MM-dd'T'HH:mm:ss.SSS'Z') |
| title | string |
| type | string |
| status | number |
| soaCode | string |
| detail | string |

Reference: https://apidoc-v1.maniscloud.com/manis-unified-api-v-1-0/psp-credentials/save-psp-credentials

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/v1/merchants/credentials:
    put:
      operationId: save-psp-credentials
      summary: Save PSP credentials
      description: >-
        This API allows a merchant to securely store credentials for a selected
        Payment Service Provider (PSP). Each PSP may require different
        credentials


        **Request Body**


        | Field | Type | Required | Description |

        | --- | --- | --- | --- |

        | `pspId` | string | Yes | Unique identifier of the Payment Service
        Provider |

        | `credentialKey` | string | Yes | Credential key used to identify the
        specific credential type for the PSP |

        | `credentialSecret` | string | Yes | The credential value or secret
        associated with the key |

        | `pspClientId` | string | yes(nium only) | client id in nium |


        Response Body


        200 OK


        | **Field** | **Type** |

        | --- | --- |

        | timestamp | date(yyyy-MM-dd'T'HH:mm:ss.SSS'Z') |

        | message | string |


        400 BAD REQUEST - 403 FORBIDDEN - 401 UNAUTHORIZED - 500 INTERNAL ERROR


        | **Field** | type |

        | --- | --- |

        | timestamp | date(yyyy-MM-dd'T'HH:mm:ss.SSS'Z') |

        | title | string |

        | type | string |

        | status | number |

        | soaCode | string |

        | detail | string |
      tags:
        - subpackage_pspCredentials
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PSP Credentials_Save PSP
                  credentials_Response_200
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                pspId:
                  type: string
                pspClientId:
                  type: string
                credentialKey:
                  type: string
                credentialSecret:
                  type: string
              required:
                - pspId
                - pspClientId
                - credentialKey
                - credentialSecret
servers:
  - url: https:/
components:
  schemas:
    PSP Credentials_Save PSP credentials_Response_200:
      type: object
      properties:
        message:
          type: string
        timestamp:
          type: string
      required:
        - message
        - timestamp
      title: PSP Credentials_Save PSP credentials_Response_200

```

## SDK Code Examples

```python Nium: Save PSP credentials
import requests

url = "https://https/api/v1/merchants/credentials"

headers = {"Content-Type": "application/json"}

response = requests.put(url, headers=headers)

print(response.json())
```

```javascript Nium: Save PSP credentials
const url = 'https://https/api/v1/merchants/credentials';
const options = {method: 'PUT', headers: {'Content-Type': 'application/json'}, body: undefined};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Nium: Save PSP credentials
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://https/api/v1/merchants/credentials"

	req, _ := http.NewRequest("PUT", url, nil)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Nium: Save PSP credentials
require 'uri'
require 'net/http'

url = URI("https://https/api/v1/merchants/credentials")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'

response = http.request(request)
puts response.read_body
```

```java Nium: Save PSP credentials
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://https/api/v1/merchants/credentials")
  .header("Content-Type", "application/json")
  .asString();
```

```php Nium: Save PSP credentials
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://https/api/v1/merchants/credentials', [
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Nium: Save PSP credentials
using RestSharp;

var client = new RestClient("https://https/api/v1/merchants/credentials");
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Nium: Save PSP credentials
import Foundation

let headers = ["Content-Type": "application/json"]

let request = NSMutableURLRequest(url: NSURL(string: "https://https/api/v1/merchants/credentials")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

```python Finmo: Save PSP credentials
import requests

url = "https://https/api/v1/merchants/credentials"

headers = {"Content-Type": "application/json"}

response = requests.put(url, headers=headers)

print(response.json())
```

```javascript Finmo: Save PSP credentials
const url = 'https://https/api/v1/merchants/credentials';
const options = {method: 'PUT', headers: {'Content-Type': 'application/json'}, body: undefined};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Finmo: Save PSP credentials
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://https/api/v1/merchants/credentials"

	req, _ := http.NewRequest("PUT", url, nil)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Finmo: Save PSP credentials
require 'uri'
require 'net/http'

url = URI("https://https/api/v1/merchants/credentials")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'

response = http.request(request)
puts response.read_body
```

```java Finmo: Save PSP credentials
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://https/api/v1/merchants/credentials")
  .header("Content-Type", "application/json")
  .asString();
```

```php Finmo: Save PSP credentials
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://https/api/v1/merchants/credentials', [
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Finmo: Save PSP credentials
using RestSharp;

var client = new RestClient("https://https/api/v1/merchants/credentials");
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Finmo: Save PSP credentials
import Foundation

let headers = ["Content-Type": "application/json"]

let request = NSMutableURLRequest(url: NSURL(string: "https://https/api/v1/merchants/credentials")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

```python PSP Credentials_Save PSP credentials_example
import requests

url = "https://https/api/v1/merchants/credentials"

payload = {
    "pspId": "pspId",
    "pspClientId": "Nium-clientId",
    "credentialKey": "Finmo-username/Nium-clientKey",
    "credentialSecret": "Finmo-password/Nium-clientSecret"
}
headers = {"Content-Type": "application/json"}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript PSP Credentials_Save PSP credentials_example
const url = 'https://https/api/v1/merchants/credentials';
const options = {
  method: 'PUT',
  headers: {'Content-Type': 'application/json'},
  body: '{"pspId":"pspId","pspClientId":"Nium-clientId","credentialKey":"Finmo-username/Nium-clientKey","credentialSecret":"Finmo-password/Nium-clientSecret"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go PSP Credentials_Save PSP credentials_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://https/api/v1/merchants/credentials"

	payload := strings.NewReader("{\n  \"pspId\": \"pspId\",\n  \"pspClientId\": \"Nium-clientId\",\n  \"credentialKey\": \"Finmo-username/Nium-clientKey\",\n  \"credentialSecret\": \"Finmo-password/Nium-clientSecret\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby PSP Credentials_Save PSP credentials_example
require 'uri'
require 'net/http'

url = URI("https://https/api/v1/merchants/credentials")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"pspId\": \"pspId\",\n  \"pspClientId\": \"Nium-clientId\",\n  \"credentialKey\": \"Finmo-username/Nium-clientKey\",\n  \"credentialSecret\": \"Finmo-password/Nium-clientSecret\"\n}"

response = http.request(request)
puts response.read_body
```

```java PSP Credentials_Save PSP credentials_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://https/api/v1/merchants/credentials")
  .header("Content-Type", "application/json")
  .body("{\n  \"pspId\": \"pspId\",\n  \"pspClientId\": \"Nium-clientId\",\n  \"credentialKey\": \"Finmo-username/Nium-clientKey\",\n  \"credentialSecret\": \"Finmo-password/Nium-clientSecret\"\n}")
  .asString();
```

```php PSP Credentials_Save PSP credentials_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://https/api/v1/merchants/credentials', [
  'body' => '{
  "pspId": "pspId",
  "pspClientId": "Nium-clientId",
  "credentialKey": "Finmo-username/Nium-clientKey",
  "credentialSecret": "Finmo-password/Nium-clientSecret"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp PSP Credentials_Save PSP credentials_example
using RestSharp;

var client = new RestClient("https://https/api/v1/merchants/credentials");
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"pspId\": \"pspId\",\n  \"pspClientId\": \"Nium-clientId\",\n  \"credentialKey\": \"Finmo-username/Nium-clientKey\",\n  \"credentialSecret\": \"Finmo-password/Nium-clientSecret\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift PSP Credentials_Save PSP credentials_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "pspId": "pspId",
  "pspClientId": "Nium-clientId",
  "credentialKey": "Finmo-username/Nium-clientKey",
  "credentialSecret": "Finmo-password/Nium-clientSecret"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://https/api/v1/merchants/credentials")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```