• Multi Bank Virtual POS

Sales Transaction General Description

The sales transaction allows you to receive payment via Tami, either as a single payment or in installments. Payment is collected using the card details you provide in the request, and once the transaction is processed, Tami informs you in the response whether the sale was successful or unsuccessful.

Tami Test/Prod Portal Information

Before going live with your integration, you can use the Tami Test Portal to test without creating any real money movement.

Test Portal address: https://sandbox-portal.tami.com.tr

If you would like to log in to the test portal to view your transactions and perform cancellations/refunds when needed, a dedicated test portal user must be defined for you. You can reach our support team for this at TeknikDestek@tami.com.tr.

Prod Portal address: https://portal.tami.com.tr

For your production environment credentials, you can register via this address or contact our ecommerce support team.

Tami Test / Prod API Users

Two different environments are used when integrating with Tami’s APIs: Sandbox (Test) and Prod (Production).

  • Test (Sandbox) Environment

This lets you test your integration without creating any real money movement. Your requests are sent to the test endpoints and can be tracked via the Tami Test Portal above.

Below are the credentials you can use to send a test request via the API in the sandbox environment:

Field Value
Merchant Number 77006950
Terminal Number 84006953
Secret Key 0edad05a-7ea7-40f1-a80c-d600121ca51b
  • Prod (Production) Environment

This is the environment where live transactions take place and real payments are collected.

For your production environment credentials, you can register via https://portal.tami.com.tr or contact our e-commerce support team.

Generating the PG Auth Token

For requests sent to Virtual POS services, the PG-Auth-Token field must be included in the header.

The PG-Auth-Token is generated in the following format:

MerchantNumber:TerminalNumber:Hash

The Hash value is generated by concatenating your Merchant Number, Terminal Number, and Secret Key (in that order), hashing the result with the SHA-256 algorithm, and converting the result to Base64 format.

Below is a sample Java code block demonstrating this calculation:

public class SHA256Example {\n public static String sha256(Long merchantNumber, Long terminalNumber, String secretKey) {\n String text = merchantNumber.toString() + terminalNumber.toString() + secretKey;\n try {\n MessageDigest digest = MessageDigest.getInstance(\"SHA-256\");\n byte[] hash = digest.digest(text.getBytes(StandardCharsets.UTF_8));\n String sha256Hex = DatatypeConverter.printBase64Binary(hash);\n return sha256Hex;\n } catch (NoSuchAlgorithmException e) {\n e.printStackTrace();\n return null;\n }\n }\n}\n

You can generate the PG-Auth-Token header value by combining the Hash value you generated with your Merchant Number and Terminal Number in the format above.

Sales Transaction API Information

The endpoint information to be used for the sales transaction is below:

 

You must send your requests using the POST method to the endpoint appropriate for the environment you are working in (test/production).

How the Sales Request Is Sent

For non-3D Virtual POS transactions, the values in the body of the request sent are not expected to be transmitted in plain form; instead, a single signed and encrypted value is expected. This value is sent in the signedRequest field.

The response returned by Tami is likewise signed and encrypted, and is delivered in the signedResponse field. Detailed information on how to decode the signedResponse value is provided in the headings below.

In addition, the following information must also be sent in the header:

  • PG-Auth-Token: How this is calculated is explained above under “Generating the PG Auth Token.”
  • CorrelationId: A variable value that must be unique for each request.
  • PG-Api-Version: Must be sent as v4.

Parameters to Be Signed and Encrypted, with Descriptions

For non-3D Cash/Installment Sales transactions on the Virtual POS, the values in the request body are not sent in plain form; the encrypted value is sent in the signedRequest field.

The signedRequest value is obtained by encrypting a request constructed from the fields listed in the tables below. If any field marked as mandatory (M) is missing or sent incorrectly, the transaction will result in an error.

The fields to be included in signedRequest, along with their rules, are specified in the tables below. Abbreviations: (O) Optional, (M) Mandatory, (C) Conditional.

Main parameters

Parameter Name Format Length O/M/C Description
orderId String (2-36) M A unique communication identifier used in the communication between Tami and the customer for the payment request. This value must be unique for the merchant and POS pair. The orderId field may contain alphanumeric characters along with only the ‘-’ and ‘’ characters. However, it must not contain consecutive ‘-’ or ‘’ characters.
amount Decimal   M The transaction amount. The decimal separator must be a period (.).
currency String 3 M Indicates the currency code of the transaction. Example: TRY must be sent for Turkish Lira.
installmentCount Number   M The installment information for the transaction to be made. For a single-payment transaction, 1 must be sent. Sending 0 is not accepted.
paymentGroup String   M Payment group; default is PRODUCT.
paymentChannel enum   O Payment channel. Valid values are provided within the enum: WEB, MOBILE, MOBILE_WEB, MOBILE_IOS, MOBILE_ANDROID, MOBILE_WINDOWS, MOBILE_TABLET, MOBILE_PHONE
callbackUrl String   C Mandatory if the transaction is to be performed as 3D. This is the address to which the 3D authentication result will be returned. It must be an address belonging to the merchant.
card Object   M Contains the details of the card used for the payment (cardholder name, card number, expiry month/year, and CVV).
billingAddress Object   O Contains the billing address details. If provided, it is stored as the billing address in the transaction record.
shippingAddress Object   O Contains the delivery address details. It is recommended to send this field for orders that require physical delivery.
buyer Object   M Contains information about the buyer on the merchant side.
basket Object   O Contains the basket details of the order, namely the list of purchased items and their details.

card

Parameter Name Format Length O/M/C Description
cvv String   M The security code of the card from which payment will be collected.
expireMonth Number (1-12) M The expiration month of the card from which payment will be collected.
expireYear Number 4 M The expiration year of the card from which payment will be collected.
holderName String 30 M The name and surname of the cardholder of the card from which payment will be collected.
number String (5-35) M The number of the card from which payment will be collected.

billingAddress

Parameter Name Format Length O/M/C Description
address String 400 O The merchant’s billing address information.
emailAddress String   O The merchant’s email information
city String 30 O The city information for the merchant’s billing address.
companyName String 100 O The merchant’s trade name information.
country String 50 O The country information for the merchant’s billing address.
contactName String 30 O The name and surname information for the merchant’s billing address.
phone String   O The mobile number of the recipient on the merchant side.
zipCode String 15 O The postal code of the merchant’s billing address.
district String 50 O The district information of the merchant’s billing address.

shippingAddress

Parameter Name Format Length O/M/C Description
address String 400 O The merchant’s shipping address information.
emailAddress String   O The merchant’s email information
city String 30 O The city information for the merchant’s shipping address.
country String 50 O The country information for the merchant’s shipping address.
contactName String 30 O The name and surname information for the merchant’s shipping address.
zipCode String 15 O The postal code information of the merchant’s shipping address.
district String 50 O The district information of the merchant’s shipping address.

buyer

Parameter Name Format Length O/M/C Description
ipAddress String   M The IP address of the buyer on the merchant side. The buyer’s actual IP address must be transmitted.
buyerId String 50 M The buyer’s ID information on the merchant side.
name String 30 M The buyer’s first name information on the merchant side.
surName String 30 M The buyer’s surname information on the merchant side.
identityNumber String 11 O The buyer’s identity (national ID) number on the merchant side.
city String 50 O The buyer’s city information on the merchant side.
country String 50 O The buyer’s country information on the merchant side.
emailAddress String   M The buyer’s email information on the merchant side. The email address must be a valid and reachable address belonging to the buyer.
phoneNumber String   M The buyer’s mobile number on the merchant side
registrationAddress String 400 O The buyer’s registration address on the merchant side.
zipCode String 15 O The buyer’s postal code on the merchant side.
registrationDate Date   O The buyer’s registration date on the merchant side. The date format must be in the form 2015-09-17 23:45:06.
lastLoginDate Date   O The buyer’s last login date on the merchant side. The date format must be in the form 2015-09-17 23:45:06.

basket

Parameter Name Format Length O/M/C Description
basketId String 50 C The ID of the basket on the merchant side. If an item is sent within the basket, sending basketId becomes mandatory.

basket/basketItems

Parameter Name Format Length O/M/C Description
itemId String 50 C The ID of the item in the basket on the merchant side. If an item is sent within the basket, sending itemId becomes mandatory.
itemType String 50 C The type of the item in the basket on the merchant side. Valid enum values: PHYSICAL and VIRTUAL. If an item is sent within the basket, sending itemType becomes mandatory.
name String 50 C The name of the item in the basket on the merchant side. If an item is sent within the basket, sending name becomes mandatory.
category String 50 O The category of the item in the basket on the merchant side.
subCategory String 100 O The subcategory of the item in the basket on the merchant side.
unitPrice Decimal min 0.0 O The unit price of the item in the basket on the merchant side.
totalPrice Decimal min 0.0 C The total price of the item in the basket on the merchant side. It cannot be 0 or less than 0; the sum of the amounts must equal the basket amount (amount). UnitPrice * numberOfProducts must equal totalPrice. If an item is sent within the basket object, sending totalPrice becomes mandatory.
numberOfProducts Number 1-99999 O The quantity of the item in the basket on the merchant side.

 

Generating the Request Token (signedRequest)

For security purposes, information in requests sent by merchants is not sent in plain form. Instead, the request body is expected to contain the signedRequest value, which is generated by signing and encrypting a request built according to the fields requested by Tami.

For a detailed explanation of the signedRequest generation steps and code samples, please see the Generating the Request Token (signedRequest) page.

API Request Example

{\n\"signedRequest\":\n\"eyJjdHkiOiJKV1QiLCJlbmMiOiJBMjU4R0NNIiwiYWxnIjoiZGlyIn0..7DhNYThZtquawbuf.7safki-ZefDRAL_H5pCvskWxaBUFrYx6XQKnEJUuHc-s5LJSmL-EgZz2KejyIWicjzbTBuyCkEUpu1ckRWHicpLTY5XqPm_CuZz6wkwddXgjKLMFt2MO7aL7EdjZAlXdT8A3UfKFO2sIPD2F9X-VehraeVzh9NE8FamNq3LTSolm0m5ciDUtraq4qi...\"\n}

The signedRequest value above has been shortened for example/test purposes. A real request contains a much longer JWE (encrypted token) value.

API Response Example

Response for a successful transaction:

{\n\"signedResponse\":\n\"eyJraWQiOiIxNTAxZTI1MMS2ODkgUqoUuUjBmUiIiwidGKGGKSIjp7InN1Y1Y2VdWiZ1ZXQiOiI3InZuIiwiYWxnIjoiZGly...\"\n}

Response Parameters and Descriptions

When the transaction is successful, the response delivered by Tami contains only the signedResponse field. All other fields listed in the table below (success, systemTime, correlationId, orderId, amount, card information, etc.) are not present in plain form in this case; all of them are carried in encrypted form inside the signedResponse field. You can only access these fields once the signedResponse value has been decoded. The decoding steps are described in the next heading.

When the transaction is unsuccessful, signedResponse is not returned at all; in this case success, systemTime, correlationId, errorCode, errorMessage, and errorGroup fields are returned directly in plain form.

Parameter Name Format Where It Appears Description
success String Inside signedResponse (plain if transaction unsuccessful) If true, the sale was successful; if false, an error was received. Error details will be shared in the error code and error message fields.
systemTime dateTime Inside signedResponse (plain if transaction unsuccessful) Indicates the date and time the response was generated by Tami.
correlationId String Inside signedResponse (plain if transaction unsuccessful) Transaction number
orderId String Inside signedResponse Order number
transactionDate dateTime Inside signedResponse Indicates the date and time the transaction took place.
amount Number Inside signedResponse Transaction amount
currency String Inside signedResponse Transaction currency
card/binNumber String Inside signedResponse First 8 digits of the card
card/maskedNumber String Inside signedResponse Masked card number
card/cardBrand String Inside signedResponse Card brand
card/cardOrganization String Inside signedResponse Card organization
card/cardType String Inside signedResponse Card type
errorCode String Plain (only when success:false) Error code
errorMessage String Plain (only when success:false) Error message
bankAuthCode String Inside signedResponse Bank authorization code
bankReferenceNumber String Inside signedResponse Retrieval reference number (RetRef) for the transaction
errorGroup String Plain (only when success:false) Indicates the group of the relevant error. Merchants can manage their own rules by making use of the error code and error groups.

 

 

Decoding the Response Token (signedResponse)

The steps required to decode the value delivered in the signedResponse field in order to access the parameters above will be provided in this section.

For a detailed explanation of the decoding steps and code samples, please see the Decoding the Response Token (signedResponse) page.

Code Examples

Below are links to code samples written in various programming languages. Through the link for your preferred programming language, you can examine in detail code written with pre-defined example values.

These samples contain code covering the relevant transaction type, and since they are written in different languages, it is also possible to observe various approaches and practices. This gives you the opportunity to work with clearer and more authentic examples suited to your preferred programming language.

  • For C# Code Samples, click here.
  • For VB.Net Code Samples, click here.
  • For Java Code Samples, click here.
  • For PHP Code Samples, click here.
  • For NodeJS Code Samples, click here.

Please note that these samples are written with pre-defined values, and the necessary adaptation and security measures may need to be taken for their use in real projects.

Error Codes

You can access the list of error codees on this page.

Test Cards

You can access the list of test cards on this page.

Frequently Asked Questions

Key Value
CorrelationId Correlation{{randomNumber}}
PG-Auth-Token {{merchantNumber}}:{{terminalNumber}}:{{hash}}
PG-Api-Version v4
In the header section, correlationId and PG-Auth-Token parameters are expected to be transmitted. correlationId must be transmitted as a string unique value for each transaction. PG-Auth-Token parameter consists of merchantNumber, terminalNumber and hash information of the merchant as stated in the table. For hash information, merchantNumber, terminalNumber and secretKey information of the merchant is obtained by hashing with sha256 and converting it to string.
Response
{
    "errorCode": 4003,
    "errorMessage": " Inconsistent hash value sent in header",
    "success": false,
    "systemTime": "2024-03-30T12:08:40.526596076",
    "correlationId": "correlation9975"
}
"PG-Auth-Token" parameter should be passed in the header in all sales, cancellation/refund, pre-authorization, pre-authorization closure, 3D sales and 3D sales completion requests.
This information consists of "merchantNumber:TerminalNumber:Hash" information of the merchant. The hash information is expected to be calculated according to the requested values and added to the PG-Auth-Token parameter.

We are here for all your questions and support requests.

Ask a Question Ask a Question