# 3D ile Ödeme

## 3D Başlatma

* [API Servisine gönderilmesi gereken parametreler](/api/odeme-servisi-kendi-formunuz/3d-ile-odeme.md#3d-api-servisi-parametreleri)
* [Örnek Kodlar](/api/odeme-servisi-kendi-formunuz/3d-ile-odeme.md#api-servis-istek-kodlari)
* [API Servisinden geri dönen parametreler](/api/odeme-servisi-kendi-formunuz/3d-ile-odeme.md#api-servisten-doenen-sonuc-oernekleri)
* [3D dönüşündeki(CallBack) parametreler](/api/odeme-servisi-kendi-formunuz/3d-ile-odeme.md#callbackurl-parametreleri)

## 3D API servisi parametreleri

<mark style="color:green;">`POST`</mark> `https://api.weepay.co/Payment/PaymentRequestThreeD`

Gönderilecek parametreler Auth, Data, Customer, BillingAddress, ShippingAddress, Products\
array'leri altında gönderilmelidir. dönen sonuç için **Response** tabı kontrol edilmelidir.\
Örnek **JSON** ve örnek gönderim için aşağıdaki&#x20;

#### Path Parameters

| Name      | Type    | Description                                                |
| --------- | ------- | ---------------------------------------------------------- |
| Auth      | array   | Auth array altında bayiId, apiKey ve secretKey gönderilir. |
| bayiId    | integer | weepay tarafıdan verilen bayiId                            |
| apiKey    | string  | weepay tarafından verilen apikey                           |
| secretKey | string  | weepay tarafından verilen secretKey                        |

#### Request Body

| Name              | Type   | Description                                                                                                                                      |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| Data              | string | Data array altında gönderilecek parametreler                                                                                                     |
| orderId           | string | Üye iş yeri sipariş id.                                                                                                                          |
| ipAddress         | string | Alıcıya ait ip adresi.                                                                                                                           |
| paidPrice         | number | Ödeme tutarı (Kuruş kısmı nokta ile yazılır. Örn: 35.50)                                                                                         |
| currency          | string | Para birimi TL, USD, EUR, GBP                                                                                                                    |
| locale            | string | Geri dönüş dili tr,en                                                                                                                            |
| installmentNumber | number | Taksit sayısı                                                                                                                                    |
| preAuth           | number | Ön provizyon işlemi için 1 gönderilmelidir.                                                                                                      |
| cardHolderName    | string | Kredi kartı isim soyisim                                                                                                                         |
| cardNumber        | number | Kredi kartı  numarası                                                                                                                            |
| expireMonth       | number | Kredi kartı son kullanım tarihi (ÖRN:12)                                                                                                         |
| expireYear        | number | Kredi kartı son kullanım yılı (ÖRN: 2024 için 24)                                                                                                |
| cvcNumber         | number | Kredi kartı güvenlik numarası (ÖRN:555)                                                                                                          |
| callBackUrl       | string | İşlemin sonucunun dönüleceği URL adresiniz.                                                                                                      |
| description       | string | Sipariş Açıklaması                                                                                                                               |
| Customer          | array  | Customer array'i altında gönderilecek bilgiler                                                                                                   |
| customerId        | string | Üye işyeri tarafındaki alıcıya ait id.                                                                                                           |
| customerName      | string | Üye işyeri tarafındaki alıcıya ait ad.                                                                                                           |
| customerSurname   | string | Üye işyeri tarafındaki alıcıya ait soyad.                                                                                                        |
| gsmNumber         | string | Üye işyeri tarafındaki alıcıya ait GSM numarası.                                                                                                 |
| email             | string | Üye işyeri tarafındaki alıcıya ait e-posta bilgisi. E-posta adresi alıcıya ait geçerli ve erişilebilir bir adres olmalıdır.                      |
| identityNumber    | number | Üye işyeri tarafındaki alıcıya ait kimlik (TCKN) numarası.                                                                                       |
| city              | string | Üye işyeri tarafındaki alıcıya ait şehir bilgisi.                                                                                                |
| country           | string | Üye işyeri tarafındaki alıcıya ait ülke bilgisi.                                                                                                 |
| BillingAddress    | array  | BillingAddress array'i altında gönderilecek bilgiler                                                                                             |
| contactName       | string | Üye işyeri tarafındaki fatura adresi ad soyad bilgisi.                                                                                           |
| address           | string | Üye işyeri tarafındaki fatura adresi.                                                                                                            |
| city              | string | Üye işyeri tarafındaki fatura adresi şehir bilgisi.                                                                                              |
| country           | string | Üye işyeri tarafındaki fatura adresi ülke bilgisi.                                                                                               |
| district          | string | Üye işyeri tarafındaki fatura adresi bölge bilgisi.                                                                                              |
| zipCode           | string | Üye işyeri tarafındaki fatura adresi posta kodu.                                                                                                 |
| ShippingAddress   | array  | SippingAddres array'i altında gönderilecek bilgiler                                                                                              |
| contactName       | array  | Üye işyeri tarafındaki teslimat adresi, ad, soyad bilgisi. Sepetteki ürünlerden en az 1 tanesi fiziksel ürün (itemType=PHYSICAL) ise zorunludur. |
| address           | string | Üye işyeri tarafındaki teslimat adresi. Sepetteki ürünlerden en az 1 tanesi fiziksel ürün (itemType=PHYSICAL) ise zorunludur.                    |
| city              | string | Üye işyeri tarafındaki teslimat adresi şehir bilgisi. Sepetteki ürünlerden en az 1 tanesi fiziksel ürün (itemType=PHYSICAL) ise zorunludur.      |
| country           | string | Üye işyeri tarafındaki teslimat adresi ülke bilgisi. Sepetteki ürünlerden en az 1 tanesi fiziksel ürün (itemType=PHYSICAL) ise zorunludur.       |
| district          | string | Üye işyeri tarafındaki fatura adresi bölge bilgisi.                                                                                              |
| zipCode           | string | Üye işyeri tarafındaki teslimat adresi posta kodu.                                                                                               |
| Products          | array  | Products array'i atında gönderilecek bilgiler                                                                                                    |
| productId         | string | Üye işyeri tarafındaki ürüne ait id.                                                                                                             |
| name              | string | Üye işyeri tarafındaki ürüne ait isim.                                                                                                           |
| productPrice      | number | Üye işyeri tarafındaki ürünlere ait tutar.tutarlar toplamı paidPrice alanına eşit olmalıdır.                                                     |
| itemType          | string | Üye işyeri tarafındaki ürüne ait tip. Geçerli enum değerler: **PHYSICAL** ve **VIRTUAL**.                                                        |

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

```javascript
{
"status":"success",
"threeDSecureUrl":"",
"systemTime":"",
"locale":"tr",
}
```

{% endtab %}

{% tab title="400 " %}

```javascript
{
"status":"failure",
"errorCode":"000",
"message":"000",
"error":array(),
"systemTime":"",
"locale":"tr",
}
```

{% endtab %}
{% endtabs %}

### API servis istek kodları

API servisi için örnek kodları inceleyebilirsiniz.

#### Örnek Kodlar

* PHP
* .NET
* Java
* Ruby
* Phython
* Node.js

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

```javascript
// Request JSON example;
{
"Auth": {
		"bayiId":"22",
		"apiKey": "XXXXXXXXX",
		"secretKey": "XXXXXXXXXXXXXXXX"
		},
"Data":{
 "orderId":1,
 "currency":"TL", 
 "locale":"tr",
 "paidPrice":"0.16", 
 "ipAddress":"192.168.1.1", 
 "cardHolderName":"isim Soyisim",
 "cardNumber":"555522223333444", // Kart Numarası
 "expireMonth":"11", // Son Kullanım Ay
 "expireYear":"24", // Son Kullanım Yıl
 "cvcNumber":"556",// Kart CVC
 "installmentNumber":1, // Uygulanacak Taksit Sayısı
 "description":"Açıkalama", // Açıklama
 "callBackUrl":"http://Sitem.com/callBack"// Response URL
},
"Customer":{
	"customerId":"1", // alıcı müşteri Id 
	"customerName":"isim", //alıcı ismi 
	"customerSurname":"soyisim", // alıcı Soyismi
	"gsmNumber":"50XXXXXXX",// alıcı cep telefonu
	"email":"hello@weepay.co", // alıcı mail
	"identityNumber":"112312312313132", // alıcı TC kimlik numarası
	 "city":"istanbul",// alıcı  şehir
	 "country":"Turkey" // alıcı ülke
},
 "BillingAddress": {
		"contactName":"isim soyisim",
		"address":"Abdurrahman Nafiz Gürman,Mh, G. Ali Rıza Gürcan Cd. No:27",
		"city":"istanbul",
		"country":"turkey",
		"zipCode":34164
},
 "ShippingAddress": {
		"contactName":"isim soyisim",
		"address":"Abdurrahman Nafiz Gürman,Mh, G. Ali Rıza Gürcan Cd. No:27",
		"city":"istanbul",
		"country":"turkey",
		"zipCode":34164
},
 "Products":
   [
    {"productId":"B104A", "name":"ürün bir","productPrice":2.3, "itemType":"PHYSICAL"},
 	  {"productId":"C1087", "name":"ürün iki","productPrice":2.3, "itemType":"PHYSICAL" },
 		{"productId":"12233352", "name":"ürün üç","productPrice":2.3, "itemType":"PHYSICAL" }
   ]
}
```

{% endtab %}

{% tab title="PHP" %}

```php

//https://github.com/weepay/weepay-php  PHP lib.
// composer or weepay initialize Bootstrap

// Auth
$options = new \weepay\Auth();
$options->setBayiID("xxxxxx");// weepay tarafıdan verilen bayiId
$options->setApiKey("xxxx-xxxx-xxx");// weepay tarafıdan verilen apiKey
$options->setSecretKey("xxxxxxx-xxxxxxxxx-xx-xx"); // weepay tarafıdan verilen secretKey
$options->setBaseUrl("https://api.weepay.co");

//Request
$request = new \weepay\Request\CreatePaymentRequestThreeD();

$request->setOrderId('1298');
$request->setIpAddress('192.168.2.1');
$request->setPrice(35.50);
$request->setCurrency(\weepay\Model\Currency::TL);
$request->setLocale(\weepay\Model\Locale::TR);
$request->setDescription('Açıklama Alanı');
$request->setCardHolderName("isim soyisim");
$request->setCardNumber("555555555555555");
$request->setEpireMonth("01");
$request->setExpireYear("22");
$request->setCvcNumber("233");
$request->setCallBackUrl("https://websitem.com/");
$request->setInstallmentNumber(1);
$request->setPaymentGroup(\weepay\Model\PaymentGroup::PRODUCT);
$request->setPaymentChannel(\weepay\Model\PaymentChannel::WEB);

//Customer
$customer = new \weepay\Model\Customer();
$customer->setCustomerId(1235); // Üye işyeri müşteri Id 
$customer->setCustomerName("isim"); //Üye işyeri müşteri ismi 
$customer->setCustomerSurname("soyisim"); //Üye işyeri müşteri Soyisim
$customer->setGsmNumber("50XXXXXX"); //Üye işyeri müşteri Cep Tel
$customer->setEmail("helo@weepay.co"); //Üye işyeri müşteri ismi 
$customer->setIdentityNumber("00032222721"); //Üye işyeri müşteri TC numarası
$customer->setCity("istanbul"); //Üye işyeri müşteri il
$customer->setCountry("turkey");//Üye işyeri müşteri ülke
$request->setCustomer($customer);

//Adresler
// Fatura Adresi
$BillingAddress = new \weepay\Model\Address();
$BillingAddress->setContactName("isim soyisim");
$BillingAddress->setAddress("Abdurrahman Nafiz Gürman,Mh, G. Ali Rıza Gürcan Cd. No:27");
$BillingAddress->setCity("istanbul");
$BillingAddress->setCountry("turkey");
$BillingAddress->setZipCode("34164");
$request->setBillingAddress($BillingAddress);

//Kargo / Teslimat Adresi
$ShippingAddress = new \weepay\Model\Address();
$ShippingAddress->setContactName("isim soyisim");
$ShippingAddress->setAddress("Abdurrahman Nafiz Gürman,Mh, G. Ali Rıza Gürcan Cd. No:27");
$ShippingAddress->setCity("istanbul");
$ShippingAddress->setCountry("turkey");
$ShippingAddress->setZipCode("34164");
$request->setShippingAddress($ShippingAddress);

// Sipariş Ürünleri
$Products = array();

// Birinci Ürün
$firstProducts = new \weepay\Model\Product();
$firstProducts->setName("Ürün Bir");
$firstProducts->setProductId(12344);
$firstProducts->setProductPrice(0.10);
$firstProducts->setItemType(\weepay\Model\ProductType::PHYSICAL);
$Products[0] = $firstProducts;

// İkinci Ürün
$secondProducts = new \weepay\Model\Product();
$secondProducts->setName("Ürün İki");
$secondProducts->setProductId("C550A100");
$secondProducts->setProductPrice(0.10);
$secondProducts->setItemType(\weepay\Model\ProductType::PHYSICAL);
$Products[1] = $secondProducts;

// Üçüncü Ürün
$thirdProducts = new \weepay\Model\Product();
$thirdProducts->setName("Ürün Üç");
$thirdProducts->setProductId("1000");
$thirdProducts->setProductPrice("0.10");
$thirdProducts->setItemType(\weepay\Model\ProductType::PHYSICAL);
$Products[2] = $thirdProducts;
$request->setProducts($Products);

$createPaymentRequest = \weepay\Model\CreatePaymentRequestThreeDInitialize::create($request, $options);

echo "<pre>";
print_r($createPaymentRequest);
echo "</pre>";



```

{% endtab %}

{% tab title="Node" %}

```javascript
// https://github.com/weepay/weepay-nodejs node.js SDK.
// npm install weepay-nodejs or Add dependency 'weepay-nodejs' 
// in your package.json file
// check sdk in samples folder CreatePaymentForm.js samples 
// Node.js v12.0.0 or later

const  weepay = require('weepay-nodejs');

weepay.configure({
    bayiId: "bayi-id",
    apiKey: "apiKey",
    secretKey: "secretKey",
    baseUrl: "https://test-api.weepay.co"
});

const request = {
    data: {
        orderId: 1,
        ipAddress: "192.168.2.1",
        paidPrice: 0.10,
        currency: Currency.TL,
        locale: Locale.TR,
        description: "Açıklama Alanı",
        cardHolderName: "isim soyisim",
        cardNumber: "555555555555555",
        expireMonth: "01",
        expireYear: "22",
        cvcNumber: "233",
        callBackUrl: "https://websitem.com/callback",
        installmentNumber: 1,
        paymentGroup: PaymentGroup.PRODUCT,
        paymentChannel: PaymentChannel.WEB
    },
    customer: {
        customerId: 1234,
        customerName: "isim",
        customerSurname: "soyisim",
        gsmNumber: "50XXXXXX",
        email: "helo@weepay.co",
        identityNumber: "00032222721",
        city: "istanbul",
        country: "turkey"
    },
    billingAddress: {
        contactName: "isim soyisim",
        address: "Abdurrahman Nafiz Gürman,Mh, G. Ali Rıza Gürcan Cd. No:27",
        city: "istanbul",
        country: "turkey",
        zipCode: "34164"
    },
    shippingAddress: {
        contactName: "isim soyisim",
        address: "Abdurrahman Nafiz Gürman,Mh, G. Ali Rıza Gürcan Cd. No:27",
        city: "istanbul",
        country: "turkey",
        zipCode: "34164"
    },
    products: [
        {
            name: "first product",
            productPrice: "30.00",
            itemType: ProductType.PHYSICAL,
            productId: "1234"
        },
        {
            name: "first product",
            productPrice: "30.00",
            itemType: ProductType.PHYSICAL,
            productId: "1234"
        },
    ]
}

weepay.createPayment3d(request).then(function (res) {
    if (res.status == "success") {
        console.log(res.threeDSecureUrl);
    } else {
        console.log(res.message)
    }
});
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
 //import weepay javascript library
 // check sample: https://github.com/weepay/weepay-javascript/blob/main/samples/createpayment3d.html
 var weepay = new weepayInit();

        weepay.configure({
            bayiId: "bayi-id",
            apiKey: "apiKey",
            secretKey: "secretKey",
            baseUrl: "https://api.weepay.co"
        })

var request = {
            data: {
                orderId: 1,
                ipAddress: "192.168.2.1",
                paidPrice: 0.10,
                currency: Constants.Currency.TL,
                locale: Constants.Locale.TR,
                description: "Açıklama Alanı",
                cardHolderName: "isim soyisim",
                cardNumber: "555555555555555",
                expireMonth: "01",
                expireYear: "22",
                cvcNumber: "233",
                callBackUrl: "https://websitem.com/callback",
                installmentNumber: 1,
                paymentGroup: Constants.PaymentGroup.PRODUCT,
                paymentChannel: Constants.PaymentChannel.WEB
            },
            customer: {
                customerId: 1234,
                customerName: "isim",
                customerSurname: "soyisim",
                gsmNumber: "50XXXXXX",
                email: "helo@weepay.co",
                identityNumber: "00032222721",
                city: "istanbul",
                country: "turkey"
            },
            billingAddress: {
                contactName: "isim soyisim",
                address: "Abdurrahman Nafiz Gürman,Mh, G. Ali Rıza Gürcan Cd. No:27",
                city: "istanbul",
                country: "turkey",
                zipCode: "34164"
            },
            shippingAddress: {
                contactName: "isim soyisim",
                address: "Abdurrahman Nafiz Gürman,Mh, G. Ali Rıza Gürcan Cd. No:27",
                city: "istanbul",
                country: "turkey",
                zipCode: "34164"
            },
            products: [
                {
                    name: "first product",
                    productPrice: "30.00",
                    itemType: Constants.ProductType.PHYSICAL,
                    productId: "1234"
                },
                {
                    name: "first product",
                    productPrice: "30.00",
                    itemType: Constants.ProductType.PHYSICAL,
                    productId: "1234"
                },
            ]
        }

weepay.createPayment3d(request, function (response) {
            if (response.status == "failure") {
                console.log(response.message);
            } else {
                console.log(response.threeDSecureUrl)
                window.location.href = response.threeDSecureUrl;
            }
        });
```

{% endtab %}

{% tab title="Java" %}

```java
// https://github.com/weepay/weepay-java java SDK.
// if you use maven, if not check github page others installation
//<dependency>
// <groupId>co.weepay</groupId>
// <artifactId>weepay-java</artifactId>
// <version>1.0.0</version>
//</dependency>
// check sdk in samples folder CreatePayment3d.txt samples 
// java  1.7 or later

    //Auth
    Auth options = new Auth();

    options.setBayiId(bayiId);
    options.setApiKey("apiKey");
    options.setSecretKey("secretKey");
    options.setBaseUrl("https://api.weepay.co");

    // Request
    CreatePaymentRequestThreeD request = new CreatePaymentRequestThreeD();
    request.setOptions(options);
    request.setOrderId("1");
    request.setIpAddress("192.168.1.2");
    request.setPrice(35.50);
    request.setCurrency(Currency.TL.name());
    request.setLocale(Locale.TR.getValue());
    request.setDescription("Açıklama Alanı");
    request.setCardHolderName("isim soyisim");
    request.setCardNumber("555555555555555");
    request.setExpireMonth("01");
    request.setExpireYear("22");
    request.setCvcNumber("223");
    request.setCallBackUrl("https://websitem.com/callback");
    request.setInstallmentNumber(1);
    request.setPaymentGroup(PaymentGroup.PRODUCT.name());
    request.setPaymentChannel(PaymentChannel.WEB.name());

    // Customer
    Customer customer = new Customer();
    customer.setCustomerId(1);
    customer.setCustomerName("isim");
    customer.setCustomerSurname("soyisim");
    customer.setGsmNumber("50XXXXXX");
    customer.setEmail("hello@weepay.co");
    customer.setIdentityNumber("00032222721");
    customer.setCity("istanbul");
    customer.setCountry("turkey");
    request.setCustomer(customer);

    // Address
    // Billing Address
    Address billingAddress = new Address();
    billingAddress.setContactName("isim soyisim");
    billingAddress.setAddress("address");
    billingAddress.setCity("city");
    billingAddress.setCountry("turkey");
    billingAddress.setZipCode("34164");
    request.setBillingAddress(billingAddress);

    // Address
    // Shipping Address
    Address shippingAddress = new Address();
    shippingAddress.setContactName("isim soyisim");
    shippingAddress.setAddress("address");
    shippingAddress.setCity("city");
    shippingAddress.setCountry("turkey");
    shippingAddress.setZipCode("34164");
    request.setShippingAddress(shippingAddress);

    // Products
    // First Product
    List<Product> products = new ArrayList<Product>();
    Product firstProduct = new Product();
    firstProduct.setName("Ürün bir");
    firstProduct.setProductId(1234);
    firstProduct.setProductPrice(0.10);
    firstProduct.setItemType(ProductType.PHYSICAL.name());
    products.add(firstProduct);

    // Second Product
    Product secondProduct = new Product();
    secondProduct.setName("Ürün iki");
    secondProduct.setProductId(4567);
    secondProduct.setProductPrice(0.10);
    secondProduct.setItemType(ProductType.PHYSICAL.name());
    products.add(secondProduct);
    request.setProducts(products);

    CreatePaymentRequestThreeDInitialize payment = CreatePaymentRequestThreeDInitialize.create(request, options);
    System.out.println(payment.getThreeDSecureUrl());

```

{% endtab %}

{% tab title="Ruby" %}

```ruby
```

{% endtab %}

{% tab title="Python" %}

```python
```

{% endtab %}

{% tab title="Go" %}

```javascript
```

{% endtab %}

{% tab title=".NET" %}

```aspnet
```

{% endtab %}
{% endtabs %}

## API Servisten Dönen Sonuç Örnekleri

### Başarılı Sonuç Örneği

threeDSecureUrl alanı altında dönen 3D secure adresi. Kullanıcı, bankadan şifre talep edebilmesi ve SMS ile gelen şifreyi girerek kredi kartı doğrulaması yapabilmesi için bu linke yönlendirilmelidir.

```javascript
{
"status":"success",
"threeDSecureUrl":"https://api.weepay.co/xxx/xxx",
"systemTime":"",
"locale":"tr",
}
```

### Başarısız Sonuç Örneği

```javascript
{
"status":"failure",
"errorCode":"000",
"message":"000",
"error":array(),
"systemTime":"",
"locale":"tr",
}
```

## CallBackUrl parametreleri

3D Secure ekranında başarılı şekilde işlem gerçekleştirildiyse belirlemiş olduğunuz CallBackUrl adresinize \
örnekteki gibi bir POST gönderilmektedir.

### Başarılı Sonuç Örneği

```javascript
{
"paymentStatus":true,// işlemin başarılı olup olmadı true / false
"paymentId":"",//Ödemenin Idsi
}
```

### Başarısız Sonuç Örneği

```javascript
{
"paymentStatus":false,// işlemin başarılı olup olmadı true / false
"errorCode":"00",
"message":"ÖRN : 3D onayı alınamadı."
}
```

##


---

# 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.weepay.co/api/odeme-servisi-kendi-formunuz/3d-ile-odeme.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.
