class Stripe::Charge

Overview

The Charge object represents a single attempt to move money into your Stripe account. PaymentIntent confirmation is the most common way to create Charges, but transferring money to a different Stripe account through Connect also creates Charges. Some legacy payment flows create Charges directly, which is not recommended for new integrations.

Included Modules

Defined in:

stripe/models/charge.cr

Constant Summary

ERROR_MESSAGE_FOR_OBJECT = "invalid value for \"object\", must be one of [charge]."
ERROR_MESSAGE_FOR_STATUS = "invalid value for \"status\", must be one of [failed, pending, succeeded]."
MAX_LENGTH_FOR_AUTHORIZATION_CODE = 5000
MAX_LENGTH_FOR_CALCULATED_STATEMENT_DESCRIPTOR = 5000
MAX_LENGTH_FOR_DESCRIPTION = 40000
MAX_LENGTH_FOR_FAILURE_CODE = 5000
MAX_LENGTH_FOR_FAILURE_MESSAGE = 5000
MAX_LENGTH_FOR_ID = 5000
MAX_LENGTH_FOR_PAYMENT_METHOD = 5000
MAX_LENGTH_FOR_RECEIPT_EMAIL = 5000
MAX_LENGTH_FOR_RECEIPT_NUMBER = 5000
MAX_LENGTH_FOR_RECEIPT_URL = 5000
MAX_LENGTH_FOR_STATEMENT_DESCRIPTOR = 5000
MAX_LENGTH_FOR_STATEMENT_DESCRIPTOR_SUFFIX = 5000
MAX_LENGTH_FOR_TRANSFER_GROUP = 5000
VALID_VALUES_FOR_OBJECT = String.static_array("charge")
VALID_VALUES_FOR_STATUS = String.static_array("failed", "pending", "succeeded")

Constructors

Instance Method Summary

Instance methods inherited from module OpenApi::Json

after_initialize after_initialize, clone clone, eql?(o : self) eql?, to_hash : Hash(String, JSON::Any) to_hash, to_json_any : JSON::Any to_json_any

Class methods inherited from module OpenApi::Json

build_from_hash(hash : Hash) build_from_hash, build_from_json_any(json_any : JSON::Any) build_from_json_any

Instance methods inherited from module OpenApi::Validatable

list_invalid_properties : Array(String) list_invalid_properties, list_invalid_properties_for(key : String) : Array(String) list_invalid_properties_for, valid? : Bool valid?, validate : Nil validate

Constructor Detail

def self.new(pull : JSON::PullParser) #

[View source]
def self.new(*, amount : Int64 | Nil = nil, amount_captured : Int64 | Nil = nil, amount_refunded : Int64 | Nil = nil, application : Stripe::ChargeApplication | Nil = nil, application_fee : Stripe::ChargeApplicationFee | Nil = nil, application_fee_amount : Int64 | Nil = nil, balance_transaction : Stripe::ChargeBalanceTransaction | Nil = nil, billing_details : Stripe::BillingDetails | Nil = nil, calculated_statement_descriptor : String | Nil = nil, captured : Bool | Nil = nil, created : Int64 | Nil = nil, currency : String | Nil = nil, customer : Stripe::ChargeCustomer | Nil = nil, description : String | Nil = nil, disputed : Bool | Nil = nil, failure_balance_transaction : Stripe::ChargeFailureBalanceTransaction | Nil = nil, failure_code : String | Nil = nil, failure_message : String | Nil = nil, fraud_details : Stripe::ChargeFraudDetails1 | Nil = nil, id : String | Nil = nil, invoice : Stripe::ChargeInvoice | Nil = nil, livemode : Bool | Nil = nil, metadata : Hash(String, String) | Nil = nil, object : String | Nil = nil, on_behalf_of : Stripe::ChargeOnBehalfOf | Nil = nil, outcome : Stripe::ChargeOutcome1 | Nil = nil, paid : Bool | Nil = nil, payment_intent : Stripe::ChargePaymentIntent | Nil = nil, payment_method : String | Nil = nil, payment_method_details : Stripe::ChargePaymentMethodDetails | Nil = nil, receipt_email : String | Nil = nil, receipt_number : String | Nil = nil, receipt_url : String | Nil = nil, refunded : Bool | Nil = nil, review : Stripe::ChargeReview | Nil = nil, shipping : Stripe::ChargeShipping | Nil = nil, source : Stripe::ChargeSource | Nil = nil, source_transfer : Stripe::ChargeSourceTransfer | Nil = nil, statement_descriptor : String | Nil = nil, statement_descriptor_suffix : String | Nil = nil, status : String | Nil = nil, transfer_data : Stripe::ChargeTransferData1 | Nil = nil, transfer_group : String | Nil = nil, authorization_code : String | Nil = nil, level3 : Stripe::Level3 | Nil = nil, radar_options : Stripe::RadarRadarOptions | Nil = nil, refunds : Stripe::RefundList | Nil = nil, transfer : Stripe::ChargeTransfer | Nil = nil) #

