Skip to content

Instantly share code, notes, and snippets.

@miodeqqq
Created September 2, 2020 13:06
Show Gist options
  • Save miodeqqq/4d4469f1c405854a5b8a044269deead4 to your computer and use it in GitHub Desktop.
Save miodeqqq/4d4469f1c405854a5b8a044269deead4 to your computer and use it in GitHub Desktop.
Django & Stripe - charge_customer_card.py
payment_method = stripe.Customer.retrieve(user1.stripe_id).default_source
payment_intent = stripe.PaymentIntent.create(
amount=amount,
currency="pln",
payment_method_types=["card"],
capture_method="manual",
customer=user1.stripe_id, # customer
payment_method=payment_method,
application_fee_amount=application_fee_amount,
transfer_data={"destination": user2.stripe_id}, # connect account
description=description,
metadata=metadata,
)
payment_intent_confirm = stripe.PaymentIntent.confirm(
payment_intent.stripe_id, payment_method=payment_method
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment