Ejemplo n.º 1
0
 def get(self):
    getexp_response = paypal.get_express_checkout_details(token=request.args.get('token', ''))
    
    if getexp_response['ACK'] == 'Success':
        return render_template("confirm_payment.html", token=getexp_response['TOKEN']) 
    else:
        return render_template("paypal_error.html", message=getexp_response['ACK'])
Ejemplo n.º 2
0
    def get(self, token):
        getexp_response = paypal.get_express_checkout_details(token=token)
        kw = {
            'amt': getexp_response['AMT'],
            'currencycode': getexp_response['CURRENCYCODE'],
            'paymentaction': 'Sale',
            'token': token,
            'payerid': getexp_response['PAYERID']
        }
        paypal.do_express_checkout_payment(**kw)

        return redirect(url_for('paypal_status', token=kw['token']))
Ejemplo n.º 3
0
    def get(self, token):
        checkout_response = paypal.get_express_checkout_details(token=token)

        if checkout_response['CHECKOUTSTATUS'] == 'PaymentActionCompleted':
            p = Purchase.query.filter_by(token=token).one()
            u = User.query.get(p.uid)
            p.confirm_payment()
            u.activated = True
            db_session.commit()

            return render_template("confirm.html")
        else:
            return render_template("paypal_error.html", message=checkout_response['CHECKOUTSTATUS'])