> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orkesta.com.tr/llms.txt
> Use this file to discover all available pages before exploring further.

# Token Flex

> Token Flex APM ile ödeme alma

## Token Flex - APM ile Ödeme Alma

**`POST`** `https://api-test.fincraft.com.tr/api/v1/payments/apm-methods/auth`

## Auth - Request Body

```json theme={null}
{
    "paymentCode": "",
    "apmType": "TOKENFLEX",
    "referenceId": "{{$guid}}",
    "amount": 1,
    "currency": "TRY",
    "clientIp": "192.168.1.100",
    "products": [
      {
        "name": "Ürün 1",
        "externalId": "PROD-001",
        "price": 1
      }
    ]
}
```

## Auth - Response Body

```json theme={null}
{
    "response": {
        "paymentStatus": "WAITING",
        "additionalData": {
            "OtpRequired": true
        }
    }
}
```

<Info>
  Kullanıcıya OTP gidecektir. OTP alındıktan sonra complete çağrılmalıdır: `/api/v1/payments/apm-methods/complete`
</Info>

## Complete - Request Body

```json theme={null}
{
    "referenceId": "89f0bef3-05ad-4da7-933e-eb405bc51ed9",
    "otpVerifyCode": "4370"
}
```

## Complete - Response (confirmRequired: true ise)

Confirm işlemi için `/api/v1/payments/apm-methods/confirm` çağrılmalıdır:

```json theme={null}
{"referenceId": "b933f8c1-430d-4802-b0cf-7fc9d8e8774d"}
```

**Response:**

```json theme={null}
{"response": {"status": "SUCCESS", "confirmRequired": false}}
```

## Rollback

Confirm edilmeden iptal için `/api/v1/payments/apm-methods/rollback`:

```json theme={null}
{"referenceId": "b933f8c1-430d-4802-b0cf-7fc9d8e8774d"}
```

## Gün Sonu (EOD)

`POST /api/v1/payments/apm-methods/eod`:

```json theme={null}
{"apm": "TOKENFLEX", "batchNo": 14}
```

## Bekleyen Batch'leri Getir

`GET /api/v1/payments/apm-methods/waiting-batches`

## Harcama İtirazı

`POST /api/v1/payments/apm-methods/payment-correction`:

```json theme={null}
{"referenceId": "4e70f41e-07c6-40a1-a7a3-037ee33b032b", "refundAmount": 0.7}
```
