# Create manual income document

- Sandbox: `POST https://sandbox.payme.io/api/partner/api/documents/income/manual`
- Production: `POST https://live.payme.io/api/partner/api/documents/income/manual`

## Credentials

- Header `Authorization: Bearer <token>`

Create a new income document manually

## Parameters

This endpoint takes no path, query or header parameters.

## Request body

Content type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `seller_email` | string | no | Seller's email address |
| `seller_social_id_number` | string | no | Seller's social/business ID number |
| `doc_type` | string | yes | Document type |
| `value_date` | string | yes | Document value date |
| `due_date` | string | no | Payment due date (required for invoice, deal, offer) |
| `currency` | string | yes | Document currency |
| `doc_language` | string | yes | Document language |
| `client_name` | string | no | Client/customer name |
| `client_email` | string | no | Client email |
| `client_phone` | string | no | Client phone |
| `items` | array | yes | Document line items |
| `items[].name` | string | yes | Item name |
| `items[].quantity` | number | yes | Item quantity |
| `items[].item_net_price` | number | yes | Item net price (before VAT) |
| `items[].item_currency` | string | yes | Item currency |
| `items[].item_total_price` | number | no | Item total price |
| `items[].is_no_item_vat` | boolean | no | VAT exempt flag (true = no VAT) |
| `total_amount` | number | yes | Total amount including VAT |
| `vat_amount` | number | no | VAT amount |
| `total_without_vat` | number | no | Total amount without VAT |
| `discount` | number | no | Discount amount |
| `comment` | string | no | Document comments |
| `origin_tax_deduction` | number | no | Tax deduction at source |
| `callbacks` | object | no | Callback URLs for async notifications |
| `callbacks.success` | array | no | URLs to call on success |
| `callbacks.error` | array | no | URLs to call on error |
| `payment_cash` | object | no |  |
| `payment_cash.date` | string | yes | Payment date |
| `payment_cash.amount` | number | yes | Payment amount |
| `payment_credit_card` | object | no |  |
| `payment_credit_card.date` | string | yes | Payment date |
| `payment_credit_card.amount` | number | yes | Payment amount |
| `payment_credit_card.last4Digits` | string | no | Last 4 digits of card |
| `payment_bank_transfer` | object | no |  |
| `payment_bank_transfer.date` | string | yes | Payment date |
| `payment_bank_transfer.amount` | number | yes | Payment amount |
| `payment_bank_transfer.bankNumber` | integer | no | Bank code |
| `payment_bank_transfer.branchNumber` | integer | no | Branch number |
| `payment_bank_transfer.accountNumber` | integer | yes | Account number |
| `payment_cheque` | object | no |  |
| `payment_cheque.date` | string | yes | Payment date |
| `payment_cheque.receivedDate` | string | yes | Cheque received date |
| `payment_cheque.amount` | number | yes | Payment amount |
| `payment_cheque.chequeNumber` | number | yes | Cheque number |
| `payment_cheque.bankNumber` | integer | no | Bank code |
| `payment_cheque.branchNumber` | integer | no | Branch number |
| `payment_cheque.accountNumber` | integer | no | Account number |

### Request example

```json
{
  "seller_email": "seller@example.com",
  "seller_social_id_number": "123456789",
  "doc_type": "deal",
  "value_date": "2024-01-15 00:00:00",
  "currency": "ILS",
  "doc_language": "he",
  "client_name": "John Doe",
  "client_email": "john@example.com",
  "items": [
    {
      "name": "Service",
      "quantity": 1,
      "item_net_price": 1000,
      "item_currency": "ILS",
      "is_no_item_vat": false
    }
  ],
  "total_amount": 1170,
  "vat_amount": 170,
  "total_without_vat": 1000
}
```

## Code samples

### curl

```bash
curl -X POST 'https://sandbox.payme.io/api/partner/api/documents/income/manual' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <YOUR_TOKEN>' \
  --data-raw '{
  "seller_email": "seller@example.com",
  "seller_social_id_number": "123456789",
  "doc_type": "deal",
  "value_date": "2024-01-15 00:00:00",
  "currency": "ILS",
  "doc_language": "he",
  "client_name": "John Doe",
  "client_email": "john@example.com",
  "items": [
    {
      "name": "Service",
      "quantity": 1,
      "item_net_price": 1000,
      "item_currency": "ILS",
      "is_no_item_vat": false
    }
  ],
  "total_amount": 1170,
  "vat_amount": 170,
  "total_without_vat": 1000
}'
```

### Node.js

```javascript
const response = await fetch("https://sandbox.payme.io/api/partner/api/documents/income/manual", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer <YOUR_TOKEN>",
  },
  body: JSON.stringify({
    "seller_email": "seller@example.com",
    "seller_social_id_number": "123456789",
    "doc_type": "deal",
    "value_date": "2024-01-15 00:00:00",
    "currency": "ILS",
    "doc_language": "he",
    "client_name": "John Doe",
    "client_email": "john@example.com",
    "items": [
      {
        "name": "Service",
        "quantity": 1,
        "item_net_price": 1000,
        "item_currency": "ILS",
        "is_no_item_vat": false
      }
    ],
    "total_amount": 1170,
    "vat_amount": 170,
    "total_without_vat": 1000
  }),
});

console.log(await response.text());
```

### Python

```python
import requests

response = requests.post(
    "https://sandbox.payme.io/api/partner/api/documents/income/manual",
    headers={
        "Authorization": "Bearer <YOUR_TOKEN>",
    },
    json={
        "seller_email": "seller@example.com",
        "seller_social_id_number": "123456789",
        "doc_type": "deal",
        "value_date": "2024-01-15 00:00:00",
        "currency": "ILS",
        "doc_language": "he",
        "client_name": "John Doe",
        "client_email": "john@example.com",
        "items": [
            {
                "name": "Service",
                "quantity": 1,
                "item_net_price": 1000,
                "item_currency": "ILS",
                "is_no_item_vat": False,
            },
        ],
        "total_amount": 1170,
        "vat_amount": 170,
        "total_without_vat": 1000,
    },
)

print(response.text)
```

### PHP

```php
<?php

$body = <<<'BODY'
{
  "seller_email": "seller@example.com",
  "seller_social_id_number": "123456789",
  "doc_type": "deal",
  "value_date": "2024-01-15 00:00:00",
  "currency": "ILS",
  "doc_language": "he",
  "client_name": "John Doe",
  "client_email": "john@example.com",
  "items": [
    {
      "name": "Service",
      "quantity": 1,
      "item_net_price": 1000,
      "item_currency": "ILS",
      "is_no_item_vat": false
    }
  ],
  "total_amount": 1170,
  "vat_amount": 170,
  "total_without_vat": 1000
}
BODY;

$ch = curl_init('https://sandbox.payme.io/api/partner/api/documents/income/manual');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Authorization: Bearer <YOUR_TOKEN>',
    ],
    CURLOPT_POSTFIELDS => $body,
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
```

## Responses

### 201 — Document created (success)

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Document ID |
| `url` | string | Document URL |

### 400 — Bad Request (error)

| Field | Type | Description |
| --- | --- | --- |
| `statusCode` | integer | HTTP status code |
| `message` | string | Error message(s) |
| `error` | string | Error type |

```json
{
  "statusCode": 400,
  "message": [
    "Validation failed"
  ],
  "error": "Bad Request"
}
```

### 401 — Unauthorized (error)

| Field | Type | Description |
| --- | --- | --- |
| `error` | string |  |
| `error_description` | string |  |

```json
{
  "error": "unauthorized_client",
  "error_description": "Client authentication failed"
}
```
