def sync_from_stripe_data(
        cls,
        data,
        api_key=djstripe_settings.STRIPE_SECRET_KEY,
        stripe_version=djstripe_settings.STRIPE_API_VERSION,
    ):
        """
        Syncs this object from the stripe data provided.

        Foreign keys will also be retrieved and synced recursively.

        :param data: stripe object
        :type data: dict
        :rtype: cls
        """
        current_ids = set()
        data_id = data.get("id")
        stripe_account = getattr(data, "stripe_account", None)

        if data_id:
            # stop nested objects from trying to retrieve this object before
            # initial sync is complete
            current_ids.add(data_id)

        instance, created = cls._get_or_create_from_stripe_object(
            data,
            current_ids=current_ids,
            stripe_account=stripe_account,
            api_key=api_key,
        )

        if not created:
            record_data = cls._stripe_object_to_record(
                data, api_key=api_key, stripe_account=stripe_account
            )
            for attr, value in record_data.items():
                setattr(instance, attr, value)
            instance._attach_objects_hook(
                cls, data, api_key=api_key, current_ids=current_ids
            )
            instance.save()
            instance._attach_objects_post_save_hook(cls, data, api_key=api_key)

        for field in instance._meta.concrete_fields:
            if isinstance(field, (StripePercentField, models.UUIDField)):
                # get rid of cached values
                delattr(instance, field.name)

        return instance

        Syncs this object from the stripe data provided.

        Foreign keys will also be retrieved and synced recursively.

        :param data: stripe object
        :type data: dict
        :rtype: cls
        
djstripe/models/base.py