Daha İyi

Developers

Download OpenAPIGet an API Key

Getting Started

  1. 1Create a live or test key on the Integration page of the brand panel. The secret is shown once, at creation.
  2. 2Send every request with the key ID, timestamp and HMAC-SHA256 signature headers.
  3. 3Try the key with GET /v1/partner/ping: the response returns your brand and the key's mode.

Authentication

  • X-Daha-KeyKey ID: starts with dk_live_ or dk_test_.
  • X-Daha-TimestampRequest time as unix seconds.
  • X-Daha-Signaturev1= followed by the HMAC-SHA256 of the signed string with your secret (lowercase hex).

Signed String

<timestamp>.<METHOD>.<path?query>.<raw body>
1763130000.POST./v1/partner/codes/verify.{"code":"ABC"}
  • The timestamp may differ from server time by at most 5 minutes.
  • The same signature is not accepted twice within 10 minutes.
  • Every authentication failure returns 401 AUTH_FAILED; the detailed reason is in the request log in the brand panel.

Node Example

import { createHmac } from "node:crypto";

const KEY_ID = process.env.DAHA_IYI_KEY_ID; // dk_live_... | dk_test_...
const SECRET = process.env.DAHA_IYI_SECRET; // dks_...

export async function dahaIyi(method, path, body) {
  const raw = body === undefined ? "" : JSON.stringify(body);
  const timestamp = String(Math.floor(Date.now() / 1000));
  const canonical = `${timestamp}.${method.toUpperCase()}.${path}.${raw}`;
  const signature = "v1=" + createHmac("sha256", SECRET).update(canonical).digest("hex");

  const res = await fetch("https://hangisidahaiyi.com" + path, {
    method,
    headers: {
      "X-Daha-Key": KEY_ID,
      "X-Daha-Timestamp": timestamp,
      "X-Daha-Signature": signature,
      ...(raw && { "Content-Type": "application/json" }),
    },
    body: raw || undefined,
  });
  return { status: res.status, body: await res.json() };
}

await dahaIyi("GET", "/v1/partner/ping");

Endpoints

Test the Key

GET/v1/partner/ping

Returns the key's brand and mode when the signature is valid. The first step of an integration.

Response (200, data)

  • okbooleanValues: true
  • modestringValues: live, test
  • keyIdstring
  • brandobject
  • brand.idstring (uuid)
  • brand.slugstring
  • brand.namestring

Error Responses

  • 401AUTH_FAILED
  • 403MODE_NOT_ALLOWED
  • 429RATE_LIMITEDTOO_MANY_FAILURES

Verify a Code

POST/v1/partner/codes/verify

Checks that a code entered at checkout belongs to this brand and can be used now. Does not use the code.

Request Body

  • codestringrequiredThe code entered by the customer; converted to upper case.1-64 characters
  • campaignIdstring (uuid)Selects the campaign when the code exists in more than one.

Response (200, data)

  • validbooleanValues: true, false
  • claimobject
  • claim.idstring (uuid)
  • claim.expiresAtstring (date-time) | null
  • claim.graceUntilstring (date-time) | null
  • campaignobject | null
  • campaign.idstring (uuid)
  • campaign.slugstring
  • campaign.titleobject
  • reasonstringValues: NOT_FOUND, AMBIGUOUS, CANCELLED, EXPIRED, ALREADY_REDEEMED

Error Responses

  • 400INVALID_JSON
  • 401AUTH_FAILED
  • 403MODE_NOT_ALLOWED
  • 413BODY_TOO_LARGE
  • 415JSON_REQUIRED
  • 429RATE_LIMITEDTOO_MANY_FAILURESTOO_MANY_CODE_FAILURES
  • 503SERVICE_UNAVAILABLE

Report a Redemption

POST/v1/partner/redemptions

Reports that a code was used in an order. externalRef is the idempotency key within brand and mode: the same body again returns 200 with Idempotent-Replayed: true, a different body returns 409 IDEMPOTENCY_CONFLICT.

Request Body

  • codestringrequiredThe code entered by the customer; converted to upper case.1-64 characters
  • campaignIdstring (uuid)Selects the campaign when the code exists in more than one.
  • externalRefstringrequiredYour order number; it makes retries safe. The cashier: prefix is reserved.Pattern: ^[A-Za-z0-9._:-]{1,128}$
  • orderAmountintegerrequiredOrder amount in kuruş.Between 1 and 2147483647
  • discountAmountintegerrequiredDiscount applied in kuruş; cannot exceed the order amount.Between 0 and 2147483647
  • currencystringrequiredCurrency.Values: TRY
  • redeemedAtstring (date-time)Time of use; defaults to the request time. At most 48 hours back.

Response (201, data)

  • idstring (uuid)
  • modestringValues: live, test
  • sourcestringValues: webhook, cashier
  • externalRefstring | null
  • statusstringValues: verified, reversed
  • orderAmountinteger
  • discountAmountinteger
  • currencystring
  • redeemedAtstring (date-time)
  • reversedAtstring (date-time) | null
  • reasonstring | null
  • claimobject
  • claim.idstring (uuid)
  • claim.codestring
  • campaignobject | null
  • campaign.idstring (uuid)
  • campaign.slugstring
  • campaign.titleobject

