# 1. Create Payment

## Initiate Payment / QR-Based

<mark style="color:green;">`POST`</mark> `{{Base Adres}}/api/paywall/apm/pay/qr/generate`

{% hint style="info" %}
**Important**: To use the APM Initiate Payment (QR-Based) service, you need to include the '**apikeypublic**' and '**apiclientpublic**' parameters in the 'Header' field.

\
[<mark style="color:green;">**PaymentAPI Address**</mark>](/payment-orchestration-integration-document/environment.md)
{% endhint %}

**The headers parameters that need to be sent to the service are as follows:**

<table><thead><tr><th width="178">Parameter</th><th width="92">Type</th><th width="143">Compulsory</th><th width="403">Description</th></tr></thead><tbody><tr><td>apikeypublic</td><td>string</td><td>Yes</td><td>The Public Key obtained from the merchant panel.</td></tr><tr><td>apiclientpublic</td><td>string</td><td>Yes</td><td>The Public Client obtained from the merchant panel.</td></tr></tbody></table>

**The parameters that need to be sent to the service in the BODY are as follows:**

<table><thead><tr><th width="245">Parameter</th><th width="104">Type</th><th width="183">Compulsory</th><th width="336">Description</th></tr></thead><tbody><tr><td>ApmKey</td><td>int</td><td>Yes (Conditional)</td><td><p>The Key information of the APM provider.</p><p><br>Bkz: <a href="/pages/SBmzwsUcnHQe4CKnuSWt">APM</a></p></td></tr><tr><td>ApmConnectionId</td><td>int</td><td>Yes (Conditional)</td><td>It is the Id (identifier) information obtained from the APM listing service connections. In scenarios where you dynamically generate your payment screen, you can initiate payments through the relevant connection using this parameter.</td></tr><tr><td>CurrencyId</td><td>int</td><td>Yes</td><td>The currency in which the payment is to be processed.<br><br>Bkz: <a href="/pages/bahfUMz1dqpN1ZCnpVtM">Currencies</a></td></tr><tr><td>MerchantUniqueCode</td><td>string</td><td>Yes</td><td>The unique identifier generated for the payment.</td></tr><tr><td>Amount</td><td>decimal</td><td>Yes</td><td>The payment amount</td></tr><tr><td>Description</td><td>string</td><td>Yes</td><td>Description of the payment. Depending on the provider, this description may be displayed on the payment screen.</td></tr><tr><td>Provider</td><td>object</td><td>No</td><td>This is used when there are specific information requirements from the provider. It is not currently active for QR-based payments and can be passed as null.</td></tr><tr><td>UserRedirectUrl</td><td>string</td><td>No</td><td>This is the address provided for redirection in wallet applications where scanning the QR code and successful payment may lead the user.</td></tr><tr><td>MerchantSuccessBackUrl</td><td>string</td><td>Yes</td><td>This is the address where the successful result of the payment will be reported via POST.</td></tr><tr><td>MerchantFailBackUrl</td><td>string</td><td>Yes</td><td>This is the address where the unsuccessful result of the payment will be reported via POST.</td></tr></tbody></table>

#### <mark style="color:orange;">Payer</mark>

<table><thead><tr><th width="221">Parameter</th><th width="120.421875">Type</th><th width="162.84375">Compolsory</th><th width="336">Description</th></tr></thead><tbody><tr><td>Fullname</td><td>string</td><td>Yes (Conditional)</td><td>Payer full name</td></tr><tr><td>CardNumber</td><td>string</td><td>Yes (Conditional)</td><td>Payer card number (e.g., meal card, etc.)</td></tr><tr><td>CardId</td><td>string</td><td>Yes (Conditional)</td><td>Payer card identity number (works if stored in the APM provider)</td></tr><tr><td>Phone</td><td>string</td><td>Yes (Conditional)</td><td>Payer phone number</td></tr><tr><td>Email</td><td>string</td><td>Yes (Conditional)</td><td>Payer email address</td></tr><tr><td>UserIdentity</td><td>string</td><td>Yes (Conditional)</td><td>Payer identity information in your system (TCKN/VKN)</td></tr><tr><td>ConsumerIdentity</td><td>string</td><td>Yes (Conditional)</td><td>Payer identity information in your system (UserId)</td></tr><tr><td>Birthday</td><td>DateTime</td><td>No</td><td>Payer date of birth</td></tr><tr><td>CardAlias</td><td>string</td><td>Yes (Conditional)</td><td><strong>Label of the card belonging to the payer</strong> (Masterpass)</td></tr></tbody></table>

**A sample JSON to be sent to the service is as follows:**

{% tabs %}
{% tab title="JSON" %}
{% code lineNumbers="true" %}

```json
{
    "ApmKey": "ApmKey",
    "ApmConnectionId": null, // Eğer bağlantı kimlik Id'sini biliyorsanız
    "CurrencyId": 1,
    "MerchantUniqueCode": "55555454544333545435",
    "UserRedirectUrl": "https://merchantsite.com/?paymentId=13114141",
    "MerchantSuccessBackUrl": "https://merchantsite.com/callback/success",
    "MerchantFailBackUrl": "https://merchantsite.com/callback/fail",
    "Amount": 1,
    "Description": "PW test",
    "Payer": {
        "Fullname": "",
        "CardNumber": "",
        "CardId": "",
        "Phone": "",
        "Email": "",
        "UserIdentity": "",
        "ConsumerIdentity": "",
        "Birthday": null
    },
    "Products": [
        {
            "ProductId": "123",
            "ProductName": "Name",
            "ProductCategory": "Food",
            "ProductDescription": "Description of Product",
            "ProductAmount": 1
        }
    ]
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

**The parameters returned from the service are as follows:**

<table><thead><tr><th width="189">Parameter</th><th width="100.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>ErrorCode</td><td>int</td><td>Error code. Returns '0' if the operation is successful</td></tr><tr><td>Result</td><td>bool</td><td>Returns true or false. If the operation is successful, it returns 'true'</td></tr><tr><td>Message</td><td>string</td><td>If the operation fails, this is the message describing the error, with language support based on the locale parameter</td></tr><tr><td>Body</td><td>nesne</td><td>If the operation fails, this is the error detail object</td></tr><tr><td>Body:FormatType</td><td>int</td><td>Indicates the format of the QRr<br><br>See: <a href="/pages/pIaJR19tmnY4DlK3NA0k">Formats</a></td></tr></tbody></table>

{% tabs %}
{% tab title="JSON" %}

```json
{
    "ErrorCode": 0,
    "Result": true,
    "Message": "",
    "Body": {
        "ApmKey": "ProviderKey",
        "ApmConnectionId": 62,
        "ApmTransactionId": 11676,
        "UniqueCode": "273162b1-ffae-45c6-9e22-724ca27f826a",
        "MerchantUniqueCode": "55555454544333545435",
        "Amount": 1.0,
        "QrDetail": {
            "FormatType": 1,
            "Content": "%BASE64CONTENT%"
        }
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.paywall.one/payment-orchestration-integration-document/alternative-methods-apm/qr-based/1.-create-payment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
