PayDM

Developers

Use PayDM from your website, bot or AI assistant. The REST API, webhooks and the MCP server all work with the same API key.

Order code flow

The API does not give payment links. You create an order and PayDM gives you an order code. Only PayDM sends the payment link to the buyer.

  1. Create the order with POST /orders. The response has the order code (for example PDM-7K2Q9X) and PayDM's WhatsApp number.
  2. Show the code to the buyer or send it in a DM. whatsapp.url opens WhatsApp with the code typed in.
  3. The buyer writes the code to PayDM's WhatsApp number. PayDM sends the payment link to that number.
  4. The buyer pays. The transaction.held webhook arrives, and GET /orders/:code returns paid with a transactionId.
  5. Confirm the order within 48 hours with POST /transactions/:id/accept. If you do not confirm it, the buyer gets the money back.

Get the payment status only from the API and webhooks. A buyer's "I paid" message is not proof of payment.

Authentication

Create an API key in Panel > Settings > Developer. The key is shown only once. Keep it safe and don't put it in browser code.

Send the key in the Authorization header with every request:

Authorization: Bearer pdm_...

Base URL: https://terrific-grasshopper-146.convex.site/api/v1

Don't put your key in shared files or repositories. If it leaks, revoke it in the panel and create a new one.

Amounts and errors

Amounts are integer kuruş everywhere: 1 TL = 100. For example, send 125000 for ₺1,250.00.

Errors come back as HTTP 4xx with a { "error": "..." } body. Choose the language of the error text with the Accept-Language header (tr, en, ar).

Without Accept-Language, or with a language other than tr, en and ar, the error text is in Turkish.

curl -X POST https://terrific-grasshopper-146.convex.site/api/v1/transactions/<id>/accept \
  -H "Authorization: Bearer $PAYDM_API_KEY" \
  -H "Accept-Language: en"

HTTP/1.1 400 Bad Request

{ "error": "This order isn't waiting for confirmation." }

Test mode

Try your integration without real money. In Panel > Settings > Developer, create a key of type Test. Test keys start with pdm_test_.

  • Orders made with a test key have livemode set to false. Webhook bodies carry the same field.
  • The payment is simulated. No card is charged, and no money goes to the wallet or the provider.
  • Test orders do not count in seller totals. Shipping simulation is always on.
  • A test key sees only test orders. A live key sees only live orders.
curl -X POST https://terrific-grasshopper-146.convex.site/api/v1/orders \
  -H "Authorization: Bearer pdm_test_..." \
  -H "Content-Type: application/json" \
  -d '{ "title": "Test order", "price": 125000 }'

{ "id": "k17b2c...", "code": "PDM-4TW8RB", "whatsapp": { ... }, "status": "open", "livemode": false }

To go live, swap the key for a live key. Nothing else changes.

Idempotency-Key

Send the Idempotency-Key header on POST requests. After a network error you can retry safely, and no duplicate order or transaction is created. A request with the same key gets the first successful response.

  • Idempotent-Replayed: true tells you the response is a replay of the first request.
  • 409 means the first request is still running. Wait a moment and retry.
  • 422 means the same key was used with a different body or on another endpoint. Make a new key for each new request.
  • Error responses are not stored. You can fix the request and send it again with the same key.
curl -X POST https://terrific-grasshopper-146.convex.site/api/v1/orders \
  -H "Authorization: Bearer $PAYDM_API_KEY" \
  -H "Idempotency-Key: order-A-1042" \
  -H "Content-Type: application/json" \
  -d '{ "title": "Ceramic mug set", "price": 125000 }'

# Same key again: same response, plus
Idempotent-Replayed: true

Rate limits

If you send requests too fast, the API returns 429. The Retry-After header tells you how many seconds to wait. Do not retry before that time passes.

Retry-After is the real time left until the limit opens again.

HTTP/1.1 429 Too Many Requests
Retry-After: 12

{ "error": "..." }

Endpoints

MethodPathWhat it does
GET/api/v1/fees?price=&shipping=&feePayer=Calculates the service fee. No key needed.
POST/api/v1/ordersCreates an order and gives its order code. You show the code to the buyer or send it in a DM.
GET/api/v1/orders/:codeGets the status of an order by its code: open, claimed or paid.
POST/api/v1/orders/:code/closeCloses an unpaid order. The buyer can no longer pay with its code.
GET/api/v1/transactions?limit=&before=Lists paid orders, newest first. For the next page, send nextBefore as before.
GET/api/v1/transactions/:idGets one order.
POST/api/v1/transactions/:id/acceptConfirms a paid order. You must confirm within 48 hours.
POST/api/v1/transactions/:id/shipMarks the order as shipped.
POST/api/v1/transactions/:id/shipmentCorrects the carrier or tracking number of a shipped order.
POST/api/v1/transactions/:id/deliverMarks a digital order as delivered.

