BillingAgreement.objects.create(
agreement_id=resource.id, user=request.user, plan=plan, active=active, token=token)
else:
resource = None
if app:
BillingAgreement.objects.create(
agreement_id=resource.id, user=request.user, plan=plan, active=active, token=token)
else:
resource = None
if app: