This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# managers.py | |
from django.contrib.auth.base_user import BaseUserManager | |
from django.utils.translation import ugettext_lazy as _ | |
class UserManager(BaseUserManager): | |
""" | |
Custom User manager to be used with default auth User model. | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stripe.PaymentIntent.cancel(payment_intent.id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stripe.Charge.create( | |
amount=amount, | |
currency="pln", | |
source=user2.stripe_id, | |
description=description | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stripe.Balance.retrieve(stripe_account=user2.stripe_id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stripe.PaymentIntent.capture( | |
payment_intent.id, amount_to_capture=amount | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new_card_source = stripe.Customer.create_source(user1.stripe_id, source=token) | |
stripe.SetupIntent.create( | |
payment_method_types=["card"], | |
customer=user1.stripe_id, | |
description="some description", | |
payment_method=new_card_source.id, | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
passport_front = stripe.File.create( | |
purpose="identity_document", | |
file=_file, # ContentFile object | |
stripe_account=user2.stripe_id, | |
) | |
individual = { | |
"verification": { | |
"document": {"front": passport_front.get("id"),}, | |
"additional_document": {"front": passport_front.get("id"),}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tos_acceptance = {"date": int(time.time()), "ip": user_ip}, | |
stripe.Account.modify(user2.stripe_id, tos_acceptance=tos_acceptance) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mcc_code, url = "1520", "https://www.softserveinc.com/" | |
response_ca = stripe.Account.create( | |
type="custom", | |
country="PL", | |
email=user2.email, | |
default_currency="pln", | |
business_type="individual", | |
settings={"payouts": {"schedule": {"interval": "manual", }}}, | |
requested_capabilities=["card_payments", "transfers", ], |
NewerOlder