Billing ยท version 0.1.0
Create a customer portal session
POST
/api/billing/portalRequest
curl -X POST 'https://sourced.sh/api/billing/portal' \
-H 'Authorization: Bearer $SOURCED_API_KEY' \
-H 'Content-Type: application/json' \
-d '{}'
const response = await fetch("https://sourced.sh/api/billing/portal", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SOURCED_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({}),
});
const data = await response.json();
import os
import requests
response = requests.request(
"POST",
"https://sourced.sh/api/billing/portal",
headers={"Authorization": f"Bearer {os.environ['SOURCED_API_KEY']}"},
json={},
)
data = response.json()
Request body
application/json
type: object
properties:
returnUrl: string
Responses
200
Hosted billing portal URL.
application/json
type: object
required: url
properties:
url (required): string
400
The workspace does not have a Stripe customer yet, or Stripe rejected the portal request.
application/json
Error:
type: object
required: error
properties:
error (required): string
Stable machine-readable error code.
message: string
Optional human-readable description.
401
403
423
The billing portal is temporarily locked because live Stripe keys are not active in production.
application/json
Error:
type: object
required: error
properties:
error (required): string
Stable machine-readable error code.
message: string
Optional human-readable description.
501
Stripe billing portal is not configured.
application/json
Error:
type: object
required: error
properties:
error (required): string
Stable machine-readable error code.
message: string
Optional human-readable description.
502
Stripe billing portal could not be reached or returned an invalid response.
application/json
Error:
type: object
required: error
properties:
error (required): string
Stable machine-readable error code.
message: string
Optional human-readable description.