Skip to content

🔄 Recurring Payment Operations

📝 Create Recurring Payment

Endpoint

POST /recurring

Description

Creates a recurring payment (subscription) that will be automatically executed at regular intervals. Payments can be scheduled on daily, monthly, or yearly periods.

Headers

http
Authorization: Bearer {token}
Content-Type: application/json

Request: RecurringPaymentRequest

json
{
  "reference": "SUB-2026-001",
  "amount": 99.90,
  "currencyCode": "TRY",
  "paymentSystemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "explanation": "Premium subscription - monthly",
  "ownerDescription": {
    "fullName": "Jane Smith",
    "email": "jane.smith@example.com",
    "phone": "+905559876543",
    "cardId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "paymentChannel": "mobile",
  "firstPaymentTime": "2026-03-01T00:00:00Z",
  "lastPaymentTime": "2027-03-01T00:00:00Z",
  "frequency": "monthly",
  "interval": 1,
  "dayOfMonth": 1
}

Parameters

ParameterTypeRequiredDescription
referencestringSubscription reference code (max 150 characters)
amountnumberAmount for each payment
currencyCodestringCurrency code (e.g., TRY, USD, EUR)
paymentSystemIduuidPayment system ID to use
explanationstringPayment description (max 400 characters)
ownerDescriptionobjectCard owner information
paymentChannelstringPayment channel (max 50 characters)
firstPaymentTimedatetimeFirst payment date (ISO 8601)
lastPaymentTimedatetimeLast payment date (ISO 8601)
frequencystringPayment frequency: daily, monthly, yearly
intervalintegerPeriod interval (between 1-30)
monthOfYearinteger⚠️Month of year (1-12) - required for yearly
dayOfMonthinteger⚠️Day of month (1-30) - required for monthly/yearly

Frequency Values

ValueDescriptionExample
dailyDailyEvery 1 day, every 5 days, etc.
monthlyMonthly1st of every month, 15th of every month, etc.
yearlyYearlyJanuary 1st every year, etc.

Response

Successful Request (200 OK)

json
{
  "success": true,
  "error": null,
  "shouldBeOwnerConfirmation": false,
  "ownerId": "OWN-123456",
  "orderStatus": "active"
}

Error (403 Forbidden)

json
{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.3",
  "title": "Forbidden",
  "status": 403,
  "detail": "Insufficient permissions",
  "instance": "/recurring"
}

📋 List Recurring Payments

Endpoint

GET /recurring

Description

Lists existing recurring payments. Supports filtering, pagination, and sorting.

Query Parameters

ParameterTypeRequiredDescription
SubscriptionstringFilter by subscription ID
PageintegerPage number (default: 1)
PageSizeintegerRecords per page
OrderBystringSort field
DirstringSort direction: asc or desc

Example Request

http
GET /recurring?Page=1&PageSize=10&OrderBy=createdAtUtc&Dir=desc

Response: RecurringPaymentModelPagedList

json
{
  "currentPage": 1,
  "pageCount": 5,
  "totalCount": 47,
  "hasNext": true,
  "hasPrevious": false,
  "stateKey": "abc123",
  "pages": [1, 2, 3, 4, 5],
  "list": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "amount": 99.90,
      "currencyCode": "TRY",
      "status": "active",
      "createdAtUtc": "2026-02-16T10:00:00Z",
      "reference": "SUB-2026-001",
      "explanation": "Premium subscription - monthly",
      "interval": 1,
      "dayOfMonth": 1,
      "monthOfYear": null,
      "nextPaymentAtUtc": "2026-03-01T00:00:00Z",
      "lastPaymentAtUtc": "2026-02-01T00:00:00Z",
      "phone": "+905559876543",
      "email": "jane.smith@example.com"
    }
  ]
}

✏️ Update Recurring Payment

Endpoint 1: Update by Subscription ID

PUT /recurring/subscription/{subscription}

Endpoint 2: Update by UUID

PUT /recurring/{id}

Description

Updates parameters of an existing recurring payment. Amount, currency, frequency, and other settings can be changed.

Path Parameters

ParameterTypeDescription
subscriptionstringSubscription ID (string)
iduuidRecurring payment UUID

Request: UpdateRecurringPaymentRequest

json
{
  "amount": 119.90,
  "currencyCode": "TRY",
  "explanation": "Premium Plus subscription - monthly",
  "lastPaymentTime": "2028-03-01T00:00:00Z",
  "paymentSystemGroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "paymentSystemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "paymentChannel": "mobile",
  "frequency": "monthly",
  "status": "active",
  "interval": 1,
  "dayOfMonth": 1
}

Parameters

ParameterTypeRequiredDescription
amountnumberUpdated payment amount
currencyCodestringCurrency code
explanationstringDescription (max 400 characters)
lastPaymentTimedatetimeLast payment date
paymentSystemGroupIduuidPayment system group ID
paymentSystemIduuidPayment system ID
paymentChannelstringPayment channel (max 50 characters)
frequencystringPayment frequency
statusstringStatus change
intervalintegerPeriod interval (1-30)
monthOfYearinteger⚠️Month of year (1-12)
dayOfMonthinteger⚠️Day of month (1-30)

Response

Successful Request (200 OK)

json
{
  "success": true
}

Example Usage

cURL - Create

bash
curl -X POST https://pgw.klogs.io/recurring \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "reference": "SUB-2026-001",
    "amount": 99.90,
    "currencyCode": "TRY",
    "ownerDescription": {
      "fullName": "Jane Smith",
      "email": "jane.smith@example.com",
      "phone": "+905559876543",
      "cardId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    },
    "firstPaymentTime": "2026-03-01T00:00:00Z",
    "frequency": "monthly",
    "interval": 1,
    "dayOfMonth": 1
  }'

JavaScript - List

javascript
const response = await fetch('https://pgw.klogs.io/recurring?Page=1&PageSize=10', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY'
  }
});

const data = await response.json();
console.log(data.list);

C# - Update

csharp
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");

var updateRequest = new {
    amount = 119.90,
    currencyCode = "TRY",
    status = "active"
};

var content = new StringContent(
    JsonSerializer.Serialize(updateRequest),
    Encoding.UTF8,
    "application/json"
);

var subscriptionId = "SUB-2026-001";
var response = await client.PutAsync(
    $"https://pgw.klogs.io/recurring/subscription/{subscriptionId}",
    content
);

Notes

  • firstPaymentTime must be in the future when creating recurring payments
  • interval value must be between 1-30
  • dayOfMonth parameter is required for monthly payments
  • dayOfMonth and monthOfYear parameters are required for yearly payments
  • Payments are automatically processed when subscription status is active
  • To stop a subscription, update the status to disabled
  • There is an automatic retry mechanism for failed payments