> For the complete documentation index, see [llms.txt](https://developer-eng.esnekpos.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer-eng.esnekpos.com/esnekpos-developer-environment/marketplace-integration/getting-payment.md).

# Getting Payment

### Marketplace Payment Service Request Mode&#x6C;**;**

<table><thead><tr><th width="101.33333333333331">Method</th><th width="523">API URL</th><th>Parameters</th></tr></thead><tbody><tr><td>POST</td><td>https://posservice.esnekpos.com/api/pay/EYV3DPay</td><td>JSON File</td></tr></tbody></table>

#### Marketplace Payment Service Transaction Flo&#x77;**;**

In order to perform a successful collection using the marketplace payment model, you must complete your integration by following the procedures described below\..

**Step 1:**

The merchant (Pazaryereri) sends the payment request to the Esnekpos 3D payment service using the request model specified above, together with the user, card, basket, payment amount and installment information, and their web address (BACK\_URL) to which the payment result is requested, and initiates the payment process.

In addition to the standard payment process, the “SubMerchantDetails” list has been added. The marketplace will let you know which store will charge how much for collection in the list. The total amount to be received by the stores will be deducted from the total amount to be received by the marketplace, and the remaining balance will be transmitted to the marketplace.

### The parameters to be sent to the service are as follows;

#### Marketplace Checkout Service Request Message Parameters

<table><thead><tr><th width="240">Parameters</th><th width="113">Type</th><th width="108">CompoltyeCompulsory</th><th>Description</th></tr></thead><tbody><tr><td>MERCHANT</td><td>string</td><td>Yes</td><td>Marketplace Payment Service Request Message Parameters It is a unique credential created specifically for the member business (Marketplace).</td></tr><tr><td>MERCHANT_KEY</td><td>string</td><td>Yes</td><td>It is the key information created specifically for the merchant (Marketplace).</td></tr><tr><td>BACK_URL</td><td>string</td><td>Yes</td><td>It is the address information to which the operation result response will be returned by the system. Transaction response will be read from this address by the member business. The result of the process is sent as a form post.</td></tr><tr><td>PRICES_CURRENCY</td><td>string</td><td>Yes</td><td>It is the currency information in which the payment transaction will be made. Currently, only “TRY, USD, EUR, GBP” can be sent.</td></tr><tr><td>ORDER_REF_NUMBER</td><td>string</td><td>Yes</td><td>It is the reference number information to be given by the member workplace. Payment transactions can be tracked with this reference number. A maximum of 24 characters can be used.</td></tr><tr><td>ORDER_AMOUNT</td><td>string</td><td>Yes</td><td>It is the transaction amount information of the payment transaction.</td></tr><tr><td>CC_NUMBER</td><td>string</td><td>Yes</td><td>It is the 16-digit card number information of the card on which the payment will be made.</td></tr><tr><td>EXP_MONTH</td><td>string</td><td>Yes</td><td>It is the month information of the 2-digit expiration date of the card on which the payment will be made.</td></tr><tr><td>EXP_YEAR</td><td>string</td><td>Yes</td><td>It is the 4-digit expiry date of the card, on which the payment will be made, and the year.</td></tr><tr><td>CC_CVV</td><td>string</td><td>Yes</td><td>It is the 3-digit security code information on the back of the card where the payment will be made.</td></tr><tr><td>CC_OWNER</td><td>string</td><td>Yes</td><td>It is the name and surname information of the card holder to whom the payment will be made.</td></tr><tr><td>INSTALLMENT_NUMBER</td><td>string</td><td>Yes</td><td>It is the information of the number of installments requested for the payment process. “1” information should be sent for single shot transactions.</td></tr><tr><td>FIRST_NAME</td><td>string</td><td>Yes</td><td>It is the name of the user (customer) performing the transaction.</td></tr><tr><td>LAST_NAME</td><td>string</td><td>Yes</td><td>It is the surname of the user (customer) who performed the transaction.</td></tr><tr><td>MAIL</td><td>string</td><td>Yes</td><td>It is the e-mail information of the user (customer) performing the transaction.</td></tr><tr><td>PHONE</td><td>string</td><td>Yes</td><td>It is the phone information of the user (customer) performing the transaction.</td></tr><tr><td>CITY</td><td>string</td><td>Yes</td><td>It is the city information of the user (customer) performing the transaction.</td></tr><tr><td>STATE</td><td>string</td><td>Yes</td><td>It is the district information of the user (customer) performing the transaction.</td></tr><tr><td>ADDRESS</td><td>string</td><td>Yes</td><td>It is the address information of the user (customer) performing the transaction.</td></tr><tr><td>CLIENT_IP</td><td>string</td><td>Yes</td><td>It is the IP information of the user (customer) performing the transaction.</td></tr><tr><td>EXTERNAL_ID</td><td>string</td><td>Yes</td><td>It is the ID information of the store (submerchant) in the marketplace (merchant) system. This information is assigned by the marketplace.</td></tr><tr><td>AMOUNT</td><td>string</td><td>Yes</td><td>It is the amount information to be transferred to the store (submerchant).</td></tr></tbody></table>

### Here is a sample JSON file to send to the service;

```json
                                            
{  
   "Config":{  
      "MERCHANT":"TEST1234",
      "MERCHANT_KEY":"4oK26hK8MOXrIV1bzTRVPA==",
      "BACK_URL":"http://localhost:51062/Pages/EYV3DPay.aspx",
      "PRICES_CURRENCY":"TRY",
      "ORDER_REF_NUMBER":"412",
      "ORDER_AMOUNT":"10.00"
   },
   "CreditCard":{  
      "CC_NUMBER":"4531444531442283",
      "EXP_MONTH":"08",
      "EXP_YEAR":"2023",
      "CC_CVV":"000",
      "CC_OWNER":"test",
      "INSTALLMENT_NUMBER":"1"
   },
   "Customer":{  
      "FIRST_NAME":"--",
      "LAST_NAME":"-",
      "MAIL":"abc@domain.com",
      "PHONE":"-",
      "CITY":"-",
      "STATE":"-",
      "ADDRESS":"-",
      "CLIENT_IP":"::1"
   },
   "SubMerchantDetails":[{  
      "EXTERNAL_ID":"EXTERNAL_ID1",
      "AMOUNT":"5.00" 
   },
   {  
      "EXTERNAL_ID":"EXTERNAL_ID2",
      "AMOUNT":"4.00"
   }]
}
                                        
```

**Step 2:**

Esnekpos evaluates the information and sends the reply message to the member business (marketplace). (The URL\_3DS field is included in the reply message.)

### The parameters of the reply message sent from the service after the transaction are as follows;

#### Marketplace Payment Service Reply Message Parameters

<table><thead><tr><th width="247">Parameters</th><th width="87">Type</th><th width="109">Compulsory</th><th>Description</th></tr></thead><tbody><tr><td>ORDER_REF_NUMBER</td><td>string</td><td>Yes</td><td>It is the reference number information given for the request in the payment request by the merchant (Marketplace).</td></tr><tr><td>STATUS</td><td>string</td><td>Yes</td><td>The result of the payment transaction is the status information.</td></tr><tr><td>RETURN_CODE</td><td>string</td><td>Yes</td><td>The status of the payment process is the code information.</td></tr><tr><td>RETURN_MESSAGE</td><td>string</td><td>Yes</td><td>The status message is the result of the payment process.</td></tr><tr><td>RETURN_MESSAGE_TR</td><td>string</td><td>Yes</td><td>It is the Turkish explanation information for the status message as a result of the payment transaction.</td></tr><tr><td>ERROR_CODE</td><td>string</td><td>Yes</td><td>Error code information as a result of unsuccessful payment transaction. Bank error codes are also returned within this parameter.</td></tr><tr><td>DATE</td><td>string</td><td>Yes</td><td>It is the transaction date information for the payment transaction.</td></tr><tr><td>URL_3DS</td><td>string</td><td>Yes</td><td>3D Verification Page URL Address to which the merchant will direct the user</td></tr><tr><td>REFNO</td><td>string</td><td>Yes</td><td>The reference number information given by the Esnekpos system for the payment transaction</td></tr><tr><td>HASH</td><td>string</td><td>Yes</td><td>Hash information of the payment transaction generated by the Esnekpos system</td></tr><tr><td>CUSTOMER_NAME</td><td>string</td><td>Yes</td><td>It is the name and surname of the user (customer) performing the transaction.</td></tr><tr><td>CUSTOMER_MAIL</td><td>string</td><td>Yes</td><td>It is the e-mail information of the user (customer) performing the transaction.</td></tr><tr><td>CUSTOMER_PHONE</td><td>string</td><td>Yes</td><td>It is the phone information of the user (customer) performing the transaction.</td></tr><tr><td>CUSTOMER_ADDRESS</td><td>string</td><td>Yes</td><td>It is the address information of the user (customer) performing the transaction.</td></tr><tr><td>CUSTOMER_CC_NUMBER</td><td>string</td><td>Yes</td><td>It is the 16-digit card number information of the card on which the payment will be made. Card information is shared in encrypted form.</td></tr><tr><td>CUSTOMER_CC_NAME</td><td>string</td><td>Yes</td><td>It is the name and surname information of the card holder to whom the payment will be made.</td></tr><tr><td>IS_NOT_3D_PAYMENT</td><td>string</td><td>Yes</td><td>It is the information of whether the payment process takes place in 3D.</td></tr><tr><td>VIRTUAL_POS_VALUES</td><td>string</td><td>Yes</td><td>It is the virtualpos description information of the payment transaction.</td></tr><tr><td>RETURN_MESSAGE_3D</td><td>string</td><td>Yes</td><td>It is the reply message information of the 3D payment transaction received from the bank.</td></tr></tbody></table>

```json
                                            
{
    "ORDER_REF_NUMBER": "412",
    "STATUS": "SUCCESS",
    "RETURN_CODE": "0",
    "RETURN_MESSAGE": "SUCCESS",
    "RETURN_MESSAGE_TR": null,
    "ERROR_CODE": null,
    "DATE": "12.08.2020 11:43:34",
    "URL_3DS": "https://posservicetest.esnekpos.com/api/pay/3DSecurity/order/a8790d467f8d3fd718e0ecbb438cccfccd74ddca6a73bcd60a59bbb9ac8d4264",
    "REFNO": "151038",
    "HASH": "a8790d467f8d3fd718e0ecbb438cccfccd74ddca6a73bcd60a59bbb9ac8d4264",
    "CUSTOMER_NAME": "-- -",
    "CUSTOMER_MAIL": "abc@domain.com",
    "CUSTOMER_PHONE": "-",
    "CUSTOMER_ADDRESS": "-",
    "CUSTOMER_CC_NUMBER": "453144******2283",
    "CUSTOMER_CC_NAME": null,
    "IS_NOT_3D_PAYMENT": false,
    "VIRTUAL_POS_VALUES": null,
    "RETURN_MESSAGE_3D": null
}
                                        
```

In the Marketplace Payment Receiving transaction response message, the value of STATUS parameter is SUCCESS and the value of RETURN\_CODE parameter is 0, indicating that the 3D Payment transaction has been accepted. In the next step, 3D verification will be done from the user to be paid.

**Step 3:**

If the payment is accepted by evaluating the reply received by the merchant (Pazaryeri), it directs the customer to the URL\_3DS address given by Esnekpos.

**Step 4:**

Esnekpos finalizes the 3D verification processes, and reports the result of the payment to the BACK\_URL address of the member merchant (Marketplace) notified in step 1, with the FORM POST method.

```html
                                            
<html xmlns=\"http://www.w3.org/1999/xhtml\" >
    <head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=iso-8859-9\" /></head>
    <body onload='document.forms[0].submit()'>
        <form action='" + payment.DEALER_RESPONSE_URL + "' method='post'>
            <input type='hidden' name='DATE' value='{0}'>
            <input type='hidden' name='HASH' value='{0}'>
            <input type='hidden' name='ORDER_REF_NUMBER' value='{0}'>
            <input type='hidden' name='REFNO' value='{0}'>
            <input type='hidden' name='RETURN_CODE' value='{0}'>
            <input type='hidden' name='RETURN_MESSAGE' value='{0}'>
            <input type='hidden' name='RETURN_MESSAGE_TR' value='{0}'>
            <input type='hidden' name='STATUS' value='{0}'>
            <input type='hidden' name='ERROR_CODE' value='{0}'>
            <input type='hidden' name='CUSTOMER_NAME' value='{0}'>
            <input type='hidden' name='CUSTOMER_MAIL' value='{0}'>
            <input type='hidden' name='CUSTOMER_PHONE' value='{0}'>
            <input type='hidden' name='CUSTOMER_ADDRESS' value='{0}'>
            <input type='hidden' name='CUSTOMER_CC_NUMBER' value='{0}'>
            <input type='hidden' name='CUSTOMER_CC_NAME' value='{0}'>
            <input type='hidden' name='COMMISSION' value='{0}'>
            <input type='hidden' name='AMOUNT' value='{0}'>
            <input type='hidden' name='INSTALLMENT' value='{0}'>
    </form>
    </body>
</html>
                                                
```

In the FORM POST message sent to the merchant (Marketplace), the value of the STATUS parameter is SUCCESS and the RETURN\_CODE parameter is 0, indicating that the marketplace payment process has been completed without any problems.

{% hint style="danger" %}

* <mark style="color:red;">In order to be sure of the payment status, you need to query with the PROCCESS\_QUERY method and take into account the answer of the PROCCESS\_QUERY method. You need to configure this query as server to server, not client-side.</mark>&#x20;
* <mark style="color:red;">This PROCCESS\_QUERY method you have made in the client browser should not be visible and cannot be followed.</mark>
  {% endhint %}
