Reference
shared.services.payment_providers.stripe.base_stripe ¶
BaseStripe ¶
Source code in shared/services/payment_providers/stripe/base_stripe.py
DETACHED_SOURCE_ERROR_MESSAGE
class-attribute
instance-attribute
¶
DETACHED_SOURCE_ERROR_MESSAGE = "The reusable source you provided is consumed because it was previously charged without being attached to a customer or was detached from a customer"
IBAN_HIGH_LIKELIHOOD_OF_CHARGEBACK_MESSAGE
class-attribute
instance-attribute
¶
IBAN_HIGH_LIKELIHOOD_OF_CHARGEBACK_MESSAGE = "The payment is blocked due to a high likelihood of chargeback"
IBAN_SUSPENDED_ERROR_MESSAGE
class-attribute
instance-attribute
¶
INVALID_IBAN_ERROR_MESSAGE
class-attribute
instance-attribute
¶
INVALID_MANDATE_FOR_SOURCE_ERROR_MESSAGE
class-attribute
instance-attribute
¶
INVALID_MANDATE_FOR_SOURCE_ERROR_MESSAGE = "The source you provided requires a valid accepted mandate to be in a chargeable state"
MAX_STRIPE_IBAN_SUSPENSION_DAYS
class-attribute
instance-attribute
¶
NOT_CORRECTLY_ATTACHED_SOURCE_ERROR_MESSAGE
class-attribute
instance-attribute
¶
NOT_CORRECTLY_ATTACHED_SOURCE_ERROR_MESSAGE = "The provided PaymentMethod was previously used with a PaymentIntent without Customer attachment, shared with a connected account without Customer attachment, or was detached from a Customer."
PROCESSED_CHARGE_EVENT_TYPES
class-attribute
instance-attribute
¶
PROCESSED_DISPUTE_EVENT_TYPES
class-attribute
instance-attribute
¶
PROCESSED_PAYMENT_INTENT_EVENT_TYPES
class-attribute
instance-attribute
¶
SUSPENDED_SOURCE_ERROR_MESSAGES
class-attribute
instance-attribute
¶
SUSPENDED_SOURCE_ERROR_MESSAGES = [
IBAN_SUSPENDED_ERROR_MESSAGE,
IBAN_HIGH_LIKELIHOOD_OF_CHARGEBACK_MESSAGE,
INVALID_MANDATE_FOR_SOURCE_ERROR_MESSAGE,
DETACHED_SOURCE_ERROR_MESSAGE,
NOT_CORRECTLY_ATTACHED_SOURCE_ERROR_MESSAGE,
UNEXPECTED_ERROR_MESSAGE,
INVALID_IBAN_ERROR_MESSAGE,
FAILED_PAYMENT,
]
UNEXPECTED_ERROR_MESSAGE
class-attribute
instance-attribute
¶
create_stripe_customer ¶
Source code in shared/services/payment_providers/stripe/base_stripe.py
on_cash_balance_funds_available
abstractmethod
¶
on_cash_balance_transaction
abstractmethod
¶
on_charge_event
abstractmethod
¶
on_dispute_created
abstractmethod
¶
on_dispute_funds_withdrawn
abstractmethod
¶
on_dispute_lost
abstractmethod
¶
on_intent_canceled
abstractmethod
¶
on_intent_created
abstractmethod
¶
on_intent_partially_funded
abstractmethod
¶
on_refund_updated
abstractmethod
¶
on_source_transaction_sepa_credit_transfer_created
abstractmethod
¶
process_webhook ¶
Process the data from the webhook.
Source code in shared/services/payment_providers/stripe/base_stripe.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
process_webhook_cash_balance ¶
Source code in shared/services/payment_providers/stripe/base_stripe.py
process_webhook_cash_balance_transaction ¶
As STRIPE documentation is not entirely clear here is an example of the cash_balance_transaction object: The object when the funds arrive look like this { 'id': 'ccsbtxn_1QIXU8IInYkvhSGNqnTjx1Wi', 'object': 'customer_cash_balance_transaction', 'created': 1730992740, 'currency': 'eur', 'customer': 'cus_R8C9gB1qOwdKPm', 'ending_balance': 5900, 'funded': { 'bank_transfer': { 'eu_bank_transfer': { 'bic': 'COBADEFFXXX', 'iban_last4': '3000', 'sender_name': 'Test Sender' }, 'reference': 'zsolt_test43', 'type': 'eu_bank_transfer' } }, 'livemode': False, 'net_amount': 1300, 'type': 'funded' } Then the payment intent is applied on the funds: { 'id': 'ccsbtxn_1QKKAmIInYkvhSGNO4ouc5pL', 'object': 'customer_cash_balance_transaction', 'applied_to_payment': { 'payment_intent': 'pi_3QKKAlIInYkvhSGN0CVK4Vlc' }, 'created': 1731418224, 'currency': 'eur', 'customer': 'cus_R8C9gB1qOwdKPm', 'ending_balance': 0, 'livemode': False, 'net_amount': -2700, 'type': 'applied_to_payment' }
Source code in shared/services/payment_providers/stripe/base_stripe.py
process_webhook_charge ¶
Source code in shared/services/payment_providers/stripe/base_stripe.py
process_webhook_dispute ¶
Source code in shared/services/payment_providers/stripe/base_stripe.py
process_webhook_payment_intent ¶
Source code in shared/services/payment_providers/stripe/base_stripe.py
process_webhook_refund ¶
Source code in shared/services/payment_providers/stripe/base_stripe.py
process_webhook_source ¶
Source code in shared/services/payment_providers/stripe/base_stripe.py
process_webhook_source_transaction ¶
For info, since this isn't well documented in the Stripe docs, the source_transaction dict looks like this { 'id': 'srctxn_1Gmgj4AvZBiC5m0dFFMiXTU5', 'object': 'source_transaction', 'amount': 1000, 'created': 1590414742, 'currency': 'eur', 'livemode': False, 'sepa_credit_transfer': { 'sender_iban': 'DE89370400440532013000', 'sender_name': 'Jenny Rosen' }, 'source': 'src_1Gmgj3AvZBiC5m0dSmclLnHx', 'status': 'succeeded', 'type': 'sepa_credit_transfer' }
Source code in shared/services/payment_providers/stripe/base_stripe.py
update_stripe_customer ¶
Source code in shared/services/payment_providers/stripe/base_stripe.py
verify_webhook ¶
Verify if the connection made via the webhook is valid.
Throws ValueError if payload is invalid and SignatureVerificationError if webhook signature is invalid.
Source code in shared/services/payment_providers/stripe/base_stripe.py
shared.services.payment_providers.stripe.entities ¶
CashBalanceEvent
dataclass
¶
CashBalanceTransactionEvent
dataclass
¶
ChargeEvent
dataclass
¶
ChargeEvent(
charge_id,
payment_intent_id,
status,
refunds,
created,
outcome=None,
failure_code=None,
payment_method=None,
payment_method_details=None,
metadata=None,
)
DisputeEvent
dataclass
¶
OutcomeEvent
dataclass
¶
PaymentIntentEvent
dataclass
¶
PaymentIntentPartiallyFundedEvent
dataclass
¶
PaymentIntentPartiallyFundedEvent(
payment_intent_id,
amount,
contract_ref,
contract_type,
contract_identifier,
invoice_number,
amount_remaining,
)
PaymentMethodDetails
dataclass
¶
RefundData
dataclass
¶
RefundEvent
dataclass
¶
SourceTransactionEvent
dataclass
¶
StripeCashBalanceEventType ¶
Bases: AlanBaseEnum
funds_available
class-attribute
instance-attribute
¶
StripeCashBalanceTransactionEventType ¶
Bases: AlanBaseEnum
transaction_created
class-attribute
instance-attribute
¶
StripeCashBalanceTransactionType ¶
Bases: AlanBaseEnum
StripeChargeEventType ¶
Bases: AlanBaseEnum
StripeCheckoutMode ¶
StripeCustomerAddressData
dataclass
¶
StripeCustomerData
dataclass
¶
StripeCustomerData(
name,
description,
customer_type,
email=None,
preferred_locales=None,
address=None,
)
StripeDisputeEventType ¶
StripeDisputeStatus ¶
StripeIBANData
dataclass
¶
StripeIBANOwner
dataclass
¶
StripeIBANOwnerAddress
dataclass
¶
StripeIBANOwnerAddress(
city=None,
country=None,
line1=None,
line2=None,
postal_code=None,
state=None,
)
StripePaymentCard
dataclass
¶
StripePaymentIntentEventType ¶
StripeRefundEventType ¶
Bases: AlanBaseEnum