-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
81 lines (67 loc) · 2.09 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
require_once 'shopinext.php';
$shopinext = new Shopinext('Shopinext ID','API Anahtarı','Gizli Anahtar','test','http://localhost/return.php');
$examplecart = array(
array(
'name' => 'Shopinext Entegrasyon Hizmeti',
'price' => 2.75,
'quantity' => 3
),
array(
'name' => 'Shopinext Ürün Hizmeti',
'price' => 10,
'quantity' => 1
),
array(
'name' => 'Kargo Ücreti',
'price' => 10,
'quantity' => 1
)
);
$price = 0;
foreach($examplecart as $product) {
$shopinext->addProduct(array(
'name'=>$product['name'],
'price'=>$product['price'],
'quantity'=>$product['quantity']
));
$price += $product['price']*$product['quantity'];
}
$shopinext->createToken(array(
'customerName' => 'Shopinext Test',
'customerMail' => '[email protected]',
'customerPhone' => '08503057717', //SMS doğrulama aktif ise bu numaraya doğrulama kodu gönderilir. Boş gönderildiği takdirde ödeme sırasında alınır.
'price' => $price,
'currency' => 'TRY', //USD, EUR, GBP
'shipCode' => false, // true gönderildiği takdirde ödeme ekranında adres bilgileri alınacaktır. Ödeme sonrası tanımladığınız firmadan kargo kodu oluşturulur.
'customerCountry' => 'TR', // Ülke kodu gönderilmelidir. Örneğin Azerbaijan => AZ, Australia => AU vb.
'customerCity' => 'İstanbul', // Şehir adı tam ve doğru şekilde gönderilmelidir.
'customerTown' => 'Maltepe', // İlçe adı tam ve doğru şekilde gönderilmelidir.
'customerAddress' => 'İdealtepe, Dik Sk. 13/2, 34841', // Adres bilgisi eksiksiz gönderilmelidir.
));
echo '<pre>';
print_r($shopinext->output);
echo '</pre>';
$shopinext->getPaymentForm(array(
'sessionToken' => $shopinext->output->sessionToken
));
if($shopinext->output->responseCode == 00) {
echo $shopinext->output->iframeData;
} else {
echo $shopinext->output->responseMsg;
}
$shopinext->checkOrder(array(
'orderId' => 'Sipariş Numarası'
));
echo '<pre>';
print_r($shopinext->output);
echo '</pre>';
$shopinext->getInstallment();
echo '<pre>';
print_r($shopinext->output);
echo '</pre>';
$shopinext->getCommission();
echo '<pre>';
print_r($shopinext->output);
echo '</pre>';
?>