Skip to main content
POST
/
api
/
v1
/
subscriptions
/
{id}
/
preview-adjust
Preview Subscription Adjustment
curl --request POST \
  --url https://app.flowglad.com/api/v1/subscriptions/{id}/preview-adjust \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "adjustment": {
    "timing": "<string>",
    "newSubscriptionItems": [
      {
        "subscriptionId": "<string>",
        "addedDate": 0,
        "unitPrice": 4503599627370495,
        "quantity": 4503599627370495,
        "type": "<string>",
        "name": "<string>",
        "priceId": "<string>",
        "metadata": {},
        "externalId": "<string>",
        "expiredAt": 0,
        "manuallyCreated": true
      }
    ],
    "prorateCurrentBillingPeriod": true
  }
}
'
{
  "canAdjust": true,
  "previewGeneratedAt": 0,
  "reason": "<string>",
  "prorationAmount": 123,
  "currentPlanTotal": 123,
  "newPlanTotal": 123,
  "resolvedTiming": "immediately",
  "effectiveDate": 0,
  "isUpgrade": true,
  "percentThroughBillingPeriod": 123,
  "billingPeriodEnd": 0,
  "paymentMethod": {
    "id": "<string>",
    "type": "<string>",
    "last4": "<string>",
    "brand": "<string>"
  },
  "currentSubscriptionItems": [
    {
      "name": "<string>",
      "unitPrice": 123,
      "quantity": 123,
      "priceId": "<string>"
    }
  ],
  "newSubscriptionItems": [
    {
      "name": "<string>",
      "unitPrice": 123,
      "quantity": 123,
      "priceId": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

Path Parameters

id
string
required

Body

application/json
adjustment
object
required

Response

Successful response

canAdjust
boolean
required

Whether the adjustment can be made. If false, the reason field will contain the explanation.

previewGeneratedAt
integer
required

Epoch milliseconds when this preview was generated. Useful for staleness detection.

Required range: -9007199254740991 <= x <= 9007199254740991
reason
string

The reason the adjustment cannot be made, if canAdjust is false.

prorationAmount
number

The proration amount that will be charged, if applicable.

currentPlanTotal
number

The total price of the current plan (sum of unitPrice * quantity for all items).

newPlanTotal
number

The total price of the new plan (sum of unitPrice * quantity for all items).

resolvedTiming
enum<string>

The resolved timing for the adjustment. When auto timing is requested, this indicates whether it resolved to immediate or end-of-period.

Available options:
immediately,
at_end_of_current_billing_period
effectiveDate
integer

Epoch milliseconds when the adjustment will take effect.

Required range: -9007199254740991 <= x <= 9007199254740991
isUpgrade
boolean

Whether this adjustment is an upgrade (true) or downgrade/lateral move (false).

percentThroughBillingPeriod
number

The percentage through the current billing period (0-1).

billingPeriodEnd
integer

Epoch milliseconds when the current billing period ends.

Required range: -9007199254740991 <= x <= 9007199254740991
paymentMethod
object

The payment method that will be charged for immediate adjustments with proration.

currentSubscriptionItems
object[]

The current subscription items.

newSubscriptionItems
object[]

The new subscription items that will be applied.