Skip to content

Instantly share code, notes, and snippets.

@homanp
Created March 23, 2016 20:53
Show Gist options
  • Save homanp/7b30ae583de9f64ce053 to your computer and use it in GitHub Desktop.
Save homanp/7b30ae583de9f64ce053 to your computer and use it in GitHub Desktop.
class BillingCard(generics.UpdateAPIView):
permission_classes = (IsAuthenticated,)
def post(self, request):
cc_token = request.DATA.get('cc_token', None)
if cc_token:
company = helpers.create_customer(self, cc_token)
serializer = CompanySerializer(company)
return Response(serializer.data, status=status.HTTP_200_OK)
else:
return Response('No cc_token in request',
status=status.HTTP_400_BAD_REQUEST)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment