3D ile Ödeme
3D Secure ile ödeme entegrasyon dokümanı
3D Başlatma
3D API servisi parametreleri
POST
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
Path Parameters
Request Body
{
"status":"success",
"threeDSecureUrl":"",
"systemTime":"",
"locale":"tr",
}
{
"status":"failure",
"errorCode":"000",
"message":"000",
"error":array(),
"systemTime":"",
"locale":"tr",
}
API servis istek kodları
API servisi için örnek kodları inceleyebilirsiniz.
Örnek Kodlar
PHP
.NET
Java
Ruby
Phython
Node.js
// 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" }
]
}
//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>";
// 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)
}
});
//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;
}
});
// 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());
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.
{
"status":"success",
"threeDSecureUrl":"https://api.weepay.co/xxx/xxx",
"systemTime":"",
"locale":"tr",
}
Başarısız Sonuç Örneği
{
"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
{
"paymentStatus":true,// işlemin başarılı olup olmadı true / false
"paymentId":"",//Ödemenin Idsi
}
Başarısız Sonuç Örneği
{
"paymentStatus":false,// işlemin başarılı olup olmadı true / false
"errorCode":"00",
"message":"ÖRN : 3D onayı alınamadı."
}
Last updated