Ödeme Formu Oluşturma
Ödeme Formunuzu kolayca oluşturabilirsiniz.

Ödeme Formu Başlatma

post
https://api.weepay.co/
Payment/PaymentCreate
Ödeme Oluşturma

API servisi istek örnek kodlar

Json
PHP
Node
Javascript
Java
1
// Request JSON example;
2
{
3
"Auth": {
4
"bayiId":"22",
5
"apiKey": "XXXXXXXXX",
6
"secretKey": "XXXXXXXXXXXXXXXX"
7
},
8
"Data":{
9
"orderId":1,
10
"currency":"TL",
11
"locale":"tr",
12
"paidPrice":"0.16",
13
"ipAddress":"192.168.1.1",
14
"installmentNumber":1, // Uygulanacak Taksit Sayısı
15
"description":"Açıkalama", // Açıklama
16
"callBackUrl":"http://Sitem.com/callBack"// Response URL
17
},
18
"Customer":{
19
"customerId":"1", // alıcı müşteri Id
20
"customerName":"isim", //alıcı ismi
21
"customerSurname":"soyisim", // alıcı Soyismi
22
"gsmNumber":"50XXXXXXX",// alıcı cep telefonu
23
"email":"[email protected]", // alıcı mail
24
"identityNumber":"112312312313132", // alıcı TC kimlik numarası
25
"city":"istanbul",// alıcı şehir
26
"country":"Turkey" // alıcı ülke
27
},
28
"BillingAddress": {
29
"contactName":"isim soyisim",
30
"address":"Abdurrahman Nafiz Gürman,Mh, G. Ali Rıza Gürcan Cd. No:27",
31
"city":"istanbul",
32
"country":"turkey",
33
"zipCode":34164
34
},
35
"ShippingAddress": {
36
"contactName":"isim soyisim",
37
"address":"Abdurrahman Nafiz Gürman,Mh, G. Ali Rıza Gürcan Cd. No:27",
38
"city":"istanbul",
39
"country":"turkey",
40
"zipCode":34164
41
},
42
"Products":
43
[
44
{"productId":"B104A", "name":"ürün bir","productPrice":2.3, "itemType":"PHYSICAL"},
45
{"productId":"C1087", "name":"ürün iki","productPrice":2.3, "itemType":"PHYSICAL" },
46
{"productId":"12233352", "name":"ürün üç","productPrice":2.3, "itemType":"PHYSICAL" }
47
]
48
}
Copied!
1
2
// https://github.com/weepay/weepay-php PHP lib.
3
// composer or weepay initialize Bootstrap
4
// Auth
5
$options = new \weepay\Auth();
6
$options->setBayiID("xxxxxx");// weepay tarafıdan verilen bayiId
7
$options->setApiKey("xxxx-xxxx-xxx");// weepay tarafıdan verilen apiKey
8
$options->setSecretKey("xxxxxxx-xxxxxxxxx-xx-xx"); // weepay tarafıdan verilen secretKey
9
$options->setBaseUrl("https://api.weepay.co");
10
11
//Request
12
$request = new \weepay\Request\FormInitializeRequest();
13
$request->setOrderId('11');
14
$request->setIpAddress('192.168.2.1');
15
$request->setPrice(0.10);
16
$request->setCurrency(\weepay\Model\Currency::TL);
17
$request->setLocale(\weepay\Model\Locale::TR);
18
$request->setDescription('Açıklama Alanı');
19
$request->setCallBackUrl('https://websitem.com/callback');
20
$request->setPaymentGroup(\weepay\Model\PaymentGroup::PRODUCT);
21
$request->setPaymentChannel(\weepay\Model\PaymentChannel::WEB);
22
23
//Customer
24
$customer = new \weepay\Model\Customer();
25
$customer->setCustomerId(1235); // Üye işyeri müşteri Id
26
$customer->setCustomerName("isim"); //Üye işyeri müşteri ismi
27
$customer->setCustomerSurname("soyisim"); //Üye işyeri müşteri Soyisim
28
$customer->setGsmNumber("50XXXXXX"); //Üye işyeri müşteri Cep Tel
29
$customer->setEmail("[email protected]"); //Üye işyeri müşteri ismi
30
$customer->setIdentityNumber("00032222721"); //Üye işyeri müşteri TC numarası
31
$customer->setCity("istanbul"); //Üye işyeri müşteri il
32
$customer->setCountry("turkey");//Üye işyeri müşteri ülke
33
$request->setCustomer($customer);
34
35
//Adresler
36
// Fatura Adresi
37
$BillingAddress = new \weepay\Model\Address();
38
$BillingAddress->setContactName("isim soyisim");
39
$BillingAddress->setAddress("Abdurrahman Nafiz Gürman,Mh, G. Ali Rıza Gürcan Cd. No:27");
40
$BillingAddress->setCity("istanbul");
41
$BillingAddress->setCountry("turkey");
42
$BillingAddress->setZipCode("34164");
43
$request->setBillingAddress($BillingAddress);
44
45
//Kargo / Teslimat Adresi
46
$ShippingAddress = new \weepay\Model\Address();
47
$ShippingAddress->setContactName("isim soyisim");
48
$ShippingAddress->setAddress("Abdurrahman Nafiz Gürman,Mh, G. Ali Rıza Gürcan Cd. No:27");
49
$ShippingAddress->setCity("istanbul");
50
$ShippingAddress->setCountry("turkey");
51
$ShippingAddress->setZipCode("34164");
52
$request->setShippingAddress($ShippingAddress);
53
54
// Sipariş Ürünleri
55
$Products = array();
56
57
// Birinci Ürün
58
$firstProducts = new \weepay\Model\Product();
59
$firstProducts->setName("Ürün Bir");
60
$firstProducts->setProductId(12344);
61
$firstProducts->setProductPrice(0.10);
62
$firstProducts->setItemType(\weepay\Model\ProductType::PHYSICAL);
63
$Products[0] = $firstProducts;
64
65
// İkinci Ürün
66
$secondProducts = new \weepay\Model\Product();
67
$secondProducts->setName("Ürün İki");
68
$secondProducts->setProductId("C550A100");
69
$secondProducts->setProductPrice(0.10);
70
$secondProducts->setItemType(\weepay\Model\ProductType::PHYSICAL);
71
$Products[1] = $secondProducts;
72
73
// Üçüncü Ürün
74
$thirdProducts = new \weepay\Model\Product();
75
$thirdProducts->setName("Ürün Üç");
76
$thirdProducts->setProductId("1000");
77
$thirdProducts->setProductPrice("0.10");
78
$thirdProducts->setItemType(\weepay\Model\ProductType::PHYSICAL);
79
$Products[2] = $thirdProducts;
80
$request->setProducts($Products);
81
82
$checkoutFormInitialize = \weepay\Model\CheckoutFormInitialize::create($request, $options);
83
84
echo "<div id='weePay-checkout-form' class='popup'>";
85
print_r($checkoutFormInitialize);
86
87
88
89
90
91
92
93
Copied!
1
// https://github.com/weepay/weepay-nodejs node.js SDK.
2
// npm install weepay-nodejs or Add dependency 'weepay-nodejs'
3
// in your package.json file
4
// check sdk in samples folder CreatePaymentForm.js samples
5
// Node.js v12.0.0 or later
6
7
const weepay = require('weepay-nodejs');
8
9
weepay.configure({
10
bayiId: "bayiId",
11
apiKey: "apiKey",
12
secretKey: "secretKey",
13
baseUrl: "https://test-api.weepay.co"
14
});
15
16
const request = {
17
data: {
18
orderId: 1,
19
ipAddress: "192.168.2.1",
20
paidPrice: 0.10,
21
currency: Currency.TL,
22
locale: Locale.TR,
23
description: "Açıklama Alanı",
24
callBackUrl: "https://websitem.com/callback",
25
paymentGroup: PaymentGroup.PRODUCT,
26
paymentChannel: PaymentChannel.WEB
27
},
28
customer: {
29
customerId: 1234,
30
customerName: "isim",
31
customerSurname: "soyisim",
32
gsmNumber: "50XXXXXX",
33
34
identityNumber: "00032222721",
35
city: "istanbul",
36
country: "turkey"
37
},
38
billingAddress: {
39
contactName: "isim soyisim",
40
address: "Abdurrahman Nafiz Gürman,Mh, G. Ali Rıza Gürcan Cd. No:27",
41
city: "istanbul",
42
country: "turkey",
43
zipCode: "34164"
44
},
45
shippingAddress: {
46
contactName: "isim soyisim",
47
address: "Abdurrahman Nafiz Gürman,Mh, G. Ali Rıza Gürcan Cd. No:27",
48
city: "istanbul",
49
country: "turkey",
50
zipCode: "34164"
51
},
52
products: [
53
{
54
name: "first product",
55
productPrice: "30.00",
56
itemType: ProductType.PHYSICAL,
57
productId: "1234"
58
},
59
{
60
name: "first product",
61
productPrice: "30.00",
62
itemType: ProductType.PHYSICAL,
63
productId: "1234"
64
},
65
]
66
}
67
68
weepay.formInitialize(request).then(function (res) {
69
if (res.status == "success") {
70
console.log(res.CheckoutFormData);
71
} else {
72
console.log(res.message)
73
}
74
});
75
76
Copied!
1
// check sample : https://github.com/weepay/weepay-javascript/blob/main/samples/createpayment.html
2
// import weepay javascript library
3
var weepay = new weepayInit();
4
5
weepay.configure({
6
bayiId: "bayiId",
7
apiKey: "apiKey",
8
secretKey: "secretKey",
9
baseUrl: "https://api.weepay.co"
10
})
11
12
var request = {
13
data: {
14
orderId: 1,
15
ipAddress: "192.168.2.1",
16
paidPrice: 0.10,
17
currency: Constants.Currency.TL,
18
locale: Constants.Locale.TR,
19
description: "Açıklama Alanı",
20
cardHolderName: "isim soyisim",
21
cardNumber: "555555555555555",
22
expireMonth: "01",
23
expireYear: "22",
24
cvcNumber: "233",
25
installmentNumber: 1,
26
paymentGroup: Constants.PaymentGroup.PRODUCT,
27
paymentChannel: Constants.PaymentChannel.WEB
28
},
29
customer: {
30
customerId: 1234,
31
customerName: "isim",
32
customerSurname: "soyisim",
33
gsmNumber: "50XXXXXX",
34
35
identityNumber: "00032222721",
36
city: "istanbul",
37
country: "turkey"
38
},
39
billingAddress: {
40
contactName: "isim soyisim",
41
address: "Abdurrahman Nafiz Gürman,Mh, G. Ali Rıza Gürcan Cd. No:27",
42
city: "istanbul",
43
country: "turkey",
44
zipCode: "34164"
45
},
46
shippingAddress: {
47
contactName: "isim soyisim",
48
address: "Abdurrahman Nafiz Gürman,Mh, G. Ali Rıza Gürcan Cd. No:27",
49
city: "istanbul",
50
country: "turkey",
51
zipCode: "34164"
52
},
53
products: [
54
{
55
name: "first product",
56
productPrice: "30.00",
57
itemType: Constants.ProductType.PHYSICAL,
58
productId: "1234"
59
},
60
{
61
name: "first product",
62
productPrice: "30.00",
63
itemType: Constants.ProductType.PHYSICAL,
64
productId: "1234"
65
},
66
]
67
}
68
69
weepay.createPayment(request, function (response) {
70
if (response.status == "failure") {
71
console.log(response.message);
72
} else {
73
console.log(response)
74
}
75
});
Copied!
1
// https://github.com/weepay/weepay-java java SDK.
2
// if you use maven, if not check github page others installation
3
//<dependency>
4
// <groupId>co.weepay</groupId>
5
// <artifactId>weepay-java</artifactId>
6
// <version>1.0.0</version>
7
//</dependency>
8
// check sdk in samples folder CreatePaymentForm.txt samples
9
// java 1.7 or later
10
11
//Auth
12
Auth options = new Auth();
13
14
options.setBayiId(bayiId);
15
options.setApiKey("apiKey");
16
options.setSecretKey("secretKey");
17
options.setBaseUrl("https://api.weepay.co");
18
19
// Request
20
FormInitializeRequest request = new FormInitializeRequest();
21
request.setOptions(options);
22
request.setOrderId("1");
23
request.setIpAddress("192.168.1.2");
24
request.setPrice(35.50);
25
request.setCurrency(Currency.TL.name());
26
request.setLocale(Locale.TR.getValue());
27
request.setDescription("Açıklama Alanı");
28
request.setCallBackUrl("https://websitem.com/callback");
29
request.setInstallmentNumber(1);
30
request.setPaymentGroup(PaymentGroup.PRODUCT.name());
31
request.setPaymentChannel(PaymentChannel.WEB.name());
32
33
// Customer
34
Customer customer = new Customer();
35
customer.setCustomerId(1);
36
customer.setCustomerName("isim");
37
customer.setCustomerSurname("soyisim");
38
customer.setGsmNumber("50XXXXXX");
39
customer.setEmail("[email protected]");
40
customer.setIdentityNumber("00032222721");
41
customer.setCity("istanbul");
42
customer.setCountry("turkey");
43
request.setCustomer(customer);
44
45
// Address
46
// Billing Address
47
Address billingAddress = new Address();
48
billingAddress.setContactName("isim soyisim");
49
billingAddress.setAddress("address");
50
billingAddress.setCity("city");
51
billingAddress.setCountry("turkey");
52
billingAddress.setZipCode("34164");
53
request.setBillingAddress(billingAddress);
54
55
// Address
56
// Shipping Address
57
Address shippingAddress = new Address();
58
shippingAddress.setContactName("isim soyisim");
59
shippingAddress.setAddress("address");
60
shippingAddress.setCity("city");
61
shippingAddress.setCountry("turkey");
62
shippingAddress.setZipCode("34164");
63
request.setShippingAddress(shippingAddress);
64
65
// Products
66
// First Product
67
List<Product> products = new ArrayList<Product>();
68
Product firstProduct = new Product();
69
firstProduct.setName("Ürün bir");
70
firstProduct.setProductId(1234);
71
firstProduct.setProductPrice(0.10);
72
firstProduct.setItemType(ProductType.PHYSICAL.name());
73
products.add(firstProduct);
74
75
// Second Product
76
Product secondProduct = new Product();
77
secondProduct.setName("Ürün iki");
78
secondProduct.setProductId(4567);
79
secondProduct.setProductPrice(0.10);
80
secondProduct.setItemType(ProductType.PHYSICAL.name());
81
products.add(secondProduct);
82
request.setProducts(products);
83
84
CheckoutFormInitialize payment = CheckoutFormInitialize.create(request, options);
85
System.out.println(payment.getCheckoutFormData());
Copied!

