> The full documentation index: https://palbase.studio/llms.txt

# iyzico

Connect **iyzico** (Sandbox or Live) to accept Turkish cards with mandatory 3D Secure, BIN-based installment tables, recurring subscriptions, same-day cancellations, partial refunds, and signed webhook verification.

## Connecting iyzico

- **In Studio**: Open **Payments › Channels**, click **Connect iyzico / Key**, choose **iyzico**, set your channel key (e.g. `iyzico_tr`), enter your iyzico API Key and Secret Key, and toggle Sandbox/Live mode.
- **In the CLI**:

```sh
# Interactive browser handoff form (keys never leave your browser -> environment)
palbase payments:iyzico:connect --channel iyzico_tr

# Non-interactive CI / script connect via stdin JSON
printf '{"key":"iyzico_tr","api_key":"sandbox-...","secret_key":"sandbox-...","livemode":false,"set_default":true}' \
  | palbase payments:iyzico:connect --stdin
```

Check credential health at any time with:

```sh
palbase payments:channels:check iyzico_tr
```

## Turkish installments (BIN lookup)

When routing to an iyzico channel, query installment counts and monthly totals from the card's first 6–8 digits (BIN) via `POST /payments/installments`:

```ts
import { createClient } from "palbase/web";

const pb = createClient({
  url: "https://k3xq81w4m.palbase.studio",
  publishableKey: "pb_k3xq81w4m_cZ8yX7wV6uT5",
});

const table = await pb.payments.installments({
  amount: 30000, // 300.00 TRY in kurus
  currency: "TRY",
  bin: "552879",
});

for (const opt of table.options) {
  console.log(opt.count, opt.total_amount, opt.installment_amount);
}
```

Pass the customer's chosen installment count when confirming the intent:

```ts
import { createClient } from "palbase/web";

const pb = createClient({
  url: "https://k3xq81w4m.palbase.studio",
  publishableKey: "pb_k3xq81w4m_cZ8yX7wV6uT5",
});

async function payWithInstallments(intentId: string, clientSecret: string) {
  const confirmed = await pb.payments.confirm(intentId, {
    clientSecret,
    installments: { count: 3 },
  });
  return pb.payments.present(confirmed);
}

void payWithInstallments;
```

`openPaymentSheet()` from `palbase/web/payments-ui` automatically fetches capabilities and displays the installment picker whenever the active channel supports installments.

## Buyer profile & fallback defaults

iyzico risk rules require buyer contact and billing address metadata (`name`, `surname`, `email`, `tax_id`, and `billing_address` with `line1`, `city`, `country`, and optional `line2`, `state`, `postal_code`, `contact_name`). Palbase lets customers save their profile once (`GET /payments/me/profile`, `PUT /payments/me/profile` via `pb.payments.profile`) and lets you configure safe fallback defaults in Studio (**Payments › Routing & Settings**) when a buyer omits optional fields.

## 3D Secure & authoritative webhook verification

- **Mandatory 3DS**: Set `three_ds_threshold: 0` in project settings to enforce 3D Secure on every Turkish card payment.
- **Callback & webhooks**: iyzico posts 3DS results to `POST /payments/callback/{provider}/{attempt_id}` and async lifecycle notifications to `POST /payments/webhooks/iyzico`.
- **Signature & Retrieve**: Palbase verifies the webhook HMAC signature when present and always performs an authoritative Retrieve call against iyzico before marking any PaymentIntent or refund as succeeded.

## No saved cards

An iyzico channel keeps no card for your project. A card a buyer saves on iyzico's payment page goes to the buyer's own iyzico wallet, and iyzico hands the merchant no card token for it; a merchant can keep a card only by sending its number through its own server, which Palbase never sees. So on an iyzico channel:

- `GET /payments/capabilities` reports `saved_cards: false`, and the web PaymentSheet (`palbase/web/payments-ui`) shows no "save card" checkbox.
- Adding a card (`POST /payments/me/methods`, `POST /payments/customers/{customer_id}/methods`) answers `422 setup_only_unsupported` before iyzico is asked anything: nothing is opened and nothing is charged.
- A payment confirmed with `save_method: true` goes through as any other, and its `method_save` reads `unsupported`.
- No card is charged with its holder away: a confirm with `off_session: true` answers `422 off_session_unsupported`.

A buyer's Masterpass cards are the buyer's own wallet's, not the project's: on a channel with Masterpass connected they are linked and listed, and each payment with one takes the buyer's one-time code.

To keep a customer's or a company's cards and charge them later, route those payments to a [Stripe](/docs/payments/stripe) channel.

## No invoices

iyzico has no invoices of its own: an invoice for a payer ([Payers & Invoices](/docs/payments/invoices)) asked of an iyzico channel answers `422 invoices_not_supported`, and `GET /payments/channels` reports `capabilities.invoices: false` for it. In Türkiye an invoice is the merchant's own document (e-Fatura or e-Arşiv, through its integrator); Palbase makes invoices on Stripe channels alone.

## Subscriptions

A recurring subscription on iyzico needs iyzico's subscription add-on on the merchant account: iyzico turns it on at the merchant's asking. On an account without it `POST /payments/subscriptions` answers `422 subscriptions_not_enabled`, opens nothing and charges nothing. (It was once sold as an ordinary payment there: charged once, and never renewed.)

An iyzico subscription is of one: iyzico's plans have no quantity. A `quantity` above one, and `POST /payments/subscriptions/{subscription_id}/quantity`, answer `422 quantity_not_supported`; the channel's capabilities say `subscription_quantity: false`. Sell [seats](/docs/payments/subscriptions#seats) on a Stripe channel.

## Same-day cancel vs refund

iyzico distinguishes same-day void (`cancel`) from post-settlement `refund`. When you call `POST /payments/refunds` with `destination: "original"`, Palbase automatically selects the appropriate provider operation (`cancel` vs `refund`) and records `provider_op` on the refund record. For instant customer retention, pass `destination: "wallet"` to credit the customer's TRY wallet immediately.

## Related

- [Channels & Routing](/docs/payments/channels)
- [Checkout & PaymentSheet](/docs/payments/checkout)
