PagSeguro没有返回重定向URL

时间:2017-02-11 23:09:16

标签: python xml

我正在尝试设置PagSeguro(巴西的PayPal)并使用this python library

进行设置

我已经创建了一个示例脚本来尝试获取返回的URL,但每次它总是返回none。 (我在脚本中加入了真正的令牌和电子邮件)

from pagseguro import PagSeguro


config = {'sandbox': True}

pg = PagSeguro(email="email", token="token", config=config)

pg.sender = {
    "name": "Bruno Rocha",
    "area_code": 11,
    "phone": 981001213,
    "email": "rochacbruno@gmail.com",
}

pg.shipping = {
    "type": pg.SEDEX,
    "street": "Av Brig Faria Lima",
    "number": 1234,
    "complement": "5 andar",
    "district": "Jardim Paulistano",
    "postal_code": "06650030",
    "city": "Sao Paulo",
    "state": "SP",
    "country": "BRA"
}
pg.reference = "00123456789"

pg.items = [
    {"id": "0001", "description": "Produto 1", "amount": 354.20, "quantity": 2, "weight": 200},
    {"id": "0002", "description": "Produto 2", "amount": 50, "quantity": 1, "weight": 1000}
]

pg.redirect_url = "http://meusite.com/obrigado"

pg.notification_url = "http://meusite.com/notification"

response = pg.checkout()
print(response.payment_url)

如果我尝试在没有payment_url的情况下打印响应,则会打印一个对象,但我不确定如何解析它。

1 个答案:

答案 0 :(得分:1)

看看是否正在做:

FreeOnTerminate

为您提供了获取更多信息所需的其他密钥名称。