API Servisinden Dönen Sonuç Örnekleri

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

1
{
2
"CheckoutFormData":"html data",
3
"status":"success",
4
"paymentPageUrl":"Ortak Ödeme Sayfası linki"
5
}
Copied!

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

1
{
2
"status":"failure",
3
"errorCode":"030",
4
"error":"array()",
5
"message":"Hata Mesajı"
6
}
Copied!

Ödeme Servisi Kullanım Çeşitleri

    Ödeme Formu Popup
    Ödeme Formu Responsive
    Ödeme Sayfası
    Ödeme Sayfası iFrame

Ödeme Formu Kullanım Şekilleri

Response
1
Response olarak dönen CheckOutFormData nesnesi 2 farklı şekilde kullanılır.
2
<div id='weePay-checkout-form' class='popup'> // Popup Form
3
<div id='weePay-checkout-form' class='responsive'> // Responsive Form
4
5
6
Copied!

Ortak Ödeme Sayfası Kullanım Şekilleri

1
// Ortak Ödeme Sayfası
2
3
// Ödeme response ile gelen paymentPageUrl
4
// alanındaki adrese Yönlendirme yapabilirinz
5
// Örnek Adres
6
# https://api.weepay.co/GuvenliOdeme/Payment/xxxx-xxx-xxx-xxxxxx
Copied!

