Skip to content

Commit 580c805

Browse files
committed
Docs on single charges.
1 parent 2907f34 commit 580c805

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

billing.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- [Introduction](#introduction)
44
- [Configuration](#configuration)
55
- [Subscribing To A Plan](#subscribing-to-a-plan)
6+
- [Single Charges](#single-charges)
67
- [No Card Up Front](#no-card-up-front)
78
- [Swapping Subscriptions](#swapping-subscriptions)
89
- [Subscription Quantity](#subscription-quantity)
@@ -89,6 +90,29 @@ If you would like to specify additional customer details, you may do so by passi
8990

9091
To learn more about the additional fields supported by Stripe, check out Stripe's [documentation on customer creation](https://stripe.com/docs/api#create_customer).
9192

93+
<a name="single-charges"></a>
94+
## Single Charges
95+
96+
If you would like to make a "one off" charge against a subscribed customer's credit card, you may use the `charge` method:
97+
98+
$user->charge(100);
99+
100+
The `charge` method accepts the amount you would like to charge in the lowest denominator of the currency. So, for example, the example above will charge 100 cents, or $1.00, against the user's credit card.
101+
102+
The `charge` method also accepts an array for its second argument, allowing you to pass any options you wish to the underlying Stripe charge creation:
103+
104+
$user->charge(100, [
105+
'source' => $token,
106+
'receipt_email' => $user->email,
107+
]);
108+
109+
The charge method will return `false` if the charge fails. This typically indicates the charge was denied:
110+
111+
if ( ! $user->charge(100))
112+
{
113+
// The charge was denied...
114+
}
115+
92116
<a name="no-card-up-front"></a>
93117
## No Card Up Front
94118

0 commit comments

Comments
 (0)