Error Responses

  • 400REDEEMED_AT_INVALIDDISCOUNT_TOO_HIGHMIN_BASKET_NOT_METINVALID_JSON
  • 401AUTH_FAILED
  • 403MODE_NOT_ALLOWED
  • 404CODE_NOT_FOUND
  • 409ALREADY_REDEEMEDCODE_EXPIREDCODE_CANCELLEDCAMPAIGN_NOT_STARTEDCODE_AMBIGUOUSIDEMPOTENCY_CONFLICT
  • 413BODY_TOO_LARGE
  • 415JSON_REQUIRED
  • 429RATE_LIMITEDTOO_MANY_FAILURESTOO_MANY_CODE_FAILURES
  • 503SERVICE_UNAVAILABLE

Reverse a Redemption

POST/v1/partner/redemptions/{externalRef}/reverse

Fully reverses a redemption when the order is refunded. Repeating the request returns the same result.

Path Parameter

  • externalRefstringrequiredYour order number; it makes retries safe. The cashier: prefix is reserved.Pattern: ^[A-Za-z0-9._:-]{1,128}$

Request Body

  • reasonstringReason for the reversal.1-200 characters

Response (200, data)

  • idstring (uuid)
  • modestringValues: live, test
  • sourcestringValues: webhook, cashier
  • externalRefstring | null
  • statusstringValues: verified, reversed
  • orderAmountinteger
  • discountAmountinteger
  • currencystring
  • redeemedAtstring (date-time)
  • reversedAtstring (date-time) | null
  • reasonstring | null
  • claimobject
  • claim.idstring (uuid)
  • claim.codestring
  • campaignobject | null
  • campaign.idstring (uuid)
  • campaign.slugstring
  • campaign.titleobject

Error Responses

  • 400INVALID_JSON
  • 401AUTH_FAILED
  • 403MODE_NOT_ALLOWED
  • 404REDEMPTION_NOT_FOUND
  • 413BODY_TOO_LARGE
  • 415JSON_REQUIRED
  • 429RATE_LIMITEDTOO_MANY_FAILURES

List Redemptions

GET/v1/partner/redemptions

Redemptions in the key's brand and mode, newest first. Redemptions at the cashier come with source: cashier. No personal data is returned.

Query Parameters

  • fromstring (date-time)From this time (inclusive).
  • tostring (date-time)Until this time (exclusive).
  • statusstringFilter by status.Values: verified, reversed
  • limitintegerPage size.Between 1 and 100 · Default: 50
  • cursorstring (uuid)The nextCursor value of the previous response.

Response (200, data.items item)

  • idstring (uuid)
  • externalRefstring | null
  • statusstringValues: verified, reversed
  • sourcestringValues: webhook, cashier
  • campaignIdstring (uuid) | null
  • orderAmountinteger
  • discountAmountinteger
  • currencystring
  • redeemedAtstring (date-time)
  • reversedAtstring (date-time) | null

Error Responses

  • 400Validation error: message and issues
  • 401AUTH_FAILED
  • 403MODE_NOT_ALLOWED
  • 429RATE_LIMITEDTOO_MANY_FAILURES

List Campaigns

GET/v1/partner/campaigns

The brand's campaigns, drafts included. Claimed and redeemed counts follow the key's mode: a test key only counts test codes.

Query Parameters

  • statusstringFilter by status.Values: draft, pending_review, active, exhausted, ended
  • limitintegerPage size.Between 1 and 100 · Default: 50
  • cursorstring (uuid)The nextCursor value of the previous response.

Response (200, data.items item)

  • idstring (uuid)
  • slugstring
  • titleobject
  • title.trstring
  • title.enstring
  • statusstringValues: draft, pending_review, active, exhausted, ended
  • startsAtstring (date-time) | null
  • endsAtstring (date-time) | null
  • quotaobject
  • quota.totalinteger | null
  • quota.remaininginteger | null
  • quota.claimedinteger
  • quota.redeemedinteger

Error Responses

  • 400Validation error: message and issues
  • 401AUTH_FAILED
  • 403MODE_NOT_ALLOWED
  • 429RATE_LIMITEDTOO_MANY_FAILURES

Rate Limits

  • 600 requests per minute per key; above that 429 RATE_LIMITED with the retry delay in the body (retryAfter, seconds).
  • 60 failed authentications per minute per IP; above that 429 TOO_MANY_FAILURES.
  • The body must be JSON and at most 100 KB.

Error Codes

Error responses have the form { "code": "..." }; some codes carry extra fields (for example retryAfter).

  • DISCOUNT_TOO_HIGH400
  • INVALID_JSON400
  • MIN_BASKET_NOT_MET400
  • REDEEMED_AT_INVALID400
  • AUTH_FAILED401
  • MODE_NOT_ALLOWED403
  • CODE_NOT_FOUND404
  • REDEMPTION_NOT_FOUND404
  • ALREADY_REDEEMED409
  • CAMPAIGN_NOT_STARTED409
  • CODE_AMBIGUOUS409
  • CODE_CANCELLED409
  • CODE_EXPIRED409
  • IDEMPOTENCY_CONFLICT409
  • BODY_TOO_LARGE413
  • JSON_REQUIRED415
  • RATE_LIMITED429
  • TOO_MANY_CODE_FAILURES429
  • TOO_MANY_FAILURES429
  • SERVICE_UNAVAILABLE503