From 94f8a581c576b7c0aa8766415a3ae2d96aade655 Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Tue, 30 Jul 2024 20:08:40 +0200 Subject: [PATCH] Vipps class is redunant, use Client directly --- examples/authorization/01-token.php | 14 ++-- examples/checkout/01-checkout-create.php | 20 ++--- examples/payment/01-epayment-init.php | 6 +- examples/payment/02-epayment-get.php | 10 ++- .../payment/03-epayment-adjust-cancel.php | 16 ++-- .../payment/04-epayment-adjust-modify.php | 16 ++-- .../01-recurring-payment-create.php | 7 +- .../01-recurring-payment-get.php | 6 +- .../02-recurring-payment-create-charge.php | 6 +- .../02-recurring-payment-get-charge.php | 6 +- examples/webhook/01-webhook-get.php | 16 ++-- examples/webhook/02-webhook-register.php | 16 ++-- examples/webhook/03-webhook-delete.php | 16 ++-- src/Api/ApiBase.php | 19 ++--- src/Api/Authorization.php | 4 +- src/Api/UserInfo.php | 10 +-- src/Api/v1/EPayment.php | 28 +++---- src/Api/v1/EPaymentInterface.php | 10 +-- src/Api/v1/Webhook.php | 14 ++-- src/Api/v3/Checkout.php | 12 +-- src/Api/v3/RecurringPayment.php | 47 ++++++----- src/Api/v3/RecurringPaymentInterface.php | 12 +-- src/Client.php | 79 +++++++++++++------ src/ClientInterface.php | 26 +++++- src/Resource/Authorization/GetToken.php | 16 ++-- src/Resource/AuthorizedResourceBase.php | 10 +-- .../Checkout/v3/CreateCheckoutSession.php | 12 +-- .../Checkout/v3/GetCheckoutSession.php | 12 +-- src/Resource/EPayment/v1/CancelPayment.php | 10 +-- src/Resource/EPayment/v1/CapturePayment.php | 10 +-- src/Resource/EPayment/v1/CreatePayment.php | 9 +-- src/Resource/EPayment/v1/GetPayment.php | 9 +-- src/Resource/EPayment/v1/GetPaymentEvents.php | 9 +-- src/Resource/EPayment/v1/RefundPayment.php | 10 +-- src/Resource/PaymentResourceBase.php | 5 +- .../RecurringPayment/v3/CancelCharge.php | 11 +-- .../RecurringPayment/v3/CaptureCharge.php | 13 ++- .../RecurringPayment/v3/CreateAgreement.php | 10 +-- .../RecurringPayment/v3/CreateCharge.php | 17 ++-- .../RecurringPayment/v3/GetAgreement.php | 9 +-- .../RecurringPayment/v3/GetCharge.php | 10 +-- .../RecurringPayment/v3/GetCharges.php | 9 +-- .../v3/RecurringPaymentResourceBase.php | 6 +- .../RecurringPayment/v3/RefundCharge.php | 11 +-- .../RecurringPayment/v3/UpdateAgreement.php | 11 +-- src/Resource/ResourceBase.php | 37 +++++---- src/Resource/UserInfo/UserInfo.php | 13 +-- src/Resource/Webhook/v1/DeleteWebhook.php | 15 +--- src/Resource/Webhook/v1/GetWebhooks.php | 13 +-- src/Resource/Webhook/v1/RegisterWebhook.php | 13 +-- src/Vipps.php | 42 ---------- src/VippsInterface.php | 22 ------ 52 files changed, 365 insertions(+), 425 deletions(-) delete mode 100644 src/Vipps.php delete mode 100644 src/VippsInterface.php diff --git a/examples/authorization/01-token.php b/examples/authorization/01-token.php index 442679d..504aa91 100644 --- a/examples/authorization/01-token.php +++ b/examples/authorization/01-token.php @@ -6,14 +6,14 @@ $settings = \Symfony\Component\Yaml\Yaml::parse(file_get_contents(__DIR__.'/../config.yml')); try { - $http_client = new \GuzzleHttp\Client( - ['headers' => [ - 'Merchant-Serial-Number' => $settings['merchant_serial_number'], - ]] - ); - $client = new \zaporylie\Vipps\Client($settings['client_id'], ['http_client' => $http_client]); + $http_client = new \GuzzleHttp\Client(); + $client = new \zaporylie\Vipps\Client($settings['client_id'], $settings['client_secret'], $settings['subscription_key'], $settings['merchant_serial_number'], [ + 'http_client' => $http_client, + 'vipps_system_name' => 'vipps_zaporylie_example', + 'vipps_system_version' => \zaporylie\Vipps\Client::VERSION, + ]); $vipps = new \zaporylie\Vipps\Vipps($client); - $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']); + $authorization = new \zaporylie\Vipps\Api\Authorization($client, $settings['subscription_key']); $result = $authorization->getToken($settings['client_secret']); echo '
';
     var_dump($result);
diff --git a/examples/checkout/01-checkout-create.php b/examples/checkout/01-checkout-create.php
index 35c5ed2..849f0aa 100644
--- a/examples/checkout/01-checkout-create.php
+++ b/examples/checkout/01-checkout-create.php
@@ -12,20 +12,16 @@
 $settings = \Symfony\Component\Yaml\Yaml::parse(file_get_contents(__DIR__.'/../config.yml'));
 
 try {
-    $http_client = new \GuzzleHttp\Client(
-        ['headers' => [
-            'Merchant-Serial-Number' => $settings['merchant_serial_number'],
-        ]]
-    );
-    $client = new \zaporylie\Vipps\Client($settings['client_id'], [
-        'http_client' => $http_client,
-        'vipps_system_name' => 'vipps_zaporylie_example',
-        'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
-    ]);
+$http_client = new \GuzzleHttp\Client();
+$client = new \zaporylie\Vipps\Client($settings['client_id'], $settings['client_secret'], $settings['subscription_key'], $settings['merchant_serial_number'], [
+    'http_client' => $http_client,
+    'vipps_system_name' => 'vipps_zaporylie_example',
+    'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
+]);
     $vipps = new \zaporylie\Vipps\Vipps($client);
-    $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
+    $authorization = new \zaporylie\Vipps\Api\Authorization($client, $settings['subscription_key']);
     $authorization->getToken($settings['client_secret']);
-    $checkout = new \zaporylie\Vipps\Api\v3\Checkout($vipps, $settings['subscription_key'], $settings['merchant_serial_number'], $settings['client_secret']);
+    $checkout = new \zaporylie\Vipps\Api\v3\Checkout($client, $settings['subscription_key'], $settings['merchant_serial_number'], $settings['client_secret']);
     $request = new \zaporylie\Vipps\Model\Checkout\v3\CreateCheckoutSessionRequest();
     $request->setType('PAYMENT');
     $request->setMerchantInfo((new \zaporylie\Vipps\Model\Checkout\v3\MerchantInfo())
diff --git a/examples/payment/01-epayment-init.php b/examples/payment/01-epayment-init.php
index ea1f623..450b753 100644
--- a/examples/payment/01-epayment-init.php
+++ b/examples/payment/01-epayment-init.php
@@ -7,15 +7,15 @@
 
 try {
     $http_client = new \GuzzleHttp\Client();
-    $client = new \zaporylie\Vipps\Client($settings['client_id'], [
+    $client = new \zaporylie\Vipps\Client($settings['client_id'], $settings['client_secret'], $settings['subscription_key'], $settings['merchant_serial_number'], [
         'http_client' => $http_client,
         'vipps_system_name' => 'vipps_zaporylie_example',
         'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
     ]);
     $vipps = new \zaporylie\Vipps\Vipps($client);
-    $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
+    $authorization = new \zaporylie\Vipps\Api\Authorization($client, $settings['subscription_key']);
     $authorization->getToken($settings['client_secret']);
-    $payment = new \zaporylie\Vipps\Api\v1\EPayment($vipps, $settings['subscription_key'], $settings['merchant_serial_number']);
+    $payment = new \zaporylie\Vipps\Api\v1\EPayment($client, $settings['subscription_key'], $settings['merchant_serial_number']);
     $result = $payment->createPayment((new \zaporylie\Vipps\Model\EPayment\v1\CreatePaymentRequest())
         ->setAmount((new \zaporylie\Vipps\Model\EPayment\v1\Amount())->setValue(1000)->setCurrency('NOK'))
         ->setPaymentMethod((new \zaporylie\Vipps\Model\EPayment\v1\PaymentMethod())->setType('WALLET'))
diff --git a/examples/payment/02-epayment-get.php b/examples/payment/02-epayment-get.php
index ac7fb10..bf9cbb6 100644
--- a/examples/payment/02-epayment-get.php
+++ b/examples/payment/02-epayment-get.php
@@ -11,11 +11,15 @@
             'Merchant-Serial-Number' => $settings['merchant_serial_number'],
         ]]
     );
-    $client = new \zaporylie\Vipps\Client($settings['client_id'], ['http_client' => $http_client]);
+    $client = new \zaporylie\Vipps\Client($settings['client_id'], $settings['client_secret'], $settings['subscription_key'], $settings['merchant_serial_number'], [
+        'http_client' => $http_client,
+        'vipps_system_name' => 'vipps_zaporylie_example',
+        'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
+    ]);
     $vipps = new \zaporylie\Vipps\Vipps($client);
-    $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
+    $authorization = new \zaporylie\Vipps\Api\Authorization($client, $settings['subscription_key']);
     $authorization->getToken($settings['client_secret']);
-    $payment = new \zaporylie\Vipps\Api\v1\EPayment($vipps, $settings['subscription_key'], $settings['merchant_serial_number']);
+    $payment = new \zaporylie\Vipps\Api\v1\EPayment($client, $settings['subscription_key'], $settings['merchant_serial_number']);
     $result = $payment->getPayment('test-12121212-4');
     echo '
';
     var_dump($result);
diff --git a/examples/payment/03-epayment-adjust-cancel.php b/examples/payment/03-epayment-adjust-cancel.php
index bbfa2ba..233b6db 100644
--- a/examples/payment/03-epayment-adjust-cancel.php
+++ b/examples/payment/03-epayment-adjust-cancel.php
@@ -6,16 +6,16 @@
 $settings = \Symfony\Component\Yaml\Yaml::parse(file_get_contents(__DIR__.'/../config.yml'));
 
 try {
-    $http_client = new \GuzzleHttp\Client(
-        ['headers' => [
-            'Merchant-Serial-Number' => $settings['merchant_serial_number'],
-        ]]
-    );
-    $client = new \zaporylie\Vipps\Client($settings['client_id'], ['http_client' => $http_client]);
+    $http_client = new \GuzzleHttp\Client();
+    $client = new \zaporylie\Vipps\Client($settings['client_id'], $settings['client_secret'], $settings['subscription_key'], $settings['merchant_serial_number'], [
+        'http_client' => $http_client,
+        'vipps_system_name' => 'vipps_zaporylie_example',
+        'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
+    ]);
     $vipps = new \zaporylie\Vipps\Vipps($client);
-    $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
+    $authorization = new \zaporylie\Vipps\Api\Authorization($client, $settings['subscription_key']);
     $authorization->getToken($settings['client_secret']);
-    $payment = new \zaporylie\Vipps\Api\v1\EPayment($vipps, $settings['subscription_key'], $settings['merchant_serial_number']);
+    $payment = new \zaporylie\Vipps\Api\v1\EPayment($client, $settings['subscription_key'], $settings['merchant_serial_number']);
     $result = $payment->cancelPayment('test-12121212-3', new \zaporylie\Vipps\Model\EPayment\v1\CancelModificationRequest(), 'costam');
     echo '
';
     var_dump($result);
diff --git a/examples/payment/04-epayment-adjust-modify.php b/examples/payment/04-epayment-adjust-modify.php
index 4c2c1ba..a524ff5 100644
--- a/examples/payment/04-epayment-adjust-modify.php
+++ b/examples/payment/04-epayment-adjust-modify.php
@@ -6,16 +6,16 @@
 $settings = \Symfony\Component\Yaml\Yaml::parse(file_get_contents(__DIR__.'/../config.yml'));
 
 try {
-    $http_client = new \GuzzleHttp\Client(
-        ['headers' => [
-            'Merchant-Serial-Number' => $settings['merchant_serial_number'],
-        ]]
-    );
-    $client = new \zaporylie\Vipps\Client($settings['client_id'], ['http_client' => $http_client]);
+    $http_client = new \GuzzleHttp\Client();
+    $client = new \zaporylie\Vipps\Client($settings['client_id'], $settings['client_secret'], $settings['subscription_key'], $settings['merchant_serial_number'], [
+        'http_client' => $http_client,
+        'vipps_system_name' => 'vipps_zaporylie_example',
+        'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
+    ]);
     $vipps = new \zaporylie\Vipps\Vipps($client);
-    $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
+    $authorization = new \zaporylie\Vipps\Api\Authorization($client, $settings['subscription_key']);
     $authorization->getToken($settings['client_secret']);
-    $payment = new \zaporylie\Vipps\Api\v1\EPayment($vipps, $settings['subscription_key'], $settings['merchant_serial_number']);
+    $payment = new \zaporylie\Vipps\Api\v1\EPayment($client, $settings['subscription_key'], $settings['merchant_serial_number']);
     $result = $payment->capturePayment('test-12121212-3', (new \zaporylie\Vipps\Model\EPayment\v1\CaptureModificationRequest())->setModificationAmount((new \zaporylie\Vipps\Model\EPayment\v1\Amount())->setCurrency('NOK')->setValue(101)), 'costam3');
     echo '
';
     var_dump($result);
diff --git a/examples/recurring_payment/01-recurring-payment-create.php b/examples/recurring_payment/01-recurring-payment-create.php
index 3a54de9..0006259 100644
--- a/examples/recurring_payment/01-recurring-payment-create.php
+++ b/examples/recurring_payment/01-recurring-payment-create.php
@@ -7,19 +7,18 @@
 
 try {
     $http_client = new \GuzzleHttp\Client();
-    $client = new \zaporylie\Vipps\Client($settings['client_id'], [
+    $client = new \zaporylie\Vipps\Client($settings['client_id'], $settings['client_secret'], $settings['subscription_key'], $settings['merchant_serial_number'], [
         'http_client' => $http_client,
         'vipps_system_name' => 'vipps_zaporylie_example',
         'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
     ]);
     $vipps = new \zaporylie\Vipps\Vipps($client);
-    $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
+    $authorization = new \zaporylie\Vipps\Api\Authorization($client, $settings['subscription_key']);
     $authorization->getToken($settings['client_secret']);
-    $payment = new \zaporylie\Vipps\Api\v3\RecurringPayment($vipps, $settings['subscription_key'], $settings['merchant_serial_number']);
+    $payment = new \zaporylie\Vipps\Api\v3\RecurringPayment($client, $settings['subscription_key'], $settings['merchant_serial_number']);
     $result = $payment->createAgreement((new \zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateAgreement())
         ->setPricing((new \zaporylie\Vipps\Model\RecurringPayment\v3\Pricing())
             ->setCurrency('NOK')
-            ->setType('FLEXIBLE')
             ->setAmount(1000))
         ->setMerchantRedirectUrl('https://eoncxehuh2o2qyq.m.pipedream.net')
         ->setMerchantAgreementUrl('https://eoncxehuh2o2qyq.m.pipedream.net')
diff --git a/examples/recurring_payment/01-recurring-payment-get.php b/examples/recurring_payment/01-recurring-payment-get.php
index aff383f..f397123 100644
--- a/examples/recurring_payment/01-recurring-payment-get.php
+++ b/examples/recurring_payment/01-recurring-payment-get.php
@@ -7,15 +7,15 @@
 
 try {
     $http_client = new \GuzzleHttp\Client();
-    $client = new \zaporylie\Vipps\Client($settings['client_id'], [
+    $client = new \zaporylie\Vipps\Client($settings['client_id'], $settings['client_secret'], $settings['subscription_key'], $settings['merchant_serial_number'], [
         'http_client' => $http_client,
         'vipps_system_name' => 'vipps_zaporylie_example',
         'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
     ]);
     $vipps = new \zaporylie\Vipps\Vipps($client);
-    $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
+    $authorization = new \zaporylie\Vipps\Api\Authorization($client, $settings['subscription_key']);
     $authorization->getToken($settings['client_secret']);
-    $payment = new \zaporylie\Vipps\Api\v3\RecurringPayment($vipps, $settings['subscription_key'], $settings['merchant_serial_number']);
+    $payment = new \zaporylie\Vipps\Api\v3\RecurringPayment($client, $settings['subscription_key'], $settings['merchant_serial_number']);
     $result = $payment->getAgreement('agr_KG6k3X3');
     echo '
';
     var_dump($result);
diff --git a/examples/recurring_payment/02-recurring-payment-create-charge.php b/examples/recurring_payment/02-recurring-payment-create-charge.php
index bdb3edc..405ecdd 100644
--- a/examples/recurring_payment/02-recurring-payment-create-charge.php
+++ b/examples/recurring_payment/02-recurring-payment-create-charge.php
@@ -7,15 +7,15 @@
 
 try {
     $http_client = new \GuzzleHttp\Client();
-    $client = new \zaporylie\Vipps\Client($settings['client_id'], [
+    $client = new \zaporylie\Vipps\Client($settings['client_id'], $settings['client_secret'], $settings['subscription_key'], $settings['merchant_serial_number'], [
         'http_client' => $http_client,
         'vipps_system_name' => 'vipps_zaporylie_example',
         'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
     ]);
     $vipps = new \zaporylie\Vipps\Vipps($client);
-    $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
+    $authorization = new \zaporylie\Vipps\Api\Authorization($client, $settings['subscription_key']);
     $authorization->getToken($settings['client_secret']);
-    $payment = new \zaporylie\Vipps\Api\v3\RecurringPayment($vipps, $settings['subscription_key'], $settings['merchant_serial_number']);
+    $payment = new \zaporylie\Vipps\Api\v3\RecurringPayment($client, $settings['subscription_key'], $settings['merchant_serial_number']);
     $result = $payment->createCharge('agr_KG6k3X3', (new \zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateCharge())
         ->setAmount(1000)
         ->setDescription('Ok, that worked')
diff --git a/examples/recurring_payment/02-recurring-payment-get-charge.php b/examples/recurring_payment/02-recurring-payment-get-charge.php
index e63571d..cf90bc7 100644
--- a/examples/recurring_payment/02-recurring-payment-get-charge.php
+++ b/examples/recurring_payment/02-recurring-payment-get-charge.php
@@ -7,15 +7,15 @@
 
 try {
     $http_client = new \GuzzleHttp\Client();
-    $client = new \zaporylie\Vipps\Client($settings['client_id'], [
+    $client = new \zaporylie\Vipps\Client($settings['client_id'], $settings['client_secret'], $settings['subscription_key'], $settings['merchant_serial_number'], [
         'http_client' => $http_client,
         'vipps_system_name' => 'vipps_zaporylie_example',
         'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
     ]);
     $vipps = new \zaporylie\Vipps\Vipps($client);
-    $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
+    $authorization = new \zaporylie\Vipps\Api\Authorization($client, $settings['subscription_key']);
     $authorization->getToken($settings['client_secret']);
-    $payment = new \zaporylie\Vipps\Api\v3\RecurringPayment($vipps, $settings['subscription_key'], $settings['merchant_serial_number']);
+    $payment = new \zaporylie\Vipps\Api\v3\RecurringPayment($client, $settings['subscription_key'], $settings['merchant_serial_number']);
     $result = $payment->getCharge('agr_KG6k3X3','chr-gTHPbNE');
     echo '
';
     var_dump($result);
diff --git a/examples/webhook/01-webhook-get.php b/examples/webhook/01-webhook-get.php
index 266f008..7fed9b8 100644
--- a/examples/webhook/01-webhook-get.php
+++ b/examples/webhook/01-webhook-get.php
@@ -6,16 +6,16 @@
 $settings = \Symfony\Component\Yaml\Yaml::parse(file_get_contents(__DIR__.'/../config.yml'));
 
 try {
-    $http_client = new \GuzzleHttp\Client(
-        ['headers' => [
-            'Merchant-Serial-Number' => $settings['merchant_serial_number'],
-        ]]
-    );
-    $client = new \zaporylie\Vipps\Client($settings['client_id'], ['http_client' => $http_client]);
+    $http_client = new \GuzzleHttp\Client();
+    $client = new \zaporylie\Vipps\Client($settings['client_id'], $settings['client_secret'], $settings['subscription_key'], $settings['merchant_serial_number'], [
+        'http_client' => $http_client,
+        'vipps_system_name' => 'vipps_zaporylie_example',
+        'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
+    ]);
     $vipps = new \zaporylie\Vipps\Vipps($client);
-    $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
+    $authorization = new \zaporylie\Vipps\Api\Authorization($client, $settings['subscription_key']);
     $authorization->getToken($settings['client_secret']);
-    $payment = new \zaporylie\Vipps\Api\v1\Webhook($vipps, $settings['subscription_key'], $settings['merchant_serial_number']);
+    $payment = new \zaporylie\Vipps\Api\v1\Webhook($client, $settings['subscription_key'], $settings['merchant_serial_number']);
     $result = $payment->getWebhooks();
     echo '
';
     var_dump($result);
diff --git a/examples/webhook/02-webhook-register.php b/examples/webhook/02-webhook-register.php
index 125aba0..9035676 100644
--- a/examples/webhook/02-webhook-register.php
+++ b/examples/webhook/02-webhook-register.php
@@ -6,16 +6,16 @@
 $settings = \Symfony\Component\Yaml\Yaml::parse(file_get_contents(__DIR__.'/../config.yml'));
 
 try {
-    $http_client = new \GuzzleHttp\Client(
-        ['headers' => [
-            'Merchant-Serial-Number' => $settings['merchant_serial_number'],
-        ]]
-    );
-    $client = new \zaporylie\Vipps\Client($settings['client_id'], ['http_client' => $http_client]);
+    $http_client = new \GuzzleHttp\Client();
+    $client = new \zaporylie\Vipps\Client($settings['client_id'], $settings['client_secret'], $settings['subscription_key'], $settings['merchant_serial_number'], [
+        'http_client' => $http_client,
+        'vipps_system_name' => 'vipps_zaporylie_example',
+        'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
+    ]);
     $vipps = new \zaporylie\Vipps\Vipps($client);
-    $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
+    $authorization = new \zaporylie\Vipps\Api\Authorization($client, $settings['subscription_key']);
     $authorization->getToken($settings['client_secret']);
-    $payment = new \zaporylie\Vipps\Api\v1\Webhook($vipps, $settings['subscription_key'], $settings['merchant_serial_number']);
+    $payment = new \zaporylie\Vipps\Api\v1\Webhook($client, $settings['subscription_key'], $settings['merchant_serial_number']);
     $request = new \zaporylie\Vipps\Model\Webhook\v1\RegisterWebhookRequest();
     $request->setUrl("https://eoncxehuh2o2qyq.m.pipedream.net/");
     $request->setEvents([
diff --git a/examples/webhook/03-webhook-delete.php b/examples/webhook/03-webhook-delete.php
index b177592..b30e64d 100644
--- a/examples/webhook/03-webhook-delete.php
+++ b/examples/webhook/03-webhook-delete.php
@@ -6,16 +6,16 @@
 $settings = \Symfony\Component\Yaml\Yaml::parse(file_get_contents(__DIR__.'/../config.yml'));
 
 try {
-    $http_client = new \GuzzleHttp\Client(
-        ['headers' => [
-            'Merchant-Serial-Number' => $settings['merchant_serial_number'],
-        ]]
-    );
-    $client = new \zaporylie\Vipps\Client($settings['client_id'], ['http_client' => $http_client]);
+    $http_client = new \GuzzleHttp\Client();
+    $client = new \zaporylie\Vipps\Client($settings['client_id'], $settings['client_secret'], $settings['subscription_key'], $settings['merchant_serial_number'], [
+        'http_client' => $http_client,
+        'vipps_system_name' => 'vipps_zaporylie_example',
+        'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
+    ]);
     $vipps = new \zaporylie\Vipps\Vipps($client);
-    $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
+    $authorization = new \zaporylie\Vipps\Api\Authorization($client, $settings['subscription_key']);
     $authorization->getToken($settings['client_secret']);
-    $payment = new \zaporylie\Vipps\Api\v1\Webhook($vipps, $settings['subscription_key'], $settings['merchant_serial_number']);
+    $payment = new \zaporylie\Vipps\Api\v1\Webhook($client, $settings['subscription_key'], $settings['merchant_serial_number']);
     $payment->deleteWebhook('1aaf0fde-afed-43c0-9af3-b876bba34e48');
     echo 'ok';
 
diff --git a/src/Api/ApiBase.php b/src/Api/ApiBase.php
index 9fa06dc..35aeafd 100644
--- a/src/Api/ApiBase.php
+++ b/src/Api/ApiBase.php
@@ -2,32 +2,25 @@
 
 namespace zaporylie\Vipps\Api;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Exceptions\Api\InvalidArgumentException;
-use zaporylie\Vipps\VippsInterface;
 
 abstract class ApiBase
 {
 
     /**
-     * @var \zaporylie\Vipps\VippsInterface
+     * @var \zaporylie\Vipps\ClientInterface
      */
-    protected $app;
-
-    /**
-     * @var string
-     */
-    protected $subscriptionKey;
+    protected $client;
 
     /**
      * ApiBase constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $app
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      */
-    public function __construct(VippsInterface $app, $subscription_key)
+    public function __construct(ClientInterface $client)
     {
-        $this->app = $app;
-        $this->subscriptionKey = $subscription_key;
+        $this->client = $client;
     }
 
     /**
diff --git a/src/Api/Authorization.php b/src/Api/Authorization.php
index 002b42b..46eac75 100644
--- a/src/Api/Authorization.php
+++ b/src/Api/Authorization.php
@@ -15,13 +15,13 @@ class Authorization extends ApiBase implements AuthorizationInterface
     public function getToken($client_secret)
     {
         // Initiate GetToken resource.
-        $resource = new GetToken($this->app, $this->getSubscriptionKey(), $client_secret);
+        $resource = new GetToken($this->client, $client_secret);
 
         /** @var \zaporylie\Vipps\Model\Authorization\ResponseGetToken $response */
         $response = $resource->call();
 
         // Save token on Client for future use.
-        $this->app->getClient()->getTokenStorage()->set($response);
+        $this->client->getTokenStorage()->set($response);
 
         return $response;
     }
diff --git a/src/Api/UserInfo.php b/src/Api/UserInfo.php
index 155a43d..b11c4ca 100644
--- a/src/Api/UserInfo.php
+++ b/src/Api/UserInfo.php
@@ -3,7 +3,7 @@
 namespace zaporylie\Vipps\Api;
 
 use zaporylie\Vipps\Resource\UserInfo\UserInfo as UserInfoResource;
-use zaporylie\Vipps\VippsInterface;
+use zaporylie\Vipps\ClientInterface;
 
 /**
  * Class UserInfo
@@ -16,11 +16,11 @@ class UserInfo extends ApiBase implements UserInfoInterface
     /**
      * UserInfo constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $app
+     * @param \zaporylie\Vipps\ClientInterface $client
      */
-    public function __construct(VippsInterface $app)
+    public function __construct(ClientInterface $client)
     {
-        $this->app = $app;
+        $this->client = $client;
     }
 
     /**
@@ -28,7 +28,7 @@ public function __construct(VippsInterface $app)
      */
     public function userInfo($sub)
     {
-        $resource = new UserInfoResource($this->app, $sub);
+        $resource = new UserInfoResource($this->client, $sub);
         /** @var \zaporylie\Vipps\Model\UserInfo\ResponseUserInfo $response */
         $response = $resource->call();
         return $response;
diff --git a/src/Api/v1/EPayment.php b/src/Api/v1/EPayment.php
index 32462c1..46613af 100644
--- a/src/Api/v1/EPayment.php
+++ b/src/Api/v1/EPayment.php
@@ -18,7 +18,7 @@
 use zaporylie\Vipps\Resource\EPayment\v1\CancelPayment;
 use zaporylie\Vipps\Resource\EPayment\v1\RefundPayment;
 use zaporylie\Vipps\Resource\IdempotencyKeyFactory;
-use zaporylie\Vipps\VippsInterface;
+use zaporylie\Vipps\ClientInterface;
 
 /**
  * Class EPayment
@@ -64,16 +64,16 @@ public function getVersion()
      *
      * Payments API needs one extra param - merchant serial number.
      *
-     * @param \zaporylie\Vipps\VippsInterface $app
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $subscription_key
      * @param $merchant_serial_number
      */
     public function __construct(
-        VippsInterface $app,
+        ClientInterface $client,
         $subscription_key,
         $merchant_serial_number
     ) {
-        parent::__construct($app, $subscription_key);
+        parent::__construct($client, $subscription_key);
         $this->merchantSerialNumber = $merchant_serial_number;
         $this->version = 'v1';
     }
@@ -81,12 +81,12 @@ public function __construct(
     /**
      * {@inheritDoc}
      */
-    public function createPayment(CreatePaymentRequest $request, ?string $idempotency_key): CreatePaymentResponse
+    public function createPayment(CreatePaymentRequest $request, ?string $idempotency_key = null): CreatePaymentResponse
     {
         // Ensure idempotency key is set.
         $idempotency_key = $idempotency_key ?? IdempotencyKeyFactory::generate();
         // @todo: Validate data.
-        $resource = new CreatePayment($this->app, $this->getSubscriptionKey(), $idempotency_key, $request);
+        $resource = new CreatePayment($this->client, $idempotency_key, $request);
         return $resource->call();
     }
 
@@ -95,7 +95,7 @@ public function createPayment(CreatePaymentRequest $request, ?string $idempotenc
      */
     public function getPayment(string $reference): GetPaymentResponse
     {
-        $resource = new GetPayment($this->app, $this->getSubscriptionKey(), $reference);
+        $resource = new GetPayment($this->client, $reference);
         return $resource->call();
     }
 
@@ -104,7 +104,7 @@ public function getPayment(string $reference): GetPaymentResponse
      */
     public function getPaymentEvents(string $reference): array
     {
-        $resource = new GetPaymentEvents($this->app, $this->getSubscriptionKey(), $reference);
+        $resource = new GetPaymentEvents($this->client, $reference);
         return $resource->call();
     }
 
@@ -114,33 +114,33 @@ public function getPaymentEvents(string $reference): array
     public function cancelPayment(
         string $reference,
         CancelModificationRequest $request,
-        ?string $idempotency_key
+        ?string $idempotency_key = null
     ): PaymentAdjustResponse {
         // Ensure idempotency key is set.
         $idempotency_key = $idempotency_key ?? IdempotencyKeyFactory::generate();
-        $resource = new CancelPayment($this->app, $this->getSubscriptionKey(), $idempotency_key, $reference, $request);
+        $resource = new CancelPayment($this->client, $idempotency_key, $reference, $request);
         return $resource->call();
     }
 
     public function capturePayment(
         string $reference,
         CaptureModificationRequest $request,
-        ?string $idempotency_key
+        ?string $idempotency_key = null
     ): PaymentAdjustResponse {
         // Ensure idempotency key is set.
         $idempotency_key = $idempotency_key ?? IdempotencyKeyFactory::generate();
-        $resource = new CapturePayment($this->app, $this->getSubscriptionKey(), $idempotency_key, $reference, $request);
+        $resource = new CapturePayment($this->client, $idempotency_key, $reference, $request);
         return $resource->call();
     }
 
     public function refundPayment(
         string $reference,
         RefundModificationRequest $request,
-        ?string $idempotency_key
+        ?string $idempotency_key = null
     ): PaymentAdjustResponse {
         // Ensure idempotency key is set.
         $idempotency_key = $idempotency_key ?? IdempotencyKeyFactory::generate();
-        $resource = new RefundPayment($this->app, $this->getSubscriptionKey(), $idempotency_key, $reference, $request);
+        $resource = new RefundPayment($this->client, $idempotency_key, $reference, $request);
         return $resource->call();
     }
 }
diff --git a/src/Api/v1/EPaymentInterface.php b/src/Api/v1/EPaymentInterface.php
index b121c7c..6af1e79 100644
--- a/src/Api/v1/EPaymentInterface.php
+++ b/src/Api/v1/EPaymentInterface.php
@@ -15,11 +15,11 @@ interface EPaymentInterface
 
     /**
      * @param \zaporylie\Vipps\Model\EPayment\v1\CreatePaymentRequest $request
-     * @param string $idempotency_key
+     * @param string|null $idempotency_key
      *
      * @return \zaporylie\Vipps\Model\EPayment\v1\CreatePaymentResponse
      */
-    public function createPayment(CreatePaymentRequest $request, ?string $idempotency_key) : CreatePaymentResponse;
+    public function createPayment(CreatePaymentRequest $request, ?string $idempotency_key = null) : CreatePaymentResponse;
 
     /**
      * @param string $reference
@@ -45,7 +45,7 @@ public function getPaymentEvents(string $reference) : array;
     public function cancelPayment(
         string $reference,
         CancelModificationRequest $request,
-        ?string $idempotency_key
+        ?string $idempotency_key = null
     ) : PaymentAdjustResponse;
 
     /**
@@ -58,7 +58,7 @@ public function cancelPayment(
     public function capturePayment(
         string $reference,
         CaptureModificationRequest $request,
-        ?string $idempotency_key
+        ?string $idempotency_key = null
     ) : PaymentAdjustResponse;
 
     /**
@@ -71,6 +71,6 @@ public function capturePayment(
     public function refundPayment(
         string $reference,
         RefundModificationRequest $request,
-        ?string $idempotency_key
+        ?string $idempotency_key = null
     ) : PaymentAdjustResponse;
 }
diff --git a/src/Api/v1/Webhook.php b/src/Api/v1/Webhook.php
index a4ce4fe..ed58b4e 100644
--- a/src/Api/v1/Webhook.php
+++ b/src/Api/v1/Webhook.php
@@ -24,7 +24,7 @@
 use zaporylie\Vipps\Resource\Webhook\v1\DeleteWebhook;
 use zaporylie\Vipps\Resource\Webhook\v1\GetWebhooks;
 use zaporylie\Vipps\Resource\Webhook\v1\RegisterWebhook;
-use zaporylie\Vipps\VippsInterface;
+use zaporylie\Vipps\ClientInterface;
 
 /**
  * Class Webhook
@@ -70,16 +70,16 @@ public function getVersion()
      *
      * Webhook API needs one extra param - merchant serial number.
      *
-     * @param \zaporylie\Vipps\VippsInterface $app
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $subscription_key
      * @param $merchant_serial_number
      */
     public function __construct(
-        VippsInterface $app,
+        ClientInterface $client,
         $subscription_key,
         $merchant_serial_number
     ) {
-        parent::__construct($app, $subscription_key);
+        parent::__construct($client, $subscription_key);
         $this->merchantSerialNumber = $merchant_serial_number;
         $this->version = 'v1';
     }
@@ -89,7 +89,7 @@ public function __construct(
      */
     public function registerWebhook(RegisterWebhookRequest $request): RegisterWebhookResponse
     {
-        $resource = new RegisterWebhook($this->app, $this->getSubscriptionKey(), $request);
+        $resource = new RegisterWebhook($this->client, $request);
         return $resource->call();
     }
 
@@ -98,7 +98,7 @@ public function registerWebhook(RegisterWebhookRequest $request): RegisterWebhoo
      */
     public function getWebhooks(): GetWebhooksResponse
     {
-        $resource = new GetWebhooks($this->app, $this->getSubscriptionKey());
+        $resource = new GetWebhooks($this->client);
         return $resource->call();
     }
 
@@ -107,7 +107,7 @@ public function getWebhooks(): GetWebhooksResponse
      */
     public function deleteWebhook(string $reference): void
     {
-        $resource = new DeleteWebhook($this->app, $this->getSubscriptionKey(), $reference);
+        $resource = new DeleteWebhook($this->client, $reference);
         $resource->call();
     }
 }
diff --git a/src/Api/v3/Checkout.php b/src/Api/v3/Checkout.php
index 5e72245..4532f83 100644
--- a/src/Api/v3/Checkout.php
+++ b/src/Api/v3/Checkout.php
@@ -30,7 +30,7 @@
 use zaporylie\Vipps\Resource\Webhook\v1\DeleteWebhook;
 use zaporylie\Vipps\Resource\Webhook\v1\GetWebhooks;
 use zaporylie\Vipps\Resource\Webhook\v1\RegisterWebhook;
-use zaporylie\Vipps\VippsInterface;
+use zaporylie\Vipps\ClientInterface;
 
 /**
  * Class Webhook
@@ -81,17 +81,17 @@ public function getVersion()
      *
      * Webhook API needs one extra param - merchant serial number.
      *
-     * @param \zaporylie\Vipps\VippsInterface $app
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $subscription_key
      * @param $merchant_serial_number
      */
     public function __construct(
-        VippsInterface $app,
+        ClientInterface $client,
         string $subscription_key,
         string $merchant_serial_number,
         string $client_secret
     ) {
-        parent::__construct($app, $subscription_key);
+        parent::__construct($client, $subscription_key);
         $this->merchantSerialNumber = $merchant_serial_number;
         $this->version = 'v3';
         $this->clientSecret = $client_secret;
@@ -102,7 +102,7 @@ public function __construct(
      */
     public function createCheckoutSession(CreateCheckoutSessionRequest $request): CreateCheckoutSessionResponse
     {
-        $resource = new CreateCheckoutSession($this->app, $this->getSubscriptionKey(), $this->clientSecret, $request);
+        $resource = new CreateCheckoutSession($this->client, $this->clientSecret, $request);
         return $resource->call();
     }
 
@@ -111,7 +111,7 @@ public function createCheckoutSession(CreateCheckoutSessionRequest $request): Cr
      */
     public function getCheckoutSession(string $reference): GetCheckoutSessionResponse
     {
-        $resource = new GetCheckoutSession($this->app, $this->getSubscriptionKey(), $this->clientSecret, $reference);
+        $resource = new GetCheckoutSession($this->client, $this->clientSecret, $reference);
         return $resource->call();
     }
 }
diff --git a/src/Api/v3/RecurringPayment.php b/src/Api/v3/RecurringPayment.php
index aa9b326..115a894 100644
--- a/src/Api/v3/RecurringPayment.php
+++ b/src/Api/v3/RecurringPayment.php
@@ -24,7 +24,7 @@
 use zaporylie\Vipps\Resource\RecurringPayment\v3\GetCharges;
 use zaporylie\Vipps\Resource\RecurringPayment\v3\RefundCharge;
 use zaporylie\Vipps\Resource\RecurringPayment\v3\UpdateAgreement;
-use zaporylie\Vipps\VippsInterface;
+use zaporylie\Vipps\ClientInterface;
 
 /**
  * Class RecurringPayment
@@ -57,26 +57,26 @@ public function getMerchantSerialNumber()
      *
      * Payments API needs one extra param - merchant serial number.
      *
-     * @param \zaporylie\Vipps\VippsInterface $app
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $subscription_key
      * @param $merchant_serial_number
      * @param $custom_path
      */
     public function __construct(
-        VippsInterface $app,
+        ClientInterface $client,
         $subscription_key,
         $merchant_serial_number
     ) {
-        parent::__construct($app, $subscription_key);
+        parent::__construct($client, $subscription_key);
         $this->merchantSerialNumber = $merchant_serial_number;
     }
 
     /**
      * {@inheritdoc}
      */
-    public function createAgreement(RequestCreateAgreement $request, ?string $idempotency_key): ResponseCreateAgreement {
+    public function createAgreement(RequestCreateAgreement $request, ?string $idempotency_key = null): ResponseCreateAgreement {
         $idempotency_key = $idempotency_key ?? IdempotencyKeyFactory::generate();
-        $resource = new CreateAgreement($this->app, $this->getSubscriptionKey(), $idempotency_key, $request);
+        $resource = new CreateAgreement($this->client, $idempotency_key, $request);
         $response = $resource->call();
         return $response;
     }
@@ -85,7 +85,7 @@ public function createAgreement(RequestCreateAgreement $request, ?string $idempo
      * {@inheritdoc}
      */
     public function getAgreements(): array {
-        $resource = new GetAgreements($this->app, $this->getSubscriptionKey());
+        $resource = new GetAgreements($this->client);
         $response = $resource->call();
         return $response;
     }
@@ -94,7 +94,7 @@ public function getAgreements(): array {
      * {@inheritdoc}
      */
     public function getAgreement(string $agreement_id): ResponseGetAgreement {
-        $resource = new GetAgreement($this->app, $this->getSubscriptionKey(), $agreement_id);
+        $resource = new GetAgreement($this->client, $agreement_id);
         $response = $resource->call();
         return $response;
     }
@@ -105,10 +105,10 @@ public function getAgreement(string $agreement_id): ResponseGetAgreement {
     public function updateAgreement(
         string $agreement_id,
         RequestUpdateAgreement $request,
-        ?string $idempotency_key
+        ?string $idempotency_key = null
     ): void {
         $idempotency_key = $idempotency_key ?? IdempotencyKeyFactory::generate();
-        $resource = new UpdateAgreement($this->app, $this->getSubscriptionKey(), $agreement_id, $idempotency_key, $request);
+        $resource = new UpdateAgreement($this->client, $agreement_id, $idempotency_key, $request);
         $response = $resource->call();
     }
 
@@ -116,7 +116,7 @@ public function updateAgreement(
      * {@inheritDoc}
      */
     public function getCharges($agreement_id): array {
-        $resource = new GetCharges($this->app, $this->getSubscriptionKey(), $agreement_id);
+        $resource = new GetCharges($this->client, $agreement_id);
         $response = $resource->call();
         return $response;
     }
@@ -125,7 +125,7 @@ public function getCharges($agreement_id): array {
      * {@inheritDoc}
      */
     public function getCharge(string $agreement_id, string $charge_id): ResponseGetCharge {
-        $resource = new GetCharge($this->app, $this->getSubscriptionKey(), $agreement_id, $charge_id);
+        $resource = new GetCharge($this->client, $agreement_id, $charge_id);
         $response = $resource->call();
         return $response;
     }
@@ -136,10 +136,10 @@ public function getCharge(string $agreement_id, string $charge_id): ResponseGetC
     public function createCharge(
         string $agreement_id,
         RequestCreateCharge $request,
-        ?string $idempotency_key
+        ?string $idempotency_key = null
     ): ResponseCreateCharge {
         $idempotency_key = $idempotency_key ?? IdempotencyKeyFactory::generate();
-        $resource = new CreateCharge($this->app, $this->getSubscriptionKey(), $agreement_id, $idempotency_key, $request);
+        $resource = new CreateCharge($this->client, $agreement_id, $idempotency_key, $request);
         $response = $resource->call();
         return $response;
     }
@@ -150,11 +150,11 @@ public function createCharge(
     public function cancelCharge(
         string $agreement_id,
         string $charge_id,
-        ?string $idempotency_key
+        ?string $idempotency_key = null
     ):void
     {
         $idempotency_key = $idempotency_key ?? IdempotencyKeyFactory::generate();
-        $resource = new CancelCharge($this->app, $this->getSubscriptionKey(), $agreement_id, $charge_id, $idempotency_key);
+        $resource = new CancelCharge($this->client, $agreement_id, $charge_id, $idempotency_key);
         $response = $resource->call();
     }
 
@@ -162,13 +162,13 @@ public function cancelCharge(
      * {@inheritDoc}
      */
     public function captureCharge(
-        $agreement_id,
-        $charge_id,
+        string $agreement_id,
+        string $charge_id,
         RequestCaptureCharge $request,
-        ?string $idempotency_key
+        ?string $idempotency_key = null
     ): void {
         $idempotency_key = $idempotency_key ?? IdempotencyKeyFactory::generate();
-        $resource = new CaptureCharge($this->app, $this->getSubscriptionKey(), $agreement_id, $charge_id, $idempotency_key, $request);
+        $resource = new CaptureCharge($this->client, $agreement_id, $charge_id, $idempotency_key, $request);
         $response = $resource->call();
     }
 
@@ -179,15 +179,14 @@ public function refundCharge(
         string $agreement_id,
         string $charge_id,
         RequestRefundCharge $requestObject,
-        ?string $idempototency_key
+        ?string $idempotency_key = null
     ): void {
         $idempotency_key = $idempotency_key ?? IdempotencyKeyFactory::generate();
         $resource = new RefundCharge(
-            $this->app,
-            $this->getSubscriptionKey(),
+            $this->client,
             $agreement_id,
             $charge_id,
-            $idempototency_key,
+            $idempotency_key,
             $requestObject
         );
         $response = $resource->call();
diff --git a/src/Api/v3/RecurringPaymentInterface.php b/src/Api/v3/RecurringPaymentInterface.php
index f8d533b..faa1e0d 100644
--- a/src/Api/v3/RecurringPaymentInterface.php
+++ b/src/Api/v3/RecurringPaymentInterface.php
@@ -26,7 +26,7 @@ interface RecurringPaymentInterface
      *
      * @return \zaporylie\Vipps\Model\RecurringPayment\v3\ResponseCreateAgreement
      */
-    public function createAgreement(RequestCreateAgreement $requestCreateAgreement, ?string $idempotency_key): ResponseCreateAgreement;
+    public function createAgreement(RequestCreateAgreement $requestCreateAgreement, ?string $idempotency_key = null): ResponseCreateAgreement;
 
     /**
      * @return \zaporylie\Vipps\Model\RecurringPayment\v3\ResponseGetAgreement[]
@@ -45,7 +45,7 @@ public function getAgreement(string $agreement_id): ResponseGetAgreement;
      * @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestUpdateAgreement $request
      * @param
      */
-    public function updateAgreement(string $agreement_id, RequestUpdateAgreement $request, ?string $idempotency_key): void;
+    public function updateAgreement(string $agreement_id, RequestUpdateAgreement $request, ?string $idempotency_key = null): void;
 
     /**
      * @param string $agreement_id
@@ -69,14 +69,14 @@ public function getCharge(string $agreement_id, string $charge_id): ResponseGetC
      *
      * @return \zaporylie\Vipps\Model\RecurringPayment\v3\ResponseCreateCharge
      */
-    public function createCharge(string $agreement_id, RequestCreateCharge $request, ?string $idempotency_key): ResponseCreateCharge;
+    public function createCharge(string $agreement_id, RequestCreateCharge $request, ?string $idempotency_key = null): ResponseCreateCharge;
 
     /**
      * @param string $agreement_id
      * @param string $charge_id
      * @param string|null $idempotency_key
      */
-    public function cancelCharge(string $agreement_id, string $charge_id, ?string $idempotency_key): void;
+    public function cancelCharge(string $agreement_id, string $charge_id, ?string $idempotency_key = null): void;
 
     /**
      * @param string $agreement_id
@@ -84,7 +84,7 @@ public function cancelCharge(string $agreement_id, string $charge_id, ?string $i
      * @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestCaptureCharge $request
      * @param string|null $idempotency_key
      */
-    public function captureCharge(string $agreement_id, string $charge_id, RequestCaptureCharge $request, ?string $idempotency_key): void;
+    public function captureCharge(string $agreement_id, string $charge_id, RequestCaptureCharge $request, ?string $idempotency_key = null): void;
 
     /**
      * @param string $agreement_id
@@ -92,5 +92,5 @@ public function captureCharge(string $agreement_id, string $charge_id, RequestCa
      * @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestRefundCharge $requestObject
      * @param string|null $idempotency_key
      */
-    public function refundCharge(string $agreement_id, string $charge_id, RequestRefundCharge $requestObject, ?string $idempotency_key): void;
+    public function refundCharge(string $agreement_id, string $charge_id, RequestRefundCharge $requestObject, ?string $idempotency_key = null): void;
 }
diff --git a/src/Client.php b/src/Client.php
index 085db7c..3d34dcb 100644
--- a/src/Client.php
+++ b/src/Client.php
@@ -60,6 +60,21 @@ class Client implements ClientInterface
      */
     protected $clientId;
 
+    /**
+     * @var string
+     */
+    protected $clientSecret;
+
+    /**
+     * @var string
+     */
+    protected $subscriptionKey;
+
+    /**
+     * @var string
+     */
+    protected $merchantSerialNumber;
+
     /**
      * @var string
      */
@@ -81,15 +96,17 @@ class Client implements ClientInterface
     protected $vippsSystemPluginVersion;
 
     /**
-     * VippsClient constructor.
+     * Client constructor.
      *
      * @param string $client_id
-     * @param array $options
      */
-    public function __construct($client_id, array $options = [])
+    public function __construct(string $client_id, string $client_secret, string $subscription_key, string $merchant_serial_number, array $options = [])
     {
-        // Set Client ID.
-        $this->setClientId($client_id);
+        // Set Vipps MobilePay credentials.
+        $this->clientId = $client_id;
+        $this->clientSecret = $client_secret;
+        $this->subscriptionKey = $subscription_key;
+        $this->merchantSerialNumber = $merchant_serial_number;
 
         $this->vippsSystemPluginName = 'zaporylie/vipps (PHP)';
         $this->vippsSystemPluginVersion = static::VERSION;
@@ -136,9 +153,7 @@ public function getToken()
     }
 
     /**
-     * Gets tokenStorage value.
-     *
-     * @return \zaporylie\Vipps\Authentication\TokenStorageInterface
+     * {@inheritdoc}
      */
     public function getTokenStorage()
     {
@@ -146,11 +161,7 @@ public function getTokenStorage()
     }
 
     /**
-     * Sets tokenStorage variable.
-     *
-     * @param \zaporylie\Vipps\Authentication\TokenStorageInterface $tokenStorage
-     *
-     * @return $this
+     * {@inheritdoc}
      */
     public function setTokenStorage(TokenStorageInterface $tokenStorage)
     {
@@ -159,11 +170,9 @@ public function setTokenStorage(TokenStorageInterface $tokenStorage)
     }
 
     /**
-     * Gets clientId value.
-     *
-     * @return string
+     * {@inheritdoc}
      */
-    public function getClientId()
+    public function getClientId(): string
     {
         if (!isset($this->clientId)) {
             throw new InvalidArgumentException('Missing Client ID');
@@ -172,11 +181,7 @@ public function getClientId()
     }
 
     /**
-     * Sets clientId variable.
-     *
-     * @param string $clientId
-     *
-     * @return $this
+     * {@inheritdoc}
      */
     public function setClientId($clientId)
     {
@@ -184,6 +189,36 @@ public function setClientId($clientId)
         return $this;
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    public function getClientSecret(): string {
+        if (!isset($this->clientSecret)) {
+            throw new InvalidArgumentException('Missing Client Secret');
+        }
+        return $this->clientSecret;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getSubscriptionKey(): string {
+        if (!isset($this->subscriptionKey)) {
+            throw new InvalidArgumentException('Missing Subscription Key');
+        }
+        return $this->subscriptionKey;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getMerchantSerialNumber(): string {
+        if (!isset($this->merchantSerialNumber)) {
+            throw new InvalidArgumentException('Missing Merchant Serial Number');
+        }
+        return $this->merchantSerialNumber;
+    }
+
     /**
      * {@inheritdoc}
      */
diff --git a/src/ClientInterface.php b/src/ClientInterface.php
index ec20794..86ade18 100644
--- a/src/ClientInterface.php
+++ b/src/ClientInterface.php
@@ -6,6 +6,7 @@
 use Psr\Http\Message\RequestFactoryInterface;
 use Psr\Http\Message\StreamFactoryInterface;
 use zaporylie\Vipps\Authentication\TokenStorageInterface;
+use zaporylie\Vipps\Exceptions\Client\InvalidArgumentException;
 
 interface ClientInterface
 {
@@ -26,7 +27,7 @@ public function setTokenStorage(TokenStorageInterface $tokenStorage);
      *
      * @return string
      */
-    public function getClientId();
+    public function getClientId(): string;
 
     /**
      * Sets clientId variable.
@@ -34,9 +35,32 @@ public function getClientId();
      * @param string $clientId
      *
      * @return $this
+     *
+     * @deprecated
      */
     public function setClientId($clientId);
 
+    /**
+     * Gets clientSecret value.
+     *
+     * @return string
+     */
+    public function getClientSecret(): string;
+
+    /**
+     * Gets subscriptionKey value.
+     *
+     * @return string
+     */
+    public function getSubscriptionKey(): string;
+
+    /**
+     * Gets merchantSerialNumber value.
+     *
+     * @return string
+     */
+    public function getMerchantSerialNumber(): string;
+
     /**
      * Gets connection value.
      *
diff --git a/src/Resource/Authorization/GetToken.php b/src/Resource/Authorization/GetToken.php
index 99be069..f1da609 100644
--- a/src/Resource/Authorization/GetToken.php
+++ b/src/Resource/Authorization/GetToken.php
@@ -2,10 +2,10 @@
 
 namespace zaporylie\Vipps\Resource\Authorization;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\Authorization\ResponseGetToken;
 use zaporylie\Vipps\Resource\ResourceBase;
 use zaporylie\Vipps\Resource\HttpMethod;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class GetToken
@@ -28,17 +28,17 @@ class GetToken extends ResourceBase
     /**
      * GetToken constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $subscription_key
      * @param string $client_secret
      */
-    public function __construct(VippsInterface $vipps, $subscription_key, $client_secret)
+    public function __construct(ClientInterface $client)
     {
-        parent::__construct($vipps, $subscription_key);
-        // Authorization module requires client_id to be set on "client_id"
-        // header.
-        $this->headers['client_id'] = $this->app->getClient()->getClientId();
-        $this->headers['client_secret'] = $client_secret;
+        parent::__construct($client);
+        // Authorization module requires client_id amd client_secret headers to
+        // be set.
+        $this->headers['client_id'] = $this->client->getClientId();
+        $this->headers['client_secret'] = $this->client->getClientSecret();
     }
 
     /**
diff --git a/src/Resource/AuthorizedResourceBase.php b/src/Resource/AuthorizedResourceBase.php
index 6d26798..75f00b7 100644
--- a/src/Resource/AuthorizedResourceBase.php
+++ b/src/Resource/AuthorizedResourceBase.php
@@ -2,7 +2,7 @@
 
 namespace zaporylie\Vipps\Resource;
 
-use zaporylie\Vipps\VippsInterface;
+use zaporylie\Vipps\ClientInterface;
 
 /**
  * Class AuthorizedResourceBase
@@ -18,12 +18,12 @@ abstract class AuthorizedResourceBase extends ResourceBase
      * In addition to setting Vipps this base class adds authorization header
      * to each request.
      */
-    public function __construct(VippsInterface $vipps, $subscription_key)
+    public function __construct(ClientInterface $client)
     {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->headers['Authorization'] =
-                $this->app->getClient()->getTokenStorage()->get()->getTokenType()
+                $this->client->getTokenStorage()->get()->getTokenType()
                 .' '.
-                $this->app->getClient()->getTokenStorage()->get()->getAccessToken();
+                $this->client->getTokenStorage()->get()->getAccessToken();
     }
 }
diff --git a/src/Resource/Checkout/v3/CreateCheckoutSession.php b/src/Resource/Checkout/v3/CreateCheckoutSession.php
index 52a2769..32579d3 100644
--- a/src/Resource/Checkout/v3/CreateCheckoutSession.php
+++ b/src/Resource/Checkout/v3/CreateCheckoutSession.php
@@ -2,11 +2,11 @@
 
 namespace zaporylie\Vipps\Resource\Checkout\v3;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\Checkout\v3\CreateCheckoutSessionRequest;
 use zaporylie\Vipps\Model\Checkout\v3\CreateCheckoutSessionResponse;
 use zaporylie\Vipps\Resource\HttpMethod;
 use zaporylie\Vipps\Resource\PaymentResourceBase;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class CreateCheckoutSession
@@ -29,17 +29,17 @@ class CreateCheckoutSession extends PaymentResourceBase
     /**
      * InitiatePayment constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $subscription_key
      * @param \zaporylie\Vipps\Model\EPayment\v1\CreatePaymentRequest $request
      */
-    public function __construct(VippsInterface $vipps, string $subscription_key, string $client_secret, CreateCheckoutSessionRequest $request)
+    public function __construct(ClientInterface $client, CreateCheckoutSessionRequest $request)
     {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
 
         // Checkout module requires client_id and client_secret headers.
-        $this->headers['client_id'] = $this->app->getClient()->getClientId();
-        $this->headers['client_secret'] = $client_secret;
+        $this->headers['client_id'] = $this->client->getClientId();
+        $this->headers['client_secret'] = $this->client->getClientSecret();
 
         $this->body = $this
             ->getSerializer()
diff --git a/src/Resource/Checkout/v3/GetCheckoutSession.php b/src/Resource/Checkout/v3/GetCheckoutSession.php
index 62d1c28..40cfb25 100644
--- a/src/Resource/Checkout/v3/GetCheckoutSession.php
+++ b/src/Resource/Checkout/v3/GetCheckoutSession.php
@@ -2,10 +2,10 @@
 
 namespace zaporylie\Vipps\Resource\Checkout\v3;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\Checkout\v3\GetCheckoutSessionResponse;
 use zaporylie\Vipps\Resource\HttpMethod;
 use zaporylie\Vipps\Resource\PaymentResourceBase;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class CreateCheckoutSession
@@ -28,18 +28,18 @@ class GetCheckoutSession extends PaymentResourceBase
     /**
      * InitiatePayment constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $subscription_key
      * @param string $reference
      */
-    public function __construct(VippsInterface $vipps, string $subscription_key, string $client_secret, string $reference)
+    public function __construct(ClientInterface $client, string $reference)
     {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->id = $reference;
 
         // Checkout module requires client_id and client_secret headers.
-        $this->headers['client_id'] = $this->app->getClient()->getClientId();
-        $this->headers['client_secret'] = $client_secret;
+        $this->headers['client_id'] = $this->client->getClientId();
+        $this->headers['client_secret'] = $this->client->getClientSecret();
     }
 
     /**
diff --git a/src/Resource/EPayment/v1/CancelPayment.php b/src/Resource/EPayment/v1/CancelPayment.php
index 1f05af0..52acbec 100644
--- a/src/Resource/EPayment/v1/CancelPayment.php
+++ b/src/Resource/EPayment/v1/CancelPayment.php
@@ -2,11 +2,11 @@
 
 namespace zaporylie\Vipps\Resource\EPayment\v1;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\EPayment\v1\CancelModificationRequest;
 use zaporylie\Vipps\Model\EPayment\v1\PaymentAdjustResponse;
 use zaporylie\Vipps\Resource\HttpMethod;
 use zaporylie\Vipps\Resource\PaymentResourceBase;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class CancelPayment
@@ -29,19 +29,17 @@ class CancelPayment extends PaymentResourceBase
     /**
      * InitiatePayment constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param ClientInterface $client
      * @param string $idempotency_key
      * @param \zaporylie\Vipps\Model\EPayment\v1\CancelModificationRequest $request
      */
     public function __construct(
-        VippsInterface $vipps,
-        string $subscription_key,
+        ClientInterface $client,
         string $idempotency_key,
         string $reference,
         CancelModificationRequest $request
     ) {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->headers['Idempotency-Key'] = $idempotency_key;
         $this->id = $reference;
         $this->body = $this
diff --git a/src/Resource/EPayment/v1/CapturePayment.php b/src/Resource/EPayment/v1/CapturePayment.php
index 5b354fb..51a91fe 100644
--- a/src/Resource/EPayment/v1/CapturePayment.php
+++ b/src/Resource/EPayment/v1/CapturePayment.php
@@ -2,11 +2,11 @@
 
 namespace zaporylie\Vipps\Resource\EPayment\v1;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\EPayment\v1\CaptureModificationRequest;
 use zaporylie\Vipps\Model\EPayment\v1\PaymentAdjustResponse;
 use zaporylie\Vipps\Resource\HttpMethod;
 use zaporylie\Vipps\Resource\PaymentResourceBase;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class CancelPayment
@@ -29,19 +29,17 @@ class CapturePayment extends PaymentResourceBase
     /**
      * InitiatePayment constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $idempotency_key
      * @param \zaporylie\Vipps\Model\EPayment\v1\CaptureModificationRequest $request
      */
     public function __construct(
-        VippsInterface $vipps,
-        string $subscription_key,
+        ClientInterface $client,
         string $idempotency_key,
         string $reference,
         CaptureModificationRequest $request
     ) {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->headers['Idempotency-Key'] = $idempotency_key;
         $this->id = $reference;
         $this->body = $this
diff --git a/src/Resource/EPayment/v1/CreatePayment.php b/src/Resource/EPayment/v1/CreatePayment.php
index a640720..95922e4 100644
--- a/src/Resource/EPayment/v1/CreatePayment.php
+++ b/src/Resource/EPayment/v1/CreatePayment.php
@@ -2,11 +2,11 @@
 
 namespace zaporylie\Vipps\Resource\EPayment\v1;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\EPayment\v1\CreatePaymentRequest;
 use zaporylie\Vipps\Model\EPayment\v1\CreatePaymentResponse;
 use zaporylie\Vipps\Resource\HttpMethod;
 use zaporylie\Vipps\Resource\PaymentResourceBase;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class CreatePayment
@@ -29,14 +29,13 @@ class CreatePayment extends PaymentResourceBase
     /**
      * InitiatePayment constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $idempotency_key
      * @param \zaporylie\Vipps\Model\EPayment\v1\CreatePaymentRequest $request
      */
-    public function __construct(VippsInterface $vipps, string $subscription_key, string $idempotency_key, CreatePaymentRequest $request)
+    public function __construct(ClientInterface $client, string $idempotency_key, CreatePaymentRequest $request)
     {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->headers['Idempotency-Key'] = $idempotency_key;
         $this->body = $this
             ->getSerializer()
diff --git a/src/Resource/EPayment/v1/GetPayment.php b/src/Resource/EPayment/v1/GetPayment.php
index 1f71179..4412bf3 100644
--- a/src/Resource/EPayment/v1/GetPayment.php
+++ b/src/Resource/EPayment/v1/GetPayment.php
@@ -2,10 +2,10 @@
 
 namespace zaporylie\Vipps\Resource\EPayment\v1;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\EPayment\v1\GetPaymentResponse;
 use zaporylie\Vipps\Resource\HttpMethod;
 use zaporylie\Vipps\Resource\PaymentResourceBase;
-use zaporylie\Vipps\VippsInterface;
 
 class GetPayment extends PaymentResourceBase
 {
@@ -23,13 +23,12 @@ class GetPayment extends PaymentResourceBase
     /**
      * InitiatePayment constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $reference
      */
-    public function __construct(VippsInterface $vipps, string $subscription_key, string $reference)
+    public function __construct(ClientInterface $client, string $reference)
     {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->id = $reference;
     }
 
diff --git a/src/Resource/EPayment/v1/GetPaymentEvents.php b/src/Resource/EPayment/v1/GetPaymentEvents.php
index 62149a5..4e7931b 100644
--- a/src/Resource/EPayment/v1/GetPaymentEvents.php
+++ b/src/Resource/EPayment/v1/GetPaymentEvents.php
@@ -2,10 +2,10 @@
 
 namespace zaporylie\Vipps\Resource\EPayment\v1;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\EPayment\v1\EventLog;
 use zaporylie\Vipps\Resource\HttpMethod;
 use zaporylie\Vipps\Resource\PaymentResourceBase;
-use zaporylie\Vipps\VippsInterface;
 
 class GetPaymentEvents extends PaymentResourceBase
 {
@@ -23,13 +23,12 @@ class GetPaymentEvents extends PaymentResourceBase
     /**
      * InitiatePayment constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $reference
      */
-    public function __construct(VippsInterface $vipps, string $subscription_key, string $reference)
+    public function __construct(ClientInterface $client, string $reference)
     {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->id = $reference;
     }
 
diff --git a/src/Resource/EPayment/v1/RefundPayment.php b/src/Resource/EPayment/v1/RefundPayment.php
index 2e20343..c93fa44 100644
--- a/src/Resource/EPayment/v1/RefundPayment.php
+++ b/src/Resource/EPayment/v1/RefundPayment.php
@@ -2,11 +2,11 @@
 
 namespace zaporylie\Vipps\Resource\EPayment\v1;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\EPayment\v1\PaymentAdjustResponse;
 use zaporylie\Vipps\Model\EPayment\v1\RefundModificationRequest;
 use zaporylie\Vipps\Resource\HttpMethod;
 use zaporylie\Vipps\Resource\PaymentResourceBase;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class CancelPayment
@@ -29,19 +29,17 @@ class RefundPayment extends PaymentResourceBase
     /**
      * InitiatePayment constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $idempotency_key
      * @param \zaporylie\Vipps\Model\EPayment\v1\RefundModificationRequest $request
      */
     public function __construct(
-        VippsInterface $vipps,
-        string $subscription_key,
+        ClientInterface $client,
         string $idempotency_key,
         string $reference,
         RefundModificationRequest $request
     ) {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->headers['Idempotency-Key'] = $idempotency_key;
         $this->id = $reference;
         $this->body = $this
diff --git a/src/Resource/PaymentResourceBase.php b/src/Resource/PaymentResourceBase.php
index 81d2590..c76efec 100644
--- a/src/Resource/PaymentResourceBase.php
+++ b/src/Resource/PaymentResourceBase.php
@@ -5,6 +5,7 @@
 use JMS\Serializer\Naming\IdenticalPropertyNamingStrategy;
 use JMS\Serializer\Naming\SerializedNameAnnotationStrategy;
 use JMS\Serializer\SerializerBuilder;
+use zaporylie\Vipps\ClientInterface;
 
 /**
  * Class PaymentResourceBase
@@ -17,9 +18,9 @@ abstract class PaymentResourceBase extends AuthorizedResourceBase
     /**
      * {@inheritdoc}
      */
-    public function __construct(\zaporylie\Vipps\VippsInterface $vipps, $subscription_key)
+    public function __construct(ClientInterface $client)
     {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
 
         // Adjust serializer.
         $this->serializer = SerializerBuilder::create()
diff --git a/src/Resource/RecurringPayment/v3/CancelCharge.php b/src/Resource/RecurringPayment/v3/CancelCharge.php
index abde416..9ff2698 100644
--- a/src/Resource/RecurringPayment/v3/CancelCharge.php
+++ b/src/Resource/RecurringPayment/v3/CancelCharge.php
@@ -2,9 +2,8 @@
 
 namespace zaporylie\Vipps\Resource\RecurringPayment\v3;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Resource\HttpMethod;
-use zaporylie\Vipps\Resource\IdempotencyKeyFactory;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class CancelCharge
@@ -27,15 +26,13 @@ class CancelCharge extends RecurringPaymentResourceBase
     /**
      * CancelCharge constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $agreement_id
      * @param string $idempotency_key
      * @param string $charge_id
      */
     public function __construct(
-        VippsInterface $vipps,
-        string $subscription_key,
+        ClientInterface $client,
         string $agreement_id,
         string $idempotency_key,
         string $charge_id
@@ -43,7 +40,7 @@ public function __construct(
         $this->id = $agreement_id;
         $this->charge_id = $charge_id;
         $this->headers['Idempotency-Key'] = $idempotency_key;
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
     }
 
     /**
diff --git a/src/Resource/RecurringPayment/v3/CaptureCharge.php b/src/Resource/RecurringPayment/v3/CaptureCharge.php
index 586c51d..304e980 100644
--- a/src/Resource/RecurringPayment/v3/CaptureCharge.php
+++ b/src/Resource/RecurringPayment/v3/CaptureCharge.php
@@ -2,10 +2,9 @@
 
 namespace zaporylie\Vipps\Resource\RecurringPayment\v3;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\RecurringPayment\v3\RequestCaptureCharge;
 use zaporylie\Vipps\Resource\HttpMethod;
-use zaporylie\Vipps\Resource\IdempotencyKeyFactory;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class CaptureCharge
@@ -28,25 +27,23 @@ class CaptureCharge extends RecurringPaymentResourceBase
     /**
      * InitiatePayment constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $agreement_id
      * @param string $idempotency_key
      * @param string $charge_id
      * @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestCaptureCharge $requestObject
      */
     public function __construct(
-        VippsInterface $vipps,
-        string $subscription_key,
+        ClientInterface $client,
         string $agreement_id,
-        string $idempotency_key,
         string $charge_id,
+        string $idempotency_key,
         RequestCaptureCharge $requestObject
     ) {
         $this->id = $agreement_id;
         $this->charge_id = $charge_id;
         $this->headers['Idempotency-Key'] = $idempotency_key;
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->body = $this
             ->getSerializer()
             ->serialize(
diff --git a/src/Resource/RecurringPayment/v3/CreateAgreement.php b/src/Resource/RecurringPayment/v3/CreateAgreement.php
index 043acfd..75354b3 100644
--- a/src/Resource/RecurringPayment/v3/CreateAgreement.php
+++ b/src/Resource/RecurringPayment/v3/CreateAgreement.php
@@ -2,11 +2,10 @@
 
 namespace zaporylie\Vipps\Resource\RecurringPayment\v3;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateAgreement;
 use zaporylie\Vipps\Model\RecurringPayment\v3\ResponseCreateAgreement;
 use zaporylie\Vipps\Resource\HttpMethod;
-use zaporylie\Vipps\Resource\IdempotencyKeyFactory;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class CreateAgreement
@@ -29,15 +28,14 @@ class CreateAgreement extends RecurringPaymentResourceBase
     /**
      * InitiatePayment constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $idempotency_key
      * @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateAgreement $requestObject
      */
-    public function __construct(VippsInterface $vipps, string $subscription_key, string $idempotency_key, RequestCreateAgreement $requestObject)
+    public function __construct(ClientInterface $client, string $idempotency_key, RequestCreateAgreement $requestObject)
     {
       $this->headers['Idempotency-Key'] = $idempotency_key;
-      parent::__construct($vipps, $subscription_key);
+      parent::__construct($client);
         $this->body = $this
             ->getSerializer()
             ->serialize(
diff --git a/src/Resource/RecurringPayment/v3/CreateCharge.php b/src/Resource/RecurringPayment/v3/CreateCharge.php
index 9b53ed6..68f4a6e 100644
--- a/src/Resource/RecurringPayment/v3/CreateCharge.php
+++ b/src/Resource/RecurringPayment/v3/CreateCharge.php
@@ -2,11 +2,10 @@
 
 namespace zaporylie\Vipps\Resource\RecurringPayment\v3;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateCharge;
 use zaporylie\Vipps\Model\RecurringPayment\v3\ResponseCreateCharge;
 use zaporylie\Vipps\Resource\HttpMethod;
-use zaporylie\Vipps\Resource\IdempotencyKeyFactory;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class CreateCharge
@@ -29,22 +28,20 @@ class CreateCharge extends RecurringPaymentResourceBase
     /**
      * InitiatePayment constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
-     * @param string $agreementId
+     * @param \zaporylie\Vipps\ClientInterface $client
+     * @param string $agreement_id
      * @param string $idempotency_key
      * @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateCharge $requestObject
      */
     public function __construct(
-        VippsInterface $vipps,
-        string $subscription_key,
-        string $agreementId,
+        ClientInterface $client,
+        string $agreement_id,
         string $idempotency_key,
         RequestCreateCharge $requestObject
     ) {
-        $this->id = $agreementId;
+        $this->id = $agreement_id;
         $this->headers['Idempotency-Key'] = $idempotency_key;
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->body = $this
             ->getSerializer()
             ->serialize(
diff --git a/src/Resource/RecurringPayment/v3/GetAgreement.php b/src/Resource/RecurringPayment/v3/GetAgreement.php
index f7c7139..01b1637 100644
--- a/src/Resource/RecurringPayment/v3/GetAgreement.php
+++ b/src/Resource/RecurringPayment/v3/GetAgreement.php
@@ -2,9 +2,9 @@
 
 namespace zaporylie\Vipps\Resource\RecurringPayment\v3;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\RecurringPayment\v3\ResponseGetAgreement;
 use zaporylie\Vipps\Resource\HttpMethod;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class GetAgreement
@@ -27,13 +27,12 @@ class GetAgreement extends RecurringPaymentResourceBase
     /**
      * InitiatePayment constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $agreement_id
      */
-    public function __construct(VippsInterface $vipps, string $subscription_key, string $agreement_id)
+    public function __construct(ClientInterface $client, string $agreement_id)
     {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->id = $agreement_id;
     }
 
diff --git a/src/Resource/RecurringPayment/v3/GetCharge.php b/src/Resource/RecurringPayment/v3/GetCharge.php
index 86f9f30..b8758be 100644
--- a/src/Resource/RecurringPayment/v3/GetCharge.php
+++ b/src/Resource/RecurringPayment/v3/GetCharge.php
@@ -2,7 +2,7 @@
 
 namespace zaporylie\Vipps\Resource\RecurringPayment\v3;
 
-use zaporylie\Vipps\Model\RecurringPayment\v3\Charge;
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\RecurringPayment\v3\ResponseGetCharge;
 use zaporylie\Vipps\Resource\HttpMethod;
 
@@ -25,18 +25,16 @@ class GetCharge extends RecurringPaymentResourceBase
     protected $path = '/recurring/v3/agreements/{id}/charges/{charge_id}';
 
     /**
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $agreement_id
      * @param string $charge_id
      */
     public function __construct(
-        \zaporylie\Vipps\VippsInterface $vipps,
-        string $subscription_key,
+        ClientInterface $client,
         string $agreement_id,
         string $charge_id
     ) {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->id = $agreement_id;
         $this->charge_id = $charge_id;
     }
diff --git a/src/Resource/RecurringPayment/v3/GetCharges.php b/src/Resource/RecurringPayment/v3/GetCharges.php
index ff77f25..4c40231 100644
--- a/src/Resource/RecurringPayment/v3/GetCharges.php
+++ b/src/Resource/RecurringPayment/v3/GetCharges.php
@@ -2,6 +2,7 @@
 
 namespace zaporylie\Vipps\Resource\RecurringPayment\v3;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\RecurringPayment\v3\Charge;
 use zaporylie\Vipps\Resource\HttpMethod;
 
@@ -24,16 +25,14 @@ class GetCharges extends RecurringPaymentResourceBase
     protected $path = '/recurring/v3/agreements/{id}/charges';
 
     /**
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $agreement_id
      */
     public function __construct(
-        \zaporylie\Vipps\VippsInterface $vipps,
-        string $subscription_key,
+        ClientInterface $client,
         string $agreement_id
     ) {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->id = $agreement_id;
     }
 
diff --git a/src/Resource/RecurringPayment/v3/RecurringPaymentResourceBase.php b/src/Resource/RecurringPayment/v3/RecurringPaymentResourceBase.php
index 7b700f5..e2252a8 100644
--- a/src/Resource/RecurringPayment/v3/RecurringPaymentResourceBase.php
+++ b/src/Resource/RecurringPayment/v3/RecurringPaymentResourceBase.php
@@ -5,8 +5,8 @@
 use JMS\Serializer\Naming\IdenticalPropertyNamingStrategy;
 use JMS\Serializer\Naming\SerializedNameAnnotationStrategy;
 use JMS\Serializer\SerializerBuilder;
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Resource\AuthorizedResourceBase;
-use zaporylie\Vipps\Resource\RequestIdFactory;
 
 /**
  * Class PaymentResourceBase
@@ -24,9 +24,9 @@ abstract class RecurringPaymentResourceBase extends AuthorizedResourceBase
     /**
      * {@inheritdoc}
      */
-    public function __construct(\zaporylie\Vipps\VippsInterface $vipps, string $subscription_key)
+    public function __construct(ClientInterface $client)
     {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
 
         // Adjust serializer.
         $this->serializer = SerializerBuilder::create()
diff --git a/src/Resource/RecurringPayment/v3/RefundCharge.php b/src/Resource/RecurringPayment/v3/RefundCharge.php
index e356492..1fbdea5 100644
--- a/src/Resource/RecurringPayment/v3/RefundCharge.php
+++ b/src/Resource/RecurringPayment/v3/RefundCharge.php
@@ -2,10 +2,9 @@
 
 namespace zaporylie\Vipps\Resource\RecurringPayment\v3;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\RecurringPayment\v3\RequestRefundCharge;
 use zaporylie\Vipps\Resource\HttpMethod;
-use zaporylie\Vipps\Resource\IdempotencyKeyFactory;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class RefundCharge
@@ -28,16 +27,14 @@ class RefundCharge extends RecurringPaymentResourceBase
     /**
      * RefundCharge constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $agreement_id
      * @param string $charge_id
      * @param string $idempotency_key
      * @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestRefundCharge $requestObject
      */
     public function __construct(
-        VippsInterface $vipps,
-        string $subscription_key,
+        ClientInterface $client,
         string $agreement_id,
         string $charge_id,
         string $idempotency_key,
@@ -46,7 +43,7 @@ public function __construct(
         $this->id = $agreement_id;
         $this->charge_id = $charge_id;
         $this->headers['Idempotency-Key'] = $idempotency_key;
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->body = $this
             ->getSerializer()
             ->serialize(
diff --git a/src/Resource/RecurringPayment/v3/UpdateAgreement.php b/src/Resource/RecurringPayment/v3/UpdateAgreement.php
index 5a4bc07..953928e 100644
--- a/src/Resource/RecurringPayment/v3/UpdateAgreement.php
+++ b/src/Resource/RecurringPayment/v3/UpdateAgreement.php
@@ -2,10 +2,9 @@
 
 namespace zaporylie\Vipps\Resource\RecurringPayment\v3;
 
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\RecurringPayment\v3\RequestUpdateAgreement;
 use zaporylie\Vipps\Resource\HttpMethod;
-use zaporylie\Vipps\Resource\IdempotencyKeyFactory;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class UpdateAgreement
@@ -28,21 +27,19 @@ class UpdateAgreement extends RecurringPaymentResourceBase
     /**
      * InitiatePayment constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param string $agreement_id
      * @param string $idempotency_key
      * @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestUpdateAgreement $requestObject
      */
     public function __construct(
-        VippsInterface $vipps,
-        string $subscription_key,
+        ClientInterface $client,
         string $agreement_id,
         string $idempotency_key,
         RequestUpdateAgreement $requestObject
     ) {
         $this->headers['Idempotency-Key'] = $idempotency_key;
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->id = $agreement_id;
         $this->body = $this
             ->getSerializer()
diff --git a/src/Resource/ResourceBase.php b/src/Resource/ResourceBase.php
index a972e26..cb30696 100644
--- a/src/Resource/ResourceBase.php
+++ b/src/Resource/ResourceBase.php
@@ -11,10 +11,10 @@
 use Doctrine\Common\Annotations\AnnotationRegistry;
 use Http\Client\Exception\HttpException;
 use JMS\Serializer\SerializerBuilder;
-use Psr\Http\Client\ClientInterface;
+use Psr\Http\Client\ClientInterface as PsrClientInterface;
 use Psr\Http\Message\RequestInterface;
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Exceptions\VippsException;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class ResourceBase
@@ -24,9 +24,9 @@ abstract class ResourceBase implements ResourceInterface, SerializableInterface
 {
 
     /**
-     * @var VippsInterface
+     * @var \zaporylie\Vipps\ClientInterface
      */
-    protected $app;
+    protected $client;
 
     /**
      * @var array
@@ -61,19 +61,19 @@ abstract class ResourceBase implements ResourceInterface, SerializableInterface
     /**
      * AbstractResource constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      */
-    public function __construct(VippsInterface $vipps, $subscription_key)
+    public function __construct(ClientInterface $client)
     {
-        $this->app = $vipps;
+        $this->client = $client;
 
-        $this->headers['Ocp-Apim-Subscription-Key'] = $subscription_key;
+        $this->headers['Ocp-Apim-Subscription-Key'] = $this->client->getSubscriptionKey();
+        $this->headers['Merchant-Serial-Number'] = $this->client->getMerchantSerialNumber();
 
-        $this->headers['Vipps-System-Name'] = $this->app->getClient()->getVippsSystemName();
-        $this->headers['Vipps-System-Version'] = $this->app->getClient()->getVippsSystemVersion();
-        $this->headers['Vipps-System-Plugin-Name'] = $this->app->getClient()->getVippsSystemPluginName();
-        $this->headers['Vipps-System-Plugin-Version'] = $this->app->getClient()->getVippsSystemPluginVersion();
+        $this->headers['Vipps-System-Name'] = $this->client->getVippsSystemName();
+        $this->headers['Vipps-System-Version'] = $this->client->getVippsSystemVersion();
+        $this->headers['Vipps-System-Plugin-Name'] = $this->client->getVippsSystemPluginName();
+        $this->headers['Vipps-System-Plugin-Version'] = $this->client->getVippsSystemPluginVersion();
 
         // Initiate serializer.
         if (class_exists(AnnotationRegistry::class) && method_exists(AnnotationRegistry::class, 'registerLoader')) {
@@ -159,7 +159,7 @@ public function getBody()
      */
     public function getUri($path)
     {
-        return $this->app->getClient()->getEndpoint()->getUri()->withPath($path);
+        return $this->client->getEndpoint()->getUri()->withPath($path);
     }
 
     /**
@@ -191,10 +191,9 @@ protected function makeCall()
     protected function handleRequest(RequestInterface $request)
     {
         // Get client.
-        $client = $this->app->getClient()->getHttpClient();
+        $client = $this->client->getHttpClient();
 
-        // Handle requests, sync precedence.
-        if ($client instanceof ClientInterface) {
+        if ($client instanceof PsrClientInterface) {
             // Send sync request.
             $response = $client->sendRequest($request);
         } else {
@@ -209,11 +208,11 @@ protected function handleRequest(RequestInterface $request)
      */
     protected function getRequest()
     {
-        $request = $this->app->getClient()->getRequestFactory()->createRequest(
+        $request = $this->client->getRequestFactory()->createRequest(
             $this->getMethod(),
             $this->getUri($this->getPath())
         );
-        $body = $this->app->getClient()->getStreamFactory()->createStream($this->getBody());
+        $body = $this->client->getStreamFactory()->createStream($this->getBody());
         $request = $request->withBody($body);
         foreach ($this->getHeaders() as $header => $value) {
             $request = $request->withAddedHeader($header, $value);
diff --git a/src/Resource/UserInfo/UserInfo.php b/src/Resource/UserInfo/UserInfo.php
index e9fe519..09c383a 100644
--- a/src/Resource/UserInfo/UserInfo.php
+++ b/src/Resource/UserInfo/UserInfo.php
@@ -3,10 +3,10 @@
 namespace zaporylie\Vipps\Resource\UserInfo;
 
 use JMS\Serializer\SerializerBuilder;
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\UserInfo\ResponseUserInfo;
 use zaporylie\Vipps\Resource\AuthorizedResourceBase;
 use zaporylie\Vipps\Resource\HttpMethod;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class UserInfo
@@ -29,19 +29,20 @@ class UserInfo extends AuthorizedResourceBase
     /**
      * AbstractResource constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
+     * @param \zaporylie\Vipps\ClientInterface $client
+     * @param string $sub
      */
-    public function __construct(VippsInterface $vipps, $sub)
+    public function __construct(ClientInterface $client, string $sub)
     {
-        $this->app = $vipps;
+        $this->client = $client;
         // Initiate serializer.
         $this->serializer = SerializerBuilder::create()
             ->build();
         $this->id = $sub;
         $this->headers['Authorization'] =
-            $this->app->getClient()->getTokenStorage()->get()->getTokenType()
+            $this->client->getTokenStorage()->get()->getTokenType()
             .' '.
-            $this->app->getClient()->getTokenStorage()->get()->getAccessToken();
+            $this->client->getTokenStorage()->get()->getAccessToken();
     }
 
     /**
diff --git a/src/Resource/Webhook/v1/DeleteWebhook.php b/src/Resource/Webhook/v1/DeleteWebhook.php
index 281d31c..13b7c07 100644
--- a/src/Resource/Webhook/v1/DeleteWebhook.php
+++ b/src/Resource/Webhook/v1/DeleteWebhook.php
@@ -2,15 +2,9 @@
 
 namespace zaporylie\Vipps\Resource\Webhook\v1;
 
-use zaporylie\Vipps\Model\Authorization\ResponseGetToken;
-use zaporylie\Vipps\Model\EPayment\v1\EventLog;
-use zaporylie\Vipps\Model\Webhook\v1\RegisterWebhookRequest;
-use zaporylie\Vipps\Model\Webhook\v1\RegisterWebhookResponse;
-use zaporylie\Vipps\Model\Webhook\v1\Webhook;
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Resource\AuthorizedResourceBase;
-use zaporylie\Vipps\Resource\ResourceBase;
 use zaporylie\Vipps\Resource\HttpMethod;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class Webhook
@@ -33,13 +27,12 @@ class DeleteWebhook extends AuthorizedResourceBase
     /**
      * GetToken constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      * @param $reference
      */
-    public function __construct(VippsInterface $vipps, $subscription_key, $reference)
+    public function __construct(ClientInterface $client, $reference)
     {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->id = $reference;
     }
 
diff --git a/src/Resource/Webhook/v1/GetWebhooks.php b/src/Resource/Webhook/v1/GetWebhooks.php
index e4e606b..a89fcce 100644
--- a/src/Resource/Webhook/v1/GetWebhooks.php
+++ b/src/Resource/Webhook/v1/GetWebhooks.php
@@ -2,14 +2,10 @@
 
 namespace zaporylie\Vipps\Resource\Webhook\v1;
 
-use zaporylie\Vipps\Model\Authorization\ResponseGetToken;
-use zaporylie\Vipps\Model\EPayment\v1\EventLog;
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\Webhook\v1\GetWebhooksResponse;
-use zaporylie\Vipps\Model\Webhook\v1\Webhook;
 use zaporylie\Vipps\Resource\AuthorizedResourceBase;
-use zaporylie\Vipps\Resource\ResourceBase;
 use zaporylie\Vipps\Resource\HttpMethod;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class Webhook
@@ -32,12 +28,11 @@ class GetWebhooks extends AuthorizedResourceBase
     /**
      * GetToken constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      */
-    public function __construct(VippsInterface $vipps, $subscription_key)
+    public function __construct(ClientInterface $client)
     {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
     }
 
     /**
diff --git a/src/Resource/Webhook/v1/RegisterWebhook.php b/src/Resource/Webhook/v1/RegisterWebhook.php
index ceb9991..88f6432 100644
--- a/src/Resource/Webhook/v1/RegisterWebhook.php
+++ b/src/Resource/Webhook/v1/RegisterWebhook.php
@@ -2,15 +2,11 @@
 
 namespace zaporylie\Vipps\Resource\Webhook\v1;
 
-use zaporylie\Vipps\Model\Authorization\ResponseGetToken;
-use zaporylie\Vipps\Model\EPayment\v1\EventLog;
+use zaporylie\Vipps\ClientInterface;
 use zaporylie\Vipps\Model\Webhook\v1\RegisterWebhookRequest;
 use zaporylie\Vipps\Model\Webhook\v1\RegisterWebhookResponse;
-use zaporylie\Vipps\Model\Webhook\v1\Webhook;
 use zaporylie\Vipps\Resource\AuthorizedResourceBase;
-use zaporylie\Vipps\Resource\ResourceBase;
 use zaporylie\Vipps\Resource\HttpMethod;
-use zaporylie\Vipps\VippsInterface;
 
 /**
  * Class Webhook
@@ -33,12 +29,11 @@ class RegisterWebhook extends AuthorizedResourceBase
     /**
      * GetToken constructor.
      *
-     * @param \zaporylie\Vipps\VippsInterface $vipps
-     * @param string $subscription_key
+     * @param \zaporylie\Vipps\ClientInterface $client
      */
-    public function __construct(VippsInterface $vipps, $subscription_key, RegisterWebhookRequest $request)
+    public function __construct(ClientInterface $client, RegisterWebhookRequest $request)
     {
-        parent::__construct($vipps, $subscription_key);
+        parent::__construct($client);
         $this->body = $this
             ->getSerializer()
             ->serialize(
diff --git a/src/Vipps.php b/src/Vipps.php
deleted file mode 100644
index 8397529..0000000
--- a/src/Vipps.php
+++ /dev/null
@@ -1,42 +0,0 @@
-client = $client;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getClient()
-    {
-        return $this->client;
-    }
-}
diff --git a/src/VippsInterface.php b/src/VippsInterface.php
deleted file mode 100644
index 9243c09..0000000
--- a/src/VippsInterface.php
+++ /dev/null
@@ -1,22 +0,0 @@
-