class Charge extends Resource implements ChargeInterface

To charge a credit or a debit card, you create a Charge object. You can retrieve and refund individual charges as well as list all charges. Charges are identified by a unique, random ID.

Traits

Retrieve.
Update.
List All.

Properties

string $id A unique identifier for the resource. from Resource
protected mixed $response A response from Stripe. from Resource

Methods

string
getId()

Returns the unique identifier for this resource.

from Resource
mixed
getResponse()

Returns the raw Stripe response.

from Resource
void
setProperties()

Set the response data as properties on the class.

from Resource
retrieve(string $id)

Get a resource by the ID.

from Retrieve
update(string $id, array $data)

Update a resource.

from Update
listAll(array $arguments = [])

List all the resources.

from ListAll
create(CustomerInterface $customer, int $amount, array $arguments = [], string $key = null, string $currency = 'usd')

Charge a Customer. A Customer must have some sort of payment source. Usually they payment source is a card, and it is added via a token that is created using JavaScript on the front end. This helps keep your application PCI compliant.

capture(string $id)

Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step payment flow, where first you created a charge with the capture option set to false.

void
stripe(string $method, mixed $arguments, string $idempotencyKey = null)

Call the Stripe API.

Details

in Resource at line 29
string getId()

Returns the unique identifier for this resource.

Return Value

string

in Resource at line 39
mixed getResponse()

Returns the raw Stripe response.

Return Value

mixed

in Resource at line 47
protected void setProperties()

Set the response data as properties on the class.

Return Value

void

in Retrieve at line 17
Retrieve retrieve(string $id)

Get a resource by the ID.

Parameters

string $id

Return Value

Retrieve

in Update at line 18
Update update(string $id, array $data)

Update a resource.

Parameters

string $id
array $data

Return Value

Update

in ListAll at line 21
ListAll listAll(array $arguments = [])

List all the resources.

This will list all of the resources from which this trait belongs to. It will then return itself, so you can method chain it, or reuse the same instantiation.

Parameters

array $arguments

Return Value

ListAll

at line 39
ChargeInterface create(CustomerInterface $customer, int $amount, array $arguments = [], string $key = null, string $currency = 'usd')

Charge a Customer. A Customer must have some sort of payment source. Usually they payment source is a card, and it is added via a token that is created using JavaScript on the front end. This helps keep your application PCI compliant.

Parameters

CustomerInterface $customer
int $amount
array $arguments
string $key
string $currency

Return Value

ChargeInterface

See also

at line 60
ChargeInterface capture(string $id)

Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step payment flow, where first you created a charge with the capture option set to false.

Parameters

string $id

Return Value

ChargeInterface

See also

at line 75
protected void stripe(string $method, mixed $arguments, string $idempotencyKey = null)

Call the Stripe API.

Parameters

string $method
mixed $arguments
string $idempotencyKey

Return Value

void