### PREAUTH Request Data Example Source: https://github.com/paytenasee/paratika-samples/blob/master/paratikaphp/src/srcproject/README.md This is an example of the data payload required for a PREAUTH operation. Ensure all fields are correctly formatted and populated. ```text ACTION=PREAUTH&AMOUNT=13.79&CURRENCY=TRY&MERCHANTPAYMENTID=MPID-59f1d5feaa99d7.08979477&MERCHANT=10000000&MERCHANTUSER=apiuser%40testmerchant.com&MERCHANTPASSWORD=Pluto321%60&CUSTOMER=MPID-59f1d5feaa9a59.35380044&CUSTOMERNAME=Aydonat+Ayd%C4%B1nlar&CUSTOMEREMAIL=mghUzjPn%40email.com&CUSTOMERIP=127.0.0.1&CUSTOMERPHONE=%2B903120000011&CUSTOMERBIRTHDAY=19-04-1969&CUSTOMERUSERAGENT=Mozilla%2F5.0+%28Windows+NT+6.1%3B+WOW64%3B+rv%3A56.0%29+Gecko%2F20100101+Firefox%2F56.0&NAMEONCARD=Aydonat+Ayd%C4%B1nlar&CARDPAN=4022774022774026&CARDEXPIRY=12.2030&CARDCVV=000&BILLTOADDRESSLINE=%C3%87%C3%B6i%C5%9F%C3%BC%C4%9F%C4%B1+Plaza%2C+Ostim+No%3A83%2F9%2C+Yenimahalle&BILLTOCITY=Ankara&BILLTOCOUNTRY=T%C3%BCrkiye&BILLTOPOSTALCODE=06000&BILLTOPHONE=%2B903120000001&SHIPTOADDRESSLINE=Plaza+%C3%87%C3%96%C4%B0%C5%9E%C3%9C%C4%9EI%2C+Ostim+No%3A83%2F9%2C+Yenimahalle&SHIPTOCITY=Ankara&SHIPTOCOUNTRY=T%C3%BCrkiye&SHIPTOPOSTALCODE=06000&SHIPTOPHONE=%2B903120000001 ``` -------------------------------- ### Paratika SESSIONTOKEN Operation Example Source: https://github.com/paytenasee/paratika-samples/blob/master/paratikaphp/src/srcproject/README.md Demonstrates a sample SESSIONTOKEN operation, including the request URL, data payload, and the expected response. This is useful for initiating a payment session. ```text >> A sample SESSIONTOKEN operation is started. > Request URL: https://test.paratika.com.tr/paratika/api/v2 > Request Data: ACTION=SESSIONTOKEN&MERCHANTPAYMENTID=MPID-59f1d5fabf0922.12373278&AMOUNT=1200&CURRENCY=TRY&SESSIONTYPE=PAYMENTSESSION&RETURNURL=https%3A%2F%2Ftest.paratika.com.tr%2Fparatika%2Findex.jsp&MERCHANT=10000000&MERCHANTUSER=apiuser%40testmerchant.com&MERCHANTPASSWORD=Pluto321%60&CUSTOMER=MPID-59f1d5fabf0a13.28869614&CUSTOMERNAME=Aydonat+Ayd%C4%B1nlar&CUSTOMEREMAIL=mghUzjPn%40email.com&CUSTOMERIP=127.0.0.1&CUSTOMERPHONE=%2B903120000011&CUSTOMERBIRTHDAY=19-04-1969&CUSTOMERUSERAGENT=Mozilla%2F5.0+%28Windows+NT+6.1%3B+WOW64%3B+rv%3A56.0%29+Gecko%2F20100101+Firefox%2F56.0&NAMEONCARD=Aydonat+Ayd%C4%B1nlar&CARDPAN=4022774022774026&CARDEXPIRY=12.2030&CARDCVV=000&BILLTOADDRESSLINE=%C3%87%C3%B6i%C5%9F%C3%BC%C4%9F%C4%B1+Plaza%2C+Ostim+No%3A83%2F9%2C+Yenimahalle&BILLTOCITY=Ankara&BILLTOCOUNTRY=T%C3%BCrkiye&BILLTOPOSTALCODE=06000&BILLTOPHONE=%2B903120000001&SHIPTOADDRESSLINE=Plaza+%C3%87%C3%96%C4%B0%C5%9E%C3%9C%C4%9EI%2C+Ostim+No%3A83%2F9%2C+Yenimahalle&SHIPTOCITY=Ankara&SHIPTOCOUNTRY=T%C3%BCrkiye&SHIPTOPOSTALCODE=06000&SHIPTOPHONE=%2B903120000001&ORDERITEMS=%255B%257B%2522code%2522%253A%2522T00D3AITCC%2522%252C%2522name%2522%253A%2522Galaxy%2BS8%252B%2522%252C%2522quantity%2522%253A%25221%2522%252C%2522description%2522%253A%2522The%2BSamsung%2BGalaxy%2BS8%2Bis%2BAndroid%2Bsmartphone%2Bproduced%2Bby%2BSamsung%2BElectronics%2Bas%2Bpart%2Bof%2Bthe%2BSamsung%2BGalaxy%2BS%2Bseries.%2522%252C%2522amount%2522%253A%25221000%2522%257D%252C%257B%2522code%2522%253A%2522T00F2IONA%2522%252C%2522name%2522%253A%2522HP%2B-%2B14%255C%2522%2BChromebook%2522%252C%2522quantity%2522%253A%25221%2522%252C%2522description%2522%253A%2522Intel%2BCeleron%2B-%2B4GB%2BMemory%2B-%2B16GB%2BeMMC%2BFlash%2BMemory%2B-%2BSilver.%2522%252C%2522amount%2522%253A%2522200%2522%257D%255D > Response Data: { "sessionToken" : "BL57PXRPGZUBLDYXS2M6MZRPGGQLWCNKL43CVMYVK7MVJJIR", "responseCode" : "00", "responseMsg" : "Approved" } >>> SESSIONTOKEN operation is SUCCESSFUL. <<< >> ParatikaClient.sessionToken() operation is finished in 1081ms. ``` -------------------------------- ### Second Paratika SESSIONTOKEN Operation Example Source: https://github.com/paytenasee/paratika-samples/blob/master/paratikaphp/src/srcproject/README.md Presents a second instance of a SESSIONTOKEN operation, illustrating potential variations in request data or timing. This is useful for observing repeated or slightly different session initiation calls. ```text >> A sample SESSIONTOKEN operation is started. > Request URL: https://test.paratika.com.tr/paratika/api/v2 > Request Data: ACTION=SESSIONTOKEN&MERCHANTPAYMENTID=MPID-59f1d5fbd29ba6.75751174&AMOUNT=1200&CURRENCY=TRY&SESSIONTYPE=PAYMENTSESSION&RETURNURL=https%3A%2F%2Ftest.paratika.com.tr%2Fparatika%2Findex.jsp&MERCHANT=10000000&MERCHANTUSER=apiuser%40testmerchant.com&MERCHANTPASSWORD=Pluto321%60&CUSTOMER=MPID-59f1d5fbd29c41.33656262&CUSTOMERNAME=Aydonat+Ayd%C4%B1nlar&CUSTOMEREMAIL=mghUzjPn%40email.com&CUSTOMERIP=127.0.0.1&CUSTOMERPHONE=%2B903120000011&CUSTOMERBIRTHDAY=19-04-1969&CUSTOMERUSERAGENT=Mozilla%2F5.0+%28Windows+NT+6.1%3B+WOW64%3B+rv%3A56.0%29+Gecko%2F20100101+Firefox%2F56.0&NAMEONCARD=Aydonat+Ayd%C4%B1nlar&CARDPAN=4022774022774026&CARDEXPIRY=12.2030&CARDCVV=000&BILLTOADDRESSLINE=%C3%87%C3%B6i%C5%9F%C3%BC%C4%9F%C4%B1+Plaza%2C+Ostim+No%3A83%2F9%2C+Yenimahalle&BILLTOCITY=Ankara&BILLTOCOUNTRY=T%C3%BCrkiye&BILLTOPOSTALCODE=06000&BILLTOPHONE=%2B903120000001&SHIPTOADDRESSLINE=Plaza+%C3%87%C3%96%C4%B0%C5%9E%C3%9C%C4%9EI%2C+Ostim+No%3A83%2F9%2C+Yenimahalle&SHIPTOCITY=Ankara&SHIPTOCOUNTRY=T%C3%BCrkiye&SHIPTOPOSTALCODE=06000&SHIPTOPHONE=%2B903120000001&ORDERITEMS=%255B%257B%2522code%2522%253A%2522T00D3AITCC%2522%252C%2522name%2522%253A%2522Galaxy%2BS8%252B%2522%252C%2522quantity%2522%253A%25221%2522%252C%2522description%2522%253A%2522The%2BSamsung%2BGalaxy%2BS8%2Bis%2BAndroid%2Bsmartphone%2Bproduced%2Bby%2BSamsung%2BElectronics%2Bas%2Bpart%2Bof%2Bthe%2BSamsung%2BGalaxy%2BS%2Bseries.%2522%252C%2522amount%2522%253A%25221000%2522%257D%252C%257B%2522code%2522%253A%2522T00F2IONA%2522%252C%2522name%2522%253A%2522HP%2B-%2B14%255C%2522%2BChromebook%2522%252C%2522quantity%2522%253A%25221%2522%252C%2522description%2522%253A%2522Intel%2BCeleron%2B-%2B4GB%2BMemory%2B-%2B16GB%2BeMMC%2BFlash%2BMemory%2B-%2BSilver.%2522%252C%2522amount%2522%253A%2522200%2522%257D%255D > Response Data: { "sessionToken" : "DMKYS6AQZSMCQM75IDQKASBOBOYCGOZFYJWE4D6WXJ4B7QWA", "responseCode" : "00", "responseMsg" : "Approved" } >>> SESSIONTOKEN operation is SUCCESSFUL. <<< ``` -------------------------------- ### Generic API Request Example Source: https://context7.com/paytenasee/paratika-samples/llms.txt This example demonstrates a generic POST request to the Paratika API endpoint using curl. It includes common parameters for initiating a payment session. ```APIDOC ## POST https://vpos.paratika.com.tr/paratika/api/v2 ### Description All API actions are sent to a single endpoint as URL-encoded POST body parameters. The `ACTION` field determines the operation type. ### Method POST ### Endpoint https://vpos.paratika.com.tr/paratika/api/v2 ### Parameters #### Request Body - **ACTION** (string) - Required - The type of operation (e.g., SESSIONTOKEN, SALE, PREAUTH, QUERYSESSION). - **MERCHANT** (string) - Required - Merchant ID. - **MERCHANTUSER** (string) - Required - Merchant API username. - **MERCHANTPASSWORD** (string) - Required - Merchant API password. - **MERCHANTPAYMENTID** (string) - Required - Unique identifier for the merchant's payment. - **AMOUNT** (integer) - Required - The transaction amount in the smallest currency unit (e.g., cents for USD, kurus for TRY). - **CURRENCY** (string) - Required - Transaction currency code (e.g., TRY, USD). - **SESSIONTYPE** (string) - Optional - Type of session for HPP/Direct Post (e.g., PAYMENTSESSION). - **RETURNURL** (string) - Required for HPP/Direct Post - The URL where the customer is redirected after payment. - **CUSTOMER** (string) - Optional - Customer identifier. - **CUSTOMERNAME** (string) - Optional - Customer's full name. - **CUSTOMEREMAIL** (string) - Optional - Customer's email address. - **CUSTOMERIP** (string) - Optional - Customer's IP address. - **CUSTOMERPHONE** (string) - Optional - Customer's phone number. - **CUSTOMERBIRTHDAY** (string) - Optional - Customer's birthday (format: DD-MM-YYYY). - **CUSTOMERUSERAGENT** (string) - Optional - Customer's browser user agent. - **NAMEONCARD** (string) - Optional - Name as it appears on the card. - **CARDPAN** (string) - Required for direct card entry - The primary account number (card number). - **CARDEXPIRY** (string) - Required for direct card entry - Card expiry date (format: MM.YYYY). - **CARDCVV** (string) - Required for direct card entry - Card security code. - **BILLTOADDRESSLINE** (string) - Optional - Billing address line 1. - **BILLTOCITY** (string) - Optional - Billing city. - **BILLTOCOUNTRY** (string) - Optional - Billing country. - **BILLTOPOSTALCODE** (string) - Optional - Billing postal code. - **BILLTOPHONE** (string) - Optional - Billing phone number. - **ORDERITEMS** (string) - Optional - JSON string representing order items. Example: `[{"code":"ITEM01","name":"Product","quantity":1,"amount":1200}]` ### Request Example ```bash curl -X POST https://test.paratika.com.tr/paratika/api/v2 \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "ACTION=SESSIONTOKEN\n&MERCHANT=10000000\n&MERCHANTUSER=apiuser%40testmerchant.com\n&MERCHANTPASSWORD=Pluto321%60\n&MERCHANTPAYMENTID=MPID-$(date +%s)\n&AMOUNT=1200\n&CURRENCY=TRY\n&SESSIONTYPE=PAYMENTSESSION\n&RETURNURL=https%3A%2F%2Fyoursite.com%2Fpayment%2Freturn\n&CUSTOMER=CUST-$(date +%s)\n&CUSTOMERNAME=John+Doe\n&CUSTOMEREMAIL=john%40example.com\n&CUSTOMERIP=192.168.1.1\n&CUSTOMERPHONE=%2B905001234567\n&CUSTOMERBIRTHDAY=01-01-1990\n&CUSTOMERUSERAGENT=Mozilla%2F5.0\n&NAMEONCARD=John+Doe\n&CARDPAN=4532513386094198\n&CARDEXPIRY=12.2030\n&CARDCVV=000\n&BILLTOADDRESSLINE=123+Main+St\n&BILLTOCITY=Istanbul\n&BILLTOCOUNTRY=Turkey\n&BILLTOPOSTALCODE=34000\n&BILLTOPHONE=%2B905001234567\n&ORDERITEMS=%5B%7B%22code%22%3A%22ITEM01%22%2C%22name%22%3A%22Product%22%2C%22quantity%22%3A1%2C%22amount%22%3A1200%7D%5D" ``` ### Response #### Success Response (200) - **sessionToken** (string) - The generated session token for HPP or Direct Post. - **responseCode** (string) - The response code indicating the transaction status (e.g., "00" for success). - **responseMsg** (string) - The response message corresponding to the `responseCode`. #### Response Example ```json { "sessionToken" : "BL57PXRPGZUBLDYXS2M6MZRPGGQLWCNKL43CVMYVK7MVJJIR", "responseCode" : "00", "responseMsg" : "Approved" } ``` ``` -------------------------------- ### PREAUTH Response Data Example Source: https://github.com/paytenasee/paratika-samples/blob/master/paratikaphp/src/srcproject/README.md This is an example of a successful response payload from a PREAUTH operation. It includes details about the transaction, payment system, and response status. ```json { "action" : "PREAUTH", "merchant" : "10000000", "amount" : 13.79, "currency" : "TRY", "apiMerchantId" : "100658785", "paymentSystem" : "My Sanalakpos Account (Test)", "paymentSystemType" : "AKBANK", "paymentSystemEftCode" : "0046", "pgTranDate" : "20171026 15:32:54", "merchantPaymentId" : "MPID-59f1d5feaa99d7.08979477", "pgTranId" : "17299Pg4H01024308", "pgTranRefId" : "729915045355", "pgOrderId" : "10000000-MPID-59f1d5feaa99d7.08979477", "responseCode" : "00", "responseMsg" : "Approved", "tmxSessionQueryOutput" : "" } ``` -------------------------------- ### Paratika PHP SALE Operation Example Source: https://github.com/paytenasee/paratika-samples/blob/master/paratikaphp/README.md Demonstrates a successful SALE transaction using the Paratika PHP SDK. Includes sample request parameters and the corresponding successful response. ```text Request Data: ACTION=SALE&AMOUNT=16.51&CURRENCY=TRY&MERCHANTPAYMENTID=MPID-59f1d5fcb619a1.58794902&MERCHANT=10000000&MERCHANTUSER=apiuser%40testmerchant.com&MERCHANTPASSWORD=Pluto321%60&CUSTOMER=MPID-59f1d5fcb61aa6.57260007&CUSTOMERNAME=Aydonat+Ayd%C4%B1nlar&CUSTOMEREMAIL=mghUzjPn%40email.com&CUSTOMERIP=127.0.0.1&CUSTOMERPHONE=%2B903120000011&CUSTOMERBIRTHDAY=19-04-1969&CUSTOMERUSERAGENT=Mozilla%2F5.0+%28Windows+NT+6.1%3B+WOW64%3B+rv%3A56.0%29+Gecko%2F20100101+Firefox%2F56.0&NAMEONCARD=Aydonat+Ayd%C4%B1nlar&CARDPAN=4022774022774026&CARDEXPIRY=12.2030&CARDCVV=000&BILLTOADDRESSLINE=%C3%87%C3%B6i%C5%9F%C3%BC%C4%9F%C4%B1+Plaza%2C+Ostim+No%3A83%2F9%2C+Yenimahalle&BILLTOCITY=Ankara&BILLTOCOUNTRY=T%C3%BCrkiye&BILLTOPOSTALCODE=06000&BILLTOPHONE=%2B903120000001&SHIPTOADDRESSLINE=Plaza+%C3%87%C3%96%C4%B0%C5%9E%C3%9C%C4%9EI%2C+Ostim+No%3A83%2F9%2C+Yenimahalle&SHIPTOCITY=Ankara&SHIPTOCOUNTRY=T%C3%BCrkiye&SHIPTOPOSTALCODE=06000&SHIPTOPHONE=%2B903120000001 ``` ```json { "action" : "SALE", "merchant" : "10000000", "amount" : 16.51, "currency" : "TRY", "apiMerchantId" : "100658785", "paymentSystem" : "My Sanalakpos Account (Test)", "paymentSystemType" : "AKBANK", "paymentSystemEftCode" : "0046", "pgTranDate" : "20171026 15:32:53", "merchantPaymentId" : "MPID-59f1d5fcb619a1.58794902", "pgTranId" : "17299Pg3B01024305", "pgTranRefId" : "729915045354", "pgOrderId" : "10000000-MPID-59f1d5fcb619a1.58794902", "responseCode" : "00", "responseMsg" : "Approved", "tmxSessionQueryOutput" : "" } ``` ```text >>> SALE operation is SUCCESSFUL. <<< >> ParatikaClient.sale() operation is finished in 1953ms. ``` -------------------------------- ### Run ParatikaClient.php as CLI Application Source: https://github.com/paytenasee/paratika-samples/blob/master/paratikaphp/README.md After cloning and setting up the `src/srcproject` in your IDE, you can run `ParatikaClient.php` as a CLI application to perform API actions. This example shows a sample SESSIONTOKEN operation. ```text >> A sample SESSIONTOKEN operation is started. > Request URL: https://test.paratika.com.tr/paratika/api/v2 > Request Data: ACTION=SESSIONTOKEN&MERCHANTPAYMENTID=MPID-59f1d5fabf0922.12373278&AMOUNT=1200&CURRENCY=TRY&SESSIONTYPE=PAYMENTSESSION&RETURNURL=https%3A%2F%2Ftest.paratika.com.tr%2Fparatika%2Findex.jsp&MERCHANT=10000000&MERCHANTUSER=apiuser%40testmerchant.com&MERCHANTPASSWORD=Pluto321%60&CUSTOMER=MPID-59f1d5fabf0a13.28869614&CUSTOMERNAME=Aydonat+Ayd%C4%B1nlar&CUSTOMEREMAIL=mghUzjPn%40email.com&CUSTOMERIP=127.0.0.1&CUSTOMERPHONE=%2B903120000011&CUSTOMERBIRTHDAY=19-04-1969&CUSTOMERUSERAGENT=Mozilla%2F5.0+%28Windows+NT+6.1%3B+WOW64%3B+rv%3A56.0%29+Gecko%2F20100101+Firefox%2F56.0&NAMEONCARD=Aydonat+Ayd%C4%B1nlar&CARDPAN=4022774022774026&CARDEXPIRY=12.2030&CARDCVV=000&BILLTOADDRESSLINE=%C3%87%C3%B6i%C5%9F%C3%BC%C4%9F%C4%B1+Plaza%2C+Ostim+No%3A83%2F9%2C+Yenimahalle&BILLTOCITY=Ankara&BILLTOCOUNTRY=T%C3%BCrkiye&BILLTOPOSTALCODE=06000&BILLTOPHONE=%2B903120000001&SHIPTOADDRESSLINE=Plaza+%C3%87%C3%96%C4%B0%C5%9E%C3%9C%C4%9EI%2C+Ostim+No%3A83%2F9%2C+Yenimahalle&SHIPTOCITY=Ankara&SHIPTOCOUNTRY=T%C3%BCrkiye&SHIPTOPOSTALCODE=06000&SHIPTOPHONE=%2B903120000001&ORDERITEMS=%255B%257B%2522code%2522%253A%2522T00D3AITCC%2522%252C%2522name%2522%253A%2522Galaxy%2BS8%252B%2522%252C%2522quantity%2522%253A%25221%2522%252C%2522description%2522%253A%2522The%2BSamsung%2BGalaxy%2BS8%2Bis%2BAndroid%2Bsmartphone%2Bproduced%2Bby%2BSamsung%2BElectronics%2Bas%2Bpart%2Bof%2Bthe%2BSamsung%2BGalaxy%2BS%2Bseries.%2522%252C%2522amount%2522%253A%25221000%2522%257D%252C%257B%2522code%2522%253A%2522T00F2IONA%2522%252C%2522name%2522%253A%2522HP%2B-%2B14%255C%2522%2BChromebook%2522%252C%2522quantity%2522%253A%25221%2522%252C%2522description%2522%253A%2522Intel%2BCeleron%2B-%2B4GB%2BMemory%2B-%2B16GB%2BeMMC%2BFlash%2BMemory%2B-%2BSilver.%2522%252C%2522amount%2522%253A%2522200%2522%257D%255D > Response Data: { "sessionToken" : "BL57PXRPGZUBLDYXS2M6MZRPGGQLWCNKL43CVMYVK7MVJJIR", "responseCode" : "00", "responseMsg" : "Approved" } >>> SESSIONTOKEN operation is SUCCESSFUL. <<< >> ParatikaClient.sessionToken() operation is finished in 1081ms. >> A sample SESSIONTOKEN operation is started. > Request URL: https://test.paratika.com.tr/paratika/api/v2 ``` -------------------------------- ### Paratika PHP PREAUTH Operation Example Source: https://github.com/paytenasee/paratika-samples/blob/master/paratikaphp/README.md Illustrates a successful PREAUTH transaction using the Paratika PHP SDK. Includes sample request URL, parameters, and the resulting successful response. ```text Request URL: https://test.paratika.com.tr/paratika/api/v2 Request Data: ACTION=PREAUTH&AMOUNT=13.79&CURRENCY=TRY&MERCHANTPAYMENTID=MPID-59f1d5feaa99d7.08979477&MERCHANT=10000000&MERCHANTUSER=apiuser%40testmerchant.com&MERCHANTPASSWORD=Pluto321%60&CUSTOMER=MPID-59f1d5feaa9a59.35380044&CUSTOMERNAME=Aydonat+Ayd%C4%B1nlar&CUSTOMEREMAIL=mghUzjPn%40email.com&CUSTOMERIP=127.0.0.1&CUSTOMERPHONE=%2B903120000011&CUSTOMERBIRTHDAY=19-04-1969&CUSTOMERUSERAGENT=Mozilla%2F5.0+%28Windows+NT+6.1%3B+WOW64%3B+rv%3A56.0%29+Gecko%2F20100101+Firefox%2F56.0&NAMEONCARD=Aydonat+Ayd%C4%B1nlar&CARDPAN=4022774022774026&CARDEXPIRY=12.2030&CARDCVV=000&BILLTOADDRESSLINE=%C3%87%C3%B6i%C5%9F%C3%BC%C4%9F%C4%B1+Plaza%2C+Ostim+No%3A83%2F9%2C+Yenimahalle&BILLTOCITY=Ankara&BILLTOCOUNTRY=T%C3%BCrkiye&BILLTOPOSTALCODE=06000&BILLTOPHONE=%2B903120000001&SHIPTOADDRESSLINE=Plaza+%C3%87%C3%96%C4%B0%C5%9E%C3%9C%C4%9EI%2C+Ostim+No%3A83%2F9%2C+Yenimahalle&SHIPTOCITY=Ankara&SHIPTOCOUNTRY=T%C3%BCrkiye&SHIPTOPOSTALCODE=06000&SHIPTOPHONE=%2B903120000001 ``` ```json { "action" : "PREAUTH", "merchant" : "10000000", "amount" : 13.79, "currency" : "TRY", "apiMerchantId" : "100658785", "paymentSystem" : "My Sanalakpos Account (Test)", "paymentSystemType" : "AKBANK", "paymentSystemEftCode" : "0046", "pgTranDate" : "20171026 15:32:54", "merchantPaymentId" : "MPID-59f1d5feaa99d7.08979477", "pgTranId" : "17299Pg4H01024308", "pgTranRefId" : "729915045355", "pgOrderId" : "10000000-MPID-59f1d5feaa99d7.08979477", "responseCode" : "00", "responseMsg" : "Approved", "tmxSessionQueryOutput" : "" } ``` ```text >>> PREAUTH operation is SUCCESSFUL. <<< >> ParatikaClient.preauth() operation is finished in 1478ms. ``` -------------------------------- ### Process Immediate Payment with `sale()` Source: https://context7.com/paytenasee/paratika-samples/llms.txt Submits a SALE action to charge a card immediately. Ensure the ParatikaClient is initialized with ParatikaUtil and ParatikaService. ```java ParatikaClient client = new ParatikaClient(new ParatikaUtil(), new ParatikaService()); JSONObject response = client.sale(); if ("00".equals(response.get("responseCode"))) { System.out.println("Transaction ID : " + response.get("pgTranId")); System.out.println("Reference ID : " + response.get("pgTranRefId")); System.out.println("Payment System : " + response.get("paymentSystem")); } ``` -------------------------------- ### Perform a Sale Transaction Source: https://github.com/paytenasee/paratika-samples/blob/master/paratikanet/README.md This snippet demonstrates how to initiate a sale transaction with specific amount, currency, and customer details. It also shows the expected response structure. ```text A sample SALE operation is started. > Request URL: https://test.paratika.com.tr/paratika/api/v2 > Request Data: ACTION=SALE&AMOUNT=10.03&CURRENCY=TRY&MERCHANTPAYMENTID=352581e8-ead3-412b-b1d2-9d0ee278a958&MERCHANT=10000000&MERCHANTUSER=apiuser%40testmerchant.com&MERCHANTPASSWORD=Pluto321%60&CUSTOMER=cfaad755-61ff-`43a1-a7b6-e9af1626c3ce&CUSTOMERNAME=Aydonat+Ayd%c4%b1nlar&CUSTOMEREMAIL=mghUzjPn%40email.com&CUSTOMERIP=127.0.0.1&CUSTOMERPHONE=%2b903120000011&CUSTOMERBIRTHDAY=19-04-1969&CUSTOMERUSERAGENT=Mozilla%2f5.0`+(Windows+NT+6.1%3b+WOW64%3b+rv%3a56.0)+Gecko%2f20100101+Firefox%2f56.0&NAMEONCARD=Aydonat+Ayd%c4%b1nlar&CARDPAN=5456165456165454&CARDEXPIRY=12.2030&CARDCVV=000&BILLTOADDRESSLINE=%c3%87%c3%b6i%c5%9f%c3%b`c%c4%9f%c4%b1+Plaza%2c+Ostim+No%3a83%2f9%2c+Yenimahalle&BILLTOCITY=Ankara&BILLTOCOUNTRY=T%c3%bcrkiye&BILLTOPOSTALCODE=06000&BILLTOPHONE=%2b903120000001&SHIPTOADDRESSLINE=Plaza+%c3%87%c3%96%c4%b0%c5%9e%c3`%9c%c4%9eI%2c+Ostim+No%3a83%2f9%2c+Yenimahalle&SHIPTOCITY=Ankara&SHIPTOCOUNTRY=T%c3%bcrkiye&SHIPTOPOSTALCODE=06000&SHIPTOPHONE=%2b903120000001& ``` ```json { "action" : "SALE", "merchant" : "10000000", "amount" : 10.03, "currency" : "TRY", "apiMerchantId" : "100658785", "paymentSystem" : "My Sanalakpos Account (Test)", "paymentSystemType" : "AKBANK", "paymentSystemEftCode" : "0046", "pgTranDate" : "20171023 12:09:37", "merchantPaymentId" : "352581e8-ead3-412b-b1d2-9d0ee278a958", "pgTranId" : "17296MJlC01011506", "pgTranRefId" : "729612044405", "pgOrderId" : "10000000-352581e8-ead3-412b-b1d2-9d0ee278a958", "responseCode" : "00", "responseMsg" : "Approved", "tmxSessionQueryOutput" : "error_detail=service_type&request_duration=0&request_id=D5F9E35E%2dDF65%2d4806%2dA560%2dA5BE874A350A&request_result=fail_invalid_parameter" } ``` -------------------------------- ### Preauth Operation Initiation Source: https://github.com/paytenasee/paratika-samples/blob/master/paratikaphp/src/srcproject/README.md This snippet indicates the start of a PREAUTH operation request to the Paratika API, showing the request URL. ```text >> A sample PREAUTH operation is started. > Request URL: https://test.paratika.com.tr/paratika/api/v2 ``` -------------------------------- ### Build Session Token Parameters with `prepareSessionTokenParameters()` Source: https://context7.com/paytenasee/paratika-samples/llms.txt Populates a parameter map with required fields for a SESSIONTOKEN request, including merchant auth, card data, customer details, and order items. Instantiate ParatikaUtil and pass a map to this method. ```java ParatikaUtil util = new ParatikaUtil(); Map params = new HashMap<>(); util.prepareSessionTokenParameters(params); // params now contains: // ACTION=SESSIONTOKEN, MERCHANTPAYMENTID=, AMOUNT=1000, CURRENCY=TRY, // SESSIONTYPE=PAYMENTSESSION, RETURNURL=..., MERCHANT=10000000, // MERCHANTUSER=apiuser@testmerchant.com, MERCHANTPASSWORD=..., // CUSTOMER=, CUSTOMERNAME=..., CARDPAN=..., CARDEXPIRY=12.2030, // BILLTOADDRESSLINE=..., ORDERITEMS=%5B%7B%22code%22%3A%22T00D3AITCC%22...%7D%5D, // EXTRA=%7B%22IntegrationModel%22%3A%22API%22%2C%22AlwaysSaveCard%22%3A%22true%22%7D ``` -------------------------------- ### Direct Post Integration Source: https://context7.com/paytenasee/paratika-samples/llms.txt Guides on integrating with Paratika using the Direct Post method, where card data is submitted directly from the browser to the gateway after obtaining a session token. ```APIDOC ## Direct Post — Browser-to-Gateway Card Submission ### Description The Direct Post model allows card data to be submitted directly from the user's browser to the Paratika endpoint. This method requires a session token to be generated first, which is then used in the form's action URL. ### Steps 1. Create a session token using the `sessionToken()` API operation. 2. Replace the placeholder `SESSIONTOKEN` in the form's `action` attribute with the actual token obtained. ### HTML Form Example ```html
``` ``` -------------------------------- ### PHP API Operations Source: https://context7.com/paytenasee/paratika-samples/llms.txt Shows how to use the `ParatikaClient` in PHP to perform various API operations like getting a session token, querying sessions, processing sales, and preauthorizations. ```APIDOC ## PHP Client — `ParatikaClient` ### `sessionToken()`, `sale()`, `preauth()`, `querySession()` — PHP API Operations PHP implementation mirrors the Java client using cURL. All four operations are available on the `ParatikaClient` class. ```php sessionToken(); $sessionData = json_decode($sessionResponse, true); if ($sessionData['responseCode'] === '00') { $token = $sessionData['sessionToken']; echo "Token: $token\n"; // → Token: DMKYS6AQZSMCQM75IDQKASBOBOYCGOZFYJWE4D6WXJ4B7QWA } // --- QUERYSESSION (internally creates a session first) --- $queryResponse = $client->querySession(); $queryData = json_decode($queryResponse, true); echo "Amount: " . $queryData['session']['amount'] . " " . $queryData['session']['currency'] . "\n"; // → Amount: 1200 TRY // --- SALE --- $saleResponse = $client->sale(); $saleData = json_decode($saleResponse, true); if ($saleData['responseCode'] === '00') { echo "Sale TX: " . $saleData['pgTranId'] . "\n"; } // --- PREAUTH --- $preauthResponse = $client->preauth(); $preauthData = json_decode($preauthResponse, true); if ($preauthData['responseCode'] === '00') { echo "Pre-auth TX: " . $preauthData['pgTranId'] . "\n"; } ?> ``` ``` -------------------------------- ### Java Client - sessionToken() Source: https://context7.com/paytenasee/paratika-samples/llms.txt This Java code snippet shows how to use the `ParatikaClient` to create a payment session. It demonstrates initializing the client and handling the response, including extracting the session token. ```APIDOC ## `sessionToken()` — Create a Payment Session ### Description Sends a `SESSIONTOKEN` request to the Paratika API and returns the session token needed for HPP redirection and Direct Post flows. Internally uses `ParatikaUtil.prepareSessionTokenParameters()` to build the full parameter map. ### Method Signature `JSONObject sessionToken()` ### Parameters This method does not take any direct parameters as it relies on the internal configuration and `ParatikaUtil` for parameter preparation. ### Request Example (Java) ```java // Maven dependency (pom.xml): // com.asee // paratikajava // 1.0.0 ParatikaUtil paratikaUtil = new ParatikaUtil(); ParatikaService paratikaService = new ParatikaService(); ParatikaClient client = new ParatikaClient(paratikaUtil, paratikaService); JSONObject response = client.sessionToken(); if ("00".equals(response.get("responseCode"))) { String token = (String) response.get("sessionToken"); System.out.println("Session Token: " + token); // → Session Token: BL57PXRPGZUBLDYXS2M6MZRPGGQLWCNKL43CVMYVK7MVJJIR } // Output: // A sample SESSIONTOKEN operation is started. // > Request URL: https://test.paratika.com.tr/paratika/api/v2 // > Request Data: ACTION=SESSIONTOKEN&MERCHANTPAYMENTID=...&AMOUNT=1000&... // > Response Data: // { "sessionToken":"BL57PXRPGZUBLDYXS2M6...", "responseCode":"00", "responseMsg":"Approved" } // > SESSIONTOKEN operation is SUCCESSFUL. // > ParatikaClient.sessionToken() operation is finished in 1081 ms. ``` ### Response #### Success Response Returns a `JSONObject` containing: - **sessionToken** (String): The generated session token. - **responseCode** (String): "00" indicates success. - **responseMsg** (String): "Approved" indicates success. #### Error Response If the operation fails, the `responseCode` will indicate an error, and `sessionToken` may be absent. ``` -------------------------------- ### Java HTTP Transport: Get Connection and Response Source: https://context7.com/paytenasee/paratika-samples/llms.txt Opens a configured URLConnection for POST requests and reads the API response into a string. Ensure the ParatikaService class is available and configured. ```java ParatikaService service = new ParatikaService(); URL url = new URL("https://test.paratika.com.tr/paratika/api/v2"); URLConnection connection = service.getConnection(url); // Sets: Content-Type: application/x-www-form-urlencoded, doOutput=true, useCaches=false String requestData = "ACTION=QUERYSESSION&SESSIONTOKEN=BL57PXRPGZUBL..."; String jsonResponse = service.getResponse(connection, requestData); System.out.println(jsonResponse); // → { "responseCode": "00", "responseMsg": "Approved", "session": { ... } } ``` -------------------------------- ### Initiate Pre-authorization Source: https://github.com/paytenasee/paratika-samples/blob/master/paratikanet/README.md This shows the request structure for initiating a pre-authorization. It is similar to a sale but reserves funds without immediate charging. ```text A sample PREAUTH operation is started. > Request URL: https://test.paratika.com.tr/paratika/api/v2 ``` -------------------------------- ### prepareSessionTokenParameters(Map) — Build Session Token Parameters Source: https://context7.com/paytenasee/paratika-samples/llms.txt Populates a parameter map with all the necessary fields required for a `SESSIONTOKEN` request. This includes merchant authentication, card data, customer details, billing and shipping addresses, order items (URL-encoded JSON), and optional EXTRA metadata. ```APIDOC ## prepareSessionTokenParameters(Map) ### Description Populates a parameter map with all required fields for a `SESSIONTOKEN` request, including merchant auth, card data, customer details, billing/shipping addresses, order items (URL-encoded JSON), and optional EXTRA metadata. ### Method ```java ParatikaUtil util = new ParatikaUtil(); Map params = new HashMap<>(); util.prepareSessionTokenParameters(params); ``` ### Parameters Populated in Map ``` ACTION=SESSIONTOKEN, MERCHANTPAYMENTID=, AMOUNT=1000, CURRENCY=TRY, SESSIONTYPE=PAYMENTSESSION, RETURNURL=..., MERCHANT=10000000, MERCHANTUSER=apiuser@testmerchant.com, MERCHANTPASSWORD=..., CUSTOMER=, CUSTOMERNAME=..., CARDPAN=..., CARDEXPIRY=12.2030, BILLTOADDRESSLINE=..., ORDERITEMS=%5B%7B%22code%22%3A%22T00D3AITCC%22...%7D%5D, EXTRA=%7B%22IntegrationModel%22%3A%22API%22%2C%22AlwaysSaveCard%22%3A%22true%22%7D ``` ```