Contents

Providers

The active provider is selected from the panel: Settings → Payment (notifications:settings permission).
Credentials live only in env; the panel does not store secrets.

Provider Env prefix Default base
Iyzico PAYMENT_IYZICO_* sandbox-api.iyzipay.com
Moka United PAYMENT_MOKA_* service.refmokaunited.com

Shared:

Variable Description
PAYMENT_CALLBACK_URL 3DS bank return; defaults to {AUTH_EMAIL_LINK_BASE_URL}/api/v1/payments/3ds/callback when empty
PAYMENT_FIELD_ENCRYPTION_KEY Card field AES-256-GCM (openssl rand -base64 32); required in production

Flow

BIN check → 3DS initialize → bank page → callback → 3DS auth (completion)
  1. BIN — first 6–8 digits of card; installment options
  2. Initialize — start 3DS with provider; returns HTML/redirect
  3. Callback — bank POST; server completes auth
  4. Auth / complete — transaction record updated (success / failure)

Client IP is taken from the server (c.IP()); client IP from the body is not accepted.

HTTP endpoints

Public (signature / bank)

Method API Web
POST /api/v1/payments/3ds/callback /payments/3ds/callback
POST /api/v1/payments/webhook/iyzico /payments/webhook/iyzico

Iyzico webhook: X-IYZ-SIGNATURE-V3PAYMENT_IYZICO_SECRET_KEY.

Protected (payments:charge / payments:list)

Method Path Permission
POST /api/v1/payments/bin-check charge
POST /api/v1/payments/3ds/initialize charge
POST /api/v1/payments/3ds/auth charge
POST /api/v1/payments/calc-amount charge
GET /api/v1/payments/transactions list
GET /api/v1/payments/transactions/:reference charge or list

Panel: /dashboard/payments/checkout, /dashboard/payments/transactions.

Resilience

  • Outbox / retry and reconciliation infrastructure integrated with payment use cases
  • Sensitive card fields via pkg/fieldenc + PAYMENT_FIELD_ENCRYPTION_KEY
  • Idempotency middleware on mutations (callback policy separate)

Settings API

Method Path
GET/POST /api/v1/settings/payment
GET/PATCH /api/v1/settings/payment/:provider

Code

  • internal/application/payment
  • internal/infrastructure/payment
  • internal/adapters/http/handler/payment_handler.go
  • internal/adapters/goui (checkout / transactions screens)