PHP code example of sveaekonomi / webpay

1. Go to this page and download the library: Download sveaekonomi/webpay library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sveaekonomi / webpay example snippets



//Include the library
\WebPay\WebPay;
use Svea\WebPay\WebPayItem;
use Svea\WebPay\Config\ConfigurationService;

//Display all errors in case something is wrong
error_reporting(E_ALL);
ini_set('display_errors', 'On');

// Get configuration object holding the Svea service login credentials
$myConfig = ConfigurationService::getDefaultConfig();

// We assume that you've collected the following information about the order in your shop:
// The shop cart contains one item "Billy" which cost 700,99 kr excluding vat (25%).
// When selecting to pay using the invoice payment method, the customer has also provided their social security number, which is ::orderRow();
$boughtItem->setDescription("Billy");
$boughtItem->setAmountExVat(700.99);
$boughtItem->setVatPercent(25);
$boughtItem->setQuantity(1);

// Add the order rows to the order:
$myOrder->addOrderRow($boughtItem);

// Next, we create a customer identity object, for invoice orders Svea will look up the customer address et al based on the social security number
$customerInformation = WebPayItem::individualCustomer();
$customerInformation->setNationalIdNumber("194605092222");

// Add the customer to the order:
$myOrder->addCustomerDetails($customerInformation);

// If a stronger authentication is needed (invoice to SE for example) we need to tell where to redirect after successful/rejected authentication
$myOrder->setIdentificationConfirmationUrl('https://mydomain.com/successful-authentication');
$myOrder->setIdentificationRejectionUrl('https://mydomain.com/rejected-authentication');

// We have now completed specifying the order, and wish to send the payment request to Svea. To do so, we first select the invoice payment method:
$myInvoiceOrderRequest = $myOrder->useInvoicePayment();

// Then send the request to Svea using the doRequest method, and immediately receive a service response object back
$myResponse = $myInvoiceOrderRequest->doRequest();


// If the response attribute accepted is true, the payment succeeded.
if($myResponse->accepted == true)
{
    echo "Invoice payment succeeded!";
};

// The response also contains a customerIdentity object containing the invoice address of the customer, which should match the order shipping address.
print_r($myResponse->customerIdentity);


...
$myOrderBuilder = WebPay::createOrder($myConfig);
//or
$myOrder = WebPay::checkout($myConfig);
...



...
$myOrderRow = WebPayItem::orderRow();       // create the order row object

$myOrderRow->setQuantity(1);                // nt(25);              // recommended to specify price using AmountExVat & VatPercent

$myOrder->addOrderRow($myOrderRow);       // add order row to the order
...

/* the same code expressed in a more compact, fluent style:
$myOrder->addOrderRow( WebPayItem::orderRow()->setQuantity(1)->setAmountExVat(10.00)->setVatPercent(25) );
*/


...
$order->
    ...
    addCustomerDetails(
        WebPayItem::individualCustomer()
        ->setNationalIdNumber(194605092222)
        ->setName("Tess", "Testson")
        ->setStreetAddress("Gatan 23")
        ->setZipCode(9999)
        ->setLocality("Stan")
        ...
    )
;
...


...
$order
    ...
    ->setCountryCode("SE")                  // t, direct bank & PayPage payments. Ignored for invoice and payment plan.
    ->setClientOrderNumber("A123456")       // Required for card payment, direct payment, Unique String(65). Optional for Invoice and Payment plan String(32).
    ->setCustomerReference("att: kgm")      // Optional for invoice and payment plan String(32), ignored for card & direct bank orders.
    ->setOrderDate("2012-12-12")            // 


