# Charge API

The Charge API provides a means for you to initiate charges on a stored Credit Card within our system. To process a charge, the API requires either a token ID or an intent ID as it can not charge a Credit Card directly. Key components of the Charge API includes the partner ID, token ID, currency code, and the specific amount to be charged. By providing these necessary details, the PMS can securely and efficiently execute charges on the stored Credit Card.

Upon successfully charging the Credit Card, the API will provide the Payment Gateway Transaction ID as part of the response. This transaction ID serves as a unique identifier for the payment transaction conducted through the Payment Gateway. The PMS can use this transaction ID for further reference or record-keeping purposes related to the completed transaction.

***

### <mark style="color:yellow;">Endpoint</mark> <a href="#property-endpoint" id="property-endpoint"></a>

<mark style="color:green;background-color:green;">**`POST`**</mark>

```url
https://token.suissu.com/service/api/charge
```

#### <mark style="color:yellow;">**Header Parameters**</mark>

***

`Content-Type` <mark style="color:orange;">**string (Required)**</mark>

Indicates the format of the data that has to be sent or received.

> Example: `application/json`

***

`x-api-name` <mark style="color:orange;">**string (Required)**</mark>

This is for authentication purpose and can be obtained by logging into the Extranet itself.

> Example: `XXXXFIRSTAPP`

{% hint style="info" %} <mark style="color:yellow;">`XXXX`</mark> can be replaced with the client name.
{% endhint %}

***

`x-api-key` <mark style="color:orange;">**string (Required)**</mark>

This is for authentication purpose and can be obtained by logging into the Extranet itself.

> Example: `kfpwsfnknknfwknfkwnknef9823rujfsormDFS3ijoncvowoeorfnv`

{% hint style="info" %}
This key will be unique for every client.
{% endhint %}

***

#### [<mark style="color:yellow;">**Attributes**</mark>](https://token.suissu.com/service/api/charge)

`partner_id` <mark style="color:orange;">**string (Required)**</mark>

Indicates the unique property ID assigned upon the creation of the property.

***

`token_id` <mark style="color:orange;">**string (Required)**</mark>

Indicates the token ID generated upon creation of an intent or token of a credit card.

***

`currency_code` <mark style="color:orange;">**string (Required)**</mark>

Indicates the currency accepted by the partner.

***

`amount` <mark style="color:orange;">**string (Required)**</mark>

Indicates the amount that has to be charged from the credit card.

***

`customer_name` <mark style="color:orange;">**string**</mark>

When you use "Pay Advantage" payment gateway than this field is required.

***

### <mark style="color:yellow;">**Sample Request**</mark>

```json
{
  "partner_id": "H1",
  "token_id": "H4sIAAAAAAAAAzO3BADDOtuOAgAAAA==",
  "currency_code": "INR",
  "amount": "5000",
  "customer_name": "John Doe"
}
```

***

### <mark style="color:yellow;">**Responses**</mark>

#### <mark style="color:green;">**200 Success Response**</mark>

`status` <mark style="color:orange;">**string**</mark>

Indicates the status of the request.

***

`ErrorMessages` <mark style="color:orange;">**string**</mark>

Indicates the error messages, if any.

{% code overflow="wrap" %}

```json
{
  "Status": "Success",
  "ErrorMessages": [],
  "PGTransactionID": "pi_3NOia7LkClv9jGLK1CV12znF"
}
```

{% endcode %}

***

#### <mark style="color:red;">**400 Bad Request**</mark>

`status` <mark style="color:orange;">**string**</mark>

Indicates the status of the request.

***

`ErrorMessages` <mark style="color:orange;">**string**</mark>

Indicates the error messages, if any.

```json
{
  "Status": "Fail",
  "ErrorMessages": [
    "amount : Invalid or missing amount"
  ]
}
```

***

#### <mark style="color:red;">**401 Unauthorized**</mark>

`status` <mark style="color:orange;">**string**</mark>

Indicates the status of the request.

***

`ErrorMessages` <mark style="color:orange;">**string**</mark>

Indicates the error messages, if any.

```json
{
  "Status": "Fail",
  "ErrorMessages": [
    "Unauthorised"
  ]
}
```
