-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeletecard.php
59 lines (44 loc) · 1.76 KB
/
deletecard.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
include_once "config.php";
include_once "include/header.php";
$secretkey = mysql_query("select * from stripecredentials where id ='1'");
$sresult = mysql_fetch_array($secretkey);
try{
$stripeClassesDir = __DIR__ . '/Stripe/lib/';
$stripeUtilDir = $stripeClassesDir . 'Util/';
$stripeErrorDir = $stripeClassesDir . 'Error/';
set_include_path($stripeClassesDir . PATH_SEPARATOR . $stripeUtilDir . PATH_SEPARATOR . $stripeErrorDir);
function __autoload($class)
{
$parts = explode('\\', $class);
require end($parts) . '.php';
}
\Stripe\Stripe::setApiKey($sresult['secretkey']);
$cu = \Stripe\Customer::retrieve($_GET['id']);
$data = mysql_query("select * from taskerdetails where customerid='".$_GET['id']."' && secretkey = '".$sresult['secretkey']."'");
while($rec= mysql_fetch_array($data)){
$customer_id = $rec['cardid'];
}
$cu->sources->retrieve($customer_id)->delete();
//$rp = \Stripe\Recipient::retrieve($_GET['id']);
// $rp->cards->retrieve($_GET['cid'])->delete();
$update = mysql_query("update taskerdetails set `cardid` ='' where customerid='".$_GET['id']."' && secretkey = '".$sresult['secretkey']."'");
echo 'Delete Successfully';
header('Refresh: 2; URL=http://'.$_SERVER['HTTP_HOST'].'/connect.php');
}
catch(Stripe_CardError $e){
$error = $e->getMessage();
echo '<span style="color:red">'.$error.'</span>';
}
catch(stripe_InvalidRequestError $e){
$error = $e->getMessage();
echo '<span style="color:red">'.$error.'</span>';
}
catch(stripe_AuthenticationError $e){
$error = $e->getMessage();
echo '<span style="color:red">'.$error.'</span>';
}
catch(Exception $e){
$error = $e->getMessage();
echo '<span style="color:red">'.$error.'</span>';
}