Invoice.php
1.77 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
<?php
namespace Stripe;
class Invoice extends ApiResource
{
/**
* @param array|null $params
* @param array|string|null $opts
*
* @return Invoice The created invoice.
*/
public static function create($params = null, $opts = null)
{
return self::_create($params, $opts);
}
/**
* @param string $id The ID of the invoice to retrieve.
* @param array|string|null $opts
*
* @return Invoice
*/
public static function retrieve($id, $opts = null)
{
return self::_retrieve($id, $opts);
}
/**
* @param array|null $params
* @param array|string|null $opts
*
* @return Collection of Invoices
*/
public static function all($params = null, $opts = null)
{
return self::_all($params, $opts);
}
/**
* @param array|null $params
* @param array|string|null $opts
*
* @return Invoice The upcoming invoice.
*/
public static function upcoming($params = null, $opts = null)
{
$url = static::classUrl() . '/upcoming';
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
/**
* @param array|string|null $opts
*
* @return Invoice The saved invoice.
*/
public function save($opts = null)
{
return $this->_save($opts);
}
/**
* @return Invoice The paid invoice.
*/
public function pay($opts = null)
{
$url = $this->instanceUrl() . '/pay';
list($response, $opts) = $this->_request('post', $url, null, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
}