-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathinvoice.php
More file actions
154 lines (143 loc) · 4.5 KB
/
Copy pathinvoice.php
File metadata and controls
154 lines (143 loc) · 4.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php
require('stripe/Stripe.php');
$invoiceID = 'in_123456789';
$stripeKey = "{PRIVATE_KEY}";
date_default_timezone_set('UTC');
Stripe::setApiKey($stripeKey);
//$this->printArray($in);
$invoice = Stripe_Invoice::retrieve($invoiceID);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Invoice</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Customer Invoice">
<meta name="author" content="5marks">
<link rel="stylesheet" href="/global/css/bootstrap.css">
<style>
.invoice-head td {
padding: 0 8px;
}
.container {
padding-top:30px;
}
.invoice-body{
background-color:transparent;
}
.invoice-thank{
margin-top: 60px;
padding: 5px;
}
address{
margin-top:15px;
}
</style>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="shortcut icon" href="/favicon.ico">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
</head>
<body>
<div class="container">
<div class="row">
<div class="span4">
<img src="/img/5marks-logo.png" title="logo">
<address>
<strong>5marks, LLC.</strong><br>
P.O Box 3171<br>
Kent, WA 98089<br>
</address>
</div>
<div class="span4 well">
<table class="invoice-head">
<tbody>
<tr>
<td class="pull-right"><strong>Customer #</strong></td>
<td><?php echo $invoice->customer; ?></td>
</tr>
<tr>
<td class="pull-right"><strong>Invoice #</strong></td>
<td><?php echo $invoice->id; ?></td>
</tr>
<tr>
<td class="pull-right"><strong>Date</strong></td>
<td><?php echo date('M j, Y', $invoice->date); ?></td>
</tr>
<tr>
<td class="pull-right"><strong>Period</strong></td>
<td><?php echo date('M j, Y', $invoice->period_start) .' to ' . date('M j, Y', $invoice->period_end); ?></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="span8">
<h2>Invoice</h2>
</div>
</div>
<div class="row">
<div class="span8 well invoice-body">
<table class="table table-bordered">
<thead>
<tr>
<th>Description</th>
<th>Date</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
<?php
$total = 0;
foreach($invoice->lines->subscriptions as $subscription){
echo '<tr>';
$amount = $subscription->amount / 100;
echo '<td>Agora '.$subscription->plan->name.' ($'.number_format($subscription->plan->amount / 100,2).'/'.$subscription->plan->interval.')</td>';
echo '<td>' . date('M j, Y', $subscription->period->start) .' - ' . date('M j, Y', $subscription->period->end). '</td>';
echo '<td>$' . number_format($amount,2).'</td>';
$total += $amount;
echo '</tr>';
}
if(isset($invoice->discount)){
echo '<tr>';
echo '<td>'.$invoice->discount->coupon->id.' ('.$invoice->discount->coupon->percent_off.'% off)</td>';
$discount = $total * ($invoice->discount->coupon->percent_off/100);
echo '<td> </td>';
echo '<td>-$'.number_format($discount,2).'</td>';
echo '</tr>';
}
?>
<tr>
<td> </td>
<td><strong>Total</strong></td>
<td><strong>$<?php echo number_format(($invoice->total / 100), 2); ?></strong></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="span6 offset1 well invoice-thank">
<h5 style="text-align:center;">Thank You!</h5>
</div>
</div>
<div class="row">
<div class="span3">
<strong>Phone:</strong> <a href="tel:555-555-5555">555-555-5555</a>
</div>
<div class="span3">
<strong>Email:</strong> <a href="mailto:hello@5marks.co">hello@5marks.co</a>
</div>
<div class="span3">
<strong>Website:</strong> <a href="http://5marks.co">http://5marks.co</a>
</div>
</div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="js/jquery/jquery-1.7.1.min.js"%3E%3C/script%3E'))</script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
</body>
</html>