Initializes the object @param [Hash] attributes Model attributes in the form of hash


[View source]

Instance Method Detail

def ==(other : self) #

Generates #hash and #== methods from all fields #== @return [Bool] #hash calculates hash code according to all attributes. #hash @return [UInt64] Hash code


def amount : Int64 | Nil #

[View source]
def amount=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] amount Object to be assigned


[View source]
def amount_captured : Int64 | Nil #

[View source]
def amount_captured=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] amount_captured Object to be assigned


[View source]
def amount_refunded : Int64 | Nil #

[View source]
def amount_refunded=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] amount_refunded Object to be assigned


[View source]
def application : Stripe::ChargeApplication | Nil #

[View source]
def application=(new_value : Stripe::ChargeApplication | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] application Object to be assigned


[View source]
def application_fee : Stripe::ChargeApplicationFee | Nil #

[View source]
def application_fee=(new_value : Stripe::ChargeApplicationFee | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] application_fee Object to be assigned


[View source]
def application_fee_amount : Int64 | Nil #

[View source]
def application_fee_amount=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] application_fee_amount Object to be assigned


[View source]
def authorization_code : String | Nil #

[View source]
def authorization_code=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] authorization_code Object to be assigned


[View source]
def balance_transaction : Stripe::ChargeBalanceTransaction | Nil #

[View source]
def balance_transaction=(new_value : Stripe::ChargeBalanceTransaction | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] balance_transaction Object to be assigned


[View source]
def billing_details : Stripe::BillingDetails | Nil #

[View source]
def billing_details=(new_value : Stripe::BillingDetails | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] billing_details Object to be assigned


[View source]
def calculated_statement_descriptor : String | Nil #

[View source]
def calculated_statement_descriptor=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] calculated_statement_descriptor Object to be assigned


[View source]
def captured : Bool | Nil #

[View source]
def captured=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] captured Object to be assigned


[View source]
def created : Int64 | Nil #

[View source]
def created=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] created Object to be assigned


[View source]
def currency : String | Nil #

[View source]
def currency=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] currency Object to be assigned


[View source]
def customer : Stripe::ChargeCustomer | Nil #

[View source]
def customer=(new_value : Stripe::ChargeCustomer | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] customer Object to be assigned


[View source]
def description : String | Nil #

[View source]
def description=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] description Object to be assigned


[View source]
def disputed : Bool | Nil #

[View source]
def disputed=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] disputed Object to be assigned


[View source]
def failure_balance_transaction : Stripe::ChargeFailureBalanceTransaction | Nil #

[View source]
def failure_balance_transaction=(new_value : Stripe::ChargeFailureBalanceTransaction | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] failure_balance_transaction Object to be assigned


[View source]
def failure_code : String | Nil #

[View source]
def failure_code=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] failure_code Object to be assigned


[View source]
def failure_message : String | Nil #

[View source]
def failure_message=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] failure_message Object to be assigned


[View source]
def fraud_details : Stripe::ChargeFraudDetails1 | Nil #

[View source]
def fraud_details=(new_value : Stripe::ChargeFraudDetails1 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] fraud_details Object to be assigned


[View source]
def hash(hasher) #

Generates #hash and #== methods from all fields #== @return [Bool] #hash calculates hash code according to all attributes. #hash @return [UInt64] Hash code


def id : String | Nil #

[View source]
def id=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] id Object to be assigned


[View source]
def invoice : Stripe::ChargeInvoice | Nil #

[View source]
def invoice=(new_value : Stripe::ChargeInvoice | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] invoice Object to be assigned


