#aemdeei-react-python
1 messages · Page 1 of 1 (latest)
def charge_customer(customer_id):
# Lookup the payment methods available for the customer
payment_methods = stripe.PaymentMethod.list(
customer=customer_id,
type='card'
)
# Charge the customer and payment method immediately
try:
stripe.PaymentIntent.create(
amount=1099,
currency='eur',
customer=customer_id,
payment_method=payment_methods.data[0].id,
off_session=True,
confirm=True
)
except stripe.error.CardError as e:
err = e.error
# Error code will be authentication_required if authentication is needed
print('Code is: %s' % err.code)
payment_intent_id = err.payment_intent['id']
payment_intent = stripe.PaymentIntent.retrieve(payment_intent_id)
This one
And you are wondering why it isn't invoked?