Skip to content

Commit af3058d

Browse files
committed
Add more API documentation
1 parent 088c9f3 commit af3058d

8 files changed

+111
-1
lines changed

src/Message/AuthorizeRequest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
/**
99
* Stripe Authorize Request
1010
*
11+
* An Authorize request is similar to a purchase request but the
12+
* charge issues an authorization (or pre-authorization), and no money
13+
* is transferred. The transaction will need to be captured later
14+
* in order to effect payment. Uncaptured charges expire in 7 days.
15+
*
1116
* Example:
1217
*
1318
* <code>

src/Message/CaptureRequest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
/**
99
* Stripe Capture Request
1010
*
11-
*
1211
* Use this request to capture and process a previously created authorization.
1312
*
1413
* Example -- note this example assumes that the authorization has been successful

src/Message/CreateCardRequest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
<?php
2+
/**
3+
* Stripe Create Credit Card Request
4+
*/
25

36
namespace Omnipay\Stripe\Message;
47

58
/**
69
* Stripe Create Credit Card Request
10+
*
11+
* This doesn't actually create a card, it creates a customer.
12+
*
13+
* See issue #8
14+
*
15+
* @link https://github.com/thephpleague/omnipay-stripe/issues/8
716
*/
817
class CreateCardRequest extends AbstractRequest
918
{

src/Message/DeleteCardRequest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
<?php
2+
/**
3+
* Stripe Delete Credit Card Request
4+
*/
25

36
namespace Omnipay\Stripe\Message;
47

58
/**
69
* Stripe Delete Credit Card Request
10+
*
11+
* This needs further work and/or explanation because it requires
12+
* a customer ID.
13+
*
14+
* @link https://stripe.com/docs/api#delete_card
715
*/
816
class DeleteCardRequest extends AbstractRequest
917
{

src/Message/FetchTokenRequest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
<?php
2+
/**
3+
* Stripe Fetch Token Request
4+
*/
25

36
namespace Omnipay\Stripe\Message;
47

58
/**
69
* Stripe Fetch Token Request
10+
*
11+
* @link https://stripe.com/docs/api#tokens
712
*/
813
class FetchTokenRequest extends AbstractRequest
914
{

src/Message/FetchTransactionRequest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
11
<?php
2+
/**
3+
* Stripe Fetch Transaction Request
4+
*/
25

36
namespace Omnipay\Stripe\Message;
47

58
/**
69
* Stripe Fetch Transaction Request
10+
*
11+
* Example -- note this example assumes that the purchase has been successful
12+
* and that the transaction ID returned from the purchase is held in $sale_id.
13+
* See PurchaseRequest for the first part of this example transaction:
14+
*
15+
* <code>
16+
* // Fetch the transaction so that details can be found for refund, etc.
17+
* $transaction = $gateway->fetchTransaction();
18+
* $transaction->setTransactionReference($sale_id);
19+
* $response = $transaction->send();
20+
* $data = $response->getData();
21+
* echo "Gateway fetchTransaction response data == " . print_r($data, true) . "\n";
22+
* </code>
23+
*
24+
* @see PurchaseRequest
25+
* @see Omnipay\Stripe\Gateway
26+
* @link https://stripe.com/docs/api#retrieve_charge
727
*/
828
class FetchTransactionRequest extends AbstractRequest
929
{

src/Message/RefundRequest.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,52 @@
11
<?php
2+
/**
3+
* Stripe Refund Request
4+
*/
25

36
namespace Omnipay\Stripe\Message;
47

58
/**
69
* Stripe Refund Request
10+
*
11+
* When you create a new refund, you must specify a
12+
* charge to create it on.
13+
*
14+
* Creating a new refund will refund a charge that has
15+
* previously been created but not yet refunded. Funds will
16+
* be refunded to the credit or debit card that was originally
17+
* charged. The fees you were originally charged are also
18+
* refunded.
19+
*
20+
* You can optionally refund only part of a charge. You can
21+
* do so as many times as you wish until the entire charge
22+
* has been refunded.
23+
*
24+
* Once entirely refunded, a charge can't be refunded again.
25+
* This method will return an error when called on an
26+
* already-refunded charge, or when trying to refund more
27+
* money than is left on a charge.
28+
*
29+
* Example -- note this example assumes that the purchase has been successful
30+
* and that the transaction ID returned from the purchase is held in $sale_id.
31+
* See PurchaseRequest for the first part of this example transaction:
32+
*
33+
* <code>
34+
* // Do a refund transaction on the gateway
35+
* $transaction = $gateway->refund(array(
36+
* 'amount' => '10.00',
37+
* 'transactionReference' => $sale_id,
38+
* ));
39+
* $response = $transaction->send();
40+
* if ($response->isSuccessful()) {
41+
* echo "Refund transaction was successful!\n";
42+
* $refund_id = $response->getTransactionReference();
43+
* echo "Transaction reference = " . $refund_id . "\n";
44+
* }
45+
* </code>
46+
*
47+
* @see PurchaseRequest
48+
* @see Omnipay\Stripe\Gateway
49+
* @link https://stripe.com/docs/api#create_refund
750
*/
851
class RefundRequest extends AbstractRequest
952
{

src/Message/Response.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
<?php
2+
/**
3+
* Stripe Response
4+
*/
25

36
namespace Omnipay\Stripe\Message;
47

58
use Omnipay\Common\Message\AbstractResponse;
69

710
/**
811
* Stripe Response
12+
*
13+
* This is the response class for all Stripe requests.
14+
*
15+
* @see \Omnipay\Stripe\Gateway
916
*/
1017
class Response extends AbstractResponse
1118
{
1219
/**
20+
* Is the transaction successful?
21+
*
1322
* @return bool
1423
*/
1524
public function isSuccessful()
@@ -18,6 +27,8 @@ public function isSuccessful()
1827
}
1928

2029
/**
30+
* Get the transaction reference.
31+
*
2132
* @return string|null
2233
*/
2334
public function getTransactionReference()
@@ -30,6 +41,8 @@ public function getTransactionReference()
3041
}
3142

3243
/**
44+
* Get a card reference, for createCard or createCustomer requests.
45+
*
3346
* @return string|null
3447
*/
3548
public function getCardReference()
@@ -42,6 +55,8 @@ public function getCardReference()
4255
}
4356

4457
/**
58+
* Get a token, for createCard requests.
59+
*
4560
* @return string|null
4661
*/
4762
public function getToken()
@@ -54,6 +69,8 @@ public function getToken()
5469
}
5570

5671
/**
72+
* Get the card data from the response.
73+
*
5774
* @return array|null
5875
*/
5976
public function getCard()
@@ -66,6 +83,10 @@ public function getCard()
6683
}
6784

6885
/**
86+
* Get the error message from the response.
87+
*
88+
* Returns null if the request was successful.
89+
*
6990
* @return string|null
7091
*/
7192
public function getMessage()

0 commit comments

Comments
 (0)