move over relevant code from django-paypal-adaptive