예제 #1
0
 def __init__(self, config=None, auth=None):
     if config is None:
         self.config = PaypalLiveConf()
     else:
         self.config = config
     self.access_token = auth.content.token
     self.headers = utils.checkout_header(self.access_token)
     self.intent = 'sale'
     self.method = 'paypal'
     self.return_url = ''
     self.cancel_url = ''
     self.price = ''
     self.response = None
예제 #2
0
    def checkout(self):
        ''' Simple express checkout with paypal method '''
        headers = utils.checkout_header(self.access_token)
        data = self.build_data()

        response = requests.post(config.checkout_url,
                                 headers=headers, data=self.build_data())

        if response.status_code == 201:
            parse = PayalCheckoutResponse(content=response.content)
            return parse
        else:
            self.response = None
            raise Exception('Error at checkout')