410 POST /links and GET /links/:slug were removed on 2026-11-13 and return 410. Use /orders instead.

Create an order

Required: title and price. Optional: shippingFee, deliveryDays, delivery (shipping, in_person, digital), feePayer (seller, buyer, split), deposit, depositDays, items, milestones, returnUrl, metadata. Put your own order number in metadata: the paid order and its webhooks carry the same metadata.

curl -X POST https://terrific-grasshopper-146.convex.site/api/v1/orders \
  -H "Authorization: Bearer $PAYDM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Ceramic mug set",
    "price": 125000,
    "shippingFee": 5000,
    "deliveryDays": 3,
    "delivery": "shipping",
    "feePayer": "seller",
    "metadata": { "orderRef": "A-1042" }
  }'
HTTP/1.1 201 Created

{
  "id": "k17b2c...",
  "code": "PDM-7K2Q9X",
  "whatsapp": {
    "number": "+908501234567",
    "url": "https://wa.me/908501234567?text=PDM-7K2Q9X"
  },
  "status": "open",
  "livemode": true
}

The response has no payment link. whatsapp gives PayDM's number and a wa.me link with the code typed in. If PayDM's number is not set, whatsapp is null.

Staged payment: pass 2 to 10 { title, amount } items in milestones. If you leave out price, PayDM uses the sum. If you send it, it must equal the sum. delivery must be digital or in_person. You cannot combine it with deposit, and no shipping fee applies. The buyer pays the first step. Each step is a separate order. In transaction objects, milestoneIndex shows the position of the step (starts at 0) and is null for orders that are not staged.

curl -X POST https://terrific-grasshopper-146.convex.site/api/v1/orders \
  -H "Authorization: Bearer $PAYDM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Logo design",
    "delivery": "digital",
    "feePayer": "seller",
    "milestones": [
      { "title": "Draft", "amount": 50000 },
      { "title": "Final files", "amount": 75000 }
    ],
    "returnUrl": "https://example.com/orders/42"
  }'

If you send returnUrl (https), the buyer can return to that address from the PayDM order page after paying.

Check an order's status

open: nobody wrote the code yet. claimed: a buyer wrote the code on WhatsApp and got the payment link. paid: the buyer paid and transactionId is set. The buyer's details come in the GET /transactions/:id response after payment.

curl https://terrific-grasshopper-146.convex.site/api/v1/orders/PDM-7K2Q9X \
  -H "Authorization: Bearer $PAYDM_API_KEY"

{
  "id": "k17b2c...",
  "code": "PDM-7K2Q9X",
  "livemode": true,
  "status": "paid",
  "transactionId": "jd7f3k...",
  "whatsapp": { "number": "+908501234567", "url": "https://wa.me/908501234567?text=PDM-7K2Q9X" },
  "title": "Ceramic mug set",
  "price": 125000,
  "shippingFee": 5000,
  "deliveryDays": 3,
  "delivery": "shipping",
  "feePayer": "seller",
  "deposit": null,
  "items": null,
  "active": true,
  "metadata": { "orderRef": "A-1042" },
  "createdAt": 1767000000000
}

Close an order

Close an unpaid order with a POST without a body. If the cart changed, close the old order before you create a new one. The buyer cannot pay a closed order: if they write the code on WhatsApp, PayDM tells them the order no longer takes payments. The response is the same as GET /orders/:code, with active set to false. An order that is already closed returns 200. A paid order returns 400.

curl -X POST https://terrific-grasshopper-146.convex.site/api/v1/orders/PDM-7K2Q9X/close \
  -H "Authorization: Bearer $PAYDM_API_KEY"

{ "id": "k17b2c...", "code": "PDM-7K2Q9X", "status": "open", "active": false, ... }

JavaScript example

const res = await fetch("https://terrific-grasshopper-146.convex.site/api/v1/orders", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.PAYDM_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": "order-A-1042",
  },
  body: JSON.stringify({
    title: "Ceramic mug set",
    price: 125000, // kuruş
    shippingFee: 5000,
    metadata: { orderRef: "A-1042" },
  }),
});
if (!res.ok) throw new Error((await res.json()).error);
const order = await res.json();

// Show the buyer the code and a WhatsApp button. Never a payment link:
// PayDM sends the link to the buyer on WhatsApp.
console.log(order.code); // "PDM-7K2Q9X"
console.log(order.whatsapp?.url); // "https://wa.me/...?text=PDM-7K2Q9X"

// Later: is it paid?
const status = await fetch(`https://terrific-grasshopper-146.convex.site/api/v1/orders/${order.code}`, {
  headers: { Authorization: `Bearer ${process.env.PAYDM_API_KEY}` },
}).then((r) => r.json());
// status.status: "open" | "claimed" | "paid", status.transactionId when paid

Old /links endpoints

Old integrations get 410 Gone. The POST /links body is the same as POST /orders. Use code and whatsapp instead of slug and url. Transaction and webhook bodies have orderCode instead of the link field.

curl -i -X POST https://terrific-grasshopper-146.convex.site/api/v1/links -H "Authorization: Bearer $PAYDM_API_KEY"

HTTP/1.1 410 Gone

{
  "error": "Payment links were replaced by order codes (2026-11-13). Use POST /api/v1/orders and GET /api/v1/orders/:code.",
  "replacement": "/api/v1/orders"
}

List orders

curl "https://terrific-grasshopper-146.convex.site/api/v1/transactions?limit=20" \
  -H "Authorization: Bearer $PAYDM_API_KEY"
{
  "data": [
    {
      "id": "jd7f3k...",
      "number": "#PD-1042",
      "status": "held",
      "title": "Ceramic mug set",
      "items": null,
      "currency": "TRY",
      "amounts": {
        "price": 125000, "shipping": 5000, "buyerFee": 0,
        "total": 130000, "commission": 3250, "sellerNet": 126750, "refunded": 0
      },
      "feePayer": "seller",
      "delivery": "shipping",
      "stage": null,
      "milestoneIndex": null,
      "buyer": { "name": "...", "email": "...", "phone": "...", "address": "..." },
      "shipment": null,
      "orderCode": "PDM-7K2Q9X",
      "metadata": { "orderRef": "A-1042" },
      "createdAt": 1767000000000,
      "paidAt": 1767000060000,
      "acceptedAt": null,
      "acceptDueAt": 1767172860000,
      "shippedAt": null,
      "deliveredAt": null,
      "autoReleaseAt": null,
      "closedAt": null
    }
  ],
  "nextBefore": 1767000060000
}

Confirm an order

When the buyer pays, the order becomes held and PayDM waits for the seller to confirm it. The deadline is the acceptDueAt field of the transaction object (milliseconds). If the deadline passes, the buyer gets the money back. Send POST /transactions/:id/accept without a body. An order that is already confirmed returns 200 with the same object, and nothing changes. If the status is not held, the API returns 400. After confirmation, and on orders that need no confirmation (the rest of a kapora, later steps of a staged payment), acceptDueAt is null.

curl -X POST https://terrific-grasshopper-146.convex.site/api/v1/transactions/<id>/accept \
  -H "Authorization: Bearer $PAYDM_API_KEY" \
  -H "Idempotency-Key: accept-A-1042"

{ "id": "jd7f3k...", "status": "held", "acceptedAt": 1767003600000, "acceptDueAt": null, ... }

Add shipping details

The response is the transaction object. Its orderCode field has the order code.

curl -X POST https://terrific-grasshopper-146.convex.site/api/v1/transactions/<id>/ship \
  -H "Authorization: Bearer $PAYDM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "carrier": "Yurtiçi Kargo", "trackingNumber": "123456789012" }'

{ "id": "jd7f3k...", "status": "shipped", "orderCode": "PDM-7K2Q9X", "shipment": { ... }, ... }

Correct shipping details

Corrects the carrier or tracking number of a shipped order (shipped or disputed). carrier and trackingNumber are required. A correction sends the transaction.shipment_updated webhook. If the seller bought a Geliver label through PayDM, the carrier sets the tracking number, so the request returns 400.

curl -X POST https://terrific-grasshopper-146.convex.site/api/v1/transactions/<id>/shipment \
  -H "Authorization: Bearer $PAYDM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "carrier": "Aras Kargo", "trackingNumber": "987654321098" }'

Digital delivery

Works on orders with delivery digital and status held. Put the download link, the code or a summary of the delivery in note (3 to 2000 characters). If the order is not confirmed yet, PayDM confirms it first. PayDM records the delivery and the status becomes delivered. The buyer gets a short inspection window, then the money goes to the seller. The API returns 400 for another delivery type, an order that is not ready, a missing or too long note, or an unpaid kapora balance.

curl -X POST https://terrific-grasshopper-146.convex.site/api/v1/transactions/<id>/deliver \
  -H "Authorization: Bearer $PAYDM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "note": "Download: https://example.com/files/logo-final.zip" }'

{ "id": "jd7f3k...", "status": "delivered", "deliveredAt": 1767090000000, ... }

GET /fees

curl "https://terrific-grasshopper-146.convex.site/api/v1/fees?price=125000&shipping=5000&feePayer=buyer"

