# Withdrawal Correlation

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

## Credentials

- Request body field `seller_payme_id` (required): Your unique PayMe seller identifier.

This endpoint retrieves credit match information for a specific seller and withdrawal.


Request Body:
```json
{
    "seller_payme_id": "string", //Your unique seller ID
    "withdrawal_payme_code": number //The withdrawal number as received from POST get-withdrawals API endpoint
}
```

Parameters:
- `seller_payme_id` (required): The unique identifier for the seller in the Payme system.
- `withdrawal_payme_code` (required): The Payme code for the specific withdrawal.

Successful Response (HTTP 200):
The response includes detailed information about the withdrawal, seller, and associated transactions.

Error Responses (HTTP 500):
1. Seller not found:
```json
{
    "status_code": 1,
    "status_error_details": "מוכר לא נמצא",
    "status_additional_info": "seller_payme_id",
    "status_error_code": 251,
    "session": "string"
}
```

2. Withdrawal not found:
```json
{
    "status_code": 1,
    "status_error_details": "משיכה לא נמצאה",
    "status_additional_info": number,
    "status_error_code": 906,
    "session": "string"
}
```

Notes:
- Ensure that the `seller_payme_id` and `withdrawal_payme_code` are valid before making the request.

## Parameters

This endpoint takes no path, query or header parameters.

## Request body

Content type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `seller_payme_id` | string | yes | Your unique PayMe seller identifier. |
| `withdrawal_payme_code` | integer | yes | Your unique Withdrawal code. |

### Request example

```json
{
  "seller_payme_id": "MPL16775-994777AM-VWDLUKNV-Y2PCAKED",
  "withdrawal_payme_code": 1066726
}
```

## Code samples

### curl

```bash
curl -X POST 'https://sandbox.payme.io/api/credit-match' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "seller_payme_id": "MPL16775-994777AM-VWDLUKNV-Y2PCAKED",
  "withdrawal_payme_code": 1066726
}'
```

### Node.js

```javascript
const response = await fetch("https://sandbox.payme.io/api/credit-match", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "seller_payme_id": "MPL16775-994777AM-VWDLUKNV-Y2PCAKED",
    "withdrawal_payme_code": 1066726
  }),
});

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

### Python

```python
import requests

response = requests.post(
    "https://sandbox.payme.io/api/credit-match",
    json={
        "seller_payme_id": "MPL16775-994777AM-VWDLUKNV-Y2PCAKED",
        "withdrawal_payme_code": 1066726,
    },
)

print(response.text)
```

### PHP

```php
<?php

$body = <<<'BODY'
{
  "seller_payme_id": "MPL16775-994777AM-VWDLUKNV-Y2PCAKED",
  "withdrawal_payme_code": 1066726
}
BODY;

$ch = curl_init('https://sandbox.payme.io/api/credit-match');
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 — OK (success)

| Field | Type | Description |
| --- | --- | --- |
| `seller_payme_id` | string | The unique PayMe seller identifier. |
| `seller_id` | string | The external Seller ID, provided by the integrator. |
| `withdrawal_payme_code` | integer | The withdrawal unique code. |
| `withdrawal_created` | string | The date the withdrawal was created in timestamp format. |
| `withdrawal_created_epoch` | integer | The date the withdrawal was created in epoch format. |
| `withdrawal_total` | integer | The withdrawal total in cents (agorot). |
| `withdrawal_currency` | string | The withdrawal currency, 3 letter ISO code. |
| `items_count` | integer | The total count of items assembling the withdrawal. (Transactions and Charges) |
| `items` | array |  |
| `items[].credit_vas_id` | string | The VAS identifier that was used to create the charge. |
| `items[].sale_remote_id` | string | The external sale identifier. |
| `items[].tran_id` | integer | The entity unique ID. |
| `items[].tran_type` | string | The entity type ID. |
| `items[].tran_created` | string | The date the entity was created on in timestamp format. |
| `items[].tran_created_epoch` | string | The date the entity was created in Epoch format. |
| `items[].tran_total` | integer | The entity total value, in cents (Agorot) |
| `items[].tran_total_after_deduction` | integer | Total after deduction (will be equal to total by default). |
| `items[].tran_currency` | string | The currency of the entity. |
| `items[].tran_installments` | integer | The installments count of the transaction. |
| `items[].tran_description` | string | The description of the entity. |
| `items[].tran_remote_id` | string | The remote ID given by the integrator. |
| `items[].tran_voucher` | string | The voucher of the transaction. |
| `items[].sale_payme_code` | integer | The unique PayMe sale identifer. |
| `items[].sale_buyer_name` | string | The buyer name of the transaction. |
| `status_code` | integer | Status code. `0` - Successful request. `1` - Failed request. |
| `session` | string | The unique session |

```json
{
  "seller_payme_id": "MPL16775-994777AM-VWDLUKNV-Y2PCAKED",
  "seller_id": "il-110110738-1677599477",
  "withdrawal_payme_code": 1066726,
  "withdrawal_created": "2024-07-28 12:29:40",
  "withdrawal_created_epoch": 1722158980,
  "withdrawal_total": 285511,
  "withdrawal_currency": "ILS",
  "items_count": 10,
  "items": [
    {
      "credit_vas_id": "VASL1677-599477XY-YKWVZACW-IWQ3BG6Y",
      "sale_remote_id": "rVrUy44C75ZShMORPNGkz9MVK",
      "tran_id": 191208278,
      "tran_type": "102",
      "tran_created": "2024-07-24 21:14:33",
      "tran_created_epoch": "1721844873",
      "tran_total": -140,
      "tran_total_after_deduction": -140,
      "tran_currency": "ILS",
      "tran_installments": 1,
      "tran_description": "עמוד תשלום - סטודיו דוצ׳ה Processing Charge",
      "tran_remote_id": "rVrUy44C75ZShMORPNGkz9MVK",
      "tran_voucher": "6003289",
      "sale_payme_code": 61974223,
      "sale_buyer_name": "ליאור צוק"
    },
    {
      "credit_vas_id": "VASL1677-599477HY-GUKISPF6-AHGOSEWS",
      "sale_remote_id": "rVrUy44C75ZShMORPNGkz9MVK",
      "tran_id": 191208274,
      "tran_type": "102",
      "tran_created": "2024-07-24 21:14:33",
      "tran_created_epoch": "1721844873",
      "tran_total": -1578,
      "tran_total_after_deduction": -1578,
      "tran_currency": "ILS",
      "tran_installments": 1,
      "tran_description": "עמוד תשלום - סטודיו דוצ׳ה Advancement services",
      "tran_remote_id": "rVrUy44C75ZShMORPNGkz9MVK",
      "tran_voucher": "6003289",
      "sale_payme_code": 61974223,
      "sale_buyer_name": "ליאור צוק"
    },
    {
      "credit_vas_id": "VASL1677-599477LB-MLQDCS8F-KTGONSZE",
      "sale_remote_id": "rVrUy44C75ZShMORPNGkz9MVK",
      "tran_id": 191208270,
      "tran_type": "102",
      "tran_created": "2024-07-24 21:14:33",
      "tran_created_epoch": "1721844873",
      "tran_total": -2953,
      "tran_total_after_deduction": -2953,
      "tran_currency": "ILS",
      "tran_installments": 1,
      "tran_description": "עמוד תשלום - סטודיו דוצ׳ה Processing Fee",
      "tran_remote_id": "rVrUy44C75ZShMORPNGkz9MVK",
      "tran_voucher": "6003289",
      "sale_payme_code": 61974223,
      "sale_buyer_name": "ליאור צוק"
    },
    {
      "credit_vas_id": null,
      "sale_remote_id": "rVrUy44C75ZShMORPNGkz9MVK",
      "tran_id": 224152597,
      "tran_type": "1",
      "tran_created": "2024-07-24 21:14:33",
      "tran_created_epoch": "1721844873",
      "tran_total": 155000,
      "tran_total_after_deduction": 155000,
      "tran_currency": "ILS",
      "tran_installments": 1,
      "tran_description": "עמוד תשלום - סטודיו דוצ׳ה ",
      "tran_remote_id": "rVrUy44C75ZShMORPNGkz9MVK",
      "tran_voucher": "6003289",
      "sale_payme_code": 61974223,
      "sale_buyer_name": "ליאור צוק"
    },
    {
      "credit_vas_id": "VASL1677-599477LB-MLQDCS8F-KTGONSZE",
      "sale_remote_id": "r36GeI5Crm2JORFnXANDmAHpm",
      "tran_id": 191334587,
      "tran_type": "102",
      "tran_created": "2024-07-25 21:15:20",
      "tran_created_epoch": "1721931320",
      "tran_total": -2667,
      "tran_total_after_deduction": -2667,
      "tran_currency": "ILS",
      "tran_installments": 1,
      "tran_description": "עמוד תשלום - סטודיו דוצ׳ה Processing Fee",
      "tran_remote_id": "r36GeI5Crm2JORFnXANDmAHpm",
      "tran_voucher": "7001937",
      "sale_payme_code": 62018574,
      "sale_buyer_name": "Ofri Katz"
    },
    {
      "credit_vas_id": null,
      "sale_remote_id": "r36GeI5Crm2JORFnXANDmAHpm",
      "tran_id": 224212542,
      "tran_type": "1",
      "tran_created": "2024-07-25 21:15:20",
      "tran_created_epoch": "1721931320",
      "tran_total": 140000,
      "tran_total_after_deduction": 140000,
      "tran_currency": "ILS",
      "tran_installments": 1,
      "tran_description": "עמוד תשלום - סטודיו דוצ׳ה ",
      "tran_remote_id": "r36GeI5Crm2JORFnXANDmAHpm",
      "tran_voucher": "7001937",
      "sale_payme_code": 62018574,
      "sale_buyer_name": "Ofri Katz"
    },
    {
      "credit_vas_id": "VASL1677-599477HY-GUKISPF6-AHGOSEWS",
      "sale_remote_id": "r36GeI5Crm2JORFnXANDmAHpm",
      "tran_id": 191334591,
      "tran_type": "102",
      "tran_created": "2024-07-25 21:15:21",
      "tran_created_epoch": "1721931321",
      "tran_total": -1425,
      "tran_total_after_deduction": -1425,
      "tran_currency": "ILS",
      "tran_installments": 1,
      "tran_description": "עמוד תשלום - סטודיו דוצ׳ה Advancement services",
      "tran_remote_id": "r36GeI5Crm2JORFnXANDmAHpm",
      "tran_voucher": "7001937",
      "sale_payme_code": 62018574,
      "sale_buyer_name": "Ofri Katz"
    },
    {
      "credit_vas_id": "VASL1677-599477XY-YKWVZACW-IWQ3BG6Y",
      "sale_remote_id": "r36GeI5Crm2JORFnXANDmAHpm",
      "tran_id": 191334595,
      "tran_type": "102",
      "tran_created": "2024-07-25 21:15:21",
      "tran_created_epoch": "1721931321",
      "tran_total": -140,
      "tran_total_after_deduction": -140,
      "tran_currency": "ILS",
      "tran_installments": 1,
      "tran_description": "עמוד תשלום - סטודיו דוצ׳ה Processing Charge",
      "tran_remote_id": "r36GeI5Crm2JORFnXANDmAHpm",
      "tran_voucher": "7001937",
      "sale_payme_code": 62018574,
      "sale_buyer_name": "Ofri Katz"
    },
    {
      "credit_vas_id": "VASL1677-599477Q0-DC5MSVNQ-H7JBRQQZ",
      "sale_remote_id": "rZsj2JQB3rVSfeLsVyPEAmH8H",
      "tran_id": 191290928,
      "tran_type": "102",
      "tran_created": "2024-07-25 10:38:05",
      "tran_created_epoch": "1721893085",
      "tran_total": -293,
      "tran_total_after_deduction": -293,
      "tran_currency": "ILS",
      "tran_installments": 1,
      "tran_description": "עמוד תשלום - סטודיו דוצ׳ה שירות 3DSecure",
      "tran_remote_id": "rZsj2JQB3rVSfeLsVyPEAmH8H",
      "tran_voucher": null,
      "sale_payme_code": 62211761,
      "sale_buyer_name": ""
    },
    {
      "credit_vas_id": "VASL1677-599477Q0-DC5MSVNQ-H7JBRQQZ",
      "sale_remote_id": "rZsj2JQB3rVSfeLsVyPEAmH8H",
      "tran_id": 191291080,
      "tran_type": "102",
      "tran_created": "2024-07-25 10:41:03",
      "tran_created_epoch": "1721893263",
      "tran_total": -293,
      "tran_total_after_deduction": -293,
      "tran_currency": "ILS",
      "tran_installments": 1,
      "tran_description": "עמוד תשלום - סטודיו דוצ׳ה שירות 3DSecure",
      "tran_remote_id": "rZsj2JQB3rVSfeLsVyPEAmH8H",
      "tran_voucher": null,
      "sale_payme_code": 62211926,
      "sale_buyer_name": ""
    }
  ],
  "status_code": 0,
  "session": "FIV3zo4M"
}
```

### 500 — Internal Server Error (error)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | integer | Status code. `0` - Successful request. `1` - Failed request. |
| `status_error_details` | string | Error description. |
| `status_additional_info` | integer | Error additional information. |
| `status_error_code` | integer | PayMe error code. |
| `session` | string | PayMe session ID. |

```json
{
  "status_code": 1,
  "status_error_details": "משיכה לא נמצאה",
  "status_additional_info": 1066726222,
  "status_error_code": 906,
  "session": "FhT3aXe7"
}
```
