微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Zapier 通过代码创建条纹退款

如何解决Zapier 通过代码创建条纹退款

我一直在尝试通过 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"],)

我错过了什么?

解决方法

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)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。