@receiver(user_registered, sender=StripeSubscriptionBackend, \
    dispatch_uid='profiles.receivers.link_stripe_customer')
def link_stripe_customer(sender, user, request, customer, plan=None, **kwargs):
    user_profile = user.get_profile()
    user_profile.customer_id = customer.id
    user_profile.card_last4 = customer.active_card.last_4
    user_profile.plan = plan

    try:
        user_profile.trial_end = datetime.utcfromtimestamp(customer.subscription.trial_end)
    except __HOLE__:
        pass

    user_profile.save()

    upcoming_invoice_updated.send(sender=None, customer=customer)
dataset/ETHPy150Open amccloud/django-stripe/example/profiles/receivers.py/link_stripe_customer