{
  "price": 125000, "shipping": 5000, "feePayer": "buyer",
  "buyerPays": 133250, "buyerFee": 3250, "commission": 3250,
  "sellerReceives": 130000, "currency": "TRY"
}

Order statuses

  • held Payment secured
  • shipped Shipped
  • delivered Delivered
  • disputed Dispute
  • returning Return in progress
  • released Completed
  • refunded Refunded

Webhooks

Add your HTTPS address in Panel > Settings > Developer. Each time the status of a paid order changes, PayDM sends a POST request to it. The data field of the body is the same as the GET /transactions/:id response. data.orderCode is the order code and data.metadata is the metadata you sent with POST /orders. No webhook arrives before payment (open, claimed).

Events

  • transaction.held Payment secured
  • transaction.shipped Shipped
  • transaction.delivered Delivered
  • transaction.disputed Dispute
  • transaction.returning Return in progress
  • transaction.released Completed
  • transaction.refunded Refunded
  • transaction.shipment_updated Carrier or tracking number corrected
  • ping Test request sent from the panel
POST /your/webhook
PayDM-Signature: t=1767000060000,v1=5f2c...e91a
Content-Type: application/json

{
  "id": "k57a...",
  "type": "transaction.held",
  "created": 1767000060000,
  "data": {
    "id": "jd7f3k...",
    "status": "held",
    "orderCode": "PDM-7K2Q9X",
    "metadata": { "orderRef": "A-1042" },
    ...
  }
}

Verify the signature

Each request has a PayDM-Signature header: t is the timestamp (milliseconds) and v1 is the HMAC-SHA256 of "<t>.<body>" with your endpoint's secret (whsec_...). Compute it from the raw body, compare it with v1 and reject requests older than 5 minutes.

import crypto from "node:crypto";
import express from "express";

const app = express();
const SECRET = process.env.PAYDM_WEBHOOK_SECRET; // whsec_...
const MAX_AGE_MS = 5 * 60 * 1000;

// Keep the raw body: the signature is computed over the exact bytes.
app.post("/paydm/webhook", express.raw({ type: "application/json" }), (req, res) => {
  const header = req.get("PayDM-Signature") ?? "";
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2)));
  const t = Number(parts.t);
  const body = req.body.toString("utf8");

  const expected = crypto.createHmac("sha256", SECRET).update(`${parts.t}.${body}`).digest("hex");
  const valid =
    typeof parts.v1 === "string" &&
    parts.v1.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected));

  // Reject bad signatures and old (replayed) deliveries.
  if (!valid || !Number.isFinite(t) || Date.now() - t > MAX_AGE_MS) {
    return res.status(400).send("invalid signature");
  }

  const event = JSON.parse(body);
  // event.type: "transaction.held", "transaction.released", ... or "ping"
  // event.data: the order, same shape as GET /transactions/:id
  // Find your order by event.data.metadata (sent with POST /orders) or event.data.orderCode.
  res.sendStatus(200);
});

app.listen(3000);

Reply with 2xx within 10 seconds. Failed requests are retried after 1, 5, 30, 120 and 360 minutes. The same event can arrive more than once: use the id in the body to drop duplicates.

MCP server

AI assistants like Claude and Cursor can use PayDM through MCP. The server runs over Streamable HTTP and uses the same API key.

URL: https://terrific-grasshopper-146.convex.site/mcp

Authorization: Bearer pdm_...

Tools

  • create_order Creates an order and gives its order code. It gives no payment link.
  • close_order Closes an unpaid order by its code.
  • list_transactions Lists paid orders.
  • get_transaction Gets one order.
  • accept_transaction Confirms a paid order.
  • ship_transaction Marks an order as shipped with the shipping details.
  • update_shipment Corrects the shipping details of a shipped order.
  • deliver_transaction Marks a digital order as delivered, with a note.
  • calculate_fee Calculates what the buyer pays and what the seller receives.

Claude Code

claude mcp add --transport http paydm https://terrific-grasshopper-146.convex.site/mcp \
  --header "Authorization: Bearer $PAYDM_API_KEY"

Claude Desktop (with mcp-remote)

{
  "mcpServers": {
    "paydm": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://terrific-grasshopper-146.convex.site/mcp", "--header", "Authorization:${PAYDM_AUTH}"],
      "env": { "PAYDM_AUTH": "Bearer pdm_..." }
    }
  }
}

Cursor (~/.cursor/mcp.json)

{
  "mcpServers": {
    "paydm": {
      "url": "https://terrific-grasshopper-146.convex.site/mcp",
      "headers": { "Authorization": "Bearer pdm_..." }
    }
  }
}

Don't put your key in shared files or repositories. If it leaks, revoke it in the panel and create a new one.

OpenAPI definition

The OpenAPI file describes every endpoint. Postman and Insomnia can import this URL.

/openapi.json