...
$order = WebPay::createOrder($config);
$order
    ->addOrderRow( ...                      // etCountryCode("SE")                  // order
$response = $request->doRequest();
...


...
// fetch all available campaigns from Svea
$campaignsRequest = WebPay::getPaymentPlanParams($config);
$campaignsRequest->setCountryCode("SE");
$campaignsResponse = $campaignsRequest->doRequest();

// we pick the first available campaign from the response
$campaign = $campaignsResponse->campaignCodes[0]->campaignCode;

// create the order
$order = WebPay::createOrder($config);
$order
    ->addOrderRow( ...
    ->addCustomerDetails( ...
    ->setCountryCode("SE")
    ->setOrderDate("2012-12-12")
;

// send the request, using the first available campaign with the payment plan payment method
$request = $order->usePaymentPlanPayment($campaign)
$response = $request->doRequest();
...


...
$form = $order
    ->usePaymentMethod(PaymentMethod::SVEACARDPAY)          // Card payment, get available providers using WebPay::listPaymentMethods()
        ->setReturnUrl("http://myurl.se")                   // Required
        ->setCancelUrl("http://myurl.se")                   // Optional
        ->setCardPageLanguage("sv")                         // Optional, languageCode As ISO639, eg. "en", default english
        ->getPaymentForm();
...


...
$form = $order

    ->addCustomerDetails(
        ...
        ->setIpAddress()                                    // Required
        ...
    ->usePaymentMethod(PaymentMethod::SVEACARDPAY)          // Card payment, get available providers using WebPay::listPaymentMethods()
        ->setReturnUrl("http://myurl.se")                   // Required
        ->setCancelUrl("http://myurl.se")                   // Optional
        ->setCardPageLanguage("sv")                         // Required, languageCode As ISO639, eg. "en", default english
        ->getPaymentUrl();
...


...
$form = $order
    ->usePaymentMethod(PaymentMethod::NORDEA_SE)            // Direct bank payment, get available banks using WebPay::listPaymentMethods()
        ->setReturnUrl("http://myurl.se")                   // Required
        ->setCancelUrl("http://myurl.se")                   // Optional
        ->setCardPageLanguage("sv")                         // Optional, languageCode As ISO639, eg. "en", default english
        ->getPaymentForm();
...


...
$form = $order
    ->usePaymentMethod(PaymentMethod::SVEACARDPAY)          // Use WebPay::listPaymentMethods() to get available payment methods
        ->setReturnUrl("http://myurl.se")                   // Required
        ->setCancelUrl("http://myurl.se")                   // Optional
        ->setCardPageLanguage("sv")                         // Optional, languageCode As ISO639, eg. "en", default english
        ->getPaymentForm();
...


...
$form = $order
    ->usePayPageCardOnly()
        ->setPayPageLanguage("sv")                          // Optional, languageCode As ISO639, eg. "en", default english
        ->setReturnUrl("http://myurl.se")                   // Required
        ->setCallbackUrl("http://myurl.se")                 // Optional
        ->setCancelUrl("http://myurl.se")                   // Optional
        ->getPaymentForm();
...


...
$form = $order
    ->usePayPageDirectBankOnly()
        ->setPayPageLanguage("sv")                          // Optional, languageCode As ISO639, eg. "en", default english
        ->setReturnUrl("http://myurl.se")                   // Required
        ->setCancelUrl("http://myurl.se")                   // Optional
        ->getPaymentForm()
;
...


...
$form = $order
    ->usePayPage()
        ->setPayPageLanguage("sv")                          // Optional, languageCode As ISO639, eg. "en", default english
        ->setReturnUrl("http://myurl.se")                   // Required
        ->setCancelUrl("http://myurl.se")                   // Optional
        ->getPaymentForm()
;
...


    $orderBuilder = WebPay::checkout($myConfig);
 



    $orderBuilder->setCountryCode('SE')// customer country, we recommend basing this on the customer billing address
    ->setCurrency('SEK')
        ->setClientOrderNumber('123-das-555-32')// 123&svea_order=123') //ags::HIDENOTYOU) // optional, hides certain elements in the iframe
        ->setMerchantData("\"Newsletter\":\"true\"") // optional, sets data on order which is not displayed to end-user but is available in backend
        ->setLocale('sv-Se'); // 


    $presetPhoneNumber = WebPayItem::presetValue()
        ->setTypeName(\Svea\WebPay\Checkout\Model\PresetValue::PHONE_NUMBER)
        ->setValue('some value')
        ->setIsReadonly(true);

    $orderBuilder->addPresetValue($presetPhoneNumber);

    
    WebPayItem::fixedDiscount()->setAmountIncVat(10); // this is 10 kr for example, not percent

    // create and add items to order
    $firstBoughtItem = WebPayItem::orderRow()
        ->setAmountIncVat(100.00)// - l. Checkout orders only. Will not be applicable for other order types.
        ->setMerchantData('gray') // optional. Checkout orders only. Set data which is not displayed to end-users but is available in the backend
        ->setName('Fork');

    $secondBoughtItem = WebPayItem::orderRow()
        ->setAmountIncVat(10.00)
        ->setVatPercent(12)
        ->setQuantity(2)
        ->setDescription('Korv med bröd')
        ->setArticleNumber('321')
        ->setTemporaryReference('231') // optional. Checkout orders only. Will not be applicable for other order types.
        ->setMerchantData('tasty') // optional. Checkout orders only. Set data which is not displayed to end-users but is available in the backend
        ->setName('Fork');

    $discountItem = WebPayItem::fixedDiscount()
        ->setName('Promo coupon')
        ->setVatPercent(10)
        ->setAmountIncVat(20);

    $shippingItem = WebPayItem::shippingFee()
        ->setAmountIncVat(17.60)
        ->setVatPercent(10)
        ->setName('incvatShippingFee');

    $orderBuilder->addOrderRow($firstBoughtItem);
    $orderBuilder->addOrderRow($secondBoughtItem);
    $orderBuilder->addDiscount($discountItem);
    $orderBuilder->addFee($shippingItem);

    $response = $orderBuilder->createOrder();


    $orderBuilder = WebPay::checkout($config)


     $orderBuilder->setCheckoutOrderId(50)
                  ->setCountryCode('SE');


     $response = $orderBuilder->getOrder();


    $orderBuilder = WebPay::checkout($myConfig);

    $orderBuilder->setCheckoutOrderId(5)
                 ->setCountryCode('SE');

    // create and add items to order
    $firstBoughtItem = WebPayItem::orderRow()
        ->setAmountExVat(10.99)
        ->setVatPercent(25)
        ->setQuantity(1)
        ->setDescription("Billy")
        ->setArticleNumber("123456789A")
        ->setTemporaryReference('230') // optional. Checkout orders only. Will not be applicable for other order types.
        ->setMerchantData('hello') // optional. Checkout orders only. Set data which is not displayed to end-users but is available in the backend
        ->setName('Fork');

    $secondBoughtItem = WebPayItem::orderRow()
        ->setAmountIncVat(5.00)
        ->setVatPercent(12)
        ->setQuantity(2)
        ->setDescription("Korv med bröd")
        ->setArticleNumber("123456789B")
        ->setTemporaryReference('231') // optional. Checkout orders only. Will not be applicable for other order types.
        ->setMerchantData('tasty') // optional. Checkout orders only. Set data which is not displayed to end-users but is available in the backend
        ->setName('Fork');

    $orderBuilder->addOrderRow($firstBoughtItem);
    $orderBuilder->addOrderRow($secondBoughtItem);

echo $response['Gui']['Snippet']


    $orderBuilder = WebPay::checkout($myConfig);

    $presetValueIsCompany = \Svea\WebPay\WebPayItem::presetValue()
        ->setTypeName(\Svea\WebPay\Checkout\Model\PresetValue::IS_COMPANY)
        ->setValue(false)
        ->setIsReadonly(true);

    $orderBuilder->setCountryCode('SE')
        ->addPresetValue($presetValueIsCompany);

    $response = $orderBuilder->getAvailablePartPaymentCampaigns();


Array
(
    [0] => Array
        (
            [CampaignCode] => 213060
            [ContractLengthInMonths] => 3
            [Description] => Köp nu betala om 3 månader (räntefritt)
            [FromAmount] => 1000
            [InitialFee] => 100
            [InterestRatePercent] => 0
            [MonthlyAnnuityFactor] => 1
            [NotificationFee] => 29
            [NumberOfInterestFreeMonths] => 3
            [NumberOfPaymentFreeMonths] => 3
            [PaymentPlanType] => 2
            [ToAmount] => 50000
        )
        
    [1] => Array
        (
            [CampaignCode] => 223065
            [ContractLengthInMonths] => 3
            [Description] => Black Friday - Cyber Monday
            [FromAmount] => 120
            [InitialFee] => 0
            [InterestRatePercent] => 0
            [MonthlyAnnuityFactor] => 1
            [NotificationFee] => 0
            [NumberOfInterestFreeMonths] => 3
            [NumberOfPaymentFreeMonths] => 3
            [PaymentPlanType] => 2
            [ToAmount] => 30000
        )
    [2] => Array
        (
            [CampaignCode] => 310012
            [ContractLengthInMonths] => 12
            [Description] => Dela upp betalningen på 12 månader (räntefritt)
            [FromAmount] => 1000
            [InitialFee] => 295
            [InterestRatePercent] => 0
            [MonthlyAnnuityFactor] => 0.083333333333333
            [NotificationFee] => 35
            [NumberOfInterestFreeMonths] => 12
            [NumberOfPaymentFreeMonths] => 0
            [PaymentPlanType] => 1
            [ToAmount] => 30000
        )
    [3] => Array
            (
                [CampaignCode] => 410012
                [ContractLengthInMonths] => 12
                [Description] => Dela upp betalningen på 12 månader
                [FromAmount] => 100
                [InitialFee] => 0
                [InterestRatePercent] => 19.9
                [MonthlyAnnuityFactor] => 0.092586652785396
                [NotificationFee] => 29
                [NumberOfInterestFreeMonths] => 0
                [NumberOfPaymentFreeMonths] => 0
                [PaymentPlanType] => 0
                [ToAmount] => 30000
            )
)


...
$order = WebPay::createOrder($config);
$order
    ->addOrderRow( ...                      // etCountryCode("SE")                  // tCredit("111111");     // 


...
    $config = ConfigurationService::getDefaultConfig();
    $form = WebPay::createOrder($config)
        ->addOrderRow(/*add any orderrow*/)
        ->setCountryCode("SE")                              //Required, must be set to "SE" for Swish Payments
        ->setClientOrderNumber("33")                        //Required
        ->setCurrency("SEK")                                //Required, must be set to "SEK" for Swish Payments
        ->setPayerAlias("46701234567")                      //Required, set consumers mobile number
        ->usePaymentMethod(PaymentMethod::SWISH)            //Set payment method to SWISH
        ->setReturnUrl("http://myurl.se")                   //Required, this is where the user will be redirected after a successful payment
        ->setCallbackUrl("http://myurl.se/callback")        //Optional, however VERY recommended as redirects from Swish to returnUrl might fail
        ->getPaymentForm();                                 
...


...
$orderrow = WebPayItem::orderRow()
   ->setAmountExVat(100.00)        // optional, Float, recommended, use precisely two of the price specification methods
   ->setVatPercent(25)             // optional, Integer, recommended, use precisely two of the price specification methods
   ->setAmountIncVat(125.00)       // optional, Float, use precisely two of the price specification methods
   ->setQuantity(2)                // 
   ->setArticleNumber("1")         // optional, String(10) for invoice and payment plan, String (256) for card and direct
   ->setDiscountPercent(0)         // optional
;
...


...
$shippingFee = WebPayItem::shippingFee()
   ->setAmountExVat(100.00)       //  optional, Float, recommended, use precisely two of the price specification methods
   ->setVatPercent(25)             // optional, Integer, recommended, use precisely two of the price specification methods
   ->setAmountIncVat(125.00)       // optional, Float, use precisely two of the price specification methods
   ->setUnit("pcs")               // optional, String(3) for invoice and payment plan, String(64) for card and direct bank
   ->setName('name')              // optional, invoice & payment plan orders will merge "name" with "description", String(256) for card and direct
   ->setDescription("description") // optional, String(40) for invoice & payment plan orders will merge "name" with "description" , String(512) for card and direct
   ->setShippingId('33')           // optional
   ->setDiscountPercent(0)
;         // optional
...


...
$invoiceFee = WebPayItem::invoiceFee()
   ->setAmountExVat(100.00)        // optional, Float, recommended, use precisely two of the price specification methods
   ->setVatPercent(25)             // optional, Integer, recommended, use precisely two of the price specification methods
   ->setAmountIncVat(125.00)       // optional, Float, use precisely two of the price specification methods
   ->setUnit("pcs")               // optional, String(3)
   ->setName('name')               // optional, will merge "name" with "description"
   ->setDescription("description") // optional, String(40) will merge "name" with "description"
   ->setDiscountPercent(0)
;         // optional
...


...
     $fixedDiscount = WebPayItem::fixedDiscount()
         ->setAmountIncVat(100.00)               // optional, Float, use precisely two of the price specification methods
         ->setAmountExVat(1.0)                   // optional, Float, recommended, use precisely two of the price specification methods
         ->setVatPercent(25)                     // optional, Integer, recommended, use precisely two of the price specification methods
         ->setDiscountId("1")                    // optional
         ->setUnit("st")                         // optional
         ->setName("Fixed")                      // optional, invoice & payment plan orders will merge "name" with "description", String(256) for card and direct
         ->setDescription("FixedDiscount");       // optional, String(40) for invoice & payment plan orders will merge "name" with "description" , String(512) for card and direct
...


...
$relativeDiscount = WebPayItem::relativeDiscount()
  ->setDiscountPercent(10.0)          //  ->setName("DiscountName")           // optional, invoice & payment plan orders will merge "name" with "description", String(256) for card and direct
  ->setDescription("DiscountDesc.")   // optional, String(40) for invoice & payment plan orders will merge "name" with "description" , String(512) for card and direct
;
...


...
$individual = WebPayItem::individualCustomer()
  ->setNationalIdNumber() // Numeric	// invoice, payment plan: nd DE
  ->setBirthDate()        // Numeric	// invoice, payment plan: ress()    // String	// invoice, payment plan: ional but desirable
  ->setEmail()         	// String	// invoice, payment plan: optional but desirable
  ->setIpAddress()       	// String	// invoice, payment plan: optional but desirable; card: 


...
$companyCustomer = WebPayItem::companyCustomer()
  ->setNationalIdNumber() // Numeric	// invoice:  ->setVatNumber()        // Numeric	// invoice:  ->setZipCode()           // String	// invoice: esirable
  ->setIpAddress()        // String	// invoice: optional but desirable; card: 


...
$myNumberedOrderRow = WebPayItem::numberedOrderRow() //inherited from OrderRow
  ->setAmountExVat(100.00)                // recommended to specify price using AmountExVat & VatPercent
  ->setVatPercent(25)                     // recommended to specify price using AmountExVat & VatPercent
  ->setAmountIncVat(125.00)               // optional, need to use two out of three of the price specification methods
  ->setQuantity(2)                        // eric)                     //


...
$order = WebPay::createOrder($config)
  ->addOrderRow($orderrow)          // fee
  ->addDiscount($discount)          // optional, see WebPayItem for fixed, relative discount
  ->addCustomerDetails($customer)   // yments
  ->setCurrency("SEK")                // bank orders.
  ->setPeppolId("1234:abcd1234")      // Optional for invoices where customer type is company, if set the invoice will be sent via PEPPOL
;
...


...
$request = WebPay::deliverOrder($config)
   ->setOrderId()                  // invoice, payment plan and accountCredit only - InvoiceDistributionType()  // invoice only and accountCredit, :deliverOrderRows instead
   ->setCreditInvoice()            // deprecated, optional -- use WebPayAdmin::creditOrderRows instead
;
// then select the corresponding request class and send request
$response = $request->deliverInvoiceOrder()->doRequest();       // returns DeliverOrdersResponse (no rows) or DeliverOrderResult (with rows)
$response = $request->deliverPaymentPlanOrder()->doRequest();   // returns DeliverOrdersResponse (no rows) or DeliverOrderResult (with rows)
$response = $request->deliverCardOrder()->doRequest();          // returns ConfirmTransactionResponse
$response = $request->deliverAccountCreditOrder()->doRequest(); // returns DeliverOrderResponse
...


dd namespaces
use Svea\WebPay\WebPay;
use Svea\WebPay\Config\ConfigurationService;
use Svea\WebPay\Constant\DistributionType;

//Display all errors in case something is wrong
error_reporting(E_ALL);
ini_set('display_errors', 'On');

// Get configuration object holding the Svea service login credentials
$myConfig = ConfigurationService::getDefaultConfig();

// We assume that you've previously run the firstorder.php file and successfully made a createOrder request to Svea using the invoice payment method.
$mySveaOrderId = "123456";

// Begin the order creation process by creating an order builder object using the WebPay::createOrder() method:
$myOrder = WebPay::deliverOrder($myConfig);

// We then add information to the order object by using the various methods in the Svea\DeliverOrderBuilder class.

// We begin by adding any additional information 


...
$request = WebPay::getAddresses($config)
   ->setCountryCode()                  // mber etc. used to identify customer
   ->setOrderTypeInvoice()             // deprecated -- method that corresponds to the ConfigurationProvider account credentials used
   ->setOrderTypePaymentPlan()         // deprecated -- method that corresponds to the ConfigurationProvider account credentials used
;
// then select the corresponding request class and send request
$response = $request->getIndividualAddresses()->doRequest();    // returns GetAddressesResponse
$response = $request->getCompanyAddresses()->doRequest();       // returns GetAddressesResponse


...
$myGetAddressResponse = WebPay::getAddresses($myConfig);

// GetAddressResponse attributes:
$myGetAddressResponse->accepted;            // Boolean  // true iff request was accepted
$myGetAddressResponse->resultcode;          // String   // set iff accepted false
$myGetAddressResponse->errormessage;        // String   // set iff accepted false
$myGetAddressResponse->customerIdentity;    // Array of GetAddressIdentity

$firstCustomerAddress = $myGetAddressesResponse->customerIdentity[0];

// GetAddressIdentity attributes:
$firstCustomerAddress->customerType;        // String   // "Person" or "Business" for individual and company customers, respectively
$firstCustomerAddress->nationalIdNumber;    // Numeric  // national id number of individual or company
$firstCustomerAddress->fullName;            // String   // amalgamated firstName and surname for individual, or company name for company customers
$firstCustomerAddress->coAddress;           // String   // optional
$firstCustomerAddress->street;              // String   // 


$request = WebPay::getAddresses($config)
  ->setCountryCode()                  // t number etc. used to identify customer
  ->setOrderTypeInvoice()             // deprecated -- method that corresponds to the ConfigurationProvider account credentials used
  ->setOrderTypePaymentPlan()         // deprecated -- method that corresponds to the ConfigurationProvider account credentials used
;
// then select the corresponding request class and send request
$response = $request->getIndividualAddresses()->doRequest();    // returns GetAddressesResponse
$response = $request->getCompanyAddresses()->doRequest();       // returns GetAddressesResponse


$response = WebPay::getAddresses( $config )
   ->setCountryCode("SE")                  // Required -- supply the country code that corresponds to the account credentials used
   ->setOrderTypeInvoice()                 // Required -- use invoice account credentials for getAddresses lookup
   ->setCustomerIdentifier("194605092222") // Required -- lookup the address
   ->getIndividualAddresses()              // get private individual address
   ->doRequest();
   ;


...
$response =
WebPay::getPaymentPlanParams($config)
  ->setCountryCode("SE")                  // Required
  ->doRequest();
...


...
$response->accepted                 // true if request was accepted by the service
$response->errormessage             // may be set if accepted above is false
$response->resultcode               // 27xxx, reason
$response->campaignCodes[]          // array of all available campaign payment plans in an array
 ->campaignCode                      // numeric campaign code identifier
 ->description                       // localised description string
 ->paymentPlanType                   // human readable identifier (not guaranteed unique)
 ->contractLengthInMonths
 ->monthlyAnnuityFactor              // pricePerMonth = price * monthlyAnnuityFactor + notificationFee
 ->initialFee
 ->notificationFee
 ->interestRatePercent
 ->numberOfInterestFreeMonths
 ->numberOfPaymentFreeMonths
 ->fromAmount                        // amount lower limit for plan availability
 ->toAmount                          // amount upper limit for plan availability
...


...
$methods = WebPay::listPaymentMethods( $config )
   ->setCountryCode("SE")      // 


...

$campaigns = WebPay::getAccountCreditParams( $config )
    ->setCountryCode('SE')  // 


...
$order = WebPay::checkout($config)
  ->addOrderRow($orderRow)                                            // ->addDiscount($discount)                                            // optional, see WebPayItem for fixed discount
  ->setCountryCode("SE")                                              //  settings (confirmation uri)
  ->setPushUri("https://svea.com/push.aspx?sid=123&svea_order=123")   // onicIdAuthentication(true)                        // optional, force electronic id authentication when customer finalizes order
  ->setLocale('sv-SE')                                                // 


...
$locale = 'sv-SE';

$order = WebPay::checkout($config)
  ->setCountryCode('SE')   // sting Checkout order

;
...


...
$locale = 'sv-SE';

$order = WebPay::checkout($config)
  ->setCountryCode('SE')   // PayItem::orderRow
  ->updateOrder();         // Update existing Checkout order
...


...
$taskUrl = 'http://paymentadminapi.svea.com/api/v1/queue/1';

$response = WebPayAdmin::queryTaskInfo($testConfig)
        ->setTaskUrl($taskUrl)
        ->getTaskInfo()
        ->doRequest();
        
...


...
$request = WebPayAdmin->cancelOrder($config)
   ->setOrderId()		// ()	// responding request class and send request
$response = $request->cancelInvoiceOrder()->doRequest();        // returns CloseOrderResponse
$response = $request->cancelPaymentPlanOrder()->doRequest();    // returns CloseOrderResponse
$response = $request->cancelCardOrder()->doRequest();           // returns AnnulTransactionResponse
$response = $request->cancelCheckoutOrder()->doRequest();       // returns empty content for valid response
$response = $request->cancelAccountCreditOrder()->doRequest();  // returns CloseOrderResponse
...

...
    $request = WebPayAdmin::cancelOrder($testConfig)
            ->setCheckoutOrderId($sveaCheckoutOrderId)
            ->setAmountIncVat(5.00)
            ->cancelCheckoutOrderAmount();
    
    $response = $request->doRequest();
...


...
$request = WebPayAdmin::queryOrder($config)
   ->setOrderId()           // er() // optional, can be used instead of ->setTransactionId()
   ->setCountryCode()       // );     // returns GetOrdersResponse
$response = $request->queryPaymentPlanOrder()->doRequest(); // returns GetOrdersResponse
$response = $request->queryCardOrder()->doRequest();        // returns QueryTransactionResponse
$response = $request->queryDirectBankOrder()->doRequest();  // returns QueryTransactionResponse
$response = $request->queryCheckoutOrder()->doRequest();    // returns formatted array response with order information
$response = $request->queryAccountCreditOrder()->doRequest(); // returns GetOrderResponse
...


...
$orderRow = WebPayItem::orderRow()
    ...
    ->setName("orderrow 1")                 // optional
    ->setDescription("description 1")       // optional
;
$order->addOrderRow($orderRow)->useInvoicePayment()->doRequest();
...


...
$queryBuilder = WebPayAdmin::queryOrder($config)
    ->setOrderId($invoiceOrderIdToQuery)
    ->setCountryCode($country)
;
$queryInvoiceOrderResponse = $queryBuilder->queryInvoiceOrder()->doRequest();

$queryInvoiceOrderResponse->name;          // contains null
$queryInvoiceOrderResponse->description;   // contains "orderrow 1: description 1"


...
$queryOrderResponse->name;             // contains "orderrow 1"
$queryOrderResponse->description;      // contains "description 1"


...
$request = WebPayAdmin::cancelOrderRows($config)
   ->setOrderId()               //     // , index of original order rows you wish to cancel
   ->addNumberedOrderRow()		// request->cancelPaymentPlanOrderRows()->doRequest();   // returns CancelOrderRowsResponse
$response = $request->cancelCardOrderRows()->doRequest();          // returns LowerTransactionResponse
$response = $request->cancelCheckoutOrderRows()->doRequest();      // returns no content if response is success
...


...
$request = WebPayAdmin::creditOrderRows($config)
  ->setCheckoutOrderId()          //  delivery action    
  ->setInvoiceId()                //   // the original order
  ->addCreditOrderRows()          // optional
  ->setRowToCredit()              // optional, index of one of the original order row you wish to credit
  ->setRowsToCredit()             // optional, list of row indexes you wish to credit
  ->addNumberedOrderRow()         // card and direct bank only, nkOrderRows()->doRequest();  // returns CreditTransactionResponse
$response = $request->creditCheckoutOrderRows()->doRequest();
$response = $request->creditAccountCreditOrderRows()->doRequest(); // returns CreditIOrderRowsResponse

...


...
$request = WebPayAdmin::addOrderRows($testConfig)
   ->setCheckoutOrderId() // Required for checkout orders
   ->setOrderId()         // Required for invoice or payment plan
   ->setCountryCode()
   ->addOrderRow()        // One or more, for checkout is limit only one row
   ->addOrderRows()       // optional

//Finish by selecting the correct orderType and perform the request:
$response = $request->addInvoiceOrderRows()->doRequest();
$response = $request->addPaymentPlanOrderRows()->doRequest();
$response = $request->addCheckoutOrderRows()->doRequest();
...


...
$request = WebPayAdmin::updateOrderRows($config)
    ->setCheckoutOrderId()  //     // ex of original order row

// then select the corresponding request class and send request
$response = $request->updateInvoiceOrderRows()->doRequest();     // returns UpdateOrderRowsResponse
$response = $request->updatePaymentPlanOrderRows()->doRequest(); // returns UpdateOrderRowsResponse
$response = $request->updateCheckoutOrderRows()->doRequest();
...


...
$request = WebPayAdmin::deliverOrderRows($config)
   ->setCheckoutOrderId()           // ->setTransactionId()	            //   		    // nd send request
$response = $request->deliverInvoiceOrderRows()->doRequest();       // returns DeliverOrderRowsResponse
$response = $request->deliverPaymentPlanOrderRows()->doRequest();   // returns DeliverOrderRowsResponse
$response = $request->deliverCardOrderRows()->doRequest();          // returns ConfirmTransactionResponse
$response = $request->deliverCheckoutOrderRows()->doRequest();
...


...
$request = WebPayAdmin::updateOrder($config)
    ->setOrderId()		     // String(32)
    ->setNotes()             // optional String(200)
;
// then select the corresponding request class and send request
$response = $request->updateInvoiceOrder()->doRequest();     // returns UpdateOrderResponse
$response = $request->updatePaymentPlanOrder()->doRequest(); // returns UpdateOrderResponse
...


...
$request = WebPayAdmin::creditAmount($config)
    ->setContractNumber(12345)
    ->setCountryCode('SE')
    ->setDescription('credit desc')
    ->setAmountIncVat(1500.00);

$response = $request->creditPaymentPlanAmount()->doRequest();
...


...
$request = WebPayAdmin::creditAmount($myConfig)
        ->setCheckoutOrderId($sveaCheckoutOrderId) //      ->setAmountIncVat(20.00)
        ->creditCheckoutAmount()
        ->doRequest();
...


...
$creditOrderRowsBuilder = WebPayAdmin::creditOrderRows($testConfig)
    ->setCheckoutOrderId($sveaCheckoutOrderId) // Set the checkout order id
    ->setDeliveryId(1)      // t();
...


...
$creditOrderRowsBuilder = WebPayAdmin::creditOrderRows($testConfig)
        ->setCheckoutOrderId($sveaCheckoutOrderId)
        ->setDeliveryId(1) // edited order with new Order row");

    $creditOrderRowsBuilder->addCreditOrderRow($myCreditRow);

    $response = $creditOrderRowsBuilder->creditCheckoutOrderWithNewOrderRow()->doRequest();
...


$config = ConfigurationService::getTestConfig();

$request = WebpayAdmin::cancelRecurSubscription($config)
        ->setCountryCode("SE")
        ->setSubscriptionId("123456")
        ->cancelRecurSubscription()
        ->doRequest();


...
  $response = (new SveaResponse($_REQUEST,$countryCode,$config))->getResponse();
...



Svea\WebPay\Helper\PaymentPlanHelper\PaymentPlanCalculator;

$orderTotal = 11200;
$decimals = 0; // This parameter is optional and will default to 0, use 2 decimals if payments are in euro
$campaign = array (
          'CampaignCode' => 213060,
          'Description' => 'Dela upp betalningen på 60 månader',
          'PaymentPlanType' => 0,
          'ContractLengthInMonths' => 60,
          'MonthlyAnnuityFactor' => 0.02555,
          'InitialFee' => 100.0,
          'NotificationFee' => 29.0,
          'InterestRatePercent' => 16.75,
          'NumberOfInterestFreeMonths' => 3,
          'NumberOfPaymentFreeMonths' => 3,
          'FromAmount' => 1000.0,
          'ToAmount' => 50000.0
          );

$totalAmountToBePayed = PaymentPlanCalculator::getTotalAmountToPay($orderTotal, $campaign, $decimals);
echo $totalAmountToBePayed;

18067



Svea\WebPay\Helper\PaymentPlanHelper\PaymentPlanCalculator;

$orderTotal = 11200;
$decimals = 0; // This parameter is optional and will default to 0, use 2 decimals if payments are in euro
$campaign = array (
          'CampaignCode' => 213060,
          'Description' => 'Dela upp betalningen på 60 månader',
          'PaymentPlanType' => 0,
          'ContractLengthInMonths' => 60,
          'MonthlyAnnuityFactor' => 0.02555,
          'InitialFee' => 100.0,
          'NotificationFee' => 29.0,
          'InterestRatePercent' => 16.75,
          'NumberOfInterestFreeMonths' => 3,
          'NumberOfPaymentFreeMonths' => 3,
          'FromAmount' => 1000.0,
          'ToAmount' => 50000.0
          );

$monthlyAmount = PaymentPlanCalculator::getMonthlyAmountToPay($orderTotal, $campaign, $decimals);
echo $monthlyAmount;

317



Svea\WebPay\Helper\PaymentPlanHelper\PaymentPlanCalculator;

$orderTotal = 11200;
$decimals = 0; // This parameter is optional and will default to 0, use 2 decimals if payments are in euro
$campaign = array (
          'CampaignCode' => 213060,
          'Description' => 'Dela upp betalningen på 60 månader',
          'PaymentPlanType' => 0,
          'ContractLengthInMonths' => 60,
          'MonthlyAnnuityFactor' => 0.02555,
          'InitialFee' => 100.0,
          'NotificationFee' => 29.0,
          'InterestRatePercent' => 16.75,
          'NumberOfInterestFreeMonths' => 3,
          'NumberOfPaymentFreeMonths' => 3,
          'FromAmount' => 1000.0,
          'ToAmount' => 50000.0
          );

$effectiveInterestRate = PaymentPlanCalculator::getEffectiveInterestRate($orderTotal, $campaign, $decimals);
echo $effectiveInterestRate;

21.33



Svea\WebPay\Helper\PaymentPlanHelper\PaymentPlanCalculator;

$orderTotal = 11200;
$decimals = 0; // This parameter is optional and will default to 0, use 2 decimals if payments are in euro
$campaign = array (
    'CampaignCode' => 213060,
    'Description' => 'Dela upp betalningen på 60 månader',
    'PaymentPlanType' => 0,
    'ContractLengthInMonths' => 60,
    'MonthlyAnnuityFactor' => 0.02555,
    'InitialFee' => 100.0,
    'NotificationFee' => 29.0,
    'InterestRatePercent' => 16.75,
    'NumberOfInterestFreeMonths' => 3,
    'NumberOfPaymentFreeMonths' => 3,
    'FromAmount' => 1000.0,
    'ToAmount' => 50000.0
);

$campaign = PaymentPlanCalculator::getAllCalculations($orderTotal, $campaign, $decimals);
echo '<pre>' . print_r($campaign, true) . '</pre>';

Array
(
    [CampaignCode] => 213060
    [Description] => Dela upp betalningen på 60 månader
    [PaymentPlanType] => 0
    [ContractLengthInMonths] => 60
    [MonthlyAnnuityFactor] => 0.02555
    [InitialFee] => 100
    [NotificationFee] => 29
    [InterestRatePercent] => 16.75
    [NumberOfInterestFreeMonths] => 3
    [NumberOfPaymentFreeMonths] => 3
    [FromAmount] => 1000
    [ToAmount] => 50000
    [EffectiveInterestRate] => 21.33
    [MonthlyAmountToPay] => 317
    [TotalAmountToPay] => 18067
)



Svea\WebPay\Helper\PaymentPlanHelper\PaymentPlanCalculator;

$orderTotal = 11200;
$decimals = 0; // This parameter is optional and will default to 0, use 2 decimals if payments are in euro
$ignoreMinMaxFlag = false; // This parameters is optional and default to false, if set to true it will return all campaigns regardless of if it's valid for the order total
$campaigns = array (
    0 => array(
        'CampaignCode' => 213060,
        'Description' => 'Dela upp betalningen på 60 månader',
        'PaymentPlanType' => 0,
        'ContractLengthInMonths' => 60,
        'MonthlyAnnuityFactor' => 0.02555,
        'InitialFee' => 100.0,
        'NotificationFee' => 29.0,
        'InterestRatePercent' => 16.75,
        'NumberOfInterestFreeMonths' => 3,
        'NumberOfPaymentFreeMonths' => 3,
        'FromAmount' => 1000.0,
        'ToAmount' => 50000.0
        ),
    1 => array (
        'CampaignCode' => 310012,
        'Description' => 'Dela upp betalningen på 12 månader (räntefritt)',
        'PaymentPlanType' => 1,
        'ContractLengthInMonths' => 12,
        'MonthlyAnnuityFactor' => 0.08333,
        'InitialFee' => 295.0,
        'NotificationFee' => 35.0,
        'InterestRatePercent' => 0.0,
        'NumberOfInterestFreeMonths' => 12,
        'NumberOfPaymentFreeMonths' => 0,
        'FromAmount' => 1000.0,
        'ToAmount' => 30000.0,
        )
);

$campaigns = PaymentPlanCalculator::getTotalAmountToPayFromCampaigns($orderTotal, $campaigns, $decimals, $ignoreMinMaxFlag);
echo '<pre>' . print_r($campaigns, true) . '</pre>';

Array
(
    [0] => Array
        (
            [CampaignCode] => 213060
            [Description] => Dela upp betalningen på 60 månader
            [PaymentPlanType] => 0
            [ContractLengthInMonths] => 60
            [MonthlyAnnuityFactor] => 0.02555
            [InitialFee] => 100
            [NotificationFee] => 29
            [InterestRatePercent] => 16.75
            [NumberOfInterestFreeMonths] => 3
            [NumberOfPaymentFreeMonths] => 3
            [FromAmount] => 1000
            [ToAmount] => 50000
            [TotalAmountToPay] => 18067
        )

    [1] => Array
        (
            [CampaignCode] => 310012
            [Description] => Dela upp betalningen på 12 månader (räntefritt)
            [PaymentPlanType] => 1
            [ContractLengthInMonths] => 12
            [MonthlyAnnuityFactor] => 0.08333
            [InitialFee] => 295
            [NotificationFee] => 35
            [InterestRatePercent] => 0
            [NumberOfInterestFreeMonths] => 12
            [NumberOfPaymentFreeMonths] => 0
            [FromAmount] => 1000
            [ToAmount] => 30000
            [TotalAmountToPay] => 11915
        )

)



Svea\WebPay\Helper\PaymentPlanHelper\PaymentPlanCalculator;

$orderTotal = 11200;
$decimals = 0; // This parameter is optional and will default to 0, use 2 decimals if payments are in euro
$ignoreMinMaxFlag = false; // This parameters is optional and default to false, if set to true it will return all campaigns regardless of if it's valid for the order total
$campaigns = array (
    0 => array(
        'CampaignCode' => 213060,
        'Description' => 'Dela upp betalningen på 60 månader',
        'PaymentPlanType' => 0,
        'ContractLengthInMonths' => 60,
        'MonthlyAnnuityFactor' => 0.02555,
        'InitialFee' => 100.0,
        'NotificationFee' => 29.0,
        'InterestRatePercent' => 16.75,
        'NumberOfInterestFreeMonths' => 3,
        'NumberOfPaymentFreeMonths' => 3,
        'FromAmount' => 1000.0,
        'ToAmount' => 50000.0
        ),
    1 => array (
        'CampaignCode' => 310012,
        'Description' => 'Dela upp betalningen på 12 månader (räntefritt)',
        'PaymentPlanType' => 1,
        'ContractLengthInMonths' => 12,
        'MonthlyAnnuityFactor' => 0.08333,
        'InitialFee' => 295.0,
        'NotificationFee' => 35.0,
        'InterestRatePercent' => 0.0,
        'NumberOfInterestFreeMonths' => 12,
        'NumberOfPaymentFreeMonths' => 0,
        'FromAmount' => 1000.0,
        'ToAmount' => 30000.0,
        )
);

$campaigns = PaymentPlanCalculator::getMonthlyAmountToPayFromCampaigns($orderTotal, $campaigns, $decimals, $ignoreMinMaxFlag);
echo '<pre>' . print_r($campaigns, true) . '</pre>';

Array
(
    [0] => Array
        (
            [CampaignCode] => 213060
            [Description] => Dela upp betalningen på 60 månader
            [PaymentPlanType] => 0
            [ContractLengthInMonths] => 60
            [MonthlyAnnuityFactor] => 0.02555
            [InitialFee] => 100
            [NotificationFee] => 29
            [InterestRatePercent] => 16.75
            [NumberOfInterestFreeMonths] => 3
            [NumberOfPaymentFreeMonths] => 3
            [FromAmount] => 1000
            [ToAmount] => 50000
            [MonthlyAmountToPay] => 317
        )

    [1] => Array
        (
            [CampaignCode] => 310012
            [Description] => Dela upp betalningen på 12 månader (räntefritt)
            [PaymentPlanType] => 1
            [ContractLengthInMonths] => 12
            [MonthlyAnnuityFactor] => 0.08333
            [InitialFee] => 295
            [NotificationFee] => 35
            [InterestRatePercent] => 0
            [NumberOfInterestFreeMonths] => 12
            [NumberOfPaymentFreeMonths] => 0
            [FromAmount] => 1000
            [ToAmount] => 30000
            [MonthlyAmountToPay] => 993
        )

)



Svea\WebPay\Helper\PaymentPlanHelper\PaymentPlanCalculator;

$orderTotal = 11200;
$decimals = 0; // This parameter is optional and will default to 0, use 2 decimals if payments are in euro
$ignoreMinMaxFlag = false; // This parameters is optional and default to false, if set to true it will return all campaigns regardless of if it's valid for the order total
$campaigns = array (
    0 => array(
        'CampaignCode' => 213060,
        'Description' => 'Dela upp betalningen på 60 månader',
        'PaymentPlanType' => 0,
        'ContractLengthInMonths' => 60,
        'MonthlyAnnuityFactor' => 0.02555,
        'InitialFee' => 100.0,
        'NotificationFee' => 29.0,
        'InterestRatePercent' => 16.75,
        'NumberOfInterestFreeMonths' => 3,
        'NumberOfPaymentFreeMonths' => 3,
        'FromAmount' => 1000.0,
        'ToAmount' => 50000.0
        ),
    1 => array (
        'CampaignCode' => 310012,
        'Description' => 'Dela upp betalningen på 12 månader (räntefritt)',
        'PaymentPlanType' => 1,
        'ContractLengthInMonths' => 12,
        'MonthlyAnnuityFactor' => 0.08333,
        'InitialFee' => 295.0,
        'NotificationFee' => 35.0,
        'InterestRatePercent' => 0.0,
        'NumberOfInterestFreeMonths' => 12,
        'NumberOfPaymentFreeMonths' => 0,
        'FromAmount' => 1000.0,
        'ToAmount' => 30000.0,
        )
);

$campaigns = PaymentPlanCalculator::getEffectiveInterestRateFromCampaigns($orderTotal, $campaigns, $decimals, $ignoreMinMaxFlag);
echo '<pre>' . print_r($campaigns, true) . '</pre>';

Array
(
    [0] => Array
        (
            [CampaignCode] => 213060
            [Description] => Dela upp betalningen på 60 månader
            [PaymentPlanType] => 0
            [ContractLengthInMonths] => 60
            [MonthlyAnnuityFactor] => 0.02555
            [InitialFee] => 100
            [NotificationFee] => 29
            [InterestRatePercent] => 16.75
            [NumberOfInterestFreeMonths] => 3
            [NumberOfPaymentFreeMonths] => 3
            [FromAmount] => 1000
            [ToAmount] => 50000
            [EffectiveInterestRate] => 21.33
        )

    [1] => Array
        (
            [CampaignCode] => 310012
            [Description] => Dela upp betalningen på 12 månader (räntefritt)
            [PaymentPlanType] => 1
            [ContractLengthInMonths] => 12
            [MonthlyAnnuityFactor] => 0.08333
            [InitialFee] => 295
            [NotificationFee] => 35
            [InterestRatePercent] => 0
            [NumberOfInterestFreeMonths] => 12
            [NumberOfPaymentFreeMonths] => 0
            [FromAmount] => 1000
            [ToAmount] => 30000
            [EffectiveInterestRate] => 12.44
        )

)



Svea\WebPay\Helper\PaymentPlanHelper\PaymentPlanCalculator;

$orderTotal = 11200;
$decimals = 0; // This parameter is optional and will default to 0, use 2 decimals if payments are in euro
$ignoreMinMaxFlag = false; // This parameters is optional and default to false, if set to true it will return all campaigns regardless of if it's valid for the order total
$campaigns = array (
    0 => array(
        'CampaignCode' => 213060,
        'Description' => 'Dela upp betalningen på 60 månader',
        'PaymentPlanType' => 0,
        'ContractLengthInMonths' => 60,
        'MonthlyAnnuityFactor' => 0.02555,
        'InitialFee' => 100.0,
        'NotificationFee' => 29.0,
        'InterestRatePercent' => 16.75,
        'NumberOfInterestFreeMonths' => 3,
        'NumberOfPaymentFreeMonths' => 3,
        'FromAmount' => 1000.0,
        'ToAmount' => 50000.0
        ),
    1 => array (
        'CampaignCode' => 310012,
        'Description' => 'Dela upp betalningen på 12 månader (räntefritt)',
        'PaymentPlanType' => 1,
        'ContractLengthInMonths' => 12,
        'MonthlyAnnuityFactor' => 0.08333,
        'InitialFee' => 295.0,
        'NotificationFee' => 35.0,
        'InterestRatePercent' => 0.0,
        'NumberOfInterestFreeMonths' => 12,
        'NumberOfPaymentFreeMonths' => 0,
        'FromAmount' => 1000.0,
        'ToAmount' => 30000.0,
        )
);

$campaigns = PaymentPlanCalculator::getAllCalculationsFromCampaigns($orderTotal, $campaigns, $decimals, $ignoreMinMaxFlag);
echo '<pre>' . print_r($campaigns, true) . '</pre>';

Array
(
    [0] => Array
        (
            [CampaignCode] => 213060
            [Description] => Dela upp betalningen på 60 månader
            [PaymentPlanType] => 0
            [ContractLengthInMonths] => 60
            [MonthlyAnnuityFactor] => 0.02555
            [InitialFee] => 100
            [NotificationFee] => 29
            [InterestRatePercent] => 16.75
            [NumberOfInterestFreeMonths] => 3
            [NumberOfPaymentFreeMonths] => 3
            [FromAmount] => 1000
            [ToAmount] => 50000
            [EffectiveInterestRate] => 21.33
            [TotalAmountToPay] => 18067
            [MonthlyAmountToPay] => 317
        )

    [1] => Array
        (
            [CampaignCode] => 310012
            [Description] => Dela upp betalningen på 12 månader (räntefritt)
            [PaymentPlanType] => 1
            [ContractLengthInMonths] => 12
            [MonthlyAnnuityFactor] => 0.08333
            [InitialFee] => 295
            [NotificationFee] => 35
            [InterestRatePercent] => 0
            [NumberOfInterestFreeMonths] => 12
            [NumberOfPaymentFreeMonths] => 0
            [FromAmount] => 1000
            [ToAmount] => 30000
            [EffectiveInterestRate] => 12.44
            [TotalAmountToPay] => 11915
            [MonthlyAmountToPay] => 993
        )

)


...
$paymentPlanParams = WebPay::getPaymentPlanParams($config)->setCountryCode("SE")->doRequest();

$response = Helper::paymentPlanPricePerMonth($amount, $paymentPlanParams, $ignoreMaxAndMinFlag = false);    // returns PaymentPlanPricePerMonth

$firstCampaign = $response->values[0]['campaignCode'];                      // i.e. [campaignCode] => 310012
$firstCampaignDescription = $response->values[0]['description'];            // i.e. [description] => Dela upp betalningen på 12 månader (räntefritt)
$pricePerMonthForFirstCampaign = $response->values[0]['pricePerMonth'];     // i.e. [pricePerMonth] => 201.66666666667
...


$order = WebPay::createOrder($config)->
         ->addOrderRow(
         WebPayItem::orderRow()
            ->setAmountIncVat(1400.00)
            ->setVatPercent(6)
            ->setQuantity(1)
         );
...
$response = $order->useInvoicePayment->doRequest();


$order->addDiscount( WebPayItem::fixedDiscount()
                       ->setAmountIncVat(-0.25)    // a negative discount shows up as a positive adjustment
                       ->setVatPercent(0)
                   )
                ...


$order = WebPay::createOrder($config)
          ->addOrderRow(
              WebPayItem::orderRow()
                  ->setAmountIncVat(1400.26)
                  ->setVatPercent(6)
                  ->setQuantity(1)
          )
          ->addDiscount( WebPayItem::fixedDiscount()
                          ->setAmountIncVat(-0.26)
                          ->setVatPercent(0)
                      )
          ...


$order = WebPay::createOrder($config)->
         ->addOrderRow(
         WebPayItem::orderRow()
            ->setAmountIncVat(1400.00)
            ->setVatPercent(6)
            ->setQuantity(1)
         );
...
$response = $order->useInvoicePayment->doRequest();


$order->addDiscount( WebPayItem::fixedDiscount()
                       ->setAmountIncVat(-0.25)    // a negative discount shows up as a positive adjustment
                       ->setVatPercent(0)
                   )
                ...


$order = WebPay::createOrder($config)
          ->addOrderRow(
              WebPayItem::orderRow()
                  ->setAmountIncVat(1400.26)
                  ->setVatPercent(6)
                  ->setQuantity(1)
          )
          ->addDiscount( WebPayItem::fixedDiscount()
                          ->setAmountIncVat(-0.26)
                          ->setVatPercent(0)
                      )
          ...


$svea_order_id = 1048731;

$svea_query = WebPayAdmin::queryOrder(ConfigurationService::getTestConfig())
    ->setOrderId($svea_order_id)
    ->setCountryCode('SE')
    ->enableLogging(true)
    ->queryAccountCreditOrder()
    ->doRequest();


Svea\WebPay\Helper\Helper;

$var = '1234:abc1234';

if(Helper::isValidPeppolId($var))
{
    // Valid Peppol-ID
}
else
{
    // Not Valid Peppol-ID    
}



Price (excl. VAT)   Price (incl. VAT)	Totalt netto	VAT%	Sum (incl. VAT)
1320,75             1400.00             1320,75          6.00	1400,00
                                        -------         -----   -------
                                        1320,75         79,25	1400,00

Price (excl. VAT)   Price (incl. VAT)	Totalt netto	VAT%	Sum (incl. VAT)
1320,75             1400.00             1320,75          6.00	1400,00
0,25                0,25                0,25             0.00   0,25
                                        -------         -----   -------
                                        1321,00         79,25	1400,25

Price (excl. VAT)   Price (incl. VAT)	Totalt netto	VAT%	Sum (incl. VAT)
1321,00             1400,26             1321,00          6.00	1400,26
-0,26               -0,26               -0,26            0.00   -0,26
                                        -------         -----   -------
                                        1320,74         79,26	1400,00

Price (excl. VAT)   Price (incl. VAT)	Totalt netto	VAT%	Sum (incl. VAT)
1320,75             1400.00             1320,75          6.00	1400,00
                                        -------         -----   -------
                                        1320,75         79,25	1400,00

Price (excl. VAT)   Price (incl. VAT)	Totalt netto	VAT%	Sum (incl. VAT)
1320,75             1400.00             1320,75          6.00	1400,00
0,25                0,25                0,25             0.00   0,25
                                        -------         -----   -------
                                        1321,00         79,25	1400,25

Price (excl. VAT)   Price (incl. VAT)	Totalt netto	VAT%	Sum (incl. VAT)
1321,00             1400,26             1321,00          6.00	1400,26
-0,26               -0,26               -0,26            0.00   -0,26
                                        -------         -----   -------
                                        1320,74         79,26	1400,00