ZIm/crates/collab/src/api
Marshall Bowers 66121fa0e8
collab: Add endpoint for managing a billing subscription (#15455)
This PR adds a new `POST /billing/subscriptions/manage` endpoint that
can be used to manage a billing subscription.

The endpoint accepts a `github_user_id` to identify the user, as well as
an optional `subscription_id` for managing a specific subscription. If
`subscription_id` is not provided, it try and use the active
subscription, if there is only one.

Right now the endpoint only supports cancelling an active subscription.
This is done by passing `"intent": "cancel"` in the request body.

The endpoint will return the URL to a Stripe customer portal session,
which the caller can redirect the user to.

Here's an example of how to call it:

```sh
curl -X POST "http://localhost:8080/billing/subscriptions/manage" \
     -H "Authorization: <ADMIN_TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{"github_user_id": 12345, "intent": "cancel"}'
```

Release Notes:

- N/A
2024-07-29 20:05:17 -04:00
..
billing.rs collab: Add endpoint for managing a billing subscription (#15455) 2024-07-29 20:05:17 -04:00
contributors.rs collab: Extract contributor endpoints to their own module (#15251) 2024-07-25 23:02:32 -04:00
events.rs Add repl events (#15259) 2024-07-26 03:31:41 -04:00
extensions.rs collab: Fix exact extension filtering (#14591) 2024-07-16 15:18:48 -04:00
ips_file.rs Extract SemanticVersion into its own crate (#9956) 2024-03-29 12:11:57 -04:00
slack.rs Upload crashes to collab directly (#8649) 2024-03-01 13:23:44 -07:00