Skip to content
Payment gateway

PayTR iFrame & Direct API Integration

End-to-end token generation, iFrame 3D Secure modals, and constant-time HMAC-SHA256 webhook notification validation.

Better Payment
iFrame 3D Secure checkout page tokenTiming-safe HMAC-SHA256 webhook validationMulti-currency processing (TRY
Protocol

iFrame

Auth

HMAC-SHA256

3D Secure

Included

3D Secure inside an iFrame

Dependencies

0

Capabilities

Full PayTR support

  • iFrame 3D Secure checkout page token
  • Timing-safe HMAC-SHA256 webhook validation
  • Multi-currency processing (TRY, USD, EUR, GBP)
  • Dynamic installment matrix & commission lookup
  • Full and partial refund execution

How a request flows

  1. 1

    createPayment / initThreeDSPayment

    One typed request, translated into PayTR's format.

  2. 2

    iFrame · token · HMAC-SHA256

    Signatures and field mappings are generated for you.

  3. 3

    Callback verification

    The signature is compared in constant time and the order match is checked.

  4. 4

    Normalized result

    Success, error code and transaction id come back in one shape.

Connect in one config.

Hand over your credentials; Better Payment handles the rest.

payment-paytr.tsTypeScript
import { createBetterPayment } from "better-payment";

const payment = createBetterPayment({
  defaultProvider: "paytr",
  providers: {
    paytr: {
      merchantId: process.env.PAYTR_MERCHANT_ID!,
      merchantKey: process.env.PAYTR_MERCHANT_KEY!,
      merchantSalt: process.env.PAYTR_MERCHANT_SALT!
    }
  }
});