Payments
Payments represent an attempt to collect payment from a customer. They map one-to-one with transactions on the card network. The payment object can also be used to verify and save a customer’s payment method for future use.
The Payment object
- Name
object
- Type
- "payment",
- Description
- Literal representing the object’s type.
- Name
id
- Type
- string,
- Description
- Unique identifier for the object.
- Name
live
- Type
- boolean,
- Description
- Has the value
true
if the object exists in a production environment or the valuefalse
if the object exists in a sandbox environment.
- Name
created_at
- Type
- integer,
- Description
- Time at which the object was created. Measured in milliseconds since the Unix epoch.
- Name
amount
- Type
- integer,
- Description
- The amount of the payment in cents.
- Name
amount_capturable
- Type
- integer,
- Description
- The amount of the payment that is available to be captured.
- Name
amount_received
- Type
- integer,
- Description
- The amount of the payment that has been received (captured).
- Name
amount_refunded
- Type
- integer,
- Description
- The amount of the payment that has been refunded.
- Name
capture_method
- Type
- enum,
- Description
- When to capture the payment.
- Array item properties
- Name
customer
- Type
- string or Customer or null,
- Description
- Expandable. The customer associated with the payment.
- Name
description
- Type
- string or null,
- Description
- A description of the payment’s purpose.
- Name
dispute
- Type
- string or Dispute or null,
- Description
- Expandable. The dispute associated with the payment.
- Name
metadata
- Type
- object,
- Description
- A key-value store that is attached to the object. Useful for storing miscellaneous structured data for your integration’s internal use.
- Name
payment_error
- Type
- empty object or null,
- Description
- For
failed
payments. Contains information about the failure that occurred. - Child properties
- Name
payment_method
- Type
- string or PaymentMethod,
- Description
- Expandable. The payment method used for the payment.
- Child properties
- Name
session
- Type
- string or CheckoutSession or null,
- Description
- Expandable. The checkout session this payment was created from.
- Name
statement_descriptor
- Type
- string or null,
- Description
- The statement descriptor for the payment.
- Name
status
- Type
- enum,
- Description
- The status of the payment.
- Array item properties
The Payment object
Get a payment
Retrieve a payment by its ID.
Optional parameters
- Name
expand
- Type
- empty object,
- Description
- Optional object that allows you to expand certain ID fields to include related resources.
- Child properties
Returns
Returns the payment object.
Retrieve a payment
Response example
List all payments
Retrieve a paginated list of payments.
Optional parameters
- Name
expand
- Type
- empty object,
- Description
- Optional object that allows you to expand certain ID fields to include related resources.
- Child properties
- Name
ending_before
- Type
- string,
- Description
- A cursor for use in pagination.
ending_before
is an object ID that results will end before. Used to move backward through the list.
- Name
starting_after
- Type
- string,
- Description
- A cursor for use in pagination.
starting_after
is an object ID that results will start after. Used to move forward through the list.
- Name
limit
- Type
- number, at least 1, at most 1000, default is 50
- Description
- Maximum number of objects to return.
- Name
filters
- Type
- ,
- Description
- Filters to apply to the list. Combine multiple conditions with
and
andor
. - Child properties
Returns
Returns a list of payment objects.
List all payments
Response example
Create a payment
Charge a customer’s payment method for the provided amount. Set capture_method
to manual
to preform an authorization without immediately capturing funds.
Required parameters
- Name
amount
- Type
- integer, at least 0,
- Description
- The amount to charge, in USD cents.
- Name
payment_method
- Type
- string or empty object,
- Description
- The payment method to charge. Can be the ID of an existing payment method or an object containing payment method details.
- Child properties
Optional parameters
- Name
capture_method
- Type
- enum, default is automatic
- Description
- When to capture the payment.
- Array item properties
- Name
customer
- Type
- string or null,
- Description
- The customer to associate with the payment.
- Name
description
- Type
- string or null,
- Description
- A description of the payment’s purpose.
- Name
metadata
- Type
- object or null,
- Description
- A key-value store that is attached to the object. Useful for storing miscellaneous structured data for your integration’s internal use.
- Name
statement_descriptor
- Type
- string or null,
- Description
- A statement descriptor for the payment. This property overrides the default descriptor. It must begin with your business name or storefront domain. Include only latin characters, exlcuding
<
,>
,\
,'
,"
,*
.
Returns
Returns the payment object.
Create a payment
Response example
Capture a payment
Capture an existing payment with status requires_capture
. Capturing a payment adds it to the batch for settlement.
You only need to capture a payment separately if you created the it with capture_method
set to manual
.
Returns
Returns the payment object.
Capture a payment
Response example
Update a payment
Update the metadata of a payment.
Optional parameters
- Name
metadata
- Type
- object or null,
Returns
Returns the payment object.