[View source]
def level3 : Stripe::Level3 | Nil #

[View source]
def level3=(new_value : Stripe::Level3 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] level3 Object to be assigned


[View source]
def list_invalid_properties : Array(String) #

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons


[View source]
def livemode : Bool | Nil #

[View source]
def livemode=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] livemode Object to be assigned


[View source]
def metadata : Hash(String, String) | Nil #

[View source]
def metadata=(new_value : Hash(String, String) | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] metadata Object to be assigned


[View source]
def object : String | Nil #

[View source]
def object=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] object Object to be assigned


[View source]
def on_behalf_of : Stripe::ChargeOnBehalfOf | Nil #

[View source]
def on_behalf_of=(new_value : Stripe::ChargeOnBehalfOf | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] on_behalf_of Object to be assigned


[View source]
def outcome : Stripe::ChargeOutcome1 | Nil #

[View source]
def outcome=(new_value : Stripe::ChargeOutcome1 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] outcome Object to be assigned


[View source]
def paid : Bool | Nil #

[View source]
def paid=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] paid Object to be assigned


[View source]
def payment_intent : Stripe::ChargePaymentIntent | Nil #

[View source]
def payment_intent=(new_value : Stripe::ChargePaymentIntent | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] payment_intent Object to be assigned


[View source]
def payment_method : String | Nil #

[View source]
def payment_method=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] payment_method Object to be assigned


[View source]
def payment_method_details : Stripe::ChargePaymentMethodDetails | Nil #

[View source]
def payment_method_details=(new_value : Stripe::ChargePaymentMethodDetails | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] payment_method_details Object to be assigned


[View source]
def radar_options : Stripe::RadarRadarOptions | Nil #

[View source]
def radar_options=(new_value : Stripe::RadarRadarOptions | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] radar_options Object to be assigned


[View source]
def receipt_email : String | Nil #

[View source]
def receipt_email=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] receipt_email Object to be assigned


[View source]
def receipt_number : String | Nil #

[View source]
def receipt_number=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] receipt_number Object to be assigned


[View source]
def receipt_url : String | Nil #

[View source]
def receipt_url=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] receipt_url Object to be assigned


[View source]
def refunded : Bool | Nil #

[View source]
def refunded=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] refunded Object to be assigned


[View source]
def refunds : Stripe::RefundList | Nil #

[View source]
def refunds=(new_value : Stripe::RefundList | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] refunds Object to be assigned


[View source]
def refunds_present=(refunds_present : Bool) #

[View source]
def refunds_present? : Bool #

[View source]
def review : Stripe::ChargeReview | Nil #

[View source]
def review=(new_value : Stripe::ChargeReview | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] review Object to be assigned


[View source]
def shipping : Stripe::ChargeShipping | Nil #

[View source]
def shipping=(new_value : Stripe::ChargeShipping | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] shipping Object to be assigned


[View source]
def source : Stripe::ChargeSource | Nil #

[View source]
def source=(new_value : Stripe::ChargeSource | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] source Object to be assigned


[View source]
def source_transfer : Stripe::ChargeSourceTransfer | Nil #

[View source]
def source_transfer=(new_value : Stripe::ChargeSourceTransfer | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] source_transfer Object to be assigned


[View source]
def statement_descriptor : String | Nil #

[View source]
def statement_descriptor=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] statement_descriptor Object to be assigned


[View source]
def statement_descriptor_suffix : String | Nil #

[View source]
def statement_descriptor_suffix=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] statement_descriptor_suffix Object to be assigned


[View source]
def status : String | Nil #

[View source]
def status=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] status Object to be assigned


[View source]
def transfer : Stripe::ChargeTransfer | Nil #

[View source]
def transfer=(new_value : Stripe::ChargeTransfer | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] transfer Object to be assigned


[View source]
def transfer_data : Stripe::ChargeTransferData1 | Nil #

[View source]
def transfer_data=(new_value : Stripe::ChargeTransferData1 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] transfer_data Object to be assigned


[View source]
def transfer_group : String | Nil #

[View source]
def transfer_group=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] transfer_group Object to be assigned


[View source]
def valid? : Bool #

Check to see if the all the properties in the model are valid @return true if the model is valid


[View source]