# SwisscomPaymentsJavascriptSdk.DefaultApi

All URIs are relative to *https://api.swisscom.com/*

Method | HTTP request | Description
------------- | ------------- | -------------
[**createPayment**](DefaultApi.md#createPayment) | **POST** /payments | 
[**getPayment**](DefaultApi.md#getPayment) | **GET** /payments/{paymentId} | 
[**searchPayments**](DefaultApi.md#searchPayments) | **GET** /payments | 


<a name="createPayment"></a>
# **createPayment**
> PaymentStatus createPayment(sCSVersion, paymentRequest, opts)



#### Makes a payment transaction #### Allows to charge or refund an amount to the end user&#39;s bill. When creating a payment, specify the actual transactions details like idempotencyKey, amount and description. Please note that the description must be encoded in ISO-8859-1 charset. 

### Example
```javascript
var SwisscomPaymentsJavascriptSdk = require('swisscom_payments_javascript_sdk');
var defaultClient = SwisscomPaymentsJavascriptSdk.ApiClient.default;

// Configure OAuth2 access token for authorization: oauth_2_0_authorization_code
var oauth_2_0_authorization_code = defaultClient.authentications['oauth_2_0_authorization_code'];
oauth_2_0_authorization_code.accessToken = 'YOUR ACCESS TOKEN';

// Configure OAuth2 access token for authorization: oauth_2_0_client_credentials
var oauth_2_0_client_credentials = defaultClient.authentications['oauth_2_0_client_credentials'];
oauth_2_0_client_credentials.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SwisscomPaymentsJavascriptSdk.DefaultApi();

var sCSVersion = "sCSVersion_example"; // String | The version of the API, value must be \"**<<SCS-Version>>**\".  This header indicates which version of the API should serve the request. If the value of the header is missing or it indicates a wrong version, the API returns an error message. 

var paymentRequest = new SwisscomPaymentsJavascriptSdk.PaymentRequest(); // PaymentRequest | 

var opts = { 
  'sCSRequestID': "sCSRequestID_example" // String | The request ID.  It is used by the API to trace the fulfillment of a request. The API user may provide its own request ID or can accept the request ID generated by the API. In both cases the request ID is returned in the header of the response.  This ID should be refered by the API users in their communication with Swisscom whenever requesting details about the execution of a request. 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.createPayment(sCSVersion, paymentRequest, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **sCSVersion** | **String**| The version of the API, value must be \&quot;**&lt;&lt;SCS-Version&gt;&gt;**\&quot;.  This header indicates which version of the API should serve the request. If the value of the header is missing or it indicates a wrong version, the API returns an error message.  | 
 **paymentRequest** | [**PaymentRequest**](PaymentRequest.md)|  | 
 **sCSRequestID** | **String**| The request ID.  It is used by the API to trace the fulfillment of a request. The API user may provide its own request ID or can accept the request ID generated by the API. In both cases the request ID is returned in the header of the response.  This ID should be refered by the API users in their communication with Swisscom whenever requesting details about the execution of a request.  | [optional] 

### Return type

[**PaymentStatus**](PaymentStatus.md)

### Authorization

[oauth_2_0_authorization_code](../README.md#oauth_2_0_authorization_code), [oauth_2_0_client_credentials](../README.md#oauth_2_0_client_credentials)

### HTTP request headers

 - **Content-Type**: application/json; charset=ISO-8859-1
 - **Accept**: application/json

<a name="getPayment"></a>
# **getPayment**
> PaymentDetails getPayment(paymentId, sCSVersion, opts)



#### Returns the payment transaction details #### Allows to retrieve the details of a payment represented by the payment identifier provided as the parameter. The payment identifier is the identifier which is returned with the location header in the response for POST payment.  The payment details and the status of the payment transaction can be retrieved from the response. 

### Example
```javascript
var SwisscomPaymentsJavascriptSdk = require('swisscom_payments_javascript_sdk');
var defaultClient = SwisscomPaymentsJavascriptSdk.ApiClient.default;

// Configure OAuth2 access token for authorization: oauth_2_0_authorization_code
var oauth_2_0_authorization_code = defaultClient.authentications['oauth_2_0_authorization_code'];
oauth_2_0_authorization_code.accessToken = 'YOUR ACCESS TOKEN';

// Configure OAuth2 access token for authorization: oauth_2_0_client_credentials
var oauth_2_0_client_credentials = defaultClient.authentications['oauth_2_0_client_credentials'];
oauth_2_0_client_credentials.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SwisscomPaymentsJavascriptSdk.DefaultApi();

var paymentId = "paymentId_example"; // String | The unique identifier of a payment transaction. This is the same identifier which is returned with the location header of the response in the POST payment.  The value of the URI parameter must not contain spaces and should be URL encoded. 

var sCSVersion = "sCSVersion_example"; // String | The version of the API, value must be \"**<<SCS-Version>>**\".  This header indicates which version of the API should serve the request. If the value of the header is missing or it indicates a wrong version, the API returns an error message. 

var opts = { 
  'sCSRequestID': "sCSRequestID_example" // String | The request ID.  It is used by the API to trace the fulfillment of a request. The API user may provide its own request ID or can accept the request ID generated by the API. In both cases the request ID is returned in the header of the response.  This ID should be refered by the API users in their communication with Swisscom whenever requesting details about the execution of a request. 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getPayment(paymentId, sCSVersion, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **paymentId** | **String**| The unique identifier of a payment transaction. This is the same identifier which is returned with the location header of the response in the POST payment.  The value of the URI parameter must not contain spaces and should be URL encoded.  | 
 **sCSVersion** | **String**| The version of the API, value must be \&quot;**&lt;&lt;SCS-Version&gt;&gt;**\&quot;.  This header indicates which version of the API should serve the request. If the value of the header is missing or it indicates a wrong version, the API returns an error message.  | 
 **sCSRequestID** | **String**| The request ID.  It is used by the API to trace the fulfillment of a request. The API user may provide its own request ID or can accept the request ID generated by the API. In both cases the request ID is returned in the header of the response.  This ID should be refered by the API users in their communication with Swisscom whenever requesting details about the execution of a request.  | [optional] 

### Return type

[**PaymentDetails**](PaymentDetails.md)

### Authorization

[oauth_2_0_authorization_code](../README.md#oauth_2_0_authorization_code), [oauth_2_0_client_credentials](../README.md#oauth_2_0_client_credentials)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="searchPayments"></a>
# **searchPayments**
> PaymentsCollection searchPayments(scn, sCSVersion, opts)



#### Search Payment Transactions #### Provides the capability to search for payment transactions based on a customer identifier. 

### Example
```javascript
var SwisscomPaymentsJavascriptSdk = require('swisscom_payments_javascript_sdk');
var defaultClient = SwisscomPaymentsJavascriptSdk.ApiClient.default;

// Configure OAuth2 access token for authorization: oauth_2_0_authorization_code
var oauth_2_0_authorization_code = defaultClient.authentications['oauth_2_0_authorization_code'];
oauth_2_0_authorization_code.accessToken = 'YOUR ACCESS TOKEN';

// Configure OAuth2 access token for authorization: oauth_2_0_client_credentials
var oauth_2_0_client_credentials = defaultClient.authentications['oauth_2_0_client_credentials'];
oauth_2_0_client_credentials.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SwisscomPaymentsJavascriptSdk.DefaultApi();

var scn = "scn_example"; // String | The Swisscom customer number (SCN) that uniquely identifies a customer.  Performing the request with this query parameter returns the list of payment transactions made on the Swisscom bill of the customer represented by the identifier. 

var sCSVersion = "sCSVersion_example"; // String | The version of the API, value must be \"**<<SCS-Version>>**\".  This header indicates which version of the API should serve the request. If the value of the header is missing or it indicates a wrong version, the API returns an error message. 

var opts = { 
  'dateFrom': "dateFrom_example", // String | Defines the date range of the returned transactions. The date has to be in format yyyy-mm-dd.
  'dateTo': "dateTo_example", // String | Defines the date range of the returned transactions. The date has to be in format yyyy-mm-dd.
  'sCSRequestID': "sCSRequestID_example" // String | The request ID.  It is used by the API to trace the fulfillment of a request. The API user may provide its own request ID or can accept the request ID generated by the API. In both cases the request ID is returned in the header of the response.  This ID should be refered by the API users in their communication with Swisscom whenever requesting details about the execution of a request. 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.searchPayments(scn, sCSVersion, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **scn** | **String**| The Swisscom customer number (SCN) that uniquely identifies a customer.  Performing the request with this query parameter returns the list of payment transactions made on the Swisscom bill of the customer represented by the identifier.  | 
 **sCSVersion** | **String**| The version of the API, value must be \&quot;**&lt;&lt;SCS-Version&gt;&gt;**\&quot;.  This header indicates which version of the API should serve the request. If the value of the header is missing or it indicates a wrong version, the API returns an error message.  | 
 **dateFrom** | **String**| Defines the date range of the returned transactions. The date has to be in format yyyy-mm-dd. | [optional] 
 **dateTo** | **String**| Defines the date range of the returned transactions. The date has to be in format yyyy-mm-dd. | [optional] 
 **sCSRequestID** | **String**| The request ID.  It is used by the API to trace the fulfillment of a request. The API user may provide its own request ID or can accept the request ID generated by the API. In both cases the request ID is returned in the header of the response.  This ID should be refered by the API users in their communication with Swisscom whenever requesting details about the execution of a request.  | [optional] 

### Return type

[**PaymentsCollection**](PaymentsCollection.md)

### Authorization

[oauth_2_0_authorization_code](../README.md#oauth_2_0_authorization_code), [oauth_2_0_client_credentials](../README.md#oauth_2_0_client_credentials)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

