1 | type Stripe = { |
2 | token: string; |
3 | }; |
4 | |
5 | * Delete test helpers test clocks test clock |
6 | * Deletes a test clock. |
7 | */ |
8 | export async function main(auth: Stripe, test_clock: string) { |
9 | const url = new URL( |
10 | `https://api.stripe.com/v1/test_helpers/test_clocks/${test_clock}` |
11 | ); |
12 |
|
13 | const response = await fetch(url, { |
14 | method: "DELETE", |
15 | headers: { |
16 | "Content-Type": "application/x-www-form-urlencoded", |
17 | Authorization: "Bearer " + auth.token, |
18 | }, |
19 | body: undefined, |
20 | }); |
21 | if (!response.ok) { |
22 | const text = await response.text(); |
23 | throw new Error(`${response.status} ${text}`); |
24 | } |
25 | return await response.json(); |
26 | } |
27 |
|