Skip to content

Reminix with Stripe

Stripe tells you the moment something happens to a payment. With Reminix, that moment runs your team’s script: a dispute opens, and the script handles it. The script calls Stripe’s API with your key, without ever reading it. Setting it up takes one trigger and one event destination.

Save your Stripe key once. Reminix adds it only to requests to api.stripe.com:

Terminal window
printf %s "$STRIPE_KEY" | reminix secrets set STRIPE_KEY --hosts api.stripe.com

The script’s reminix.json declares the request input that a webhook trigger fills, the host and where the key goes:

{
"command": "python dispute.py",
"inputSchema": {
"type": "object",
"required": ["request"],
"properties": { "request": { "type": "object" } }
},
"hosts": ["api.stripe.com"],
"secrets": {
"STRIPE_KEY": {
"host": "api.stripe.com",
"header": "Authorization",
"format": "Bearer {secret}"
}
}
}

The script reads Stripe’s event from its request input. It sends no key:

import json
import os
import requests
with open(os.environ["REMINIX_INPUTS_FILE"]) as f:
event = json.load(f)["request"]["body"]
dispute = event["data"]["object"]
closed = requests.post(
f"https://api.stripe.com/v1/disputes/{dispute['id']}/close"
).json()
print(json.dumps({"dispute": closed["id"], "status": closed["status"]}))

On the script’s page, choose Triggers → Add trigger, then When something calls its webhook URL. Choose The whole request under Inputs, and leave No signature for now. Reminix shows the URL once. Copy it.

  1. In Stripe, open the Webhooks tab in Workbench.
  2. Click Create an event destination, and choose Your account.
  3. Choose the Snapshot payload, so the event carries the whole object.
  4. Choose the events the script handles, such as charge.dispute.created.
  5. Choose Webhook endpoint, and enter the trigger’s URL.

Stripe then shows the endpoint’s signing secret, whsec_…. Give it to the trigger, whose id is in its URL after /webhooks/:

Terminal window
curl -X PATCH https://api.reminix.com/v1/scripts/stripe-dispute/triggers/$TRIGGER_ID \
-H "Authorization: Bearer $REMINIX_TOKEN" -H "X-Workspace: acme" \
-H "Content-Type: application/json" \
-d '{ "signature": "stripe", "signingSecret": "whsec_…" }'

From then on, Reminix refuses a call without a valid Stripe-Signature header, or with one older than 5 minutes.

When a customer disputes a charge, Stripe calls the trigger, and Reminix answers 202. The trigger’s Recent calls lists the call, and the run’s page shows the event and what the script printed. Stripe sends an event again when it doesn’t hear back. Reminix starts one run per event, by the event’s id.

To have a person approve each run before money moves, open the script’s Settings and, under Approval, choose Agents need approval. Run a script when Stripe calls builds the whole dispute script, with its $50 cap and the approval step.