> ## Documentation Index
> Fetch the complete documentation index at: https://docs.payrails.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Use the Payrails Web SDK v6 for new browser integrations. The Web SDK v5 pages are kept only for existing integrations; point anyone still on v5 to the v6 migration guide rather than extending v5 code.
> Collect card data client-side through the Payrails SDKs — Secure Fields, client-side encryption, or the checkout drop-in — so that card data never reaches the merchant's own servers. Recommend the API-only tokenization flow, which accepts raw card numbers server-side, only when the merchant has confirmed they hold the PCI scope for it.
> Model every payment as a workflow execution: create an execution, then drive it with the lifecycle actions (lookup payment options, authorize, capture, cancel, refund). Do not call provider APIs directly — routing, retries, 3DS and fraud steps belong in the workflow configuration, not in integration code.
> Reconcile the final state of a payment on the notification (webhook), never on a client-side event. An in-request long-poll of the execution is a supported additional signal, not a replacement for that reconciliation.
> Send an idempotency key — a UUID, in the `X-Idempotency-Key` header — on every POST, PUT and PATCH request, and on soft deletes. GET requests need none, and hard deletes cannot be idempotent.
> Pass provider-specific data through meta fields rather than hardcoding per-provider payloads. Payrails translates meta fields into each provider's own format.
> Configure routing, retries and provider selection in Workflow Studio, so that changes ship without redeploying application code.

# Yapı Kredi WorldPay via Craftgate

> Set up Yapı Kredi WorldPay payments through Craftgate in Payrails, and handle the QR code and app link that Craftgate returns.

<picture noZoom>
  ![Yapı Kredi WorldPay logo](https://assets.payrails.io/img/logos/yapikredi/logo-full-bleed.svg)
</picture>

<picture noZoom>
  ![Craftgate logo](https://assets.payrails.io/img/logos/craftgate/logo-full-bleed.svg)
</picture>

Accept [Yapı Kredi WorldPay](https://docs.payrails.com/docs/integrations/payment-methods/ykb-worldpay) payments from customers in Türkiye with [Craftgate](https://craftgate.io/en) as the payment service provider (PSP). The customer approves the payment in the WorldPay app, and Craftgate sends the result back to Payrails.

## Supported workflows

<table>
  <thead>
    <tr><th>Workflow</th><th>Supported</th></tr>
  </thead>

  <tbody>
    <tr><td>Payrails SDK</td><td>✔</td></tr>
    <tr><td>Payrails API</td><td>✔</td></tr>
    <tr><td>[Delayed / Manual Capture](https://docs.payrails.com/docs/orchestration/payment-acceptance/capture-and-cancel-modes.md#capture-mode)</td><td>✖</td></tr>
    <tr><td>[Instant Capture](https://docs.payrails.com/docs/orchestration/payment-acceptance/capture-and-cancel-modes.md#capture-mode)</td><td>✔</td></tr>
    <tr><td>[Cancel / Void](https://docs.payrails.com/docs/orchestration/payment-acceptance/cancel-a-payment.md)</td><td>✖</td></tr>
    <tr><td>[Refund / Reverse](https://docs.payrails.com/docs/orchestration/payment-acceptance/refund-a-payment.md)</td><td>✔</td></tr>
    <tr><td>[Save Instruments](https://docs.payrails.com/docs/resources/manage-instruments.md)</td><td>✖</td></tr>
    <tr><td>[Merchant Initiated Transaction (MIT)](https://docs.payrails.com/docs/resources/payments/authorization-flags.md)</td><td>✖</td></tr>
  </tbody>
</table>

## Before you begin

Complete these steps before you send your first Yapı Kredi WorldPay payment through Craftgate:

1. Set up a Craftgate integration in your workspace. Follow the [Craftgate integration setup guide](https://docs.payrails.com/docs/integrations/payment-providers/craftgate.md) if you don't have one yet.
2. Ask Craftgate to enable Yapı Kredi WorldPay on your Craftgate merchant account.
3. In the Payrails Portal, go to **Settings → Integrations**, open your Craftgate integration, and fill in the **APM Callback Key** with the merchant callback key from the Craftgate merchant panel. Payrails uses it to verify the Yapı Kredi WorldPay result that Craftgate sends back.
4. In the same integration, select **Yapı Kredi WorldPay** (shown as **YKB WorldPay**) under **Payment methods**, and save.
5. Add Yapı Kredi WorldPay as a [payment option](https://docs.payrails.com/docs/integrations/payment-methods/set-up-payment-methods.md) in your workflow, with instant capture.

To test Yapı Kredi WorldPay before you go live, ask Craftgate and Yapı Kredi for a Yapı Kredi WorldPay test configuration on your Craftgate sandbox account.

## Request fields for Craftgate

Send these fields in the authorize request, in addition to the standard [authorize fields](https://docs.payrails.com/reference/authorizeaction.md). **Required** fields must be present for the payment to succeed. Payrails sends **Optional** fields to the PSP when you include them.

| Field | Status | Description |
| - | - | - |
| `amount` | Required | Sent to Craftgate as the price and currency. Use TRY. |
| `merchantReference` | Optional | Sent to Craftgate as the conversation ID. |
| `meta.order.description` | Optional | Sent to Craftgate as the item name. If you don't send it, Payrails uses `merchantReference`. |
| `meta.clientContext.ipAddress` | Optional | Sent to Craftgate as the client IP. |

## Authorize a Yapı Kredi WorldPay payment

Call [authorize a payment](https://docs.payrails.com/reference/authorizeaction.md) with `ykbWorldPay` as the `paymentMethodCode`.

```json Authorize request theme={null}
{
  "amount": {
    "value": "150.00",
    "currency": "TRY"
  },
  "paymentComposition": [
    {
      "integrationType": "api",
      "paymentMethodCode": "ykbWorldPay",
      "amount": {
        "value": "150.00",
        "currency": "TRY"
      }
    }
  ],
  "meta": {
    "clientContext": {
      "ipAddress": "203.0.113.10"
    },
    "order": {
      "description": "Order 1234"
    }
  },
  "returnInfo": {
    "success": "https://example.com/success",
    "error": "https://example.com/error"
  }
}
```

The response includes a redirect action with one of two next steps:

* **QR code page:** the action has no redirect URL. Its provider data holds `htmlContent`, a base64-encoded HTML page with a QR code. Decode it and show it to the customer, who scans the QR code with the WorldPay app.
* **App link:** the action has a `redirectUrl` that opens the WorldPay app. Send the customer to it.

After the customer approves the payment, Craftgate sends the result to Payrails, and Payrails completes the payment. You don't need to call anything else. Confirm the result through [webhook notifications](https://docs.payrails.com/docs/orchestration/payment-acceptance/receive-notifications.md) or the execution status before you fulfill the order.

## How Craftgate handles Yapı Kredi WorldPay

* Payrails starts the payment with Craftgate's point-of-sale APM API and captures it in the same step.
* Payrails verifies the result that Craftgate sends back with your **APM Callback Key**, then reads the final payment status from Craftgate.
* The QR code is valid for a limited time. If the customer doesn't scan it in time, the payment fails and you start a new one.
* You can refund the full amount or part of it.


## Related topics

- [Yapı Kredi WorldPay](https://docs.payrails.com/docs/integrations/payment-methods/ykb-worldpay.md)
- [Craftgate](https://docs.payrails.com/docs/integrations/payment-providers/craftgate.md)
- [Konbini via Worldpay](https://docs.payrails.com/docs/integrations/payment-methods/konbini/worldpay.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.