text
stringlengths 129
11.9k
|
---|
'''TokensTokenization is the process Stripe uses to collect sensitive card or bank
account details, or personally identifiable information (PII), directly from
your customers in a secure manner. A token representing this information is
returned to your server to use. You should use our
recommended payments integrations to perform this process
client-side. This ensures that no sensitive card data touches your server,
and allows your integration to operate in a PCI-compliant way.If you cannot use client-side tokenization, you can also create tokens using
the API with either your publishable or secret API key. Keep in mind that if
your integration uses this method, you are responsible for any PCI compliance
that may be required, and you must keep your secret API key safe. Unlike with
client-side tokenization, your customer's information is not sent directly to
Stripe, so we cannot determine how it is handled or stored.Tokens cannot be stored or used more than once. To store card or bank account
information for later use, you can create Customer
objects or Custom accounts. Note that
Radar, our integrated solution for automatic fraud protection,
performs best with integrations that use client-side tokenization.
''''''Endpoints POST /v1/tokens POST /v1/tokens POST /v1/tokens POST /v1/tokens POST /v1/tokens POST /v1/tokens GET /v1/tokens/:id
''' |
'''The token objectAttributes id string Unique identifier for the object.More attributesExpand all object string, value is "token" bank_account hash card hash client_ip string created timestamp livemode boolean type string used boolean
''''''The token object {
"id": "tok_1LSdru2eZvKYlo2C20SinvF6",
"object": "token",
"card": {
"id": "card_1LSdru2eZvKYlo2CdGVYqYZs",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"redaction": null,
"tokenization_method": null
},
"client_ip": null,
"created": 1659518878,
"livemode": false,
"redaction": null,
"type": "card",
"used": false
}
''' |
'''Create a card tokenCreates a single-use token that represents a credit card’s details.
This token can be used in place of a credit card dictionary with any API method.
These tokens can be used only once:
by creating a new Charge object,
or by attaching them to a Customer object.
In most cases, you should use our recommended
payments integrations instead of using the API.Parameters card optional dictionary The card this token will represent. If you also pass in a customer, the card must be the ID of a card belonging to the customer. Otherwise, if you do not pass in a customer, this is a dictionary containing a user's credit card details, with the options described below.Show child parametersMore parametersExpand all customer optional Connect only ReturnsReturns the created card token if successful. Otherwise, this call raises an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Token.create(
card={
"number": "4242424242424242",
"exp_month": 8,
"exp_year": 2023,
"cvc": "314",
},
)
'''Response {
"id": "tok_1LSdru2eZvKYlo2C20SinvF6",
"object": "token",
"card": {
"id": "card_1LSdru2eZvKYlo2CdGVYqYZs",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"redaction": null,
"tokenization_method": null
},
"client_ip": null,
"created": 1659518878,
"livemode": false,
"redaction": null,
"type": "card",
"used": false
}''' |
'''Create a bank account tokenCreates a single-use token that represents a bank account’s details.
This token can be used with any API method in place of a bank account dictionary. This token can be used only once, by attaching it to a Custom account.Parameters bank_account optional The bank account this token will represent.Show child parametersMore parametersExpand all customer optional Connect only ReturnsReturns the created bank account token if successful. Otherwise, this call raises an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Token.create(
bank_account={
"country": "US",
"currency": "usd",
"account_holder_name": "Jenny Rosen",
"account_holder_type": "individual",
"routing_number": "110000000",
"account_number": "000123456789",
},
)
'''Response {
"id": "btok_1LSdru2eZvKYlo2CxKotkHqd",
"object": "token",
"bank_account": {
"id": "ba_1LSdru2eZvKYlo2C1eZb0Ys3",
"object": "bank_account",
"account_holder_name": "Jane Austen",
"account_holder_type": "individual",
"account_type": null,
"bank_name": "STRIPE TEST BANK",
"country": "US",
"currency": "usd",
"fingerprint": "1JWtPxqbdX5Gamtz",
"last4": "6789",
"routing_number": "110000000",
"status": "new"
},
"client_ip": null,
"created": 1659518878,
"livemode": false,
"redaction": null,
"type": "bank_account",
"used": false
}''' |
'''Create a PII tokenCreates a single-use token that represents the details of personally identifiable information (PII).
This token can be used in place of an id_number or id_number_secondary in Account or Person Update API methods.
A PII token can be used only once.Parameters pii required The PII this token will represent.Show child parametersReturnsReturns the created PII token if successful. Otherwise, this call raises an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Token.create(
pii={"id_number": "000000000"},
)
'''Response {
"id": "pii_19yVPm2eZvKYlo2Ch3ixYQCk",
"object": "token",
"client_ip": "104.198.56.199",
"created": 1489796846,
"livemode": false,
"redaction": null,
"type": "pii",
"used": false
}''' |
'''Create an account tokenCreates a single-use token that wraps a user’s legal entity information.
Use this when creating or updating a Connect account.
See the account tokens documentation to learn more.
In live mode, account tokens can only be created with your application’s publishable key.
In test mode, account tokens can be created with your secret key or publishable key.Parameters account required Information for the account this token will represent.Show child parametersReturnsReturns the created account token if successful. Otherwise, this call raises an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Token.create(
account={
"individual": {
"first_name": "Jane",
"last_name": "Doe",
},
"tos_shown_and_accepted": True,
},
)
'''Response {
"id": "ct_1BZ6j62eZvKYlo2CKbM4U8aw",
"object": "token",
"client_ip": "8.21.168.104",
"created": 1513296416,
"livemode": false,
"redaction": null,
"type": "account",
"used": false
}''' |
'''Create a person tokenCreates a single-use token that represents the details for a person.
Use this when creating or updating persons associated with a Connect account.
See the documentation to learn more.
Person tokens may be created only in live mode, with your application’s publishable key.
Your application’s secret key may be used to create person tokens only in test mode.Parameters person required Information for the person this token will represent.Show child parametersReturnsReturns the created person token if successful. Otherwise, this call raises an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Token.create(
person={
"first_name": "Jane",
"last_name": "Doe",
"relationship": {"owner": True},
},
)
'''Response {
"id": "cpt_1EDww82eZvKYlo2CsdelTHFu",
"object": "token",
"client_ip": "8.21.168.117",
"created": 1552582904,
"livemode": false,
"redaction": null,
"type": "person",
"used": false
}''' |
'''Create a CVC update tokenCreates a single-use token that represents an updated CVC value to be used for CVC re-collection.
This token can be used when confirming a card payment
using a saved card on a PaymentIntent with confirmation_method: manual.
For most cases, use our JavaScript library
instead of using the API. For a PaymentIntent with confirmation_method: automatic, use our recommended
payments integration without tokenizing the CVC value.Parameters cvc_update required The updated CVC value this token will represent.Show child parametersReturnsReturns the created CVC update token if successful. Otherwise, this call raises an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Token.create(cvc_update={"cvc": "123"})
'''Response {
"id": "cvctok_1LSdru2eZvKYlo2CXdZXzhJB",
"object": "token",
"client_ip": null,
"created": 1659518878,
"livemode": false,
"redaction": null,
"type": "cvc_update",
"used": false
}''' |
'''Retrieve a tokenRetrieves the token with the given ID.ParametersNo parameters.ReturnsReturns a token if a valid ID was provided. Raises an error otherwise
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Token.retrieve(
"tok_1LSdru2eZvKYlo2C20SinvF6",
)
'''Response {
"id": "tok_1LSdru2eZvKYlo2C20SinvF6",
"object": "token",
"card": {
"id": "card_1LSdru2eZvKYlo2CdGVYqYZs",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"redaction": null,
"tokenization_method": null
},
"client_ip": null,
"created": 1659518878,
"livemode": false,
"redaction": null,
"type": "card",
"used": false
}''' |
'''PaymentMethodsPaymentMethod objects represent your customer's payment instruments.
You can use them with PaymentIntents to collect payments or save them to
Customer objects to store instrument details for future payments.
''''''Endpoints POST /v1/payment_methods GET /v1/payment_methods/:id GET /v1/customers/:customer/payment_methods/:payment_method POST /v1/payment_methods/:id GET /v1/payment_methods GET /v1/customers/:customer/payment_methods POST /v1/payment_methods/:id/attach POST /v1/payment_methods/:id/detach
''' |
'''The PaymentMethod objectAttributes id string Unique identifier for the object. billing_details hash Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.Show child attributes customer string expandable The ID of the Customer to which this PaymentMethod is saved. This will not be set when the PaymentMethod has not been saved to a Customer. metadata hash Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. type enum The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type.Possible enum valuesacss_debit Pre-authorized debit payments are used to debit Canadian bank accounts through the Automated Clearing Settlement System (ACSS).affirm Affirm is a buy now, pay later payment method in the US.afterpay_clearpay Afterpay / Clearpay is a buy now, pay later payment method used in Australia, Canada, France, New Zealand, Spain, the UK, and the US.alipay Alipay is a digital wallet payment method used in China.au_becs_debit BECS Direct Debit is used to debit Australian bank accounts through the Bulk Electronic Clearing System (BECS).bacs_debit Bacs Direct Debit is used to debit UK bank accounts.bancontact Bancontact is a bank redirect payment method used in Belgium.Show 22 moreMore attributesExpand all object string, value is "payment_method" acss_debit hash affirm hash afterpay_clearpay hash alipay hash au_becs_debit hash bacs_debit hash bancontact hash blik hash boleto hash card hash card_present hash created timestamp customer_balance hash preview feature eps hash fpx hash giropay hash grabpay hash ideal hash interac_present hash preview feature klarna hash konbini hash link hash livemode boolean oxxo hash p24 hash paynow hash promptpay hash radar_options hash sepa_debit hash sofort hash us_bank_account hash wechat_pay hash
''''''The PaymentMethod object {
"id": "pm_1LSdci2eZvKYlo2CH68OnHFJ",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": "BE",
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": "[email protected]",
"name": null,
"phone": "+15555555555"
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "pass"
},
"country": "US",
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 123456789,
"customer": null,
"livemode": false,
"metadata": {
"order_id": "123456789"
},
"redaction": null,
"type": "card"
}
''' |
'''Create a PaymentMethodCreates a PaymentMethod object. Read the Stripe.js reference to learn how to create PaymentMethods via Stripe.js.
Instead of creating a PaymentMethod directly, we recommend using the PaymentIntents API to accept a payment immediately or the SetupIntent API to collect payment method details ahead of a future payment.Parameters type required The type of the PaymentMethod.
An additional hash is included on the PaymentMethod with a name matching this value.
It contains additional information specific to the PaymentMethod type.
Required unless payment_method is specified (see the Cloning PaymentMethods guide).Possible enum valuesacss_debit Pre-authorized debit payments are used to debit Canadian bank accounts through the Automated Clearing Settlement System (ACSS).affirm Affirm is a buy now, pay later payment method in the US.afterpay_clearpay Afterpay / Clearpay is a buy now, pay later payment method used in Australia, Canada, France, New Zealand, Spain, the UK, and the US.alipay Alipay is a digital wallet payment method used in China.au_becs_debit BECS Direct Debit is used to debit Australian bank accounts through the Bulk Electronic Clearing System (BECS).bacs_debit Bacs Direct Debit is used to debit UK bank accounts.bancontact Bancontact is a bank redirect payment method used in Belgium.Show 20 more billing_details optional dictionary Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.Show child parameters metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.More parametersExpand all acss_debit optional dictionary affirm optional dictionary afterpay_clearpay optional dictionary alipay optional dictionary au_becs_debit optional dictionary bacs_debit optional dictionary bancontact optional dictionary blik optional dictionary boleto optional dictionary card optional dictionary customer_balance optional dictionary preview feature eps optional dictionary fpx optional dictionary giropay optional dictionary grabpay optional dictionary ideal optional dictionary interac_present optional dictionary preview feature klarna optional dictionary konbini optional dictionary link optional dictionary oxxo optional dictionary p24 optional dictionary paynow optional dictionary promptpay optional dictionary radar_options optional dictionary sepa_debit optional dictionary sofort optional dictionary us_bank_account optional dictionary wechat_pay optional dictionary ReturnsReturns a PaymentMethod object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.PaymentMethod.create(
type="card",
card={
"number": "4242424242424242",
"exp_month": 8,
"exp_year": 2023,
"cvc": "314",
},
)
'''Response {
"id": "pm_1LSYy32eZvKYlo2CoClVP3wb",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1659500040,
"customer": null,
"livemode": false,
"metadata": {},
"redaction": null,
"type": "card"
}''' |
'''Retrieve a PaymentMethodRetrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method attached to a Customer, you should use Retrieve a Customer’s PaymentMethodsParametersNo parameters.ReturnsReturns a PaymentMethod object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.PaymentMethod.retrieve(
"pm_1LSYy32eZvKYlo2CoClVP3wb",
)
'''Response {
"id": "pm_1LSYy32eZvKYlo2CoClVP3wb",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1659500040,
"customer": "cus_8TEMHVY5moxIPI",
"livemode": false,
"metadata": {},
"redaction": null,
"type": "card"
}''' |
'''Retrieve a Customer's PaymentMethodRetrieves a PaymentMethod object for a given Customer.ParametersNo parameters.ReturnsReturns a PaymentMethod object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.list_payment_methods(
"cus_8TEMHVY5moxIPI",
type="card",
)
'''Response {
"object": "list",
"url": "/v1/customers/cus_8TEMHVY5moxIPI/payment_methods",
"has_more": false,
"data": [
{
"id": "pm_1LSYy32eZvKYlo2CoClVP3wb",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1659500040,
"customer": null,
"livemode": false,
"metadata": {},
"redaction": null,
"type": "card"
},
{...},
{...}
]
}''' |
'''Update a PaymentMethodUpdates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated.Parameters billing_details optional dictionary Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.Show child parameters metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.More parametersExpand all card optional dictionary link optional dictionary us_bank_account optional dictionary ReturnsReturns a PaymentMethod object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.PaymentMethod.modify(
"pm_1LSYy32eZvKYlo2CoClVP3wb",
metadata={"order_id": "6735"},
)
'''Response {
"id": "pm_1LSYy32eZvKYlo2CoClVP3wb",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1659500040,
"customer": "cus_8TEMHVY5moxIPI",
"livemode": false,
"metadata": {
"order_id": "6735"
},
"redaction": null,
"type": "card"
}''' |
'''List PaymentMethodsReturns a list of PaymentMethods attached to the StripeAccount. For listing a customer’s payment methods, you should use List a Customer’s PaymentMethodsParameters type required A required filter on the list, based on the object type field.Possible enum valuesacss_debit affirm afterpay_clearpay alipay au_becs_debit bacs_debit bancontact Show 20 moreMore parametersExpand all customer optional ending_before optional limit optional starting_after optional ReturnsA dictionary with a data property that contains an array of up to limit PaymentMethods of type type, starting after PaymentMethods starting_after. Each entry in the array is a separate PaymentMethod object. If no more PaymentMethods are available, the resulting array will be empty. This request should never raise an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.PaymentMethod.list(
customer="cus_8TEMHVY5moxIPI",
type="card",
)
'''Response {
"object": "list",
"url": "/v1/payment_methods",
"has_more": false,
"data": [
{
"id": "pm_1LSYy32eZvKYlo2CoClVP3wb",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1659500040,
"customer": null,
"livemode": false,
"metadata": {},
"redaction": null,
"type": "card"
},
{...},
{...}
]
}''' |
'''List a Customer's PaymentMethodsReturns a list of PaymentMethods for a given CustomerParameters type required A required filter on the list, based on the object type field.Possible enum valuesacss_debit affirm afterpay_clearpay alipay au_becs_debit bacs_debit bancontact Show 20 moreMore parametersExpand all ending_before optional limit optional starting_after optional ReturnsA dictionary with a data property that contains an array of up to limit PaymentMethods of type type, starting after PaymentMethods starting_after. Each entry in the array is a separate PaymentMethod object. If no more PaymentMethods are available, the resulting array will be empty. This request should never raise an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.list_payment_methods(
"cus_8TEMHVY5moxIPI",
type="card",
)
'''Response {
"object": "list",
"url": "/v1/customers/cus_8TEMHVY5moxIPI/payment_methods",
"has_more": false,
"data": [
{
"id": "pm_1LSYy32eZvKYlo2CoClVP3wb",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1659500040,
"customer": null,
"livemode": false,
"metadata": {},
"redaction": null,
"type": "card"
},
{...},
{...}
]
}''' |
'''Attach a PaymentMethod to a CustomerAttaches a PaymentMethod object to a Customer.
To attach a new PaymentMethod to a customer for future payments, we recommend you use a SetupIntent
or a PaymentIntent with setup_future_usage.
These approaches will perform any necessary steps to set up the PaymentMethod for future payments. Using the /v1/payment_methods/:id/attach
endpoint without first using a SetupIntent or PaymentIntent with setup_future_usage does not optimize the PaymentMethod for
future use, which makes later declines and payment friction more likely.
See Optimizing cards for future payments for more information about setting up
future payments.
To use this PaymentMethod as the default for invoice or subscription payments,
set invoice_settings.default_payment_method,
on the Customer to the PaymentMethod’s ID.Parameters customer required The ID of the customer to which to attach the PaymentMethod.ReturnsReturns a PaymentMethod object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.PaymentMethod.attach(
"pm_1LSdci2eZvKYlo2CH68OnHFJ",
customer="cus_8TEMHVY5moxIPI",
)
'''Response {
"id": "pm_1LSYy32eZvKYlo2CoClVP3wb",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1659500040,
"customer": "cus_8TEMHVY5moxIPI",
"livemode": false,
"metadata": {},
"redaction": null,
"type": "card"
}''' |
'''Detach a PaymentMethod from a CustomerDetaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer.ParametersNo parameters.ReturnsReturns a PaymentMethod object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.PaymentMethod.detach(
"pm_1LSdci2eZvKYlo2CH68OnHFJ",
)
'''Response {
"id": "pm_1LSYy32eZvKYlo2CoClVP3wb",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1659500040,
"customer": null,
"livemode": false,
"metadata": {},
"redaction": null,
"type": "card"
}''' |
'''Bank AccountsThese bank accounts are payment methods on Customer objects.On the other hand External Accounts are transfer
destinations on Account objects for Custom accounts.
They can be bank accounts or debit cards as well, and are documented in the links above.
''''''Endpoints POST /v1/customers/:id/sources GET /v1/customers/:id/sources/:id POST /v1/customers/:id/sources/:id POST /v1/customers/:id/sources/:id/verifyDELETE /v1/customers/:id/sources/:id GET /v1/customers/:id/sources?object=bank_account
''' |
'''The bank account objectAttributes id string Unique identifier for the object. account_holder_name string The name of the person or business that owns the bank account. account_holder_type string The type of entity that holds the account. This can be either individual or company. bank_name string Name of the bank associated with the routing number (e.g., WELLS FARGO). country string Two-letter ISO code representing the country the bank account is located in. currency currency Three-letter ISO code for the currency paid out to the bank account. customer string expandable The ID of the customer that the bank account is associated with. fingerprint string Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. last4 string The last four digits of the bank account number. metadata hash Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. routing_number string The routing transit number for the bank account.More attributesExpand all object string, value is "bank_account" account string expandable account_type string available_payout_methods array status string
''''''The bank account object {
"id": "ba_1LSdvK2eZvKYlo2C8WPIzm4k",
"object": "bank_account",
"account_holder_name": "Jane Austen",
"account_holder_type": "company",
"account_type": null,
"bank_name": "STRIPE TEST BANK",
"country": "US",
"currency": "usd",
"customer": null,
"fingerprint": "1JWtPxqbdX5Gamtc",
"last4": "6789",
"metadata": {},
"routing_number": "110000000",
"status": "new"
}
''' |
'''Create a bank accountWhen you create a new bank account, you must specify a Customer object on which to create it.Parameters source required Either a token, like the ones returned by Stripe.js, or a dictionary containing a user’s bank account details (with the options shown below).Show child parameters metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.ReturnsReturns the bank account object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.create_source(
"cus_8TEMHVY5moxIPI",
source="btok_1LSdvL2eZvKYlo2CdRk2u2Dc",
)
'''Response {
"id": "ba_1LSdvK2eZvKYlo2C8WPIzm4k",
"object": "bank_account",
"account_holder_name": "Jane Austen",
"account_holder_type": "company",
"account_type": null,
"bank_name": "STRIPE TEST BANK",
"country": "US",
"currency": "usd",
"customer": "cus_8TEMHVY5moxIPI",
"fingerprint": "1JWtPxqbdX5Gamtc",
"last4": "6789",
"metadata": {},
"routing_number": "110000000",
"status": "new"
}''' |
'''Retrieve a bank accountBy default, you can see the 10 most recent sources stored on a Customer directly on the object, but you can also retrieve details about a specific bank account stored on the Stripe account.ParametersNo parameters.ReturnsReturns the bank account object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.retrieve_source(
"cus_8TEMHVY5moxIPI",
"ba_1LSdvK2eZvKYlo2C8WPIzm4k",
)
'''Response {
"id": "ba_1LSdvK2eZvKYlo2C8WPIzm4k",
"object": "bank_account",
"account_holder_name": "Jane Austen",
"account_holder_type": "company",
"account_type": null,
"bank_name": "STRIPE TEST BANK",
"country": "US",
"currency": "usd",
"customer": "cus_8TEMHVY5moxIPI",
"fingerprint": "1JWtPxqbdX5Gamtc",
"last4": "6789",
"metadata": {},
"routing_number": "110000000",
"status": "new"
}''' |
'''Update a bank accountUpdates the account_holder_name, account_holder_type, and metadata of a bank account belonging to a customer. Other bank account details are not editable, by design.Parameters account_holder_name optional The name of the person or business that owns the bank account. account_holder_type optional The type of entity that holds the account. This can be either individual or company. metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.ReturnsReturns the bank account object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.modify_source(
"cus_8TEMHVY5moxIPI",
"ba_1LSdvK2eZvKYlo2C8WPIzm4k",
metadata={"order_id": "6735"},
)
'''Response {
"id": "ba_1LSdvK2eZvKYlo2C8WPIzm4k",
"object": "bank_account",
"account_holder_name": "Jane Austen",
"account_holder_type": "company",
"account_type": null,
"bank_name": "STRIPE TEST BANK",
"country": "US",
"currency": "usd",
"customer": "cus_8TEMHVY5moxIPI",
"fingerprint": "1JWtPxqbdX5Gamtc",
"last4": "6789",
"metadata": {
"order_id": "6735"
},
"routing_number": "110000000",
"status": "new"
}''' |
'''Verify a bank accountA customer's bank account must first be verified before it can be charged. Stripe supports instant verification using Plaid for many of the most popular banks. If your customer's bank is not supported or you do not wish to integrate with Plaid, you must manually verify the customer's bank account using the API.Parameters amounts optional Two positive integers, in cents, equal to the values of the microdeposits sent to the bank account.ReturnsReturns the bank account object with a status of verified
'''import stripe
stripe.api_key = "sk_test_your_key"
bank_account = stripe.Customer.retrieve_source(
'cus_8TEMHVY5moxIPI',
'ba_1LSdvK2eZvKYlo2C8WPIzm4k'
)
bank_account.verify(amounts = [32,45])
'''Response {
"id": "ba_1LSdvK2eZvKYlo2C8WPIzm4k",
"object": "bank_account",
"account_holder_name": "Jane Austen",
"account_holder_type": "company",
"account_type": null,
"bank_name": "STRIPE TEST BANK",
"country": "US",
"currency": "usd",
"customer": "cus_8TEMHVY5moxIPI",
"fingerprint": "1JWtPxqbdX5Gamtc",
"last4": "6789",
"metadata": {},
"routing_number": "110000000",
"status": "new",
"name": "Jenny Rosen"
}''' |
'''Delete a bank accountYou can delete bank accounts from a Customer.ParametersNo parameters.ReturnsReturns the deleted bank account object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.delete_source(
"cus_8TEMHVY5moxIPI",
"ba_1LSdvK2eZvKYlo2C8WPIzm4k",
)
'''Response {
"id": "ba_1LSdvK2eZvKYlo2C8WPIzm4k",
"object": "bank_account",
"deleted": true
}''' |
'''List all bank accountsYou can see a list of the bank accounts belonging to a Customer. Note that the 10 most recent sources are always available by default on the Customer. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional bank accounts.ParametersExpand all ending_before optional limit optional starting_after optional ReturnsReturns a list of the bank accounts stored on the customer
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.list_sources(
"cus_8TEMHVY5moxIPI",
object="bank_account",
limit=3,
)
'''Response {
"object": "list",
"url": "/v1/customers/cus_8TEMHVY5moxIPI/sources",
"has_more": false,
"data": [
{
"id": "ba_1LSdvK2eZvKYlo2C8WPIzm4k",
"object": "bank_account",
"account_holder_name": "Jane Austen",
"account_holder_type": "company",
"account_type": null,
"bank_name": "STRIPE TEST BANK",
"country": "US",
"currency": "usd",
"customer": "cus_8TEMHVY5moxIPI",
"fingerprint": "1JWtPxqbdX5Gamtc",
"last4": "6789",
"metadata": {},
"routing_number": "110000000",
"status": "new"
},
{...},
{...}
]
}''' |
'''Cash balanceA customer's Cash balance represents real funds. Customers can add funds to their cash balance by sending a bank transfer. These funds can be used for payment and can eventually be paid out to your bank account
''''''Endpoints GET /v1/customers/:id/cash_balance POST /v1/customers/:id/cash_balance GET /v1/customers/:id/cash_balance_transactions/:id GET /v1/customers/:id/cash_balance_transactions
''' |
'''The cash balance objectAttributes object string, value is "cash_balance" String representing the object’s type. Objects of the same type share the same value. available hash A hash of all cash balances available to this customer. You cannot delete a customer with any cash balances, even if the balance is 0. Amounts are represented in the smallest currency unit. customer string The ID of the customer whose cash balance this object represents. livemode boolean Has the value true if the object exists in live mode or the value false if the object exists in test mode. settings hash A hash of settings for this cash balance.Show child attribute
''''''The cash balance object {
"object": "cash_balance",
"available": {
"eur": 10000
},
"customer": "cus_8TEMHVY5moxIPI",
"livemode": false,
"settings": {
"reconciliation_mode": "automatic"
}
}
''' |
'''Retrieve a cash balancePreview featureRetrieves a customer’s cash balance.ParametersNo parameters.ReturnsThe Cash Balance object for a given customer
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.retrieve_cash_balance(
"cus_8TEMHVY5moxIPI",
)
'''Response {
"object": "cash_balance",
"available": {
"eur": 10000
},
"customer": "cus_8TEMHVY5moxIPI",
"livemode": false,
"settings": {
"reconciliation_mode": "automatic"
}
}''' |
'''Update a cash balance's settingsPreview featureChanges the settings on a customer’s cash balance.Parameters settings optional dictionary A hash of settings for this cash balance.Show child parametersReturnsThe customer’s cash balance, with the updated settings
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.modify_cash_balance(
"cus_8TEMHVY5moxIPI",
settings={"reconciliation_mode": "manual"},
)
'''Response {
"object": "cash_balance",
"available": {
"eur": 10000
},
"customer": "cus_8TEMHVY5moxIPI",
"livemode": false,
"settings": {
"reconciliation_mode": "manual"
}
}''' |
'''The cash balance transaction objectAttributes id string Unique identifier for the object. object string, value is "customer_cash_balance_transaction" String representing the object’s type. Objects of the same type share the same value. applied_to_payment hash If this is a type=applied_to_payment transaction, contains information about how funds were applied.Show child attributes created timestamp Time at which the object was created. Measured in seconds since the Unix epoch. currency string Three-letter ISO currency code, in lowercase. Must be a supported currency. customer string expandable The customer whose available cash balance changed as a result of this transaction. ending_balance integer The total available cash balance for the specified currency after this transaction was applied. Represented in the smallest currency unit. funded hash If this is a type=funded transaction, contains information about the funding.Show child attributes livemode boolean Has the value true if the object exists in live mode or the value false if the object exists in test mode. net_amount integer The amount by which the cash balance changed, represented in the smallest currency unit. A positive value represents funds being added to the cash balance, a negative value represents funds being removed from the cash balance. refunded_from_payment hash If this is a type=refunded_from_payment transaction, contains information about the source of the refund.Show child attributes type string The type of the cash balance transaction. One of applied_to_payment, unapplied_from_payment, refunded_from_payment, funded, return_initiated, or return_canceled. New types may be added in future. See Customer Balance to learn more about these types. unapplied_from_payment hash If this is a type=unapplied_from_payment transaction, contains information about how funds were unapplied.Show child attribute
''''''The cash balance transaction object {
"id": "ccsbtxn_1LSdvL2eZvKYlo2CmIIb3s9A",
"object": "customer_cash_balance_transaction",
"created": 1659519091,
"currency": "eur",
"customer": "cus_8TEMHVY5moxIPI",
"ending_balance": 10000,
"funded": {
"bank_transfer": {
"eu_bank_transfer": {
"bic": "BANKDEAAXXX",
"iban_last4": "7089",
"sender_name": "Sample Business GmbH"
},
"reference": "Payment for Invoice F899D8E-155",
"type": "eu_bank_transfer"
}
},
"livemode": false,
"net_amount": 5000,
"type": "funded"
}
''' |
'''Retrieve a cash balance transactionPreview featureRetrieves a specific cash balance transaction, which updated the customer’s cash balance.ParametersNo parameters.ReturnsReturns a cash balance transaction object if a valid identifier was provided
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.retrieve_cash_balance_transaction(
"cus_8TEMHVY5moxIPI",
"ccsbtxn_1LSdvL2eZvKYlo2CmIIb3s9A",
)
'''Response {
"id": "ccsbtxn_1LSdvL2eZvKYlo2CmIIb3s9A",
"object": "customer_cash_balance_transaction",
"created": 1659519091,
"currency": "eur",
"customer": "cus_8TEMHVY5moxIPI",
"ending_balance": 10000,
"funded": {
"bank_transfer": {
"eu_bank_transfer": {
"bic": "BANKDEAAXXX",
"iban_last4": "7089",
"sender_name": "Sample Business GmbH"
},
"reference": "Payment for Invoice F899D8E-155",
"type": "eu_bank_transfer"
}
},
"livemode": false,
"net_amount": 5000,
"type": "funded"
}''' |
'''List cash balance transactionsPreview featureReturns a list of transactions that modified the customer’s cash balance.ParametersExpand all ending_before optional limit optional starting_after optional ReturnsA dictionary with a data property that contains an array of up to limit cash balance transactions, starting after item starting_after. Each entry in the array is a separate cash balance transaction object. If no more items are available, the resulting array will be empty. This request should never raise an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.list_cash_balance_transactions(
"cus_8TEMHVY5moxIPI",
limit=3,
)
'''Response {
"object": "list",
"url": "/v1/customers/cus_8TEMHVY5moxIPI/customer_cash_balance_transactions",
"has_more": false,
"data": [
{
"id": "ccsbtxn_1LSdvL2eZvKYlo2CmIIb3s9A",
"object": "customer_cash_balance_transaction",
"created": 1659519091,
"currency": "eur",
"customer": "cus_8TEMHVY5moxIPI",
"ending_balance": 10000,
"funded": {
"bank_transfer": {
"eu_bank_transfer": {
"bic": "BANKDEAAXXX",
"iban_last4": "7089",
"sender_name": "Sample Business GmbH"
},
"reference": "Payment for Invoice F899D8E-155",
"type": "eu_bank_transfer"
}
},
"livemode": false,
"net_amount": 5000,
"type": "funded"
},
{...},
{...}
]
}''' |
'''CardsYou can store multiple cards on a customer in order to charge the customer
later. You can also store multiple debit cards on a recipient in order to
transfer to those cards later.
''''''Endpoints POST /v1/customers/:id/sources GET /v1/customers/:id/sources/:id POST /v1/customers/:id/sources/:idDELETE /v1/customers/:id/sources/:id GET /v1/customers/:id/sources?object=card
''' |
'''The card objectAttributes id string Unique identifier for the object. address_city string City/District/Suburb/Town/Village. address_country string Billing address country, if provided when creating card. address_line1 string Address line 1 (Street address/PO Box/Company name). address_line2 string Address line 2 (Apartment/Suite/Unit/Building). address_state string State/County/Province/Region. address_zip string ZIP or postal code. address_zip_check string If address_zip was provided, results of the check: pass, fail, unavailable, or unchecked. brand string Card brand. Can be American Express, Diners Club, Discover, JCB, MasterCard, UnionPay, Visa, or Unknown. country string Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you’ve collected. customer string expandable The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead. cvc_check string If a CVC was provided, results of the check: pass, fail, unavailable, or unchecked. A result of unchecked indicates that CVC was provided but hasn’t been checked yet. Checks are typically performed when attaching a card to a Customer object, or when creating a charge. For more details, see Check if a card is valid without a charge. exp_month integer Two-digit number representing the card’s expiration month. exp_year integer Four-digit number representing the card’s expiration year. fingerprint string Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number.
Starting May 1, 2021, card fingerprint in India for Connect will change to allow two fingerprints for the same card — one for India and one for the rest of the world. funding string Card funding type. Can be credit, debit, prepaid, or unknown. last4 string The last four digits of the card. metadata hash Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. name string Cardholder name.More attributesExpand all object string, value is "card" account string expandable custom Connect only address_line1_check string available_payout_methods array currency currency custom Connect only dynamic_last4 string recipient string expandable tokenization_method string
''''''The card object {
"id": "card_1LSdvI2eZvKYlo2CS9wK7l0M",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"customer": null,
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"redaction": null,
"tokenization_method": null
}
''' |
'''Create a cardWhen you create a new credit card, you must specify a customer or recipient on which to create it.
If the card’s owner has no default card, then the new card will become the default.
However, if the owner already has a default, then it will not change.
To change the default, you should update the customer to have a new default_source.Parameters source required A token, like the ones returned by Stripe.js. Stripe will automatically validate the card.Show child parameters metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.ReturnsReturns the Card object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.create_source(
"cus_8TEMHVY5moxIPI",
source="tok_amex",
)
'''Response {
"id": "card_1LSdvI2eZvKYlo2CS9wK7l0M",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"customer": "cus_8TEMHVY5moxIPI",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"redaction": null,
"tokenization_method": null
}''' |
'''Retrieve a cardYou can always see the 10 most recent cards directly on a customer; this method lets you retrieve details about a specific card stored on the customer.ParametersNo parameters.ReturnsReturns the Card object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.retrieve_source(
"cus_8TEMHVY5moxIPI",
"card_1LSdvI2eZvKYlo2CS9wK7l0M",
)
'''Response {
"id": "card_1LSdvI2eZvKYlo2CS9wK7l0M",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"customer": "cus_8TEMHVY5moxIPI",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"redaction": null,
"tokenization_method": null
}''' |
'''Update a card If you need to update only some card details, like the billing address or expiration date, you can do so without having to re-enter the full card details. Also, Stripe works directly with card networks so that your customers can continue using your service without interruption.
When you update a card, Stripe typically validates the card automatically. For more details, see Check if a card is valid without a charge.
Parameters address_city optional City/District/Suburb/Town/Village. address_country optional Billing address country, if provided when creating card. address_line1 optional Address line 1 (Street address/PO Box/Company name). address_line2 optional Address line 2 (Apartment/Suite/Unit/Building). address_state optional State/County/Province/Region. address_zip optional ZIP or postal code. exp_month optional Two digit number representing the card’s expiration month. exp_year optional Four digit number representing the card’s expiration year. metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata. name optional Cardholder name.ReturnsReturns the Card object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.modify_source(
"cus_8TEMHVY5moxIPI",
"card_1LSdvI2eZvKYlo2CS9wK7l0M",
name="Jenny Rosen",
)
'''Response {
"id": "card_1LSdvI2eZvKYlo2CS9wK7l0M",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"customer": "cus_8TEMHVY5moxIPI",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": "Jenny Rosen",
"redaction": null,
"tokenization_method": null
}''' |
'''Delete a card You can delete cards from a customer.
If you delete a card that is currently the default source, then the most
recently added source will become the new default. If you delete a card that is the last
remaining source on the customer, then the default_source attribute will become null.
For recipients: if you delete the default card, then the most recently added card will become the new default. If you delete the last remaining card on a recipient, then the
default_card attribute will become null.
Note that for cards belonging to customers, you might want to prevent customers on paid subscriptions from deleting all cards on file, so that there is at least one default card for the next invoice payment attempt.
ParametersNo parameters.ReturnsReturns the deleted Card object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.delete_source(
"cus_8TEMHVY5moxIPI",
"card_1LSdvI2eZvKYlo2CS9wK7l0M",
)
'''Response {
"id": "card_1LSdvI2eZvKYlo2CS9wK7l0M",
"object": "card",
"deleted": true
}''' |
'''List all cardsYou can see a list of the cards belonging to a customer.
Note that the 10 most recent sources are always available on the Customer object.
If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional cards.ParametersExpand all ending_before optional limit optional starting_after optional ReturnsReturns a list of the cards stored on the customer
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.list_sources(
"cus_8TEMHVY5moxIPI",
object="card",
limit=3,
)
'''Response {
"object": "list",
"url": "/v1/customers/cus_8TEMHVY5moxIPI/sources",
"has_more": false,
"data": [
{
"id": "card_1LSdvI2eZvKYlo2CS9wK7l0M",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"customer": "cus_8TEMHVY5moxIPI",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2023,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"redaction": null,
"tokenization_method": null
},
{...},
{...}
]
}''' |
'''SourcesSource objects allow you to accept a variety of payment methods. They
represent a customer's payment instrument, and can be used with the Stripe API
just like a Card object: once chargeable, they can be charged, or can be
attached to customers.
''''''Endpoints POST /v1/sources GET /v1/sources/:id POST /v1/sources/:id POST /v1/customers/:id/sourcesDELETE /v1/customers/:id/sources/:id
''' |
'''The source objectAttributes id string Unique identifier for the object. amount integer A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount associated with the source. This is the amount for which the source will be chargeable once ready. Required for single_use sources. currency currency Three-letter ISO code for the currency associated with the source. This is the currency for which the source will be chargeable once ready. Required for single_use sources. customer string The ID of the customer to which this source is attached. This will not be present when the source has not been attached to a customer. metadata hash Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. owner hash Information about the owner of the payment instrument that may be used or required by particular source types.Show child attributes redirect hash Information related to the redirect flow. Present if the source is authenticated by a redirect (flow is redirect).Show child attributes statement_descriptor string Extra information about a source. This will appear on your customer’s statement every time you charge the source. status string The status of the source, one of canceled, chargeable, consumed, failed, or pending. Only chargeable sources can be used to create a charge. type string The type of the source. The type is a payment method, one of ach_credit_transfer, ach_debit, alipay, bancontact, card, card_present, eps, giropay, ideal, multibanco, klarna, p24, sepa_debit, sofort, three_d_secure, or wechat. An additional hash is included on the source with a name matching this value. It contains additional information specific to the payment method used.More attributesExpand all object string, value is "source" client_secret string code_verification hash created timestamp flow string livemode boolean receiver hash source_order hash usage string
''''''The source object {
"id": "src_1LSdsx2eZvKYlo2CynOAUbXz",
"object": "source",
"ach_credit_transfer": {
"account_number": "test_52796e3294dc",
"routing_number": "110000000",
"fingerprint": "ecpwEzmBOSMOqQTL",
"bank_name": "TEST BANK",
"swift_code": "TSTEZ122"
},
"amount": null,
"client_secret": "src_client_secret_6jh1NqD1xGAI0sVLZcI5kKWy",
"created": 1659518943,
"currency": "usd",
"flow": "receiver",
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": "[email protected]",
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "121042882-38381234567890123",
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"refund_attributes_method": "email",
"refund_attributes_status": "missing"
},
"redaction": null,
"statement_descriptor": null,
"status": "pending",
"type": "ach_credit_transfer",
"usage": "reusable"
}
''' |
'''Create a sourceCreates a new source object.Parameters type required The type of the source to create. Required unless customer and original_source are specified (see the Cloning card Sources guide) amount optional Amount associated with the source. This is the amount for which the source will be chargeable once ready. Required for single_use sources. Not supported for receiver type sources, where charge amount may not be specified until funds land. currency optional Three-letter ISO code for the currency associated with the source. This is the currency for which the source will be chargeable once ready. metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata. owner optional dictionary Information about the owner of the payment instrument that may be used or required by particular source types.Show child parameters redirect optional dictionary Parameters required for the redirect flow. Required if the source is authenticated by a redirect (flow is redirect).Show child parameters statement_descriptor optional An arbitrary string to be displayed on your customer’s statement. As an example, if your website is RunClub and the item you’re charging for is a race ticket, you may want to specify a statement_descriptor of RunClub 5K race ticket. While many payment types will display this information, some may not display it at all.More parametersExpand all flow optional mandate optional dictionary receiver optional dictionary source_order optional dictionary token optional usage optional ReturnsReturns a newly created source
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Source.create(
type='ach_credit_transfer',
currency='usd',
owner={
'email': '[email protected]'
}
)
'''Response {
"id": "src_1LSdsx2eZvKYlo2CynOAUbXz",
"object": "source",
"ach_credit_transfer": {
"account_number": "test_52796e3294dc",
"routing_number": "110000000",
"fingerprint": "ecpwEzmBOSMOqQTL",
"bank_name": "TEST BANK",
"swift_code": "TSTEZ122"
},
"amount": null,
"client_secret": "src_client_secret_6jh1NqD1xGAI0sVLZcI5kKWy",
"created": 1659518943,
"currency": "usd",
"flow": "receiver",
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": "[email protected]",
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "121042882-38381234567890123",
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"refund_attributes_method": "email",
"refund_attributes_status": "missing"
},
"redaction": null,
"statement_descriptor": null,
"status": "pending",
"type": "ach_credit_transfer",
"usage": "reusable"
}''' |
'''Retrieve a sourceRetrieves an existing source object. Supply the unique source ID from a source creation request and Stripe will return the corresponding up-to-date source object information.ParametersExpand all client_secret optional ReturnsReturns a source if a valid identifier was provided
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Source.retrieve(
"src_1LSdsx2eZvKYlo2CynOAUbXz",
)
'''Response {
"id": "src_1LSdsx2eZvKYlo2CynOAUbXz",
"object": "source",
"ach_credit_transfer": {
"account_number": "test_52796e3294dc",
"routing_number": "110000000",
"fingerprint": "ecpwEzmBOSMOqQTL",
"bank_name": "TEST BANK",
"swift_code": "TSTEZ122"
},
"amount": null,
"client_secret": "src_client_secret_6jh1NqD1xGAI0sVLZcI5kKWy",
"created": 1659518943,
"currency": "usd",
"flow": "receiver",
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": "[email protected]",
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "121042882-38381234567890123",
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"refund_attributes_method": "email",
"refund_attributes_status": "missing"
},
"redaction": null,
"statement_descriptor": null,
"status": "pending",
"type": "ach_credit_transfer",
"usage": "reusable"
}''' |
'''Update a sourceUpdates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our payment method guides for more detail.Parameters amount optional Amount associated with the source. metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata. owner optional dictionary Information about the owner of the payment instrument that may be used or required by particular source types.Show child parametersMore parametersExpand all mandate optional dictionary source_order optional dictionary ReturnsReturns the source object if the update succeeded. This call will raise an error if update parameters are invalid
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Source.modify(
"src_1LSdsx2eZvKYlo2CynOAUbXz",
metadata={"order_id": "6735"},
)
'''Response {
"id": "src_1LSdsx2eZvKYlo2CynOAUbXz",
"object": "source",
"ach_credit_transfer": {
"account_number": "test_52796e3294dc",
"routing_number": "110000000",
"fingerprint": "ecpwEzmBOSMOqQTL",
"bank_name": "TEST BANK",
"swift_code": "TSTEZ122"
},
"amount": null,
"client_secret": "src_client_secret_6jh1NqD1xGAI0sVLZcI5kKWy",
"created": 1659518943,
"currency": "usd",
"flow": "receiver",
"livemode": false,
"metadata": {
"order_id": "6735"
},
"owner": {
"address": null,
"email": "[email protected]",
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "121042882-38381234567890123",
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"refund_attributes_method": "email",
"refund_attributes_status": "missing"
},
"redaction": null,
"statement_descriptor": null,
"status": "pending",
"type": "ach_credit_transfer",
"usage": "reusable"
}''' |
'''Attach a sourceAttaches a Source object to a Customer. The source must be in a chargeable or pending state.Parameters source required The identifier of the source to be attached.ReturnsReturns the attached Source object
'''import stripe
stripe.api_key = "sk_test_your_key"
source = stripe.Customer.create_source(
'cus_8TEMHVY5moxIPI',
source='src_1LSdsx2eZvKYlo2CynOAUbXz'
)
'''Response {
"id": "src_1LSdsx2eZvKYlo2CynOAUbXz",
"object": "source",
"ach_credit_transfer": {
"account_number": "test_52796e3294dc",
"routing_number": "110000000",
"fingerprint": "ecpwEzmBOSMOqQTL",
"bank_name": "TEST BANK",
"swift_code": "TSTEZ122"
},
"amount": 1000,
"client_secret": "src_client_secret_6jh1NqD1xGAI0sVLZcI5kKWy",
"created": 1659518943,
"currency": "usd",
"flow": "receiver",
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": "[email protected]",
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "121042882-38381234567890123",
"amount_received": 1000,
"amount_charged": 0,
"amount_returned": 0,
"refund_attributes_status": "missing",
"refund_attributes_method": "email"
},
"redaction": null,
"statement_descriptor": null,
"status": "chargeable",
"type": "ach_credit_transfer",
"usage": "reusable",
"customer": "cus_8TEMHVY5moxIPI"
}''' |
'''Detach a sourceDetaches a Source object from a Customer. The status of a source is changed to consumed when it is detached and it can no longer be used to create a charge.ParametersNo parameters.ReturnsReturns the detached Source object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.delete_source(
'cus_8TEMHVY5moxIPI',
'src_1LSdsx2eZvKYlo2CynOAUbXz'
)
'''Response {
"id": "src_1LSdsx2eZvKYlo2CynOAUbXz",
"object": "source",
"ach_credit_transfer": {
"account_number": "test_52796e3294dc",
"routing_number": "110000000",
"fingerprint": "ecpwEzmBOSMOqQTL",
"bank_name": "TEST BANK",
"swift_code": "TSTEZ122"
},
"amount": 0,
"client_secret": "src_client_secret_6jh1NqD1xGAI0sVLZcI5kKWy",
"created": 1659518943,
"currency": "usd",
"flow": "receiver",
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": "[email protected]",
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "121042882-38381234567890123",
"amount_received": 1000,
"amount_charged": 1000,
"amount_returned": 0,
"refund_attributes_status": "missing",
"refund_attributes_method": "email"
},
"redaction": null,
"statement_descriptor": null,
"status": "consumed",
"type": "ach_credit_transfer",
"usage": "reusable",
"customer": "cus_8TEMHVY5moxIPI"
}''' |
'''ProductsProducts describe the specific goods or services you offer to your customers.
For example, you might offer a Standard and Premium version of your goods or service; each version would be a separate Product.
They can be used in conjunction with Prices to configure pricing in Payment Links, Checkout, and Subscriptions.
''''''Endpoints POST /v1/products GET /v1/products/:id POST /v1/products/:id GET /v1/productsDELETE /v1/products/:id GET /v1/products/search
''' |
'''The product objectAttributes id string Unique identifier for the object. active boolean Whether the product is currently available for purchase. default_price string expandable The ID of the Price object that is the default price for this product. description string The product’s description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes. metadata hash Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. name string The product’s name, meant to be displayable to the customer.More attributesExpand all object string, value is "product" created timestamp images array containing strings livemode boolean package_dimensions hash shippable boolean statement_descriptor string tax_code string expandable unit_label string updated timestamp url string
''''''The product object {
"id": "prod_MAzbye5Vk2hgmo",
"object": "product",
"active": true,
"created": 1659517907,
"default_price": null,
"description": null,
"images": [],
"livemode": false,
"metadata": {},
"name": "Product",
"package_dimensions": null,
"shippable": null,
"statement_descriptor": null,
"tax_code": null,
"unit_label": null,
"updated": 1659517907,
"url": null
}
''' |
'''Create a productCreates a new product object.Parameters id optional An identifier will be randomly generated by Stripe. You can optionally override this ID, but the ID must be unique across all products in your Stripe account. name required The product’s name, meant to be displayable to the customer. active optional Whether the product is currently available for purchase. Defaults to true. description optional The product’s description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes. metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.More parametersExpand all default_price_data optional dictionary images optional package_dimensions optional dictionary shippable optional statement_descriptor optional tax_code optional unit_label optional url optional ReturnsReturns a product object if the call succeeded
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Product.create(name="Gold Special")
'''Response {
"id": "prod_MAzbye5Vk2hgmo",
"object": "product",
"active": true,
"created": 1659517907,
"default_price": null,
"description": null,
"images": [],
"livemode": false,
"metadata": {},
"name": "Gold Special",
"package_dimensions": null,
"shippable": null,
"statement_descriptor": null,
"tax_code": null,
"unit_label": null,
"updated": 1659517907,
"url": null
}''' |
'''Retrieve a productRetrieves the details of an existing product. Supply the unique product ID from either a product creation request or the product list, and Stripe will return the corresponding product information.ParametersNo parameters.ReturnsReturns a product object if a valid identifier was provided
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Product.retrieve("prod_MAzbye5Vk2hgmo")
'''Response {
"id": "prod_MAzbye5Vk2hgmo",
"object": "product",
"active": true,
"created": 1659517907,
"default_price": null,
"description": null,
"images": [],
"livemode": false,
"metadata": {},
"name": "Product",
"package_dimensions": null,
"shippable": null,
"statement_descriptor": null,
"tax_code": null,
"unit_label": null,
"updated": 1659517907,
"url": null
}''' |
'''Update a productUpdates the specific product by setting the values of the parameters passed. Any parameters not provided will be left unchanged.Parameters active optional Whether the product is available for purchase. default_price optional The ID of the Price object that is the default price for this product. description optional The product’s description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes. metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata. name optional The product’s name, meant to be displayable to the customer.More parametersExpand all images optional package_dimensions optional dictionary shippable optional statement_descriptor optional tax_code optional unit_label optional url optional ReturnsReturns the product object if the update succeeded
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Product.modify(
"prod_MAzbye5Vk2hgmo",
metadata={"order_id": "6735"},
)
'''Response {
"id": "prod_MAzbye5Vk2hgmo",
"object": "product",
"active": true,
"created": 1659517907,
"default_price": null,
"description": null,
"images": [],
"livemode": false,
"metadata": {
"order_id": "6735"
},
"name": "Product",
"package_dimensions": null,
"shippable": null,
"statement_descriptor": null,
"tax_code": null,
"unit_label": null,
"updated": 1659517907,
"url": null
}''' |
'''List all productsReturns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first.Parameters active optional Only return products that are active or inactive (e.g., pass false to list all inactive products).More parametersExpand all created optional dictionary ending_before optional ids optional limit optional shippable optional starting_after optional url optional ReturnsA dictionary with a data property that contains an array of up to limit products, starting after product starting_after. Each entry in the array is a separate product object. If no more products are available, the resulting array will be empty. This request should never raise an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Product.list(limit=3)
'''Response {
"object": "list",
"url": "/v1/products",
"has_more": false,
"data": [
{
"id": "prod_MAzbye5Vk2hgmo",
"object": "product",
"active": true,
"created": 1659517907,
"default_price": null,
"description": null,
"images": [],
"livemode": false,
"metadata": {},
"name": "Product",
"package_dimensions": null,
"shippable": null,
"statement_descriptor": null,
"tax_code": null,
"unit_label": null,
"updated": 1659517907,
"url": null
},
{...},
{...}
]
}''' |
'''Delete a productDelete a product. Deleting a product is only possible if it has no prices associated with it. Additionally, deleting a product with type=good is only possible if it has no SKUs associated with it.ParametersNo parameters.ReturnsReturns a deleted object on success. Otherwise, this call raises an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Product.delete("prod_MAzbye5Vk2hgmo")
'''Response {
"id": "prod_MAzbye5Vk2hgmo",
"object": "product",
"deleted": true
}''' |
'''Search productsSearch for products you’ve previously created using Stripe’s Search Query Language.
Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating
conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
to an hour behind during outages. Search functionality is not available to merchants in India.Parameters query required The search query string. See search query language and the list of supported query fields for products. limit optional A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. page optional A cursor for pagination across multiple pages of results. Don’t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.ReturnsA dictionary with a data property that contains an array of up to limit products. If no objects match the
query, the resulting array will be empty. See the related guide on expanding properties in lists
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Product.search(
query="active:'true' AND metadata['order_id']:'6735'",
)
'''Response {
"object": "search_result",
"url": "/v1/products/search",
"has_more": false,
"data": [
{
"id": "prod_MAzbye5Vk2hgmo",
"object": "product",
"active": true,
"created": 1659517907,
"default_price": null,
"description": null,
"images": [],
"livemode": false,
"metadata": {
"order_id": "6735"
},
"name": "Product",
"package_dimensions": null,
"shippable": null,
"statement_descriptor": null,
"tax_code": null,
"unit_label": null,
"updated": 1659517907,
"url": null
},
{...},
{...}
]
}''' |
'''PricesPrices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products.
Products help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme.For example, you might have a single "gold" product that has prices for $10/month, $100/year, and €9 once.
''''''Endpoints POST /v1/prices GET /v1/prices/:id POST /v1/prices/:id GET /v1/prices GET /v1/prices/search
''' |
'''The price objectAttributes id string Unique identifier for the object. active boolean Whether the price can be used for new purchases. currency currency Three-letter ISO currency code, in lowercase. Must be a supported currency. metadata hash Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. nickname string A brief description of the price, hidden from customers. product string expandable The ID of the product this price is associated with. recurring hash The recurring components of a price such as interval and usage_type.Show child attributes type string One of one_time or recurring depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. unit_amount integer The unit amount in cents to be charged, represented as a whole integer if possible. Only set if billing_scheme=per_unit.More attributesExpand all object string, value is "price" billing_scheme string created timestamp currency_options hash expandable preview feature custom_unit_amount hash livemode boolean lookup_key string tax_behavior string tiers array of hashes expandable tiers_mode string transform_quantity hash unit_amount_decimal decimal string
''''''The price object {
"id": "price_1LSTX02eZvKYlo2CrKMGl6Dy",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1659479142,
"currency": "usd",
"custom_unit_amount": null,
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "prod_MApBpixJvIPdF1",
"recurring": {
"aggregate_usage": null,
"interval": "month",
"interval_count": 1,
"usage_type": "licensed"
},
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "recurring",
"unit_amount": 1200,
"unit_amount_decimal": "1200"
}
''' |
'''Create a priceCreates a new price for an existing product. The price can be recurring or one-time.Parameters currency required Three-letter ISO currency code, in lowercase. Must be a supported currency. product required unless product_data is provided The ID of the product that this price will belong to. unit_amount Required conditionally A positive integer in cents (or 0 for a free price) representing how much to charge. One of unit_amount or custom_unit_amount is required, unless billing_scheme=tiered. active optional Whether the price can be used for new purchases. Defaults to true. metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata. nickname optional A brief description of the price, hidden from customers. recurring optional dictionary The recurring components of a price such as interval and usage_type.Show child parametersMore parametersExpand all custom_unit_amount Required unless unit_amount is provided product_data required unless product is provided tiers Required if billing_scheme=tiered tiers_mode Required if billing_scheme=tiered billing_scheme optional currency_options optional dictionary preview feature lookup_key optional tax_behavior optional transfer_lookup_key optional transform_quantity optional dictionary unit_amount_decimal optional ReturnsThe newly created Price object is returned upon success. Otherwise, this call raises an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Price.create(
unit_amount=1200,
currency="usd",
recurring={"interval": "month"},
product="prod_MApBpixJvIPdF1",
)
'''Response {
"id": "price_1LSTX02eZvKYlo2CrKMGl6Dy",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1659479142,
"currency": "usd",
"custom_unit_amount": null,
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "prod_MApBpixJvIPdF1",
"recurring": {
"aggregate_usage": null,
"interval": "month",
"interval_count": 1,
"usage_type": "licensed"
},
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "recurring",
"unit_amount": 1200,
"unit_amount_decimal": "1200"
}''' |
'''Retrieve a priceRetrieves the price with the given ID.ParametersNo parameters.ReturnsReturns a price if a valid price or plan ID was provided. Raises an error otherwise
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Price.retrieve(
"price_1LSTX02eZvKYlo2CrKMGl6Dy",
)
'''Response {
"id": "price_1LSTX02eZvKYlo2CrKMGl6Dy",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1659479142,
"currency": "usd",
"custom_unit_amount": null,
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "prod_MApBpixJvIPdF1",
"recurring": {
"aggregate_usage": null,
"interval": "month",
"interval_count": 1,
"usage_type": "licensed"
},
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "recurring",
"unit_amount": 1200,
"unit_amount_decimal": "1200"
}''' |
'''Update a priceUpdates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.Parameters active optional Whether the price can be used for new purchases. Defaults to true. metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata. nickname optional A brief description of the price, hidden from customers.More parametersExpand all currency_options optional dictionary preview feature lookup_key optional tax_behavior optional transfer_lookup_key optional ReturnsThe updated price object is returned upon success. Otherwise, this call raises an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Price.modify(
"price_1LSTX02eZvKYlo2CrKMGl6Dy",
metadata={"order_id": "6735"},
)
'''Response {
"id": "price_1LSTX02eZvKYlo2CrKMGl6Dy",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1659479142,
"currency": "usd",
"custom_unit_amount": null,
"livemode": false,
"lookup_key": null,
"metadata": {
"order_id": "6735"
},
"nickname": null,
"product": "prod_MApBpixJvIPdF1",
"recurring": {
"aggregate_usage": null,
"interval": "month",
"interval_count": 1,
"usage_type": "licensed"
},
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "recurring",
"unit_amount": 1200,
"unit_amount_decimal": "1200"
}''' |
'''List all pricesReturns a list of your prices.Parameters active optional Only return prices that are active or inactive (e.g., pass false to list all inactive prices). currency optional Only return prices for the given currency. product optional Only return prices for the given product. type optional Only return prices of type recurring or one_time.More parametersExpand all created optional dictionary ending_before optional limit optional lookup_keys optional recurring optional dictionary starting_after optional ReturnsA dictionary with a data property that contains an array of up to limit prices, starting after prices starting_after. Each entry in the array is a separate price object. If no more prices are available, the resulting array will be empty. This request should never raise an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Price.list(limit=3)
'''Response {
"object": "list",
"url": "/v1/prices",
"has_more": false,
"data": [
{
"id": "price_1LSTX02eZvKYlo2CrKMGl6Dy",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1659479142,
"currency": "usd",
"custom_unit_amount": null,
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "prod_MApBpixJvIPdF1",
"recurring": {
"aggregate_usage": null,
"interval": "month",
"interval_count": 1,
"usage_type": "licensed"
},
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "recurring",
"unit_amount": 1200,
"unit_amount_decimal": "1200"
},
{...},
{...}
]
}''' |
'''Search pricesSearch for prices you’ve previously created using Stripe’s Search Query Language.
Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating
conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
to an hour behind during outages. Search functionality is not available to merchants in India.Parameters query required The search query string. See search query language and the list of supported query fields for prices. limit optional A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. page optional A cursor for pagination across multiple pages of results. Don’t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.ReturnsA dictionary with a data property that contains an array of up to limit prices. If no objects match the
query, the resulting array will be empty. See the related guide on expanding properties in lists
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Price.search(
query="active:'true' AND metadata['order_id']:'6735'",
)
'''Response {
"object": "search_result",
"url": "/v1/prices/search",
"has_more": false,
"data": [
{
"id": "price_1LSTX02eZvKYlo2CrKMGl6Dy",
"object": "price",
"active": "true",
"billing_scheme": "per_unit",
"created": 1659479142,
"currency": "usd",
"custom_unit_amount": null,
"livemode": false,
"lookup_key": null,
"metadata": {
"order_id": "6735"
},
"nickname": null,
"product": "prod_MApBpixJvIPdF1",
"recurring": {
"aggregate_usage": null,
"interval": "month",
"interval_count": 1,
"usage_type": "licensed"
},
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "recurring",
"unit_amount": 1200,
"unit_amount_decimal": "1200"
},
{...},
{...}
]
}''' |
'''CouponsA coupon contains information about a percent-off or amount-off discount you
might want to apply to a customer. Coupons may be applied to subscriptions, invoices,
checkout sessions, quotes, and more. Coupons do not work with conventional one-off charges or payment intents
''''''Endpoints POST /v1/coupons GET /v1/coupons/:id POST /v1/coupons/:idDELETE /v1/coupons/:id GET /v1/coupons
''' |
'''The coupon objectAttributes id string Unique identifier for the object. amount_off positive integer Amount (in the currency specified) that will be taken off the subtotal of any invoices for this customer. currency currency If amount_off has been set, the three-letter ISO code for the currency of the amount to take off. duration enum One of forever, once, and repeating. Describes how long a customer who applies this coupon will get the discount.Possible enum valuesonce repeating forever duration_in_months positive integer If duration is repeating, the number of months the coupon applies. Null if coupon duration is forever or once. metadata hash Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. name string Name of the coupon displayed to customers on for instance invoices or receipts. percent_off decimal Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a €100 invoice €50 instead.More attributesExpand all object string, value is "coupon" applies_to hash expandable created timestamp currency_options hash expandable preview feature livemode boolean max_redemptions positive integer redeem_by timestamp times_redeemed positive integer or zero valid boolean
''''''The coupon object {
"id": "Z4OV52SU",
"object": "coupon",
"amount_off": null,
"created": 1659519093,
"currency": "usd",
"duration": "repeating",
"duration_in_months": 3,
"livemode": false,
"max_redemptions": null,
"metadata": {},
"name": "25.5% off",
"percent_off": 25.5,
"redeem_by": null,
"times_redeemed": 0,
"valid": true
}
''' |
'''Create a couponYou can create coupons easily via the coupon management page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly.
A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that amount will be subtracted from any invoice’s subtotal. For example, an invoice with a subtotal of €100 will have a final total of €0 if a coupon with an amount_off of 20000 is applied to it and an invoice with a subtotal of €300 will have a final total of €100 if a coupon with an amount_off of 20000 is applied to it.Parameters amount_off optional A positive integer representing the amount to subtract from an invoice total (required if percent_off is not passed). currency optional Three-letter ISO code for the currency of the amount_off parameter (required if amount_off is passed). duration optional enum Specifies how long the discount will be in effect if used on a subscription. Can be forever, once, or repeating. Defaults to once.Possible enum valuesonce repeating forever duration_in_months optional Required only if duration is repeating, in which case it must be a positive integer that specifies the number of months the discount will be in effect. metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata. name optional Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the id is shown if name is not set. percent_off optional A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required if amount_off is not passed).More parametersExpand all id optional applies_to optional dictionary currency_options optional dictionary preview feature max_redemptions optional redeem_by optional ReturnsReturns the coupon object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Coupon.create(
percent_off=25.5,
duration="repeating",
duration_in_months=3,
)
'''Response {
"id": "Z4OV52SU",
"object": "coupon",
"amount_off": null,
"created": 1659519093,
"currency": "usd",
"duration": "repeating",
"duration_in_months": 3,
"livemode": false,
"max_redemptions": null,
"metadata": {},
"name": "25.5% off",
"percent_off": 25.5,
"redeem_by": null,
"times_redeemed": 0,
"valid": true
}''' |
'''Retrieve a couponRetrieves the coupon with the given ID.ParametersNo parameters.ReturnsReturns a coupon if a valid coupon ID was provided. Raises an error otherwise
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Coupon.retrieve("Z4OV52SU")
'''Response {
"id": "Z4OV52SU",
"object": "coupon",
"amount_off": null,
"created": 1659519093,
"currency": "usd",
"duration": "repeating",
"duration_in_months": 3,
"livemode": false,
"max_redemptions": null,
"metadata": {},
"name": "25.5% off",
"percent_off": 25.5,
"redeem_by": null,
"times_redeemed": 0,
"valid": true
}''' |
'''Update a couponUpdates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.Parameters metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata. name optional Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the id is shown if name is not set.More parametersExpand all currency_options optional dictionary preview feature ReturnsThe newly updated coupon object if the call succeeded. Otherwise, this call raises an error, such as if the coupon has been deleted
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Coupon.modify(
"Z4OV52SU",
metadata={"order_id": "6735"},
)
'''Response {
"id": "Z4OV52SU",
"object": "coupon",
"amount_off": null,
"created": 1659519093,
"currency": "usd",
"duration": "repeating",
"duration_in_months": 3,
"livemode": false,
"max_redemptions": null,
"metadata": {
"order_id": "6735"
},
"name": "25.5% off",
"percent_off": 25.5,
"redeem_by": null,
"times_redeemed": 0,
"valid": true
}''' |
'''Delete a couponYou can delete coupons via the coupon management page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can’t redeem the coupon. You can also delete coupons via the API.ParametersNo parameters.ReturnsAn object with the deleted coupon’s ID and a deleted flag upon success. Otherwise, this call raises an error, such as if the coupon has already been deleted
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Coupon.delete("Z4OV52SU")
'''Response {
"id": "Z4OV52SU",
"object": "coupon",
"deleted": true
}''' |
'''List all couponsReturns a list of your coupons.ParametersExpand all created optional dictionary ending_before optional limit optional starting_after optional ReturnsA dictionary with a data property that contains an array of up to limit coupons, starting after coupon starting_after. Each entry in the array is a separate coupon object. If no more coupons are available, the resulting array will be empty. This request should never raise an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Coupon.list(limit=3)
'''Response {
"object": "list",
"url": "/v1/coupons",
"has_more": false,
"data": [
{
"id": "Z4OV52SU",
"object": "coupon",
"amount_off": null,
"created": 1659519093,
"currency": "usd",
"duration": "repeating",
"duration_in_months": 3,
"livemode": false,
"max_redemptions": null,
"metadata": {},
"name": "25.5% off",
"percent_off": 25.5,
"redeem_by": null,
"times_redeemed": 0,
"valid": true
},
{...},
{...}
]
}''' |
'''Promotion CodeA Promotion Code represents a customer-redeemable code for a coupon. It can be used to
create multiple codes for a single coupon
''''''Endpoints POST /v1/promotion_codes POST /v1/promotion_codes/:id GET /v1/promotion_codes/:id GET /v1/promotion_codes
''' |
'''The promotion code objectAttributes id string Unique identifier for the object. code string The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer. coupon hash, coupon object Hash describing the coupon for this promotion code. metadata hash Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.More attributesExpand all object string, value is "promotion_code" active boolean created timestamp customer string expandable expires_at timestamp livemode boolean max_redemptions positive integer restrictions hash times_redeemed positive integer or zero
''''''The promotion code object {
"id": "promo_1HMxuf2eZvKYlo2CmGXSyhRx",
"object": "promotion_code",
"active": true,
"code": "TS0EQJHH",
"coupon": {
"id": "123",
"object": "coupon",
"amount_off": null,
"created": 1507799684,
"currency": null,
"duration": "repeating",
"duration_in_months": 3,
"livemode": false,
"max_redemptions": 14,
"metadata": {
"teste": "test"
},
"name": null,
"percent_off": 34.0,
"redeem_by": null,
"times_redeemed": 0,
"valid": true
},
"created": 1599060617,
"customer": null,
"expires_at": null,
"livemode": false,
"max_redemptions": null,
"metadata": {
"order_id": "1"
},
"restrictions": {
"first_time_transaction": false,
"minimum_amount": null,
"minimum_amount_currency": null
},
"times_redeemed": 0
}
''' |
'''Create a promotion codeA promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.Parameters coupon required The coupon for this promotion code. code optional The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. If left blank, we will generate one automatically. metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.More parametersExpand all active optional customer optional expires_at optional max_redemptions optional restrictions optional dictionary ReturnsReturns the promotion code object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.PromotionCode.create(coupon="Z4OV52SU")
'''Response {
"id": "promo_1HMxuf2eZvKYlo2CmGXSyhRx",
"object": "promotion_code",
"active": true,
"code": "TS0EQJHH",
"coupon": "Z4OV52SU",
"created": 1599060617,
"customer": null,
"expires_at": null,
"livemode": false,
"max_redemptions": null,
"metadata": {
"order_id": "1"
},
"restrictions": {
"first_time_transaction": false,
"minimum_amount": null,
"minimum_amount_currency": null
},
"times_redeemed": 0
}''' |
'''Update a promotion codeUpdates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.Parameters metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.More parametersExpand all active optional restrictions optional dictionary preview feature ReturnsThe updated promotion code object is returned upon success. Otherwise, this call raises an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.PromotionCode.modify(
"promo_1HMxuf2eZvKYlo2CmGXSyhRx",
metadata={"order_id": "6735"},
)
'''Response {
"id": "promo_1HMxuf2eZvKYlo2CmGXSyhRx",
"object": "promotion_code",
"active": true,
"code": "TS0EQJHH",
"coupon": {
"id": "123",
"object": "coupon",
"amount_off": null,
"created": 1507799684,
"currency": null,
"duration": "repeating",
"duration_in_months": 3,
"livemode": false,
"max_redemptions": 14,
"metadata": {
"teste": "test"
},
"name": null,
"percent_off": 34.0,
"redeem_by": null,
"times_redeemed": 0,
"valid": true
},
"created": 1599060617,
"customer": null,
"expires_at": null,
"livemode": false,
"max_redemptions": null,
"metadata": {
"order_id": "6735"
},
"restrictions": {
"first_time_transaction": false,
"minimum_amount": null,
"minimum_amount_currency": null
},
"times_redeemed": 0
}''' |
'''Retrieve a promotion codeRetrieves the promotion code with the given ID. In order to retrieve a promotion code by the customer-facing code use list with the desired code.ParametersNo parameters.ReturnsReturns a promotion code if a valid promotion code ID was provided. Raises an error otherwise
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.PromotionCode.retrieve(
"promo_1HMxuf2eZvKYlo2CmGXSyhRx",
)
'''Response {
"id": "promo_1HMxuf2eZvKYlo2CmGXSyhRx",
"object": "promotion_code",
"active": true,
"code": "TS0EQJHH",
"coupon": {
"id": "123",
"object": "coupon",
"amount_off": null,
"created": 1507799684,
"currency": null,
"duration": "repeating",
"duration_in_months": 3,
"livemode": false,
"max_redemptions": 14,
"metadata": {
"teste": "test"
},
"name": null,
"percent_off": 34.0,
"redeem_by": null,
"times_redeemed": 0,
"valid": true
},
"created": 1599060617,
"customer": null,
"expires_at": null,
"livemode": false,
"max_redemptions": null,
"metadata": {
"order_id": "1"
},
"restrictions": {
"first_time_transaction": false,
"minimum_amount": null,
"minimum_amount_currency": null
},
"times_redeemed": 0
}''' |
'''List all promotion codesReturns a list of your promotion codes.ParametersExpand all active optional code optional coupon optional created optional dictionary customer optional ending_before optional limit optional starting_after optional ReturnsA dictionary with a data property that contains an array of up to limit promotion codes, starting after promotion code starting_after. Each entry in the array is a separate promotion code object. If no more promotion codes are available, the resulting array will be empty. This request should never raise an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.PromotionCode.list(limit=3)
'''Response {
"object": "list",
"url": "/v1/promotion_codes",
"has_more": false,
"data": [
{
"id": "promo_1HMxuf2eZvKYlo2CmGXSyhRx",
"object": "promotion_code",
"active": true,
"code": "TS0EQJHH",
"coupon": {
"id": "123",
"object": "coupon",
"amount_off": null,
"created": 1507799684,
"currency": null,
"duration": "repeating",
"duration_in_months": 3,
"livemode": false,
"max_redemptions": 14,
"metadata": {
"teste": "test"
},
"name": null,
"percent_off": 34.0,
"redeem_by": null,
"times_redeemed": 0,
"valid": true
},
"created": 1599060617,
"customer": null,
"expires_at": null,
"livemode": false,
"max_redemptions": null,
"metadata": {
"order_id": "1"
},
"restrictions": {
"first_time_transaction": false,
"minimum_amount": null,
"minimum_amount_currency": null
},
"times_redeemed": 0
},
{...},
{...}
]
}''' |
'''DiscountsA discount represents the actual application of a coupon or promotion code.
It contains information about when the discount began, when it will end, and what it is applied to.
''''''EndpointsDELETE /v1/customers/:id/discountDELETE /v1/subscriptions/:id/discount
''' |
'''The discount objectAttributes id string The ID of the discount object. Discounts cannot be fetched by ID. Use expand[]=discounts in API calls to expand discount IDs in an array. coupon hash, coupon object Hash describing the coupon applied to create this discount. customer string expandable The ID of the customer associated with this discount. end timestamp If the coupon has a duration of repeating, the date that this discount will end. If the coupon has a duration of once or forever, this attribute will be null. start timestamp Date that the coupon was applied. subscription string The subscription that this coupon is applied to, if it is applied to a particular subscription.More attributesExpand all object string, value is "discount" checkout_session string invoice string invoice_item string promotion_code string expandable
''''''The discount object {
"id": "di_17G0M72eZvKYlo2ClYl5y9Fl",
"object": "discount",
"checkout_session": null,
"coupon": {
"id": "MmtYHtx6",
"object": "coupon",
"amount_off": 99,
"created": 1449638350,
"currency": "usd",
"duration": "once",
"duration_in_months": null,
"livemode": false,
"max_redemptions": 1,
"metadata": {},
"name": null,
"percent_off": null,
"redeem_by": 1452230350,
"times_redeemed": 1,
"valid": false
},
"customer": "cus_8TEMHVY5moxIPI",
"end": null,
"invoice": null,
"invoice_item": null,
"promotion_code": null,
"start": 1449638351,
"subscription": null
}
''' |
'''Delete a customer discountRemoves the currently applied discount on a customer.ParametersNo parameters.ReturnsAn object with a deleted flag set to true upon success. This call returns an error otherwise, such as if no discount exists on this customer
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Customer.delete_discount('cus_8TEMHVY5moxIPI')
'''Response {
"object": "discount",
"deleted": true
}''' |
'''Delete a subscription discountRemoves the currently applied discount on a subscription.ParametersNo parameters.ReturnsAn object with a deleted flag set to true upon success. This call returns an error otherwise, such as if no discount exists on this subscription
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.Subscription.delete_discount('sub_1JbiLB2eZvKYlo2CNHnqfMzf')
'''Response {
"object": "discount",
"deleted": true
}''' |
'''Tax CodeTax codes classify goods and services for tax purposes
''''''Endpoints GET /v1/tax_codes GET /v1/tax_codes/:id
''' |
'''The tax code objectAttributes id string Unique identifier for the object. object string, value is "tax_code" String representing the object’s type. Objects of the same type share the same value. description string A detailed description of which types of products the tax code represents. name string A short name for the tax code
''''''The tax code object {
"id": "txcd_99999999",
"object": "tax_code",
"description": "Any tangible or physical good. For jurisdictions that impose a tax, the standard rate is applied.",
"name": "General - Tangible Goods"
}
''' |
'''List all tax codesA list of all tax codes available to add to Products in order to allow specific tax calculations.ParametersExpand all ending_before optional limit optional starting_after optional ReturnsA dictionary with a data property that contains an array of up to limit tax codes, starting after tax code starting_after. Each entry in the array is a separate tax code object. If no more tax codes are available, the resulting array will be empty. This request should never return an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.TaxCode.list(limit=3)
'''Response {
"object": "list",
"url": "/v1/tax_codes",
"has_more": false,
"data": [
{
"id": "txcd_99999999",
"object": "tax_code",
"description": "Any tangible or physical good. For jurisdictions that impose a tax, the standard rate is applied.",
"name": "General - Tangible Goods"
},
{...},
{...}
]
}''' |
'''Retrieve a tax codeRetrieves the details of an existing tax code. Supply the unique tax code ID and Stripe will return the corresponding tax code information.ParametersNo parameters.ReturnsReturns a tax code object if a valid identifier was provided
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.TaxCode.retrieve("txcd_99999999")
'''Response {
"id": "txcd_99999999",
"object": "tax_code",
"description": "Any tangible or physical good. For jurisdictions that impose a tax, the standard rate is applied.",
"name": "General - Tangible Goods"
}''' |
'''Tax RateTax rates can be applied to invoices, subscriptions and Checkout Sessions to collect tax.
''''''Endpoints POST /v1/tax_rates GET /v1/tax_rates/:id POST /v1/tax_rates/:id GET /v1/tax_rates
''' |
'''The tax rate objectAttributes id string Unique identifier for the object. active boolean Defaults to true. When set to false, this tax rate cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set. country string Two-letter country code (ISO 3166-1 alpha-2). description string An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers. display_name string The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page. inclusive boolean This specifies if the tax rate is inclusive or exclusive. jurisdiction string The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice. metadata hash Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. percentage decimal This represents the tax rate percent out of 100. state string ISO 3166-2 subdivision code, without country prefix. For example, “NY” for New York, United States.More attributesExpand all object string, value is "tax_rate" created timestamp livemode boolean tax_type string
''''''The tax rate object {
"id": "txr_1LSdrn2eZvKYlo2Cnyh3Sdyj",
"object": "tax_rate",
"active": true,
"country": "DE",
"created": 1659518871,
"description": "VAT Germany",
"display_name": "VAT",
"inclusive": false,
"jurisdiction": "DE",
"livemode": false,
"metadata": {},
"percentage": 19.0,
"state": null,
"tax_type": "vat"
}
''' |
'''Create a tax rateCreates a new tax rate.Parameters display_name required The display name of the tax rate, which will be shown to users. inclusive required This specifies if the tax rate is inclusive or exclusive. percentage required This represents the tax rate percent out of 100. active optional Flag determining whether the tax rate is active or inactive (archived). Inactive tax rates cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set. country optional Two-letter country code (ISO 3166-1 alpha-2). description optional An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers. jurisdiction optional The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice. metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata. state optional ISO 3166-2 subdivision code, without country prefix. For example, “NY” for New York, United States.More parametersExpand all tax_type optional ReturnsThe created tax rate object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.TaxRate.create(
display_name="VAT",
description="VAT Germany",
jurisdiction="DE",
percentage=16,
inclusive=False,
)
'''Response {
"id": "txr_1LSdrn2eZvKYlo2Cnyh3Sdyj",
"object": "tax_rate",
"active": true,
"country": "DE",
"created": 1659518871,
"description": "VAT Germany",
"display_name": "VAT",
"inclusive": false,
"jurisdiction": "DE",
"livemode": false,
"metadata": {},
"percentage": 16.0,
"state": null,
"tax_type": "vat"
}''' |
'''Retrieves a tax rateRetrieves a tax rate with the given IDParametersNo parameters.ReturnsReturns an tax rate if a valid tax rate ID was provided. Raises an error otherwise
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.TaxRate.retrieve(
"txr_1LSdrn2eZvKYlo2Cnyh3Sdyj",
)
'''Response {
"id": "txr_1LSdrn2eZvKYlo2Cnyh3Sdyj",
"object": "tax_rate",
"active": true,
"country": "DE",
"created": 1659518871,
"description": "VAT Germany",
"display_name": "VAT",
"inclusive": false,
"jurisdiction": "DE",
"livemode": false,
"metadata": {},
"percentage": 19.0,
"state": null,
"tax_type": "vat"
}''' |
'''Update a tax rateUpdates an existing tax rate.Parameters active optional Flag determining whether the tax rate is active or inactive (archived). Inactive tax rates cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set. country optional Two-letter country code (ISO 3166-1 alpha-2). description optional An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers. display_name optional The display name of the tax rate, which will be shown to users. jurisdiction optional The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice. metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata. state optional ISO 3166-2 subdivision code, without country prefix. For example, “NY” for New York, United States.More parametersExpand all tax_type optional ReturnsThe updated tax rate
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.TaxRate.modify(
"txr_1LSdrn2eZvKYlo2Cnyh3Sdyj",
active=False,
)
'''Response {
"id": "txr_1LSdrn2eZvKYlo2Cnyh3Sdyj",
"object": "tax_rate",
"active": false,
"country": "DE",
"created": 1659518871,
"description": "VAT Germany",
"display_name": "VAT",
"inclusive": false,
"jurisdiction": "DE",
"livemode": false,
"metadata": {},
"percentage": 19.0,
"state": null,
"tax_type": "vat"
}''' |
'''List all tax ratesReturns a list of your tax rates. Tax rates are returned sorted by creation date, with the most recently created tax rates appearing first.Parameters active optional Optional flag to filter by tax rates that are either active or inactive (archived).More parametersExpand all created optional dictionary ending_before optional inclusive optional limit optional starting_after optional ReturnsA dictionary with a data property that contains an array of up to limit tax rates, starting after tax rate starting_after. Each entry in the array is a separate tax rate object. If no more tax rates are available, the resulting array will be empty. This request should never raise an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.TaxRate.list(limit=3)
'''Response {
"object": "list",
"url": "/v1/tax_rates",
"has_more": false,
"data": [
{
"id": "txr_1LSdrn2eZvKYlo2Cnyh3Sdyj",
"object": "tax_rate",
"active": true,
"country": "DE",
"created": 1659518871,
"description": "VAT Germany",
"display_name": "VAT",
"inclusive": false,
"jurisdiction": "DE",
"livemode": false,
"metadata": {},
"percentage": 19.0,
"state": null,
"tax_type": "vat"
},
{...},
{...}
]
}''' |
'''Shipping RatesShipping rates describe the price of shipping presented to your customers and can be
applied to Checkout Sessions
and Orders to collect shipping costs
''''''Endpoints POST /v1/shipping_rates GET /v1/shipping_rates/:id POST /v1/shipping_rates/:id GET /v1/shipping_rates
''' |
'''The shipping rate objectAttributes id string Unique identifier for the object. active boolean Whether the shipping rate can be used for new purchases. Defaults to true. display_name string The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions. fixed_amount hash Describes a fixed amount to charge for shipping. Must be present if type is fixed_amount.Show child attributes metadata hash Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. type enum The type of calculation to use on the shipping rate. Can only be fixed_amount for now.Possible enum valuesfixed_amount More attributesExpand all object string, value is "shipping_rate" created timestamp delivery_estimate hash livemode boolean tax_behavior string tax_code string expandable
''''''The shipping rate object {
"id": "shr_1LSdrn2eZvKYlo2CxRF2J7J9",
"object": "shipping_rate",
"active": true,
"created": 1659518871,
"delivery_estimate": null,
"display_name": "Ground shipping",
"fixed_amount": {
"amount": 500,
"currency": "usd"
},
"livemode": false,
"metadata": {},
"tax_behavior": "unspecified",
"tax_code": null,
"type": "fixed_amount"
}
''' |
'''Create a shipping rateCreates a new shipping rate object.Parameters display_name required The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions. type required The type of calculation to use on the shipping rate. Can only be fixed_amount for now.Possible enum valuesfixed_amount fixed_amount optional dictionary Describes a fixed amount to charge for shipping. Must be present if type is fixed_amount.Show child parameters metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.More parametersExpand all delivery_estimate optional dictionary tax_behavior optional tax_code optional ReturnsReturns a shipping rate object if the call succeeded
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.ShippingRate.create(
display_name="Ground shipping",
type="fixed_amount",
fixed_amount={"amount": 500, "currency": "usd"},
)
'''Response {
"id": "shr_1LSdrn2eZvKYlo2CxRF2J7J9",
"object": "shipping_rate",
"active": true,
"created": 1659518871,
"delivery_estimate": null,
"display_name": "Ground shipping",
"fixed_amount": {
"amount": 500,
"currency": "usd"
},
"livemode": false,
"metadata": {},
"tax_behavior": "unspecified",
"tax_code": null,
"type": "fixed_amount"
}''' |
'''Retrieve a shipping rateReturns the shipping rate object with the given ID.ParametersNo parameters.ReturnsReturns a shipping rate object if a valid identifier was provided
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.ShippingRate.retrieve(
"shr_1LSdrn2eZvKYlo2CxRF2J7J9",
)
'''Response {
"id": "shr_1LSdrn2eZvKYlo2CxRF2J7J9",
"object": "shipping_rate",
"active": true,
"created": 1659518871,
"delivery_estimate": null,
"display_name": "Ground shipping",
"fixed_amount": {
"amount": 500,
"currency": "usd"
},
"livemode": false,
"metadata": {},
"tax_behavior": "unspecified",
"tax_code": null,
"type": "fixed_amount"
}''' |
'''Update a shipping rateUpdates an existing shipping rate object.Parameters active optional Whether the shipping rate can be used for new purchases. Defaults to true. fixed_amount optional dictionary preview feature Describes a fixed amount to charge for shipping. Must be present if type is fixed_amount.Show child parameters metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.More parametersExpand all tax_behavior optional preview feature ReturnsReturns the modified shipping rate object if the call succeeded
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.ShippingRate.modify(
"shr_1LSdrn2eZvKYlo2CxRF2J7J9",
metadata={"order_id": "6735"},
)
'''Response {
"id": "shr_1LSdrn2eZvKYlo2CxRF2J7J9",
"object": "shipping_rate",
"active": true,
"created": 1659518871,
"delivery_estimate": null,
"display_name": "Ground shipping",
"fixed_amount": {
"amount": 500,
"currency": "usd"
},
"livemode": false,
"metadata": {
"order_id": "6735"
},
"tax_behavior": "unspecified",
"tax_code": null,
"type": "fixed_amount"
}''' |
'''List all shipping ratesReturns a list of your shipping rates.Parameters active optional Only return shipping rates that are active or inactive. created optional dictionary A filter on the list based on the object created field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with the following options:Show child parameters currency optional Only return shipping rates for the given currency.More parametersExpand all ending_before optional limit optional starting_after optional ReturnsA dictionary with a data property that contains an array of up to limit shipping rates, starting after shipping rate starting_after. Each entry in the array is a separate shipping rate object. If no more shipping rates are available, the resulting array will be empty. This require should never raise an error
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.ShippingRate.list(limit=3)
'''Response {
"object": "list",
"url": "/v1/shipping_rates",
"has_more": false,
"data": [
{
"id": "shr_1LSdrn2eZvKYlo2CxRF2J7J9",
"object": "shipping_rate",
"active": true,
"created": 1659518871,
"delivery_estimate": null,
"display_name": "Ground shipping",
"fixed_amount": {
"amount": 500,
"currency": "usd"
},
"livemode": false,
"metadata": {},
"tax_behavior": "unspecified",
"tax_code": null,
"type": "fixed_amount"
},
{...},
{...}
]
}''' |
'''SessionsA Checkout Session represents your customer's session as they pay for
one-time purchases or subscriptions through Checkout
or Payment Links. We recommend creating a
new Session each time your customer attempts to pay.Once payment is successful, the Checkout Session will contain a reference
to the Customer, and either the successful
PaymentIntent or an active
Subscription.You can create a Checkout Session on your server and pass its ID to the
client to begin Checkout.
''''''Endpoints POST /v1/checkout/sessions POST /v1/checkout/sessions/:id/expire GET /v1/checkout/sessions/:id GET /v1/checkout/sessions GET /v1/checkout/sessions/:id/line_items
''' |
'''The Session objectAttributes id string Unique identifier for the object. Used to pass to redirectToCheckout
in Stripe.js. cancel_url string The URL the customer will be directed to if they decide to cancel payment and return to your website. client_reference_id string A unique string to reference the Checkout Session. This can be a
customer ID, a cart ID, or similar, and can be used to reconcile the
Session with your internal systems. currency currency Three-letter ISO currency code, in lowercase. Must be a supported currency. customer string expandable The ID of the customer for this Session.
For Checkout Sessions in payment or subscription mode, Checkout
will create a new customer object based on information provided
during the payment flow unless an existing customer was provided when
the Session was created. customer_email string If provided, this value will be used when the Customer object is created.
If not provided, customers will be asked to enter their email address.
Use this parameter to prefill customer data if you already have an email
on file. To access information about the customer once the payment flow is
complete, use the customer attribute. line_items list expandable The line items purchased by the customer. This field is not included by default. To include it in the response, expand the line_items field.Show child attributes metadata hash Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. mode enum The mode of the Checkout Session.Possible enum valuespayment Accept one-time payments for cards, iDEAL, and more.setup Save payment details to charge your customers later.subscription Use Stripe Billing to set up fixed-price subscriptions. payment_intent string expandable The ID of the PaymentIntent for Checkout Sessions in payment mode. payment_method_types array containing strings A list of the types of payment methods (e.g. card) this Checkout
Session is allowed to accept. payment_status enum The payment status of the Checkout Session, one of paid, unpaid, or no_payment_required.
You can use this value to decide when to fulfill your customer’s order.Possible enum valuespaid The payment funds are available in your account.unpaid The payment funds are not yet available in your account.no_payment_required The Checkout Session is in setup mode and doesn’t require a payment at this time. success_url string The URL the customer will be directed to after the payment or
subscription creation is successful.More attributesExpand all object string, value is "checkout.session" after_expiration hash allow_promotion_codes boolean amount_subtotal integer amount_total integer automatic_tax hash billing_address_collection enum consent hash consent_collection hash customer_creation enum customer_details hash expires_at timestamp livemode boolean locale enum payment_link string expandable payment_method_options hash phone_number_collection hash recovered_from string setup_intent string expandable shipping_address_collection hash shipping_cost hash shipping_details hash shipping_options array of hashes status enum submit_type enum subscription string expandable tax_id_collection hash total_details hash url string
''''''The Session object {
"id": "cs_test_a15vFKPu138xjcETgEZfTyxnbkKfnzQK1lY1QsG5fRTht29TiQtRu6BG2I",
"object": "checkout.session",
"after_expiration": null,
"allow_promotion_codes": null,
"amount_subtotal": null,
"amount_total": null,
"automatic_tax": {
"enabled": false,
"status": null
},
"billing_address_collection": null,
"cancel_url": "https://example.com/cancel",
"client_reference_id": null,
"consent": null,
"consent_collection": null,
"currency": null,
"customer": null,
"customer_creation": null,
"customer_details": null,
"customer_email": null,
"expires_at": 1659518871,
"livemode": false,
"locale": null,
"metadata": {},
"mode": "payment",
"payment_intent": "pi_1DrPsv2eZvKYlo2CEDzqXfPH",
"payment_link": null,
"payment_method_options": {},
"payment_method_types": [
"card"
],
"payment_status": "unpaid",
"phone_number_collection": {
"enabled": false
},
"recovered_from": null,
"redaction": null,
"setup_intent": null,
"shipping_address_collection": null,
"shipping_cost": null,
"shipping_details": null,
"shipping_options": [],
"status": "expired",
"submit_type": null,
"subscription": null,
"success_url": "https://example.com/success",
"total_details": null,
"url": null
}
''' |
'''Create a SessionCreates a Session object.Parameters cancel_url required The URL the customer will be directed to if they decide to cancel payment and return to your website. mode required conditionally The mode of the Checkout Session. Required when using prices or setup mode. Pass subscription if the Checkout Session includes at least one recurring item.Possible enum valuespayment Accept one-time payments for cards, iDEAL, and more.setup Save payment details to charge your customers later.subscription Use Stripe Billing to set up fixed-price subscriptions. success_url required The URL to which Stripe should send customers when payment or setup
is complete.
If you’d like to use information from the successful Checkout Session on your page,
read the guide on customizing your success page. client_reference_id optional A unique string to reference the Checkout Session. This can be a
customer ID, a cart ID, or similar, and can be used to reconcile the
session with your internal systems. currency optional preview feature Three-letter ISO currency code, in lowercase. Must be a supported currency. customer optional ID of an existing Customer, if one exists. In payment mode, the customer’s most recent card
payment method will be used to prefill the email, name, card details, and billing address
on the Checkout page. In subscription mode, the customer’s default payment method
will be used if it’s a card, and otherwise the most recent card will be used. A valid billing address, billing name and billing email are required on the payment method for Checkout to prefill the customer’s card details.
If the Customer already has a valid email set, the email will be prefilled and not editable in Checkout.
If the Customer does not have a valid email, Checkout will set the email entered during the session on the Customer.
If blank for Checkout Sessions in payment or subscription mode, Checkout will create a new Customer object based on information provided during the payment flow.
You can set payment_intent_data.setup_future_usage to have Checkout automatically attach the payment method to the Customer you pass in for future reuse. customer_email optional If provided, this value will be used when the Customer object is created.
If not provided, customers will be asked to enter their email address.
Use this parameter to prefill customer data if you already have an email
on file. To access information about the customer once a session is
complete, use the customer field. line_items optional array of hashes A list of items the customer is purchasing. Use this parameter to pass one-time or recurring Prices.
For payment mode, there is a maximum of 100 line items, however it is recommended to consolidate line items if there are more than a few dozen.
For subscription mode, there is a maximum of 20 line items with recurring Prices and 20 line items with one-time Prices. Line items with one-time Prices in will be on the initial invoice only.Show child parameters metadata optional dictionary Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata. payment_method_types optional enum A list of the types of payment methods (e.g., card) this Checkout Session can accept.
Do not include this attribute if you prefer to manage your payment methods from the Stripe Dashboard.
Read more about the supported payment methods and their requirements in our payment
method details guide.
If multiple payment methods are passed, Checkout will dynamically reorder them to
prioritize the most relevant payment methods based on the customer’s location and
other characteristics.Possible enum valuescard acss_debit affirm afterpay_clearpay alipay au_becs_debit bacs_debit Show 19 moreMore parametersExpand all after_expiration optional dictionary allow_promotion_codes optional automatic_tax optional dictionary billing_address_collection optional enum consent_collection optional dictionary customer_creation optional enum customer_update optional dictionary discounts optional array of hashes expires_at optional locale optional enum payment_intent_data optional dictionary payment_method_options optional dictionary phone_number_collection optional dictionary setup_intent_data optional dictionary shipping_address_collection optional dictionary shipping_options optional array of hashes submit_type optional enum subscription_data optional dictionary tax_id_collection optional dictionary ReturnsReturns a Session object
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.checkout.Session.create(
success_url="https://example.com/success",
cancel_url="https://example.com/cancel",
line_items=[
{
"price": "price_H5ggYwtDq4fbrJ",
"quantity": 2,
},
],
mode="payment",
)
'''Response {
"id": "cs_test_a15vFKPu138xjcETgEZfTyxnbkKfnzQK1lY1QsG5fRTht29TiQtRu6BG2I",
"object": "checkout.session",
"after_expiration": null,
"allow_promotion_codes": null,
"amount_subtotal": null,
"amount_total": null,
"automatic_tax": {
"enabled": false,
"status": null
},
"billing_address_collection": null,
"cancel_url": "https://example.com/cancel",
"client_reference_id": null,
"consent": null,
"consent_collection": null,
"currency": null,
"customer": null,
"customer_creation": null,
"customer_details": null,
"customer_email": null,
"expires_at": 1659518871,
"livemode": false,
"locale": null,
"metadata": {},
"mode": "payment",
"payment_intent": "pi_1DrPsv2eZvKYlo2CEDzqXfPH",
"payment_link": null,
"payment_method_options": {},
"payment_method_types": [
"card"
],
"payment_status": "unpaid",
"phone_number_collection": {
"enabled": false
},
"recovered_from": null,
"redaction": null,
"setup_intent": null,
"shipping_address_collection": null,
"shipping_cost": null,
"shipping_details": null,
"shipping_options": [],
"status": "expired",
"submit_type": null,
"subscription": null,
"success_url": "https://example.com/success",
"total_details": null,
"url": "https://checkout.stripe.com/pay/..."
}''' |
'''Expire a SessionA Session can be expired when it is in one of these statuses: open
After it expires, a customer can’t complete a Session and customers loading the Session see a message saying the Session is expired.ParametersNo parameters.ReturnsReturns a Session object if the expiration succeeded. Returns an error if the Session has already expired or isn’t in an expireable state
'''import stripe
stripe.api_key = "sk_test_your_key"
stripe.checkout.Session.expire(
"cs_test_a15vFKPu138xjcETgEZfTyxnbkKfnzQK1lY1QsG5fRTht29TiQtRu6BG2I",
)
'''Response {
"id": "cs_test_a15vFKPu138xjcETgEZfTyxnbkKfnzQK1lY1QsG5fRTht29TiQtRu6BG2I",
"object": "checkout.session",
"after_expiration": null,
"allow_promotion_codes": null,
"amount_subtotal": null,
"amount_total": null,
"automatic_tax": {
"enabled": false,
"status": null
},
"billing_address_collection": null,
"cancel_url": "https://example.com/cancel",
"client_reference_id": null,
"consent": null,
"consent_collection": null,
"currency": null,
"customer": null,
"customer_creation": null,
"customer_details": null,
"customer_email": null,
"expires_at": 1659518871,
"livemode": false,
"locale": null,
"metadata": {},
"mode": "payment",
"payment_intent": "pi_1DrPsv2eZvKYlo2CEDzqXfPH",
"payment_link": null,
"payment_method_options": {},
"payment_method_types": [
"card"
],
"payment_status": "unpaid",
"phone_number_collection": {
"enabled": false
},
"recovered_from": null,
"redaction": null,
"setup_intent": null,
"shipping_address_collection": null,
"shipping_cost": null,
"shipping_details": null,
"shipping_options": [],
"status": "expired",
"submit_type": null,
"subscription": null,
"success_url": "https://example.com/success",
"total_details": null,
"url": null
}''' |