> For the complete documentation index, see [llms.txt](https://developer.weepay.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.weepay.co/api/odeme-servisi-kendi-formunuz/odeme.md).

# Ödeme

## Ödeme Başlatma

* API servisine gönderilmesi gereken parametreler
* Örnek kodlar
* API servisinden dönen parametreler

## Ödeme Servisi Parametreleri

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

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 örnek kodlar bölümünü inceleyebilirsiniz.<br>

#### Path Parameters

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

#### Request Body

| Name              | Type    | Description                                                                                                                                      |
| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| Data              | array   | 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 | integer | Taksit sayısı                                                                                                                                    |
| preAuth           | integer | Ön provizyon işlemi için 1 gönderilmelidir                                                                                                       |
| cardHolderName    | string  | Kart sahibinin adı soyadı                                                                                                                        |
| cardNumber        | number  | Kart numarası                                                                                                                                    |
| expireMonth       | number  | Kredi kartı son kullanım ay (ÖRN : 12)                                                                                                           |
| expireYear        | number  | Kredi kartı son kullanım  yılı (ÖRN 2024 için 24)                                                                                                |
| cvcNumber         | number  | Kredi Kartı güvenlik numarası                                                                                                                    |
| description       | string  | Sipariş açıklaması                                                                                                                               |
| Customer          | string  | Customer array altında gönderilecek parametreler                                                                                                 |
| 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 ad.                                                                                                           |
| gsmNumber         | number  | Üye işyeri tarafındaki alıcıya ait gsm no.                                                                                                       |
| email             | string  | Üye işyeri tarafındaki alıcıya ait email.                                                                                                        |
| 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    | string  | BillingAddress array altında gönderilecek parametreler                                                                                           |
| 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           | number  | Üye işyeri tarafındaki fatura adresi posta kodu.                                                                                                 |
| ShippingAddress   | string  | ShippingAddress array altında gönderilecek parametreler                                                                                          |
| contactName       | string  | Ü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 teslimat adresi bölge bilgisi.                                                                                            |
| zipCode           | number  | Üye işyeri tarafındaki teslimat adresi posta kodu.                                                                                               |
| Products          | string  | Products array altında gönderilecek parametreler                                                                                                 |
| productId         | string  | Üye işyeri tarafındaki sepetteki ürüne ait id.                                                                                                   |
| name              | string  | Üye işyeri tarafındaki sepetteki ürüne ait isim.                                                                                                 |
| productPrice      | number  | Üye işyeri tarafındaki sepetteki ürüne ait tutar. tutarlar toplamı sepet tutarına (paidPrice) eşit olmalıdır.                                    |
| itemType          | string  | Üye işyeri tarafındaki sepetteki ürüne ait tip. Geçerli enum değerler: PHYSICAL ve VIRTUAL.                                                      |

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

```
```

{% endtab %}
{% endtabs %}

## API servisi istek kodları

Servis için ö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
},
"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\CreatePaymentRequest();

$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->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\CreatePaymentRequestInitialize::create($request, $options);

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

{% endtab %}

{% tab title="Node" %}

```javascript
// 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",
        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.createPayment(request).then(function (res) {
    if (res.status == "success") {
        console.log(res);
    } 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/createpayment.html
var weepay = new weepayInit();

        weepay.configure({
            bayiId: "bayiId",
            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",
                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.createPayment(request, function (response) {
            if (response.status == "failure") {
                console.log(response.message);
            } else {
                console.log(response)
            }
        });
```

{% 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 CreatePayment.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
    CreatePaymentRequest request = new CreatePaymentRequest();
    request.setOptions(options);
    request.setOrderId("1");
    request.setIpAddress("192.168.1.2");
    request.setPaidPrice(35.50);
    request.setCurrency(Currency.TL.name());
    request.setDescription("Açıklama Alanı");
    request.setCardHolderName("isim soyisim");
    request.setCardNumber("555555555555555");
    request.setexpireMonth("01");
    request.setExpireYear("22");
    request.setCvcNumber("223");
    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);

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

```

{% endtab %}

{% tab title="Perl" %}

```
```

{% endtab %}

{% tab title="Ruby" %}

```
```

{% endtab %}

{% tab title="Phython" %}

```
```

{% endtab %}

{% tab title="Go" %}

```
```

{% endtab %}

{% tab title=".NET" %}

```
```

{% endtab %}
{% endtabs %}

## API servisinden dönen parametreler

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

{% tabs %}
{% tab title="Başarılı Sonuç" %}

```javascript
{
"status":"success",
"paymentStatus":true,
"paymentId":"",
}
```

{% endtab %}
{% endtabs %}

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

{% tabs %}
{% tab title="Başarısız Sonuç" %}

```javascript
{
"status":"failure",
"errorCode":"xxxxx",
"message":true,
"paymentStatus":false,
}
```

{% endtab %}
{% endtabs %}
