-
Notifications
You must be signed in to change notification settings - Fork 19
/
cancel_recur.php
35 lines (28 loc) · 955 Bytes
/
cancel_recur.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
require_once '../../vendor/autoload.php';
use \Svea\WebPay\WebPayAdmin;
use \Svea\WebPay\Config\ConfigurationService;
$config = ConfigurationService::getTestConfig();
try {
$request = WebpayAdmin::cancelRecurSubscription($config)
->setCountryCode("SE");
$subscriptionId = file_get_contents("subscription.txt");
if ($subscriptionId) {
$request->setSubscriptionId($subscriptionId);
} else {
echo "<pre>Error: subscription.txt not found, first run cardorder_recur.php to set up the card order subscription. aborting.";
die;
}
$response = $request->cancelRecurSubscription()->doRequest();
if ($response->accepted == 1) {
echo "SubscriptionId " . $subscriptionId . " was cancelled.";
}
else
{
echo "Statuscode: " . $response->resultcode . " Error message: " . $response->errormessage;
}
}
catch(Exception $exception)
{
echo $exception->getMessage();
}