9 * @property string $object
10 * @property int $amount
11 * @property string $client_secret
12 * @property mixed $code_verification
13 * @property int $created
14 * @property string $currency
15 * @property string $flow
16 * @property bool $livemode
17 * @property StripeObject $metadata
18 * @property mixed $owner
19 * @property mixed $receiver
20 * @property mixed $redirect
21 * @property string $statement_descriptor
22 * @property string $status
23 * @property string $type
24 * @property string $usage
28 class Source
extends ApiResource
31 const OBJECT_NAME
= "source";
33 use ApiOperations\Create
;
34 use ApiOperations\Retrieve
;
35 use ApiOperations\Update
;
38 * @param array|null $params
39 * @param array|string|null $options
41 * @return Source The detached source.
43 public function detach($params = null, $options = null)
45 self
::_validateParams($params);
49 $class = get_class($this);
50 $msg = "Could not determine which URL to request: $class instance "
51 . "has invalid ID: $id";
52 throw new Error\
InvalidRequest($msg, null);
55 if ($this['customer']) {
56 $base = Customer
::classUrl();
57 $parentExtn = urlencode(Util\Util
::utf8($this['customer']));
58 $extn = urlencode(Util\Util
::utf8($id));
59 $url = "$base/$parentExtn/sources/$extn";
61 list($response, $opts) = $this->_request('delete', $url, $params, $options);
62 $this->refreshFrom($response, $opts);
65 $message = "This source object does not appear to be currently attached "
66 . "to a customer object.";
67 throw new Error\
Api($message);
72 * @param array|null $params
73 * @param array|string|null $options
75 * @return Source The detached source.
77 * @deprecated Use the `detach` method instead.
79 public function delete($params = null, $options = null)
81 $this->detach($params, $options);
85 * @param array|null $params
86 * @param array|string|null $options
88 * @return Collection The list of source transactions.
90 public function sourceTransactions($params = null, $options = null)
92 $url = $this->instanceUrl() . '/source_transactions';
93 list($response, $opts) = $this->_request('get', $url, $params, $options);
94 $obj = Util\Util
::convertToStripeObject($response, $opts);
95 $obj->setLastResponse($response);
100 * @param array|null $params
101 * @param array|string|null $options
103 * @return Source The verified source.
105 public function verify($params = null, $options = null)
107 $url = $this->instanceUrl() . '/verify';
108 list($response, $opts) = $this->_request('post', $url, $params, $options);
109 $this->refreshFrom($response, $opts);