# Schemas

Schemas used in requests/responses of our API:

## returnUrls

| Parameter | Type             | Description                                          | Constraints | Required             |
| :-------- | :--------------- | :--------------------------------------------------- | :---------- | :------------------- |
| success   | String(1...2000) | Return URL to use when the transaction succeeds.     |             | :white\_check\_mark: |
| cancelled | String(1...2000) | Return URL to use when the transaction is cancelled. |             | :white\_check\_mark: |
| expired   | String(1...2000) | Return URL to use when the transaction is expired.   |             | :white\_check\_mark: |
| failed    | String(1...2000) | Return URL to use when the transaction is failed.    |             | :white\_check\_mark: |

## consumerInRequest

| Parameter   | Type                                                | Description                    | Constraints                                    | Required |
| :---------- | :-------------------------------------------------- | :----------------------------- | :--------------------------------------------- | :------- |
| givenName   | String(1...35)                                      | Customer given name.           |                                                |          |
| middleName  | String(1...35)                                      | Customer middle name.          |                                                |          |
| familyName  | String(1...35)                                      | Customer family name.          |                                                |          |
| email       | String                                              | Email provided by customer.    |                                                |          |
| gender      | String(1...2000)                                    | Gender of the customer.        | The possible values are: `m`, `f` , or `null`. |          |
| address     | [addressInRequest](schemas#addressInRequest) Object | Customer address.              |                                                |          |
| phone       | String                                              | Customer phone number.         |                                                |          |
| dateOfBirth | String                                              | Date of birth of the customer. |                                                |          |

## addressInRequest

| Parameter      | Type            | Description                     | Constraints              | Required |
| :------------- | :-------------- | :------------------------------ | :----------------------- | :------- |
| street         | String(1...100) | Street.                         |                          |          |
| houseNumber    | String(1...35)  | House and number.               |                          |          |
| postalCode     | String(1...35)  | Postal code.                    |                          |          |
| city           | String(1...35)  | City.                           |                          |          |
| countryCode    | String          | Country code.                   | ISO 3166-1 country code. |          |
| state          | String(1...40)  | State.                          |                          |          |
| additionalData | String(1...35)  | Additional address information. |                          |          |

## consumer

| Parameter   | Type                              | Description                    | Constraints                                    | Required |
| :---------- | :-------------------------------- | :----------------------------- | :--------------------------------------------- | :------- |
| givenName   | String(1...35)                    | Customer given name.           |                                                |          |
| middleName  | String(1...35)                    | Customer middle name.          |                                                |          |
| familyName  | String(1...35)                    | Customer family name.          |                                                |          |
| email       | String                            | Email provided by customer.    |                                                |          |
| gender      | String(1...2000)                  | Gender of the customer.        | The possible values are: `m`, `f` , or `null`. |          |
| address     | [address](schemas#address) Object | Customer address.              |                                                |          |
| phone       | String                            | Customer phone number.         |                                                |          |
| dateOfBirth | String                            | Date of birth of the customer. |                                                |          |

## address

| Parameter      | Type            | Description                     | Constraints              | Required |
| :------------- | :-------------- | :------------------------------ | :----------------------- | :------- |
| street         | String(1...100) | Street.                         |                          |          |
| houseNumber    | String(1...35)  | House and number.               |                          |          |
| postalCode     | String(1...35)  | Postal code.                    |                          |          |
| city           | String(1...35)  | City.                           |                          |          |
| countryCode    | String          | Country code.                   | ISO 3166-1 country code. |          |
| state          | String(1...40)  | State.                          |                          |          |
| additionalData | String(1...35)  | Additional address information. |                          |          |

## orderItem

| Parameter   | Type                | Description                                                                                                   | Constraints | Required             |
| :---------- | :------------------ | :------------------------------------------------------------------------------------------------------------ | :---------- | :------------------- |
| code        | String(1...50)      | A code that identifies the item.                                                                              |             | :white\_check\_mark: |
| name        | String(1...50)      | A human readable name for the item.                                                                           |             |                      |
| description | String(1...100)     | Additional item description.                                                                                  |             |                      |
| unitPrice   | Int(1...99999999)   | Unit price (including VAT) of the item, specified in the smallest currency subunit, as for example eurocents. |             | ✅                    |
| quantity    | Int(1...1000000000) | The number of items.                                                                                          |             | ✅                    |
| vatAmount   | Int(1...99999999)   | VAT amount of one unit, specified in the smallest currency subunit, as for example eurocents.                 |             | ✅                    |
| vatRate     | Number(0...99.9)    | Percentage of VAT applied. Only the first decimal value will be taken into account, the rest will be ignored. |             | ✅                    |

## action

| Parameter | Type                                | Description                                                                    | Constraints | Required |
| :-------- | :---------------------------------- | :----------------------------------------------------------------------------- | :---------- | :------- |
| redirect  | [redirect](schemas#redirect) Object | Next action to be performed by merchant (or consumer) to complete the payment. |             |          |

## redirect

| Parameter | Type   | Description                                                                        | Constraints | Required |
| :-------- | :----- | :--------------------------------------------------------------------------------- | :---------- | :------- |
| url       | String | URL where consumer should be redirected to by the merchant to perform the payment. |             |          |

## refund

| Parameter             | Type              | Description                                                                                                | Constraints | Required             |
| :-------------------- | :---------------- | :--------------------------------------------------------------------------------------------------------- | :---------- | :------------------- |
| refundedAmount        | Int(0...99999999) | Amount in the smallest currency subunit, as for example eurocents, that has already been refunded.         |             | :white\_check\_mark: |
| refundedPendingAmount | Int(1...99999999) | Amount in the smallest currency subunit, as for example eurocents, that has been requested to be refunded. |             | ✅                    |

## payment

[block:parameters]
{
  "data": {
    "h-0": "Parameter",
    "h-1": "Type",
    "h-2": "Description",
    "h-3": "Constraints",
    "h-4": "Required",
    "0-0": "id",
    "0-1": "String(36)",
    "0-2": "Payment unique identifier.",
    "0-3": "",
    "0-4": ":white_check_mark:",
    "1-0": "type",
    "1-1": "String",
    "1-2": "The type of payment. ",
    "1-3": "The possible values are: `bancontact`, `creditcard`, `ideal`, `paypal`, `giropay`.",
    "1-4": "✅",
    "2-0": "status",
    "2-1": "String",
    "2-2": "`OPEN` - Payment has been created. This is the initial status.  \n`SUCCESS` - Payment has succeeded.  \n`CANCELLED` - Payment has not succeeded; cancelled by the consumer.  \n`EXPIRED` - Payment has not succeeded; expired.  \n`FAILURE` - Payment has not succeeded; unknown reason.  \n`AUTHORIZED` - Payment is authorized.  \n`PENDING` - Payment could not be completed yet; waiting for something.  \n`CHARGEBACK` - Payment chargeback was created.",
    "2-3": "",
    "2-4": "✅",
    "3-0": "createdAt",
    "3-1": "String(RFC3339)",
    "3-2": "Creation time.",
    "3-3": "ISO 8601 date and time.",
    "3-4": "✅"
  },
  "cols": 5,
  "rows": 4,
  "align": [
    "left",
    "left",
    "left",
    "left",
    "left"
  ]
}
[/block]