【问题标题】:Creating a Stripe Refund via Code by ZapierZapier 通过代码创建条纹退款
【发布时间】:2021-05-18 12:41:57
【问题描述】:

我一直在尝试通过 Zapier 的代码在 Stripe 中创建退款,使用此答案中的 python 代码:Is is possible to create a Stripe refund action in Zapier?

当我尝试在 Zapier 中测试该步骤时,我收到“ModuleNotFoundError: no module named 'stripe'”。

我的代码如下所示:

import stripe
stripe.api_key = "myAPIkey"

stripe.Refund.create(
  charge = input_data["charge"],
)

我错过了什么?

【问题讨论】:

    标签: stripe-payments zapier


    【解决方案1】:

    https://zapier.com/help/create/code-webhooks/use-python-code-in-zaps

    您不能要求外部库或安装通常称为“pip 模块”的库。 Code 应用程序中只有标准 Python 库和请求可用,并且请求已包含在命名空间中。

    (免责声明,我从未使用过 Zapier,但是)据我所知,这意味着您不能使用 Stripe 的官方 Python 库之类的库(您的错误消息是它现在已安装)。

    相反,您需要通过使用requests 库将https://stripe.com/docs/api/curl#create_refund 直接转换为对Stripe 的REST API 的调用来进行此调用。请记住,您需要提供an API key(Making an API call in Python with an API that requires a bearer token)

    【讨论】:

      猜你喜欢
      • 2017-04-15
      • 1970-01-01
      • 2023-02-03
      • 2018-07-21
      • 2020-05-23
      • 2021-03-01
      • 2023-03-06
      • 2021-02-23
      • 2020-12-01
      相关资源
      最近更新 更多