Simulators
Rate limits
Test how your integration backs off when Stripe refuses a request for speed. With rate_limits: real on, the simulator applies the limits Rate limits lists. Each limit’s window opens at its first request. The search endpoints share 20 requests a second and every request counts toward 25 a second. Control routes such as /_rystic/network count toward neither. Send 41 searches over one connection, then 6 other requests and one more search in the same second, then reset:
SEARCH="$RYSTIC_URL/v1/customers/search?query=email%3A%27dev%40example.com%27"
curl -s -X POST "$RYSTIC_URL/_rystic/network" -o /dev/null -w '%{http_code}\n' -d '{"rate_limits": "real"}'
# -> 204
curl -s -u sk_test_123: -w '%{http_code}\n' $(for i in $(seq 41); do echo "-o /dev/null $SEARCH"; done) | sort | uniq -c | awk '{print $2, $1}'
# -> 200 20
# -> 429 21
curl -s -u sk_test_123: -w '%{http_code}\n' $(for i in $(seq 6); do echo "-o /dev/null $RYSTIC_URL/v1/customers?limit=1"; done) | sort | uniq -c | awk '{print $2, $1}'
# -> 200 5
# -> 429 1
curl -s -u sk_test_123: "$SEARCH" | jq -r .error.type
# -> invalid_request_error
curl -s -X POST "$RYSTIC_URL/_rystic/reset" -o /dev/null -w '%{http_code}\n'
# -> 204
curl -s "$RYSTIC_URL/_rystic/network" | jq -r .rate_limits
# -> real
curl -s -u sk_test_123: "$SEARCH" | jq -r .object
# -> search_result
The 21 refused searches counted toward no limit, so 5 other requests fit in the 25 a second and the sixth was refused. A refused request returns Stripe’s 429 body, whose error.type is invalid_request_error. A reset restores every allowance while the setting stays on.
Last updated on