# Generate Transfer

- Sandbox: `POST https://sandbox.payme.io/api/sales`
- Production: `POST https://live.payme.io/api/sales`

## Credentials

No credentials are documented for this endpoint.

This endpoint can be used in order to transfer funds between different wallets in our system.

## Parameters

This endpoint takes no path, query or header parameters.

## Request body

Content type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `payment` | object | yes |  |
| `payment.method` | string | yes | Default value - 'Funds Transfer' |
| `payment.origin_seller_id` | string | yes | The unique PayMe seller ID |
| `currency` | string | yes | The currency used for the transfer |
| `sale_price` | number | yes | The transfer amount |
| `product_name` | string | no | What is the transfer paid for |
| `seller_payme_id` | string | no | Seller unique ID |

### Request example

```json
{
  "payment": {
    "method": "funds-transfer",
    " origin_seller_id": "MPL15814-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX"
  },
  "currency": "ILS",
  "sale_price": 150,
  "product_name": "ddd",
  "seller_payme_id": "MPL15855-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX"
}
```

## Code samples

### curl

```bash
curl -X POST 'https://sandbox.payme.io/api/sales' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "payment": {
    "method": "funds-transfer",
    " origin_seller_id": "MPL15814-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX"
  },
  "currency": "ILS",
  "sale_price": 150,
  "product_name": "ddd",
  "seller_payme_id": "MPL15855-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX"
}'
```

### Node.js

```javascript
const response = await fetch("https://sandbox.payme.io/api/sales", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "payment": {
      "method": "funds-transfer",
      " origin_seller_id": "MPL15814-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX"
    },
    "currency": "ILS",
    "sale_price": 150,
    "product_name": "ddd",
    "seller_payme_id": "MPL15855-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX"
  }),
});

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

### Python

```python
import requests

response = requests.post(
    "https://sandbox.payme.io/api/sales",
    json={
        "payment": {
            "method": "funds-transfer",
            " origin_seller_id": "MPL15814-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX",
        },
        "currency": "ILS",
        "sale_price": 150,
        "product_name": "ddd",
        "seller_payme_id": "MPL15855-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX",
    },
)

print(response.text)
```

### PHP

```php
<?php

$body = <<<'BODY'
{
  "payment": {
    "method": "funds-transfer",
    " origin_seller_id": "MPL15814-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX"
  },
  "currency": "ILS",
  "sale_price": 150,
  "product_name": "ddd",
  "seller_payme_id": "MPL15855-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX"
}
BODY;

$ch = curl_init('https://sandbox.payme.io/api/sales');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);

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

echo $response;
```

## Responses

### 200 — User Created (success)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | number |  |
| `payme_status` | string |  |
| `status_error_code` | number |  |
| `payme_sale_id` | string |  |
| `payme_sale_code` | number |  |
| `sale_created` | string |  |
| `payme_sale_status` | string |  |
| `sale_status` | string |  |
| `currency` | string |  |
| `transaction_id` | string |  |
| `is_token_sale` | boolean |  |
| `price` | number |  |
| `payme_signature` | string |  |
| `payme_transaction_id` | string |  |
| `payme_transaction_total` | number |  |
| `payme_transaction_card_brand` | string |  |
| `payme_transaction_auth_number` | string |  |
| `payme_transaction_voucher` | string |  |
| `buyer_name` | string |  |
| `buyer_email` | string |  |
| `buyer_phone` | string |  |
| `buyer_card_mask` | string |  |
| `buyer_card_exp` | string |  |
| `buyer_card_is_foreign` | boolean |  |
| `buyer_social_id` | string |  |
| `installments` | number |  |
| `sale_paid_date` | string |  |
| `sale_release_date` | string |  |
| `redirect_url` | string |  |

```json
{
  "status_code": 0,
  "payme_status": "success",
  "status_error_code": 0,
  "payme_sale_id": "SALE1597-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX",
  "payme_sale_code": 8965519,
  "sale_created": "2020-08-11 16:28:08",
  "payme_sale_status": "completed",
  "sale_status": "completed",
  "currency": "ILS",
  "transaction_id": "",
  "is_token_sale": false,
  "price": 600,
  "payme_signature": "XXXXXXXXXXXX",
  "payme_transaction_id": "TRAN1597-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX",
  "payme_transaction_total": 600,
  "payme_transaction_card_brand": "PrivateLabel",
  "payme_transaction_auth_number": null,
  "payme_transaction_voucher": null,
  "buyer_name": "John Doe Inc",
  "buyer_email": "test@example.com",
  "buyer_phone": "0540000000",
  "buyer_card_mask": null,
  "buyer_card_exp": null,
  "buyer_card_is_foreign": false,
  "buyer_social_id": "123456782",
  "installments": 1,
  "sale_paid_date": "2020-08-11 16:28:08",
  "sale_release_date": "2020-08-11 16:28:09",
  "redirect_url": null
}
```

### 500 — Internal Server Error (error)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | number |  |
| `status_error_details` | string |  |
| `status_additional_info` | string |  |
| `status_error_code` | number |  |

```json
{
  "status_code": 1,
  "status_error_details": "השירות לא הופעל בחשבון",
  "status_additional_info": "funds-transfer",
  "status_error_code": 720
}
```
