cURL
curl --request GET \
--url https://us.api.flexprice.io/v1/subscriptions/{id}/grants/upcoming \
--header 'x-api-key: <api-key>'from flexprice import Flexprice
with Flexprice(
api_key_auth="<YOUR_API_KEY_HERE>",
) as f_client:
res = f_client.subscriptions.get_subscription_upcoming_grants(id="<id>")
# Handle response
print(res)import { Flexprice } from "@flexprice/sdk";
const flexprice = new Flexprice({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await flexprice.subscriptions.getSubscriptionUpcomingGrants("<id>");
console.log(result);
}
run();package main
import(
"context"
flexprice "github.com/flexprice/go-sdk/v2"
"log"
)
func main() {
ctx := context.Background()
s := flexprice.New(
flexprice.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Subscriptions.GetSubscriptionUpcomingGrants(ctx, "<id>")
if err != nil {
log.Fatal(err)
}
if res.ListCreditGrantApplicationsResponse != nil {
// handle response
}
}{
"items": [
{
"application_reason": "first_time_recurring_credit_grant",
"application_status": "applied",
"applied_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_id": "<string>",
"credits": "<string>",
"environment_id": "<string>",
"failure_reason": "<string>",
"id": "<string>",
"idempotency_key": "<string>",
"metadata": {},
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z",
"retry_count": 123,
"scheduled_for": "<string>",
"status": "published",
"subscription_id": "<string>",
"subscription_status_at_application": "active",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"pagination": {
"limit": 123,
"offset": 123,
"total": 123
}
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}Subscriptions
Get upcoming credit grant applications
Use when showing upcoming or pending credits for a subscription (e.g. in a portal or for forecasting).
GET
/
subscriptions
/
{id}
/
grants
/
upcoming
cURL
curl --request GET \
--url https://us.api.flexprice.io/v1/subscriptions/{id}/grants/upcoming \
--header 'x-api-key: <api-key>'from flexprice import Flexprice
with Flexprice(
api_key_auth="<YOUR_API_KEY_HERE>",
) as f_client:
res = f_client.subscriptions.get_subscription_upcoming_grants(id="<id>")
# Handle response
print(res)import { Flexprice } from "@flexprice/sdk";
const flexprice = new Flexprice({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await flexprice.subscriptions.getSubscriptionUpcomingGrants("<id>");
console.log(result);
}
run();package main
import(
"context"
flexprice "github.com/flexprice/go-sdk/v2"
"log"
)
func main() {
ctx := context.Background()
s := flexprice.New(
flexprice.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Subscriptions.GetSubscriptionUpcomingGrants(ctx, "<id>")
if err != nil {
log.Fatal(err)
}
if res.ListCreditGrantApplicationsResponse != nil {
// handle response
}
}{
"items": [
{
"application_reason": "first_time_recurring_credit_grant",
"application_status": "applied",
"applied_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_id": "<string>",
"credits": "<string>",
"environment_id": "<string>",
"failure_reason": "<string>",
"id": "<string>",
"idempotency_key": "<string>",
"metadata": {},
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z",
"retry_count": 123,
"scheduled_for": "<string>",
"status": "published",
"subscription_id": "<string>",
"subscription_status_at_application": "active",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"pagination": {
"limit": 123,
"offset": 123,
"total": 123
}
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}
