For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inGet Paid
DocumentationAPI Reference
DocumentationAPI Reference
  • Introduction
    • Overview
  • API Reference
      • GETList orders
      • POSTCreate order
      • GETGet order by ID
      • DELDelete order
      • POSTActivate order
      • POSTActivate order and process payment
      • POSTCancel order renewal
      • POSTSchedule a plan change with proration
      • GETGet invoices for an order
LogoLogo
Log inGet Paid
API Referenceorders

Schedule a plan change with proration

POST
https://api.agentpaid.io/api/v1/orders/:orderId/schedule-plan-change
POST
/api/v1/orders/:orderId/schedule-plan-change
1import { PaidClient } from "@paid-ai/paid-node";
2
3async function main() {
4 const client = new PaidClient({
5 token: "YOUR_TOKEN_HERE",
6 });
7 await client.orders.schedulePlanChange("orderId", {
8 orderVersion: 1,
9 effectiveDate: new Date("2025-02-01T00:00:00.000Z"),
10 updatedOrderLineAttributes: [
11 {
12 orderLineAttributeId: "a1b2c3d4-5678-90ab-cdef-1234567890ab",
13 newPricing: {
14 "unitPrice": 200,
15 "currency": "USD",
16 },
17 newQuantity: 10,
18 },
19 ],
20 });
21}
22main();
1{
2 "orderId": "63fd642c-569d-44f9-8d67-5cf4944a16cc",
3 "amendmentId": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
4 "version": 2,
5 "effectiveDate": "2025-02-01T00:00:00.000Z",
6 "endedLineIds": [
7 "old-line-id-1"
8 ],
9 "createdLineIds": [
10 "new-line-id-1"
11 ],
12 "creditLineIds": [
13 "credit-line-id-1"
14 ],
15 "prorationDetails": [
16 {
17 "oldAttributeId": "old-attr-id",
18 "newAttributeId": "new-attr-id",
19 "creditLineId": "credit-line-id-1",
20 "oldPrice": 100,
21 "newPrice": 200,
22 "creditAmount": 50,
23 "remainingDays": 15,
24 "totalDaysInCycle": 30
25 }
26 ]
27}
Schedules a plan upgrade or downgrade for an order with automatic proration calculation. Credits are applied for the unused portion of the current billing period.
Was this page helpful?
Previous

Get invoices for an order

Next
Built with

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

orderIdstringRequired

The order ID (can be internal ID or display ID)

Request

This endpoint expects an object.
orderVersionintegerRequired>=1

The current version of the order (for optimistic locking)

effectiveDatedatetimeRequired

The date when the plan change should take effect (ISO 8601 format)

updatedOrderLineAttributeslist of objectsRequired
The list of order line attributes to update

Response

Plan change scheduled successfully
orderIdstringformat: "uuid"
The ID of the order
amendmentIdstringformat: "uuid"
The ID of the amendment record
versioninteger
The new version of the order after the amendment
effectiveDatedatetime
The effective date of the plan change
endedLineIdslist of strings
IDs of order lines that were ended
createdLineIdslist of strings
IDs of new order lines that were created
creditLineIdslist of strings
IDs of credit lines that were created
prorationDetailslist of objects
Detailed proration calculations for each updated attribute

Errors

400
Bad Request Error
403
Forbidden Error
404
Not Found Error