-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathupdateCheckoutOrder.php
More file actions
54 lines (43 loc) · 1.39 KB
/
updateCheckoutOrder.php
File metadata and controls
54 lines (43 loc) · 1.39 KB
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
<?php //
/**
* example file, how to create an checkout order request
*
* @author Savo Garovic and Janko Stevanovic for Svea Svea\WebPay\WebPay
*/
require_once '../../vendor/autoload.php';
use Svea\WebPay\WebPay;
use Svea\WebPay\WebPayItem;
use Svea\WebPay\Config\ConfigurationService;
error_reporting(E_ALL);
ini_set('display_errors', 'On');
// get config object
$myConfig = ConfigurationService::getTestConfig();
$orderBuilder = WebPay::checkout($myConfig);
$orderBuilder->setCheckoutOrderId(7479)
//->setMerchantData("merchantData")
->setCountryCode('SE');
// create and add items to order
$firstBoughtItem = WebPayItem::orderRow()
->setAmountIncVat(10.99)
->setVatPercent(25)
// ->setAmountExVat(12.32) // - this action is not allowed for checkout
->setQuantity(1)
->setDescription("Billy")
->setArticleNumber("123456789A")
->setName('Fork');
$secondBoughtItem = WebPayItem::orderRow()
->setAmountIncVat(5.00)
->setVatPercent(12)
// ->setAmountExVat(12.32) // - this action is not allowed for checkout
->setQuantity(2)
->setDescription("Korv med bröd")
->setArticleNumber("123456789B")
->setName('Fork');
$orderBuilder->addOrderRow($firstBoughtItem);
$orderBuilder->addOrderRow($secondBoughtItem);
try {
$response = $orderBuilder->updateOrder();
print_r($response);
} catch (\Exception $e) {
print_r($e->getMessage());
}