【问题标题】:Stripe Refunds Error条纹退款错误
【发布时间】:2017-04-15 14:47:38
【问题描述】:

我正在使用带有 Python 2.7 的 Stripe Python 库版本 1.23.0。当我尝试使用以下代码处理退款时

import stripe
stripe.api_key = <my_api_key>
refund = stripe.Refund.create(
        charge=payment_id.stripe_id
    )

我收到一个错误

'module'对象没有Refund属性

我检查了初始化文件,确实没有导入退款。

我检查了条纹支持,他们说

在我们库的 1.25.0 版本中添加了 Refund 对象

我找不到任何关于库版本 1.23 中如何处理退款的文档

【问题讨论】:

  • @Anoop 的响应是正确的,你可以在charge 对象上调用refund 方法。也就是说,您应该能够毫无问题地升级到最新版本的 Stripe Python 绑定 (1.43.0):当引入向后不兼容的更改时,Stripe 会增加主要版本号。

标签: python python-2.7 stripe-payments stripe-connect


【解决方案1】:

试试这个,

import stripe
stripe.api_key = <my_api_key>
resp = stripe.Charge.retrieve(charge_id)
resp.refund()

【讨论】:

    猜你喜欢
    • 2023-02-03
    • 2021-03-01
    • 2021-05-18
    • 2021-07-08
    • 2014-08-27
    • 2021-07-02
    • 2019-02-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多