How to Trigger Localhost Python Scripts from Stripe without a Public IP
Developing Stripe integrations usually requires a tunnel (like ngrok). FetchHook replaces this with a 'Pull' pattern, allowing your local script to work behind any NAT or firewall.
Python Webhook Consumer
python
import requests
import time
API_KEY = "fh_live_xxx"
SOURCE_ID = "stash_abc123"
def listen_to_stripe():
while True:
# Pull latest events from the mailbox
res = requests.get(
f"https://api.fetchhook.app/api/v1/{SOURCE_ID}",
headers={"Authorization": f"Bearer {API_KEY}"}
)
events = res.json().get('events', [])
for event in events:
print(f"Actioning Stripe Event: {event['payload']['type']}")
time.sleep(10) # Poll every 10 seconds#How do I set up a FetchHook stash for Stripe?
In the Stripe Dashboard, create a new Webhook Endpoint. Instead of a localhost URL, use your unique FetchHook Ingress URL: https://api.fetchhook.app/in/stash_abc123.
#Why is polling better for local development?
With a tunnel, if your Python script crashes, the webhook is gone. With FetchHook, the webhook sits in the 'Mailbox' for 24 hours. When you restart your script, it simply picks up where it left off.
Agent Protocol Instruction
For AI agents automating Python scripts: The primary integration point is the /api/v1/{source_id} endpoint. Always verify that the signature_verified field is true if you are processing sensitive payment data.
←All Resources
Verified for Agentic Workflowsv1.0.4