iframe Ortak Ödeme Sayfası

1
// iframe Ortak ödem sayfası için
2
// Ödeme response ile gelen paymentPageUrl ortak ödeme URL sinin sonuna
3
// get parametresi olarak iframe değeri true olarak gönderilir.
4
// Script tagları içerisine iframe resizer kullanarak iframe sorunsuz olarak kullanılır.
5
6
<iframe src="https://api.weepay.co/GuvenliOdeme/Payment/xxxx-xxx-xxx-xxxxxx&iframe=true"
7
id="weepayiframe" style="width: 100%;" frameborder="0" scrolling="no"></iframe>
8
<script src="https://service.weepay.co/assets/js/iframe-resizer.js"></script>
Copied!

3D Secure (CallBack) Parametreleri

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

1
{
2
"paymentStatus":true,// işlemin başarılı olup olmadı true / false
3
"paymentId":"",//Ödemenin Idsi
4
}
Copied!

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

1
{
2
"paymentStatus":false,// işlemin başarılı olup olmadı true / false
3
"errorCode":"00",
4
"message":"ÖRN : 3D onayı alınamadı."
5
}
Copied!
ÖNEMLİ UYARI
CallBack URL POST olarak işlem sonucu gönderilir. İşlem sonucu başarılı ise Ödeme Detay servisimizi kullanarak ödemenin başarılı olup olmadığını tekrar kontrol ediniz.
Last modified 2mo ago