Links
Comment on page

Ö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
// 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",
"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":"[email protected]", // 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\FormInitializeRequest();
$request->setOrderId('11');
$request->setIpAddress('192.168.2.1');
$request->setPrice(0.10);
$request->setCurrency(\weepay\Model\Currency::TL);
$request->setLocale(\weepay\Model\Locale::TR);
$request->setDescription('Açıklama Alanı');
$request->setCallBackUrl('https://websitem.com/callback');
$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("[email protected]"); //Ü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);
$checkoutFormInitialize = \weepay\Model\CheckoutFormInitialize::create($request, $options);
echo "<div id='weePay-checkout-form' class='popup'>";
print_r($checkoutFormInitialize);
// 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: "bayiId",
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ı",
callBackUrl: "https://websitem.com/callback",
paymentGroup: PaymentGroup.PRODUCT,
paymentChannel: PaymentChannel.WEB
},
customer: {
customerId: 1234,
customerName: "isim",
customerSurname: "soyisim",
gsmNumber: "50XXXXXX",
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.formInitialize(request).then(function (res) {
if (res.status == "success") {
console.log(res.CheckoutFormData);
} else {
console.log(res.message)
}
});
// check sample : https://github.com/weepay/weepay-javascript/blob/main/samples/createpayment.html
// import weepay javascript library
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",
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)
}
});
// 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 CreatePaymentForm.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
FormInitializeRequest request = new FormInitializeRequest();
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.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("[email protected]");
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);
CheckoutFormInitialize payment = CheckoutFormInitialize.create(request, options);
System.out.println(payment.getCheckoutFormData());

API Servisinden Dönen Sonuç Örnekleri

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

{
"CheckoutFormData":"html data",
"status":"success",
"paymentPageUrl":"Ortak Ödeme Sayfası linki"
}

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

{
"status":"failure",
"errorCode":"030",
"error":"array()",
"message":"Hata Mesajı"
}

Ödeme Servisi Kullanım Çeşitleri

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

Ödeme Formu Kullanım Şekilleri

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

Ortak Ödeme Sayfası Kullanım Şekilleri

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

iframe Ortak Ödeme Sayfası

// iframe ortak ödeme sayfası için
// Ödeme response ile gelen paymentPageUrl ortak ödeme URL'nin sonuna
// get parametresi olarak iframe değeri true olarak gönderilir.
// Script tagları içerisine iframe resizer kullanarak iframe sorunsuz olarak kullanılır.
<iframe src="https://api.weepay.co/GuvenliOdeme/Payment/xxxx-xxx-xxx-xxxxxx?iframe=true"
id="weepayiframe" style="width: 100%;" frameborder="0" scrolling="no"></iframe>
<script src="https://service.weepay.co/assets/js/iframe-resizer.js"></script>

3D Secure (CallBack) Parametreleri

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ı."
}
Ö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.