0

I've been trying to create a refund in Stripe via code by Zapier, using the python code from this answer: Is is possible to create a Stripe refund action in Zapier?

I'm receiving a "ModuleNotFoundError: no module named 'stripe'" when I attempt to test the step in Zapier.

My code looks something like this:

import stripe
stripe.api_key = "myAPIkey"

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

What am I missing?

xavdid
  • 4,430
  • 2
  • 18
  • 29

1 Answers1

1

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

You cannot require external libraries or install libraries commonly referred to as "pip modules". Only the standard Python library and requests are available in the Code app and requests is already included in the namespace.

(disclaimer, I've never used Zapier, but)As far as I know, that means you can't use a library like Stripe's official Python library(your error message is that it's now installed).

Instead you'd need to make this call by translating https://stripe.com/docs/api/curl#create_refund directly into calls to Stripe's REST API using the requests library. Remember that you need to supply an API key with it(Making an API call in Python with an API that requires a bearer token)

karllekko
  • 3,229
  • 1
  • 5
  • 11