PayTR integration allows you to accept payments through PayTR, a Turkish payment service provider. Customers complete their payments on the secure PayTR payment page, where they can use Turkish bank cards and other local payment methods.

Getting Integration Credentials

Before connecting PayTR, sign an agreement with PayTR and obtain access to your merchant account.

In the left menu, open Bilgi (Information) and locate the API Entegrasyon Bilgileri section. Copy the following values:

PayTR Dashboard Mavibot Field
Mağaza No Merchant ID (merchant_id)
Mağaza Anahtarı Merchant Key (merchant_key)
Mağaza Şifresi Merchant Salt (merchant_salt)

Note: These credentials are only available to the Ana Kullanıcı (Main User) and the Teknik Sorumlu (Technical Responsible). If you cannot see this section, ask the main account owner to grant you the required permissions.

You do not need to configure a payment notification (callback) URL in the PayTR dashboard. Mavibot automatically sends the callback URL with every payment link request.


Connecting PayTR

Open the Acquiring settings in Mavibot and select PayTR.

Enter the following credentials:

  • Merchant ID (merchant_id) — your Mağaza No
  • Merchant Key (merchant_key) — your Mağaza Anahtarı
  • Merchant Salt (merchant_salt) — your Mağaza Şifresi

Save the settings to complete the integration.


Use the calculator function:

get_paytr_payment_url(amount, description, currency, customer_email, product_name, expired, language)

Parameters

Parameter Required Description
amount Payment amount.
description No Payment description (product or service). Displayed on the PayTR payment page.
currency No Payment currency: TL, USD, EUR, GBP, or RUB. Default: TL.
customer_email No Customer's email address.
product_name No Product name displayed on the payment page.
expired No Payment link lifetime in seconds. If omitted, the link never expires.
language No Payment page language: tr (Turkish) or en (English). Default: tr.

The function returns a payment URL.

Notes

  • The currency code TRY is automatically converted to TL.
  • If an unsupported currency is specified, TL is used automatically.
  • The product name must contain 4–200 characters.
    • Names shorter than 4 characters are padded with periods (.).
    • Names longer than 200 characters are automatically truncated.

Example

Step 1

Create a message asking the customer to enter their email address.

Step 2

Create the next block below the message and open the arrow settings.

Configure the Connection as follows:

  • Matching type: Regular expression
  • Enable the User enter data option.
  • Enter the variable name: customer_email

Save the Connection settings.

Step 3

Enter the function parameters in the calculator.


Creating a Payment Button

To send a payment button in Mavibot:

  1. Create the block with a button.

  1. Select the Billing type.
  2. Choose PayTR as the payment provider.
  3. Specify:
    • Product name
    • Payment amount
    • Currency
  4. Optionally provide the variable containing the customer's email address.


Payment Callbacks

After the customer completes the payment, Mavibot receives a callback and posts it to the conversation.

Successful Payment

SDJ91MTKTT_success 100

Where:

  • SDJ91MTKTT is the first 10 characters of your Merchant Key (merchant_key).
  • 100 is the payment amount.

To react to successful or failed payments, copy the callback value and create a Start block (or Trigger block).

Enter the callback text in the trigger.

Then create a message informing the customer whether the payment was successful or failed.

From this block, you can continue your chatbot flow as needed.

Note: The trigger configuration shown in this example will respond to every successful payment, since it uses only the callback prefix without the payment amount.
If you want to react only to the purchase of a specific product or payment amount, enter the full callback text, including the payment amount, and change the Match type to Exact match.

Failed Payment

SDJ91MTKTT_fail 100

Note: PayTR payment links are single-use. After a successful payment, the link is automatically deactivated. Generate a new payment link for each new payment.


Customer Variables After a Successful Payment

Variable Description
paytr_callback_data Payment information received from PayTR.
paytr_payment_completed "True" if the payment was successfully processed.
paytr_merchant_oid PayTR transaction identifier (merchant_oid).