Generic function for creating a payment token from the
    payment backend. Some payment backends (e.g. braintree) support creating a payment
    token, which should be imported from the backend as 'get_token'

def create_token(request):
    """ Generic function for creating a payment token from the
    payment backend. Some payment backends (e.g. braintree) support creating a payment
    token, which should be imported from the backend as 'get_token'
    """
    token = GATEWAY.get_token(request)
    return Response({'token': token}, status=status.HTTP_200_OK)