@crvouga/mockingbird-service-paddle 1.3.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,8 +53,38 @@ var CORE_MIGRATIONS = [
53
53
  `
54
54
  }
55
55
  ];
56
+ var LEGACY_TABLES = [
57
+ ["emulates_records", "mockingbird_records"],
58
+ ["emulators_records", "mockingbird_records"],
59
+ ["emulates_sequences", "mockingbird_sequences"],
60
+ ["emulators_sequences", "mockingbird_sequences"]
61
+ ];
62
+ var LEGACY_INDEXES = [
63
+ ["emulates_records_seq", "mockingbird_records_seq"],
64
+ ["emulators_records_seq", "mockingbird_records_seq"]
65
+ ];
66
+ var namesOf = (sqlite, type) => new Set(sqlite.prepare("SELECT name FROM sqlite_master WHERE type = ?").all(type).map((row) => row.name));
56
67
  var migrateCore = (sqlite) => {
57
68
  migrate(sqlite, CORE_MIGRATIONS);
69
+ const tables = namesOf(sqlite, "table");
70
+ const indexes = namesOf(sqlite, "index");
71
+ sqlite.transaction(() => {
72
+ for (const [from, to] of LEGACY_TABLES) {
73
+ if (!tables.has(from) || tables.has(to))
74
+ continue;
75
+ sqlite.exec(`ALTER TABLE ${from} RENAME TO ${to}`);
76
+ tables.delete(from);
77
+ tables.add(to);
78
+ }
79
+ for (const [from, to] of LEGACY_INDEXES) {
80
+ if (!indexes.has(from) || indexes.has(to))
81
+ continue;
82
+ sqlite.exec(`DROP INDEX ${from}`);
83
+ sqlite.exec(`CREATE INDEX ${to} ON mockingbird_records (namespace, collection, seq)`);
84
+ indexes.delete(from);
85
+ indexes.add(to);
86
+ }
87
+ });
58
88
  };
59
89
  var clearNamespace = (sqlite, namespace) => {
60
90
  sqlite.transaction(() => {
@@ -2354,7 +2384,7 @@ var stateAdminRoutes = (routes) => {
2354
2384
  };
2355
2385
 
2356
2386
  // ../core/dist/version.js
2357
- var PACKAGE_VERSION = true ? "1.3.0" : UNRELEASED_VERSION;
2387
+ var PACKAGE_VERSION = true ? "2.1.0" : UNRELEASED_VERSION;
2358
2388
 
2359
2389
  // ../core/dist/signing.js
2360
2390
  var encoder = new TextEncoder();
@@ -3716,9 +3746,9 @@ var invalidField = (errors) => new PaddleError(400, "invalid_field", "Request do
3716
3746
  var badRequest = (detail) => new PaddleError(400, "bad_request", detail);
3717
3747
 
3718
3748
  // src/generated/openapi.ts
3719
- var document = JSON.parse(`{"openapi":"3.1.0","info":{"title":"Paddle Billing API (Mockingbird subset)","description":"Stateful mock subset of the Paddle Billing API: customers with their addresses and\\nbusinesses, the catalog (products and prices), transactions with computed totals,\\nsubscriptions with their lifecycle (activate, pause, resume, cancel, one-time charges,\\nrenewals) and the events list. Subscriptions come from paid transactions, as in Paddle:\\nthe mock's admin routes stand in for the hosted checkout and the billing engine.\\n","version":"1","x-mockingbird-upstream":{"note":"Hand-authored from https://developer.paddle.com/api-reference/overview and the wire types of @paddle/paddle-node-sdk@3.10.0 (dist/types/**). Every entity carries the fields the SDK reads; enums are trimmed to representative values so generated requests stay meaningful."}},"servers":[{"url":"https://sandbox-api.paddle.com"}],"security":[{"bearerAuth":[]}],"paths":{"/customers":{"get":{"operationId":"ListCustomers","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/OrderBy"},{"name":"id","in":"query","description":"Comma-separated customer ids.","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"customer","missing":"ctm_00000000000000000000000000"}}},{"name":"email","in":"query","description":"Comma-separated exact email addresses.","schema":{"type":"string","maxLength":120}},{"name":"search","in":"query","description":"Matches id, name or email (case-insensitive substring).","schema":{"type":"string","maxLength":60}},{"$ref":"#/components/parameters/StatusFilter"}],"responses":{"200":{"description":"Customers, newest first","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"operationId":"CreateCustomer","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerCreate"}}}},"responses":{"201":{"description":"The created customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/customers/{customer_id}":{"parameters":[{"$ref":"#/components/parameters/CustomerId"}],"get":{"operationId":"GetCustomer","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"The customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerResponse"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"operationId":"UpdateCustomer","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerUpdate"}}}},"responses":{"200":{"description":"The updated customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/customers/{customer_id}/credit-balances":{"parameters":[{"$ref":"#/components/parameters/CustomerId"}],"get":{"operationId":"GetCustomerCreditBalances","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"One balance per currency the customer holds credit in (none, in the mock)","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"type":"object","required":["customer_id","currency_code","balance"],"properties":{"customer_id":{"type":"string"},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"},"balance":{"type":"object","required":["available","reserved","used"],"properties":{"available":{"type":"string"},"reserved":{"type":"string"},"used":{"type":"string"}}}}}},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/customers/{customer_id}/auth-token":{"parameters":[{"$ref":"#/components/parameters/CustomerId"}],"post":{"operationId":"CreateCustomerAuthToken","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"A customer auth token for Paddle.js","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"object","required":["customer_auth_token","expires_at"],"properties":{"customer_auth_token":{"type":"string","x-mockingbird-volatile":{"kind":"token"}},"expires_at":{"type":"string","x-mockingbird-volatile":{"kind":"timestamp"}}}},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/customers/{customer_id}/addresses":{"parameters":[{"$ref":"#/components/parameters/CustomerId"}],"get":{"operationId":"ListAddresses","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/OrderBy"},{"name":"id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"address","missing":"add_00000000000000000000000000"}}},{"name":"search","in":"query","schema":{"type":"string","maxLength":60}},{"$ref":"#/components/parameters/StatusFilter"}],"responses":{"200":{"description":"The customer's addresses, newest first","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Address"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"operationId":"CreateAddress","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressCreate"}}}},"responses":{"201":{"description":"The created address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/customers/{customer_id}/addresses/{address_id}":{"parameters":[{"$ref":"#/components/parameters/CustomerId"},{"$ref":"#/components/parameters/AddressId"}],"get":{"operationId":"GetAddress","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"The address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressResponse"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"operationId":"UpdateAddress","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressUpdate"}}}},"responses":{"200":{"description":"The updated address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/customers/{customer_id}/businesses":{"parameters":[{"$ref":"#/components/parameters/CustomerId"}],"get":{"operationId":"ListBusinesses","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/OrderBy"},{"name":"id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"business","missing":"biz_00000000000000000000000000"}}},{"name":"search","in":"query","schema":{"type":"string","maxLength":60}},{"$ref":"#/components/parameters/StatusFilter"}],"responses":{"200":{"description":"The customer's businesses, newest first","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Business"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"operationId":"CreateBusiness","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessCreate"}}}},"responses":{"201":{"description":"The created business","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/customers/{customer_id}/businesses/{business_id}":{"parameters":[{"$ref":"#/components/parameters/CustomerId"},{"$ref":"#/components/parameters/BusinessId"}],"get":{"operationId":"GetBusiness","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"The business","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessResponse"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"operationId":"UpdateBusiness","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessUpdate"}}}},"responses":{"200":{"description":"The updated business","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/products":{"get":{"operationId":"ListProducts","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/OrderBy"},{"name":"id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"product","missing":"pro_00000000000000000000000000"}}},{"name":"include","in":"query","description":"\`prices\` embeds each product's prices.","schema":{"type":"string","enum":["prices"]}},{"$ref":"#/components/parameters/StatusFilter"},{"name":"tax_category","in":"query","schema":{"$ref":"#/components/schemas/TaxCategory"}},{"name":"type","in":"query","schema":{"$ref":"#/components/schemas/CatalogType"}}],"responses":{"200":{"description":"Products, newest first","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"operationId":"CreateProduct","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCreate"}}}},"responses":{"201":{"description":"The created product","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/products/{product_id}":{"parameters":[{"$ref":"#/components/parameters/ProductId"}],"get":{"operationId":"GetProduct","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"include","in":"query","schema":{"type":"string","enum":["prices"]}}],"responses":{"200":{"description":"The product","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"operationId":"UpdateProduct","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductUpdate"}}}},"responses":{"200":{"description":"The updated product","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/prices":{"get":{"operationId":"ListPrices","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/OrderBy"},{"name":"id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"price","missing":"pri_00000000000000000000000000"}}},{"name":"product_id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"product","missing":"pro_00000000000000000000000000"}}},{"name":"include","in":"query","description":"\`product\` embeds each price's product.","schema":{"type":"string","enum":["product"]}},{"$ref":"#/components/parameters/StatusFilter"},{"name":"recurring","in":"query","schema":{"type":"boolean"}},{"name":"type","in":"query","schema":{"$ref":"#/components/schemas/CatalogType"}}],"responses":{"200":{"description":"Prices, newest first","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Price"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"operationId":"CreatePrice","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceCreate"}}}},"responses":{"201":{"description":"The created price","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/prices/{price_id}":{"parameters":[{"$ref":"#/components/parameters/PriceId"}],"get":{"operationId":"GetPrice","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"include","in":"query","schema":{"type":"string","enum":["product"]}}],"responses":{"200":{"description":"The price","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"operationId":"UpdatePrice","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceUpdate"}}}},"responses":{"200":{"description":"The updated price","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/transactions":{"get":{"operationId":"ListTransactions","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"name":"per_page","in":"query","schema":{"type":"integer","minimum":1,"maximum":30}},{"$ref":"#/components/parameters/OrderBy"},{"name":"id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"transaction","missing":"txn_00000000000000000000000000"}}},{"name":"customer_id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"customer","missing":"ctm_00000000000000000000000000"}}},{"name":"subscription_id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"subscription","missing":"sub_00000000000000000000000000"}}},{"name":"status","in":"query","description":"Comma-separated statuses.","schema":{"$ref":"#/components/schemas/TransactionStatus"}},{"name":"origin","in":"query","schema":{"$ref":"#/components/schemas/TransactionOrigin"}},{"name":"collection_mode","in":"query","schema":{"$ref":"#/components/schemas/CollectionMode"}},{"name":"invoice_number","in":"query","schema":{"type":"string","maxLength":40}},{"name":"include","in":"query","description":"Comma-separated relations to embed.","schema":{"type":"string","enum":["customer","address","business","customer,address","customer,address,business"]}},{"name":"created_at[GTE]","in":"query","description":"Transactions created at or after this RFC 3339 datetime (\`[LT]\`, \`[LTE]\`, \`[GT]\` and \`updated_at[\u2026]\` work the same way).","schema":{"type":"string","pattern":"^20[2-3][0-9]-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9](\\\\.[0-9]+)?Z$"}},{"name":"billed_at[GTE]","in":"query","schema":{"type":"string","pattern":"^20[2-3][0-9]-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9](\\\\.[0-9]+)?Z$"}}],"responses":{"200":{"description":"Transactions, newest first (30 per page)","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Transaction"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"operationId":"CreateTransaction","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"parameters":[{"$ref":"#/components/parameters/TransactionInclude"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionCreate"}}}},"responses":{"201":{"description":"The created transaction, with computed totals","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/transactions/preview":{"post":{"operationId":"PreviewTransaction","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionPreviewRequest"}}}},"responses":{"200":{"description":"Totals for the items, nothing stored","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/TransactionPreview"},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/transactions/{transaction_id}":{"parameters":[{"$ref":"#/components/parameters/TransactionId"}],"get":{"operationId":"GetTransaction","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/TransactionInclude"}],"responses":{"200":{"description":"The transaction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"operationId":"UpdateTransaction","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"parameters":[{"$ref":"#/components/parameters/TransactionInclude"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionUpdate"}}}},"responses":{"200":{"description":"The updated transaction (only \`draft\` and \`ready\` transactions can change)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/transactions/{transaction_id}/invoice":{"parameters":[{"$ref":"#/components/parameters/TransactionId"}],"get":{"operationId":"GetTransactionInvoice","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"disposition","in":"query","schema":{"type":"string","enum":["attachment","inline"]}}],"responses":{"200":{"description":"A link to the invoice PDF (billed, paid and completed transactions only)","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"object","required":["url"],"properties":{"url":{"type":"string","x-mockingbird-volatile":{"kind":"url"}}}},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/transactions/{transaction_id}/revise":{"parameters":[{"$ref":"#/components/parameters/TransactionId"}],"post":{"operationId":"ReviseTransaction","x-mockingbird":{"supported":false,"reason":"Invoice revision (customer, business and address corrections on billed transactions) is not modelled."},"responses":{"200":{"description":"The revised transaction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionResponse"}}}}}}},"/subscriptions":{"get":{"operationId":"ListSubscriptions","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/OrderBy"},{"name":"id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"subscription","missing":"sub_00000000000000000000000000"}}},{"name":"customer_id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"customer","missing":"ctm_00000000000000000000000000"}}},{"name":"address_id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"address","missing":"add_00000000000000000000000000"}}},{"name":"price_id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"price","missing":"pri_00000000000000000000000000"}}},{"name":"status","in":"query","schema":{"$ref":"#/components/schemas/SubscriptionStatus"}},{"name":"collection_mode","in":"query","schema":{"$ref":"#/components/schemas/CollectionMode"}},{"name":"scheduled_change_action","in":"query","schema":{"type":"string","enum":["cancel","pause","resume"]}}],"responses":{"200":{"description":"Subscriptions, newest first","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Subscription"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/subscriptions/{subscription_id}":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"get":{"operationId":"GetSubscription","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"include","in":"query","description":"\`next_transaction\` and \`recurring_transaction_details\` embed previews.","schema":{"type":"string","enum":["next_transaction","recurring_transaction_details","next_transaction,recurring_transaction_details"]}}],"responses":{"200":{"description":"The subscription","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"operationId":"UpdateSubscription","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionUpdate"}}}},"responses":{"200":{"description":"The updated subscription","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/subscriptions/{subscription_id}/preview":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"patch":{"operationId":"PreviewSubscriptionUpdate","x-mockingbird":{"supported":false,"reason":"Update previews (proration credit/charge summaries) are not modelled; apply the update instead."},"responses":{"200":{"description":"A preview of the update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}}}}},"/subscriptions/{subscription_id}/activate":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"post":{"operationId":"ActivateSubscription","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"responses":{"200":{"description":"The subscription, now active (it must have been trialing)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/subscriptions/{subscription_id}/pause":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"post":{"operationId":"PauseSubscription","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"effective_from":{"type":["string","null"],"enum":["next_billing_period","immediately",null]},"resume_at":{"type":["string","null"],"description":"RFC 3339 datetime to resume at.","pattern":"^20[2-3][0-9]-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9](\\\\.[0-9]+)?Z$"},"on_resume":{"type":"string","enum":["continue_existing_billing_period","start_new_billing_period"]}}}}}},"responses":{"200":{"description":"The subscription, paused now or scheduled to pause","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/subscriptions/{subscription_id}/resume":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"post":{"operationId":"ResumeSubscription","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["effective_from"],"properties":{"effective_from":{"type":"string","description":"\`immediately\`, or an RFC 3339 datetime to resume at.","oneOf":[{"type":"string","enum":["immediately"]},{"type":"string","pattern":"^20[2-3][0-9]-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9](\\\\.[0-9]+)?Z$"}]},"on_resume":{"type":"string","enum":["continue_existing_billing_period","start_new_billing_period"]}}}}}},"responses":{"200":{"description":"The subscription, active again or scheduled to resume","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/subscriptions/{subscription_id}/cancel":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"post":{"operationId":"CancelSubscription","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"effective_from":{"type":["string","null"],"enum":["next_billing_period","immediately",null]}}}}}},"responses":{"200":{"description":"The subscription, canceled now or scheduled to cancel","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/subscriptions/{subscription_id}/charge":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"post":{"operationId":"CreateSubscriptionCharge","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["effective_from","items"],"properties":{"effective_from":{"type":"string","enum":["next_billing_period","immediately"]},"items":{"type":"array","minItems":1,"maxItems":5,"items":{"$ref":"#/components/schemas/TransactionItemRequest"}},"on_payment_failure":{"type":"string","enum":["prevent_change","apply_change"]}}}}}},"responses":{"200":{"description":"The subscription; an immediate charge also creates a completed \`subscription_charge\` transaction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/subscriptions/{subscription_id}/charge/preview":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"post":{"operationId":"PreviewSubscriptionCharge","x-mockingbird":{"supported":false,"reason":"One-time charge previews are not modelled; create the charge instead."},"responses":{"200":{"description":"A preview of the charge","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}}}}},"/subscriptions/{subscription_id}/update-payment-method-transaction":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"get":{"operationId":"GetSubscriptionPaymentMethodChangeTransaction","x-mockingbird":{"supported":false,"reason":"Payment method changes go through the hosted checkout, which the mock does not serve."},"responses":{"200":{"description":"A zero-amount transaction for updating the payment method","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionResponse"}}}}}}},"/events":{"get":{"operationId":"ListEvents","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/OrderBy"}],"responses":{"200":{"description":"Every event the account produced, newest first","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Event"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/notification-settings":{"get":{"operationId":"ListNotificationSettings","x-mockingbird":{"supported":false,"reason":"Notification destinations are configured on the mock (\`--webhook-url\`, \`PUT /__admin/webhook-endpoints\`), not through the API."},"responses":{"200":{"description":"Notification settings","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"operationId":"CreateNotificationSetting","x-mockingbird":{"supported":false,"reason":"Notification destinations are configured on the mock (\`--webhook-url\`, \`PUT /__admin/webhook-endpoints\`), not through the API."},"responses":{"201":{"description":"The created notification setting","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/discounts":{"get":{"operationId":"ListDiscounts","x-mockingbird":{"supported":false,"reason":"Discounts are not modelled; totals carry a zero discount."},"responses":{"200":{"description":"Discounts","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"operationId":"CreateDiscount","x-mockingbird":{"supported":false,"reason":"Discounts are not modelled; totals carry a zero discount."},"responses":{"201":{"description":"The created discount","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/adjustments":{"get":{"operationId":"ListAdjustments","x-mockingbird":{"supported":false,"reason":"Refunds and credits (adjustments) are not modelled."},"responses":{"200":{"description":"Adjustments","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"operationId":"CreateAdjustment","x-mockingbird":{"supported":false,"reason":"Refunds and credits (adjustments) are not modelled."},"responses":{"201":{"description":"The created adjustment","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/customers/{customer_id}/portal-sessions":{"parameters":[{"$ref":"#/components/parameters/CustomerId"}],"post":{"operationId":"CreateCustomerPortalSession","x-mockingbird":{"supported":false,"reason":"The hosted customer portal is not served; \`management_urls\` on a subscription point at placeholder links."},"responses":{"201":{"description":"The created portal session","content":{"application/json":{"schema":{"type":"object"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"\`Authorization: Bearer pdl_sdbx_apikey_\u2026\` (any key; none is 403 \`authentication_missing\`)"}},"parameters":{"After":{"name":"after","in":"query","description":"Return entities after this id (the cursor from \`meta.pagination.next\`).","schema":{"type":"string","maxLength":40}},"PerPage":{"name":"per_page","in":"query","schema":{"type":"integer","minimum":1,"maximum":200}},"OrderBy":{"name":"order_by","in":"query","schema":{"type":"string","enum":["id[ASC]","id[DESC]"]}},"StatusFilter":{"name":"status","in":"query","description":"Comma-separated statuses.","schema":{"type":"string","enum":["active","archived","active,archived"]}},"TransactionInclude":{"name":"include","in":"query","description":"Comma-separated relations to embed.","schema":{"type":"string","enum":["customer","address","business","customer,address","customer,address,business"]}},"CustomerId":{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"customer","missing":"ctm_00000000000000000000000000"}}},"AddressId":{"name":"address_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"address","missing":"add_00000000000000000000000000"}}},"BusinessId":{"name":"business_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"business","missing":"biz_00000000000000000000000000"}}},"ProductId":{"name":"product_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"product","missing":"pro_00000000000000000000000000"}}},"PriceId":{"name":"price_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"price","missing":"pri_00000000000000000000000000"}}},"TransactionId":{"name":"transaction_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"transaction","missing":"txn_00000000000000000000000000"}}},"SubscriptionId":{"name":"subscription_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"subscription","missing":"sub_00000000000000000000000000"}}}},"responses":{"BadRequest":{"description":"Validation failed (\`invalid_field\`, with \`errors[]\`) or the request is malformed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"description":"Missing, malformed or rejected API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"No such entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Conflict":{"description":"The change conflicts with existing state (a customer with that email exists)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"schemas":{"RequestId":{"type":"string","x-mockingbird-volatile":{"kind":"opaque"}},"Meta":{"type":"object","required":["request_id"],"properties":{"request_id":{"$ref":"#/components/schemas/RequestId"}}},"MetaPaginated":{"type":"object","required":["request_id","pagination"],"properties":{"request_id":{"$ref":"#/components/schemas/RequestId"},"pagination":{"type":"object","required":["per_page","next","has_more","estimated_total"],"properties":{"per_page":{"type":"integer"},"next":{"type":"string","x-mockingbird-volatile":{"kind":"url"}},"has_more":{"type":"boolean"},"estimated_total":{"type":"integer"}}}}},"ErrorResponse":{"type":"object","required":["error","meta"],"properties":{"error":{"type":"object","required":["type","code","detail","documentation_url"],"properties":{"type":{"type":"string","enum":["request_error","api_error"]},"code":{"type":"string"},"detail":{"type":"string"},"documentation_url":{"type":"string"},"errors":{"type":"array","items":{"type":"object","required":["field","message"],"properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}},"meta":{"$ref":"#/components/schemas/Meta"}}},"Timestamp":{"type":"string","x-mockingbird-volatile":{"kind":"timestamp"}},"NullableTimestamp":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"timestamp"}},"Status":{"type":"string","enum":["active","archived"]},"CatalogType":{"type":"string","enum":["standard","custom"]},"CurrencyCode":{"type":"string","enum":["USD","EUR","GBP","CAD","AUD","JPY"]},"CountryCode":{"type":"string","enum":["US","GB","DE","FR","CA","AU","NL","ES","IE","JP"]},"TaxCategory":{"type":"string","enum":["standard","saas","digital-goods","ebooks","implementation-services","professional-services","software-programming-services","training-services","website-hosting"]},"TaxMode":{"type":"string","enum":["account_setting","external","internal","location"]},"Interval":{"type":"string","enum":["day","week","month","year"]},"CollectionMode":{"type":"string","enum":["automatic","manual"]},"TransactionStatus":{"type":"string","enum":["draft","ready","billed","paid","completed","canceled","past_due"]},"TransactionOrigin":{"type":"string","enum":["api","subscription_charge","subscription_payment_method_change","subscription_recurring","subscription_update","web"]},"SubscriptionStatus":{"type":"string","enum":["active","canceled","past_due","paused","trialing"]},"CustomData":{"type":["object","null"],"description":"Your own key-value data, echoed back unchanged.","maxProperties":10,"additionalProperties":{"type":["string","number","boolean","null"]}},"ImportMeta":{"type":["object","null"],"required":["imported_from"],"properties":{"external_id":{"type":["string","null"]},"imported_from":{"type":"string"}}},"Email":{"type":"string","description":"An email address.","pattern":"^[A-Za-z0-9._+-]+@[A-Za-z0-9-]+(\\\\.[A-Za-z0-9-]+)+$","maxLength":120},"Locale":{"type":"string","pattern":"^[a-z]{2}(-[A-Z]{2})?$"},"Money":{"type":"object","required":["amount","currency_code"],"properties":{"amount":{"type":"string","description":"In the currency's lowest unit, as a string of digits.","pattern":"^[0-9]{1,9}$"},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"}}},"TimePeriod":{"type":"object","required":["interval","frequency"],"properties":{"interval":{"$ref":"#/components/schemas/Interval"},"frequency":{"type":"integer","minimum":1,"maximum":365}}},"TrialPeriod":{"type":"object","required":["interval","frequency"],"properties":{"interval":{"$ref":"#/components/schemas/Interval"},"frequency":{"type":"integer","minimum":1,"maximum":365},"requires_payment_method":{"type":"boolean"}}},"PriceQuantity":{"type":"object","required":["minimum","maximum"],"properties":{"minimum":{"type":"integer","minimum":1,"maximum":999},"maximum":{"type":"integer","minimum":1,"maximum":999}}},"UnitPriceOverride":{"type":"object","required":["country_codes","unit_price"],"properties":{"country_codes":{"type":"array","minItems":1,"maxItems":3,"items":{"$ref":"#/components/schemas/CountryCode"}},"unit_price":{"$ref":"#/components/schemas/Money"}}},"Customer":{"type":"object","required":["id","name","email","marketing_consent","status","custom_data","locale","created_at","updated_at","import_meta"],"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"customer","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"name":{"type":["string","null"]},"email":{"type":"string"},"marketing_consent":{"type":"boolean"},"status":{"$ref":"#/components/schemas/Status"},"custom_data":{"$ref":"#/components/schemas/CustomData"},"locale":{"type":"string"},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"},"import_meta":{"$ref":"#/components/schemas/ImportMeta"}}},"CustomerResponse":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Customer"},"meta":{"$ref":"#/components/schemas/Meta"}}},"CustomerCreate":{"type":"object","required":["email"],"properties":{"email":{"$ref":"#/components/schemas/Email"},"name":{"type":["string","null"],"maxLength":80},"custom_data":{"$ref":"#/components/schemas/CustomData"},"locale":{"$ref":"#/components/schemas/Locale"}}},"CustomerUpdate":{"type":"object","properties":{"email":{"$ref":"#/components/schemas/Email"},"name":{"type":["string","null"],"maxLength":80},"status":{"$ref":"#/components/schemas/Status"},"custom_data":{"$ref":"#/components/schemas/CustomData"},"locale":{"$ref":"#/components/schemas/Locale"}}},"Address":{"type":"object","required":["id","customer_id","description","first_line","second_line","city","postal_code","region","country_code","custom_data","status","created_at","updated_at","import_meta"],"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"address","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"customer_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"description":{"type":["string","null"]},"first_line":{"type":["string","null"]},"second_line":{"type":["string","null"]},"city":{"type":["string","null"]},"postal_code":{"type":["string","null"]},"region":{"type":["string","null"]},"country_code":{"type":"string"},"custom_data":{"$ref":"#/components/schemas/CustomData"},"status":{"$ref":"#/components/schemas/Status"},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"},"import_meta":{"$ref":"#/components/schemas/ImportMeta"}}},"AddressResponse":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Address"},"meta":{"$ref":"#/components/schemas/Meta"}}},"AddressFields":{"type":"object","properties":{"description":{"type":["string","null"],"maxLength":80},"first_line":{"type":["string","null"],"maxLength":120},"second_line":{"type":["string","null"],"maxLength":120},"city":{"type":["string","null"],"maxLength":60},"postal_code":{"type":["string","null"],"maxLength":20},"region":{"type":["string","null"],"maxLength":60},"custom_data":{"$ref":"#/components/schemas/CustomData"}}},"AddressCreate":{"allOf":[{"$ref":"#/components/schemas/AddressFields"},{"type":"object","required":["country_code"],"properties":{"country_code":{"$ref":"#/components/schemas/CountryCode"}}}]},"AddressUpdate":{"allOf":[{"$ref":"#/components/schemas/AddressFields"},{"type":"object","properties":{"country_code":{"$ref":"#/components/schemas/CountryCode"},"status":{"$ref":"#/components/schemas/Status"}}}]},"BusinessContact":{"type":"object","required":["email"],"properties":{"name":{"type":["string","null"],"maxLength":80},"email":{"$ref":"#/components/schemas/Email"}}},"Business":{"type":"object","required":["id","customer_id","name","company_number","tax_identifier","status","contacts","created_at","updated_at","custom_data","import_meta"],"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"business","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"customer_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"name":{"type":"string"},"company_number":{"type":["string","null"]},"tax_identifier":{"type":["string","null"]},"status":{"$ref":"#/components/schemas/Status"},"contacts":{"type":["array","null"],"items":{"type":"object","required":["name","email"],"properties":{"name":{"type":["string","null"]},"email":{"type":"string"}}}},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"},"custom_data":{"$ref":"#/components/schemas/CustomData"},"import_meta":{"$ref":"#/components/schemas/ImportMeta"}}},"BusinessResponse":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Business"},"meta":{"$ref":"#/components/schemas/Meta"}}},"BusinessCreate":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":120},"company_number":{"type":["string","null"],"maxLength":40},"tax_identifier":{"type":["string","null"],"maxLength":40},"contacts":{"type":["array","null"],"maxItems":3,"items":{"$ref":"#/components/schemas/BusinessContact"}},"custom_data":{"$ref":"#/components/schemas/CustomData"}}},"BusinessUpdate":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"company_number":{"type":["string","null"],"maxLength":40},"tax_identifier":{"type":["string","null"],"maxLength":40},"status":{"$ref":"#/components/schemas/Status"},"contacts":{"type":["array","null"],"maxItems":3,"items":{"$ref":"#/components/schemas/BusinessContact"}},"custom_data":{"$ref":"#/components/schemas/CustomData"}}},"Product":{"type":"object","required":["id","name","type","description","tax_category","image_url","custom_data","status","created_at","updated_at","import_meta"],"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"product","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"name":{"type":"string"},"type":{"$ref":"#/components/schemas/CatalogType"},"description":{"type":["string","null"]},"tax_category":{"$ref":"#/components/schemas/TaxCategory"},"image_url":{"type":["string","null"]},"custom_data":{"$ref":"#/components/schemas/CustomData"},"status":{"$ref":"#/components/schemas/Status"},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"},"import_meta":{"$ref":"#/components/schemas/ImportMeta"},"prices":{"type":"array","description":"Present with \`include=prices\`.","items":{"$ref":"#/components/schemas/Price"}}}},"ProductResponse":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Product"},"meta":{"$ref":"#/components/schemas/Meta"}}},"ProductCreate":{"type":"object","required":["name","tax_category"],"properties":{"name":{"type":"string","minLength":1,"maxLength":120},"tax_category":{"$ref":"#/components/schemas/TaxCategory"},"type":{"type":["string","null"],"enum":["standard","custom",null]},"description":{"type":["string","null"],"maxLength":500},"image_url":{"type":["string","null"],"pattern":"^https://[A-Za-z0-9./_-]+$","maxLength":200},"custom_data":{"$ref":"#/components/schemas/CustomData"}}},"ProductUpdate":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"tax_category":{"$ref":"#/components/schemas/TaxCategory"},"type":{"type":["string","null"],"enum":["standard","custom",null]},"description":{"type":["string","null"],"maxLength":500},"image_url":{"type":["string","null"],"pattern":"^https://[A-Za-z0-9./_-]+$","maxLength":200},"custom_data":{"$ref":"#/components/schemas/CustomData"},"status":{"$ref":"#/components/schemas/Status"}}},"Price":{"type":"object","required":["id","product_id","description","type","name","billing_cycle","trial_period","tax_mode","unit_price","unit_price_overrides","quantity","status","created_at","updated_at","custom_data","import_meta"],"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"price","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"product_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"description":{"type":"string"},"type":{"$ref":"#/components/schemas/CatalogType"},"name":{"type":["string","null"]},"billing_cycle":{"oneOf":[{"$ref":"#/components/schemas/TimePeriod"},{"type":"null"}]},"trial_period":{"oneOf":[{"$ref":"#/components/schemas/TrialPeriod"},{"type":"null"}]},"tax_mode":{"$ref":"#/components/schemas/TaxMode"},"unit_price":{"$ref":"#/components/schemas/Money"},"unit_price_overrides":{"type":"array","items":{"$ref":"#/components/schemas/UnitPriceOverride"}},"quantity":{"$ref":"#/components/schemas/PriceQuantity"},"status":{"$ref":"#/components/schemas/Status"},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"},"custom_data":{"$ref":"#/components/schemas/CustomData"},"import_meta":{"$ref":"#/components/schemas/ImportMeta"},"product":{"description":"Present with \`include=product\`.","$ref":"#/components/schemas/Product"}}},"PriceResponse":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Price"},"meta":{"$ref":"#/components/schemas/Meta"}}},"PriceFields":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":120},"name":{"type":["string","null"],"maxLength":80},"type":{"type":["string","null"],"enum":["standard","custom",null]},"billing_cycle":{"oneOf":[{"$ref":"#/components/schemas/TimePeriod"},{"type":"null"}]},"trial_period":{"oneOf":[{"$ref":"#/components/schemas/TrialPeriod"},{"type":"null"}]},"tax_mode":{"$ref":"#/components/schemas/TaxMode"},"unit_price":{"$ref":"#/components/schemas/Money"},"unit_price_overrides":{"type":"array","maxItems":3,"items":{"$ref":"#/components/schemas/UnitPriceOverride"}},"quantity":{"$ref":"#/components/schemas/PriceQuantity"},"custom_data":{"$ref":"#/components/schemas/CustomData"}}},"PriceCreate":{"allOf":[{"$ref":"#/components/schemas/PriceFields"},{"type":"object","required":["description","product_id","unit_price"],"properties":{"product_id":{"type":"string","x-mockingbird-resource-ref":{"type":"product","missing":"pro_00000000000000000000000000"}}}}]},"PriceUpdate":{"allOf":[{"$ref":"#/components/schemas/PriceFields"},{"type":"object","properties":{"status":{"$ref":"#/components/schemas/Status"}}}]},"NonCatalogProduct":{"type":"object","required":["name","tax_category"],"properties":{"name":{"type":"string","minLength":1,"maxLength":120},"tax_category":{"$ref":"#/components/schemas/TaxCategory"},"description":{"type":["string","null"],"maxLength":500},"image_url":{"type":["string","null"],"pattern":"^https://[A-Za-z0-9./_-]+$","maxLength":200},"custom_data":{"$ref":"#/components/schemas/CustomData"}}},"NonCatalogPrice":{"type":"object","description":"A price created for this transaction only (type custom), for an existing product or a new custom product.","required":["description","unit_price"],"properties":{"description":{"type":"string","minLength":1,"maxLength":120},"name":{"type":["string","null"],"maxLength":80},"unit_price":{"$ref":"#/components/schemas/Money"},"billing_cycle":{"oneOf":[{"$ref":"#/components/schemas/TimePeriod"},{"type":"null"}]},"trial_period":{"oneOf":[{"$ref":"#/components/schemas/TrialPeriod"},{"type":"null"}]},"tax_mode":{"$ref":"#/components/schemas/TaxMode"},"quantity":{"$ref":"#/components/schemas/PriceQuantity"},"custom_data":{"$ref":"#/components/schemas/CustomData"},"product_id":{"type":"string","x-mockingbird-resource-ref":{"type":"product","missing":"pro_00000000000000000000000000"}},"product":{"$ref":"#/components/schemas/NonCatalogProduct"}}},"TransactionItemRequest":{"type":"object","required":["quantity"],"properties":{"quantity":{"type":"integer","minimum":1,"maximum":100},"price_id":{"type":"string","x-mockingbird-resource-ref":{"type":"price","missing":"pri_00000000000000000000000000"}},"price":{"$ref":"#/components/schemas/NonCatalogPrice"}}},"BillingDetails":{"type":"object","required":["payment_terms"],"properties":{"enable_checkout":{"type":"boolean"},"purchase_order_number":{"type":["string","null"],"maxLength":40},"additional_information":{"type":["string","null"],"maxLength":200},"payment_terms":{"$ref":"#/components/schemas/TimePeriod"}}},"BillingDetailsResponse":{"type":["object","null"],"required":["enable_checkout","purchase_order_number","additional_information","payment_terms"],"properties":{"enable_checkout":{"type":"boolean"},"purchase_order_number":{"type":["string","null"]},"additional_information":{"type":["string","null"]},"payment_terms":{"$ref":"#/components/schemas/TimePeriod"}}},"BillingPeriod":{"type":"object","required":["starts_at","ends_at"],"properties":{"starts_at":{"$ref":"#/components/schemas/Timestamp"},"ends_at":{"$ref":"#/components/schemas/Timestamp"}}},"TransactionFields":{"type":"object","properties":{"customer_id":{"type":["string","null"],"x-mockingbird-resource-ref":{"type":"customer","missing":"ctm_00000000000000000000000000"}},"address_id":{"type":["string","null"],"x-mockingbird-resource-ref":{"type":"address","missing":"add_00000000000000000000000000"}},"business_id":{"type":["string","null"],"x-mockingbird-resource-ref":{"type":"business","missing":"biz_00000000000000000000000000"}},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"},"collection_mode":{"$ref":"#/components/schemas/CollectionMode"},"billing_details":{"oneOf":[{"$ref":"#/components/schemas/BillingDetails"},{"type":"null"}]},"billing_period":{"oneOf":[{"$ref":"#/components/schemas/BillingPeriod"},{"type":"null"}]},"custom_data":{"$ref":"#/components/schemas/CustomData"},"checkout":{"type":["object","null"],"properties":{"url":{"type":["string","null"],"pattern":"^https://[A-Za-z0-9./_?=&-]+$","maxLength":200}}}}},"TransactionCreate":{"allOf":[{"$ref":"#/components/schemas/TransactionFields"},{"type":"object","required":["items"],"properties":{"items":{"type":"array","minItems":1,"maxItems":5,"items":{"$ref":"#/components/schemas/TransactionItemRequest"}},"status":{"type":"string","enum":["draft","ready","billed"]}}}]},"TransactionUpdate":{"allOf":[{"$ref":"#/components/schemas/TransactionFields"},{"type":"object","properties":{"items":{"type":"array","minItems":1,"maxItems":5,"items":{"$ref":"#/components/schemas/TransactionItemRequest"}},"status":{"type":"string","enum":["draft","ready","billed","canceled"]}}}]},"TransactionPreviewRequest":{"type":"object","required":["items"],"properties":{"items":{"type":"array","minItems":1,"maxItems":5,"items":{"allOf":[{"$ref":"#/components/schemas/TransactionItemRequest"},{"type":"object","properties":{"include_in_totals":{"type":"boolean"}}}]}},"customer_id":{"type":["string","null"],"x-mockingbird-resource-ref":{"type":"customer","missing":"ctm_00000000000000000000000000"}},"address_id":{"type":["string","null"],"x-mockingbird-resource-ref":{"type":"address","missing":"add_00000000000000000000000000"}},"business_id":{"type":["string","null"],"x-mockingbird-resource-ref":{"type":"business","missing":"biz_00000000000000000000000000"}},"currency_code":{"type":["string","null"],"enum":["USD","EUR","GBP","CAD","AUD","JPY",null]},"address":{"type":["object","null"],"required":["country_code"],"properties":{"postal_code":{"type":["string","null"],"maxLength":20},"country_code":{"$ref":"#/components/schemas/CountryCode"}}},"ignore_trials":{"type":["boolean","null"]}}},"Totals":{"type":"object","required":["subtotal","discount","tax","total"],"properties":{"subtotal":{"type":"string"},"discount":{"type":"string"},"tax":{"type":"string"},"total":{"type":"string"}}},"TransactionTotals":{"type":"object","required":["subtotal","discount","tax","total","credit","credit_to_balance","balance","grand_total","grand_total_tax","fee","earnings","currency_code"],"properties":{"subtotal":{"type":"string"},"discount":{"type":"string"},"tax":{"type":"string"},"total":{"type":"string"},"credit":{"type":"string"},"credit_to_balance":{"type":"string"},"balance":{"type":"string"},"grand_total":{"type":"string"},"grand_total_tax":{"type":"string"},"fee":{"type":["string","null"]},"earnings":{"type":["string","null"]},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"}}},"TaxRateUsed":{"type":"object","required":["tax_rate","totals"],"properties":{"tax_rate":{"type":"string"},"totals":{"$ref":"#/components/schemas/Totals"}}},"LineItem":{"type":"object","required":["id","price_id","quantity","proration","tax_rate","unit_totals","totals","product"],"properties":{"id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"price_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"quantity":{"type":"integer"},"proration":{"type":"null"},"tax_rate":{"type":"string"},"unit_totals":{"$ref":"#/components/schemas/Totals"},"totals":{"$ref":"#/components/schemas/Totals"},"product":{"$ref":"#/components/schemas/Product"}}},"TransactionDetails":{"type":"object","required":["tax_rates_used","totals","adjusted_totals","payout_totals","adjusted_payout_totals","line_items"],"properties":{"tax_rates_used":{"type":"array","items":{"$ref":"#/components/schemas/TaxRateUsed"}},"totals":{"$ref":"#/components/schemas/TransactionTotals"},"adjusted_totals":{"type":"object","required":["subtotal","tax","total","grand_total","grand_total_tax","fee","earnings","currency_code","retained_fee"],"properties":{"subtotal":{"type":"string"},"tax":{"type":"string"},"total":{"type":"string"},"grand_total":{"type":"string"},"grand_total_tax":{"type":"string"},"fee":{"type":["string","null"]},"earnings":{"type":["string","null"]},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"},"retained_fee":{"type":"string"}}},"payout_totals":{"type":"null"},"adjusted_payout_totals":{"type":"null"},"line_items":{"type":"array","items":{"$ref":"#/components/schemas/LineItem"}}}},"PaymentAttempt":{"type":"object","required":["payment_attempt_id","stored_payment_method_id","payment_method_id","amount","status","error_code","method_details","created_at","captured_at"],"properties":{"payment_attempt_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"stored_payment_method_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"payment_method_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"amount":{"type":"string"},"status":{"type":"string","enum":["authorized","authorized_flagged","canceled","captured","error","action_required","pending_no_action_required","created","unknown","dropped"]},"error_code":{"type":["string","null"]},"method_details":{"type":["object","null"],"required":["type","card","paypal","south_korea_local_card","underlying_details"],"properties":{"type":{"type":"string"},"card":{"type":["object","null"],"required":["type","last4","expiry_month","expiry_year","cardholder_name"],"properties":{"type":{"type":"string"},"last4":{"type":"string"},"expiry_month":{"type":"integer"},"expiry_year":{"type":"integer"},"cardholder_name":{"type":"string"}}},"paypal":{"type":"null"},"south_korea_local_card":{"type":"null"},"underlying_details":{"type":"null"}}},"created_at":{"$ref":"#/components/schemas/Timestamp"},"captured_at":{"$ref":"#/components/schemas/NullableTimestamp"}}},"Transaction":{"type":"object","required":["id","status","customer_id","address_id","business_id","custom_data","currency_code","origin","subscription_id","invoice_id","invoice_number","collection_mode","discount_id","billing_details","billing_period","items","details","payments","checkout","created_at","updated_at","billed_at","revised_at"],"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"transaction","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"status":{"$ref":"#/components/schemas/TransactionStatus"},"customer_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"address_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"business_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"custom_data":{"$ref":"#/components/schemas/CustomData"},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"},"origin":{"$ref":"#/components/schemas/TransactionOrigin"},"subscription_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"invoice_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"invoice_number":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"opaque"}},"collection_mode":{"$ref":"#/components/schemas/CollectionMode"},"discount_id":{"type":"null"},"billing_details":{"$ref":"#/components/schemas/BillingDetailsResponse"},"billing_period":{"oneOf":[{"$ref":"#/components/schemas/BillingPeriod"},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","required":["price_id","price","quantity","proration"],"properties":{"price_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"price":{"$ref":"#/components/schemas/Price"},"quantity":{"type":"integer"},"proration":{"type":"null"}}}},"details":{"$ref":"#/components/schemas/TransactionDetails"},"payments":{"type":"array","items":{"$ref":"#/components/schemas/PaymentAttempt"}},"checkout":{"type":["object","null"],"required":["url"],"properties":{"url":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"url"}}}},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"},"billed_at":{"$ref":"#/components/schemas/NullableTimestamp"},"revised_at":{"type":"null"},"customer":{"description":"Present with \`include=customer\`.","oneOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}]},"address":{"description":"Present with \`include=address\`.","oneOf":[{"$ref":"#/components/schemas/Address"},{"type":"null"}]},"business":{"description":"Present with \`include=business\`.","oneOf":[{"$ref":"#/components/schemas/Business"},{"type":"null"}]}}},"TransactionResponse":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Transaction"},"meta":{"$ref":"#/components/schemas/Meta"}}},"TransactionPreview":{"type":"object","required":["customer_id","address_id","business_id","currency_code","discount_id","customer_ip_address","address","ignore_trials","items","details","available_payment_methods"],"properties":{"customer_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"address_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"business_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"},"discount_id":{"type":"null"},"customer_ip_address":{"type":"null"},"address":{"type":["object","null"],"required":["postal_code","country_code"],"properties":{"postal_code":{"type":["string","null"]},"country_code":{"type":"string"}}},"ignore_trials":{"type":"boolean"},"items":{"type":"array","items":{"type":"object","required":["price","quantity","include_in_totals","proration"],"properties":{"price":{"$ref":"#/components/schemas/Price"},"quantity":{"type":"integer"},"include_in_totals":{"type":"boolean"},"proration":{"type":"null"}}}},"details":{"type":"object","required":["tax_rates_used","totals","line_items"],"properties":{"tax_rates_used":{"type":"array","items":{"$ref":"#/components/schemas/TaxRateUsed"}},"totals":{"$ref":"#/components/schemas/TransactionTotals"},"line_items":{"type":"array","items":{"type":"object","required":["price_id","quantity","tax_rate","unit_totals","totals","product","proration"],"properties":{"price_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"quantity":{"type":"integer"},"tax_rate":{"type":"string"},"unit_totals":{"$ref":"#/components/schemas/Totals"},"totals":{"$ref":"#/components/schemas/Totals"},"product":{"$ref":"#/components/schemas/Product"},"proration":{"type":"null"}}}}}},"available_payment_methods":{"type":"array","items":{"type":"string"}}}},"SubscriptionItem":{"type":"object","required":["status","quantity","recurring","created_at","updated_at","previously_billed_at","next_billed_at","trial_dates","price","product"],"properties":{"status":{"type":"string","enum":["active","inactive","trialing"]},"quantity":{"type":"integer"},"recurring":{"type":"boolean"},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"},"previously_billed_at":{"$ref":"#/components/schemas/NullableTimestamp"},"next_billed_at":{"$ref":"#/components/schemas/NullableTimestamp"},"trial_dates":{"oneOf":[{"$ref":"#/components/schemas/BillingPeriod"},{"type":"null"}]},"price":{"$ref":"#/components/schemas/Price"},"product":{"$ref":"#/components/schemas/Product"}}},"ScheduledChange":{"type":["object","null"],"required":["action","effective_at","resume_at"],"properties":{"action":{"type":"string","enum":["cancel","pause","resume"]},"effective_at":{"$ref":"#/components/schemas/Timestamp"},"resume_at":{"$ref":"#/components/schemas/NullableTimestamp"}}},"Subscription":{"type":"object","required":["id","status","customer_id","address_id","business_id","currency_code","created_at","updated_at","started_at","first_billed_at","next_billed_at","paused_at","canceled_at","discount","collection_mode","billing_details","current_billing_period","billing_cycle","scheduled_change","management_urls","items","custom_data","import_meta"],"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"subscription","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"status":{"$ref":"#/components/schemas/SubscriptionStatus"},"customer_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"address_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"business_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"},"started_at":{"$ref":"#/components/schemas/NullableTimestamp"},"first_billed_at":{"$ref":"#/components/schemas/NullableTimestamp"},"next_billed_at":{"$ref":"#/components/schemas/NullableTimestamp"},"paused_at":{"$ref":"#/components/schemas/NullableTimestamp"},"canceled_at":{"$ref":"#/components/schemas/NullableTimestamp"},"discount":{"type":"null"},"collection_mode":{"$ref":"#/components/schemas/CollectionMode"},"billing_details":{"$ref":"#/components/schemas/BillingDetailsResponse"},"current_billing_period":{"oneOf":[{"$ref":"#/components/schemas/BillingPeriod"},{"type":"null"}]},"billing_cycle":{"$ref":"#/components/schemas/TimePeriod"},"scheduled_change":{"$ref":"#/components/schemas/ScheduledChange"},"management_urls":{"type":"object","required":["update_payment_method","cancel"],"properties":{"update_payment_method":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"url"}},"cancel":{"type":"string","x-mockingbird-volatile":{"kind":"url"}}}},"items":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionItem"}},"custom_data":{"$ref":"#/components/schemas/CustomData"},"import_meta":{"$ref":"#/components/schemas/ImportMeta"},"next_transaction":{"description":"Present with \`include=next_transaction\` (null once canceled).","type":["object","null"],"required":["billing_period","details","adjustments"],"properties":{"billing_period":{"$ref":"#/components/schemas/BillingPeriod"},"details":{"$ref":"#/components/schemas/PreviewDetails"},"adjustments":{"type":"array","items":{"type":"object"}}}},"recurring_transaction_details":{"description":"Present with \`include=recurring_transaction_details\`.","$ref":"#/components/schemas/PreviewDetails"}}},"PreviewDetails":{"type":"object","required":["tax_rates_used","totals","line_items"],"properties":{"tax_rates_used":{"type":"array","items":{"$ref":"#/components/schemas/TaxRateUsed"}},"totals":{"$ref":"#/components/schemas/TransactionTotals"},"line_items":{"type":"array","items":{"type":"object","required":["price_id","quantity","tax_rate","unit_totals","totals","product","proration"],"properties":{"price_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"quantity":{"type":"integer"},"tax_rate":{"type":"string"},"unit_totals":{"$ref":"#/components/schemas/Totals"},"totals":{"$ref":"#/components/schemas/Totals"},"product":{"$ref":"#/components/schemas/Product"},"proration":{"type":"null"}}}}}},"SubscriptionResponse":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Subscription"},"meta":{"$ref":"#/components/schemas/Meta"}}},"SubscriptionUpdate":{"type":"object","properties":{"customer_id":{"type":"string","x-mockingbird-resource-ref":{"type":"customer","missing":"ctm_00000000000000000000000000"}},"address_id":{"type":"string","x-mockingbird-resource-ref":{"type":"address","missing":"add_00000000000000000000000000"}},"business_id":{"type":["string","null"],"x-mockingbird-resource-ref":{"type":"business","missing":"biz_00000000000000000000000000"}},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"},"next_billed_at":{"type":"string","pattern":"^20[2-3][0-9]-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9](\\\\.[0-9]+)?Z$"},"collection_mode":{"$ref":"#/components/schemas/CollectionMode"},"billing_details":{"oneOf":[{"$ref":"#/components/schemas/BillingDetails"},{"type":"null"}]},"scheduled_change":{"type":"null","description":"Only \`null\` is accepted, to remove a scheduled change."},"items":{"type":"array","minItems":1,"maxItems":5,"items":{"$ref":"#/components/schemas/TransactionItemRequest"}},"custom_data":{"$ref":"#/components/schemas/CustomData"},"proration_billing_mode":{"type":"string","enum":["prorated_immediately","prorated_next_billing_period","full_immediately","full_next_billing_period","do_not_bill"]},"on_payment_failure":{"type":"string","enum":["prevent_change","apply_change"]}}},"Event":{"type":"object","required":["event_id","event_type","occurred_at","notification_id","data"],"properties":{"event_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"event_type":{"type":"string"},"occurred_at":{"$ref":"#/components/schemas/Timestamp"},"notification_id":{"type":"null"},"data":{"type":"object"}}}}}}`);
3720
- var operationIds = ["ListCustomers", "CreateCustomer", "GetCustomer", "UpdateCustomer", "GetCustomerCreditBalances", "CreateCustomerAuthToken", "ListAddresses", "CreateAddress", "GetAddress", "UpdateAddress", "ListBusinesses", "CreateBusiness", "GetBusiness", "UpdateBusiness", "ListProducts", "CreateProduct", "GetProduct", "UpdateProduct", "ListPrices", "CreatePrice", "GetPrice", "UpdatePrice", "ListTransactions", "CreateTransaction", "PreviewTransaction", "GetTransaction", "UpdateTransaction", "GetTransactionInvoice", "ReviseTransaction", "ListSubscriptions", "GetSubscription", "UpdateSubscription", "PreviewSubscriptionUpdate", "ActivateSubscription", "PauseSubscription", "ResumeSubscription", "CancelSubscription", "CreateSubscriptionCharge", "PreviewSubscriptionCharge", "GetSubscriptionPaymentMethodChangeTransaction", "ListEvents", "ListNotificationSettings", "CreateNotificationSetting", "ListDiscounts", "CreateDiscount", "ListAdjustments", "CreateAdjustment", "CreateCustomerPortalSession"];
3721
- var supportedOperationIds = ["ListCustomers", "CreateCustomer", "GetCustomer", "UpdateCustomer", "GetCustomerCreditBalances", "CreateCustomerAuthToken", "ListAddresses", "CreateAddress", "GetAddress", "UpdateAddress", "ListBusinesses", "CreateBusiness", "GetBusiness", "UpdateBusiness", "ListProducts", "CreateProduct", "GetProduct", "UpdateProduct", "ListPrices", "CreatePrice", "GetPrice", "UpdatePrice", "ListTransactions", "CreateTransaction", "PreviewTransaction", "GetTransaction", "UpdateTransaction", "GetTransactionInvoice", "ListSubscriptions", "GetSubscription", "UpdateSubscription", "ActivateSubscription", "PauseSubscription", "ResumeSubscription", "CancelSubscription", "CreateSubscriptionCharge", "ListEvents"];
3749
+ var document = JSON.parse(`{"openapi":"3.1.0","info":{"title":"Paddle Billing API (Mockingbird subset)","description":"Stateful mock subset of the Paddle Billing API: customers with their addresses and\\nbusinesses, the catalog (products and prices), transactions with computed totals,\\nsubscriptions with their lifecycle (activate, pause, resume, cancel, one-time charges,\\nrenewals) and the events list. Subscriptions come from paid transactions, as in Paddle:\\nthe mock's admin routes stand in for the hosted checkout and the billing engine.\\n","version":"1","x-mockingbird-upstream":{"note":"Hand-authored from https://developer.paddle.com/api-reference/overview and the wire types of @paddle/paddle-node-sdk@3.10.0 (dist/types/**). Every entity carries the fields the SDK reads; enums are trimmed to representative values so generated requests stay meaningful."}},"servers":[{"url":"https://sandbox-api.paddle.com"}],"security":[{"bearerAuth":[]}],"paths":{"/customers":{"get":{"operationId":"ListCustomers","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/OrderBy"},{"name":"id","in":"query","description":"Comma-separated customer ids.","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"customer","missing":"ctm_00000000000000000000000000"}}},{"name":"email","in":"query","description":"Comma-separated exact email addresses.","schema":{"type":"string","maxLength":120}},{"name":"search","in":"query","description":"Matches id, name or email (case-insensitive substring).","schema":{"type":"string","maxLength":60}},{"$ref":"#/components/parameters/StatusFilter"}],"responses":{"200":{"description":"Customers, newest first","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"operationId":"CreateCustomer","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerCreate"}}}},"responses":{"201":{"description":"The created customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/customers/{customer_id}":{"parameters":[{"$ref":"#/components/parameters/CustomerId"}],"get":{"operationId":"GetCustomer","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"The customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerResponse"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"operationId":"UpdateCustomer","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerUpdate"}}}},"responses":{"200":{"description":"The updated customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/customers/{customer_id}/credit-balances":{"parameters":[{"$ref":"#/components/parameters/CustomerId"}],"get":{"operationId":"GetCustomerCreditBalances","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"One balance per currency the customer holds credit in (none, in the mock)","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"type":"object","required":["customer_id","currency_code","balance"],"properties":{"customer_id":{"type":"string"},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"},"balance":{"type":"object","required":["available","reserved","used"],"properties":{"available":{"type":"string"},"reserved":{"type":"string"},"used":{"type":"string"}}}}}},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/customers/{customer_id}/auth-token":{"parameters":[{"$ref":"#/components/parameters/CustomerId"}],"post":{"operationId":"CreateCustomerAuthToken","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"A customer auth token for Paddle.js","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"object","required":["customer_auth_token","expires_at"],"properties":{"customer_auth_token":{"type":"string","x-mockingbird-volatile":{"kind":"token"}},"expires_at":{"type":"string","x-mockingbird-volatile":{"kind":"timestamp"}}}},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/customers/{customer_id}/addresses":{"parameters":[{"$ref":"#/components/parameters/CustomerId"}],"get":{"operationId":"ListAddresses","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/OrderBy"},{"name":"id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"address","missing":"add_00000000000000000000000000"}}},{"name":"search","in":"query","schema":{"type":"string","maxLength":60}},{"$ref":"#/components/parameters/StatusFilter"}],"responses":{"200":{"description":"The customer's addresses, newest first","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Address"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"operationId":"CreateAddress","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressCreate"}}}},"responses":{"201":{"description":"The created address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/customers/{customer_id}/addresses/{address_id}":{"parameters":[{"$ref":"#/components/parameters/CustomerId"},{"$ref":"#/components/parameters/AddressId"}],"get":{"operationId":"GetAddress","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"The address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressResponse"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"operationId":"UpdateAddress","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressUpdate"}}}},"responses":{"200":{"description":"The updated address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/customers/{customer_id}/businesses":{"parameters":[{"$ref":"#/components/parameters/CustomerId"}],"get":{"operationId":"ListBusinesses","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/OrderBy"},{"name":"id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"business","missing":"biz_00000000000000000000000000"}}},{"name":"search","in":"query","schema":{"type":"string","maxLength":60}},{"$ref":"#/components/parameters/StatusFilter"}],"responses":{"200":{"description":"The customer's businesses, newest first","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Business"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"operationId":"CreateBusiness","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessCreate"}}}},"responses":{"201":{"description":"The created business","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/customers/{customer_id}/businesses/{business_id}":{"parameters":[{"$ref":"#/components/parameters/CustomerId"},{"$ref":"#/components/parameters/BusinessId"}],"get":{"operationId":"GetBusiness","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"The business","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessResponse"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"operationId":"UpdateBusiness","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessUpdate"}}}},"responses":{"200":{"description":"The updated business","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/products":{"get":{"operationId":"ListProducts","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/OrderBy"},{"name":"id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"product","missing":"pro_00000000000000000000000000"}}},{"name":"include","in":"query","description":"\`prices\` embeds each product's prices.","schema":{"type":"string","enum":["prices"]}},{"$ref":"#/components/parameters/StatusFilter"},{"name":"tax_category","in":"query","schema":{"$ref":"#/components/schemas/TaxCategory"}},{"name":"type","in":"query","schema":{"$ref":"#/components/schemas/CatalogType"}}],"responses":{"200":{"description":"Products, newest first","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"operationId":"CreateProduct","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCreate"}}}},"responses":{"201":{"description":"The created product","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/products/{product_id}":{"parameters":[{"$ref":"#/components/parameters/ProductId"}],"get":{"operationId":"GetProduct","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"include","in":"query","schema":{"type":"string","enum":["prices"]}}],"responses":{"200":{"description":"The product","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"operationId":"UpdateProduct","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductUpdate"}}}},"responses":{"200":{"description":"The updated product","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/prices":{"get":{"operationId":"ListPrices","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/OrderBy"},{"name":"id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"price","missing":"pri_00000000000000000000000000"}}},{"name":"product_id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"product","missing":"pro_00000000000000000000000000"}}},{"name":"include","in":"query","description":"\`product\` embeds each price's product.","schema":{"type":"string","enum":["product"]}},{"$ref":"#/components/parameters/StatusFilter"},{"name":"recurring","in":"query","schema":{"type":"boolean"}},{"name":"type","in":"query","schema":{"$ref":"#/components/schemas/CatalogType"}}],"responses":{"200":{"description":"Prices, newest first","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Price"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"operationId":"CreatePrice","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceCreate"}}}},"responses":{"201":{"description":"The created price","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/prices/{price_id}":{"parameters":[{"$ref":"#/components/parameters/PriceId"}],"get":{"operationId":"GetPrice","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"include","in":"query","schema":{"type":"string","enum":["product"]}}],"responses":{"200":{"description":"The price","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"operationId":"UpdatePrice","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceUpdate"}}}},"responses":{"200":{"description":"The updated price","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/transactions":{"get":{"operationId":"ListTransactions","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"name":"per_page","in":"query","schema":{"type":"integer","minimum":1,"maximum":30}},{"$ref":"#/components/parameters/OrderBy"},{"name":"id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"transaction","missing":"txn_00000000000000000000000000"}}},{"name":"customer_id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"customer","missing":"ctm_00000000000000000000000000"}}},{"name":"subscription_id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"subscription","missing":"sub_00000000000000000000000000"}}},{"name":"status","in":"query","description":"Comma-separated statuses.","schema":{"$ref":"#/components/schemas/TransactionStatus"}},{"name":"origin","in":"query","schema":{"$ref":"#/components/schemas/TransactionOrigin"}},{"name":"collection_mode","in":"query","schema":{"$ref":"#/components/schemas/CollectionMode"}},{"name":"invoice_number","in":"query","schema":{"type":"string","maxLength":40}},{"name":"include","in":"query","description":"Comma-separated relations to embed.","schema":{"type":"string","enum":["customer","address","business","customer,address","customer,address,business"]}},{"name":"created_at[GTE]","in":"query","description":"Transactions created at or after this RFC 3339 datetime (\`[LT]\`, \`[LTE]\`, \`[GT]\` and \`updated_at[\u2026]\` work the same way).","schema":{"type":"string","pattern":"^20[2-3][0-9]-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9](\\\\.[0-9]+)?Z$"}},{"name":"billed_at[GTE]","in":"query","schema":{"type":"string","pattern":"^20[2-3][0-9]-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9](\\\\.[0-9]+)?Z$"}}],"responses":{"200":{"description":"Transactions, newest first (30 per page)","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Transaction"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"operationId":"CreateTransaction","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"parameters":[{"$ref":"#/components/parameters/TransactionInclude"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionCreate"}}}},"responses":{"201":{"description":"The created transaction, with computed totals","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/transactions/preview":{"post":{"operationId":"PreviewTransaction","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionPreviewRequest"}}}},"responses":{"200":{"description":"Totals for the items, nothing stored","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/TransactionPreview"},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/transactions/{transaction_id}":{"parameters":[{"$ref":"#/components/parameters/TransactionId"}],"get":{"operationId":"GetTransaction","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/TransactionInclude"}],"responses":{"200":{"description":"The transaction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"operationId":"UpdateTransaction","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"parameters":[{"$ref":"#/components/parameters/TransactionInclude"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionUpdate"}}}},"responses":{"200":{"description":"The updated transaction (only \`draft\` and \`ready\` transactions can change)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/transactions/{transaction_id}/invoice":{"parameters":[{"$ref":"#/components/parameters/TransactionId"}],"get":{"operationId":"GetTransactionInvoice","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"disposition","in":"query","schema":{"type":"string","enum":["attachment","inline"]}}],"responses":{"200":{"description":"A link to the invoice PDF (billed, paid and completed transactions only)","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"object","required":["url"],"properties":{"url":{"type":"string","x-mockingbird-volatile":{"kind":"url"}}}},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/transactions/{transaction_id}/revise":{"parameters":[{"$ref":"#/components/parameters/TransactionId"}],"post":{"operationId":"ReviseTransaction","x-mockingbird":{"supported":false,"reason":"Invoice revision (customer, business and address corrections on billed transactions) is not modelled."},"responses":{"200":{"description":"The revised transaction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionResponse"}}}}}}},"/subscriptions":{"get":{"operationId":"ListSubscriptions","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/OrderBy"},{"name":"id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"subscription","missing":"sub_00000000000000000000000000"}}},{"name":"customer_id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"customer","missing":"ctm_00000000000000000000000000"}}},{"name":"address_id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"address","missing":"add_00000000000000000000000000"}}},{"name":"price_id","in":"query","schema":{"type":"string","x-mockingbird-resource-ref":{"type":"price","missing":"pri_00000000000000000000000000"}}},{"name":"status","in":"query","schema":{"$ref":"#/components/schemas/SubscriptionStatus"}},{"name":"collection_mode","in":"query","schema":{"$ref":"#/components/schemas/CollectionMode"}},{"name":"scheduled_change_action","in":"query","schema":{"type":"string","enum":["cancel","pause","resume"]}}],"responses":{"200":{"description":"Subscriptions, newest first","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Subscription"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/subscriptions/{subscription_id}":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"get":{"operationId":"GetSubscription","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"include","in":"query","description":"\`next_transaction\` and \`recurring_transaction_details\` embed previews.","schema":{"type":"string","enum":["next_transaction","recurring_transaction_details","next_transaction,recurring_transaction_details"]}}],"responses":{"200":{"description":"The subscription","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"operationId":"UpdateSubscription","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionUpdate"}}}},"responses":{"200":{"description":"The updated subscription","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/subscriptions/{subscription_id}/preview":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"patch":{"operationId":"PreviewSubscriptionUpdate","x-mockingbird":{"supported":false,"reason":"Update previews (proration credit/charge summaries) are not modelled; apply the update instead."},"responses":{"200":{"description":"A preview of the update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}}}}},"/subscriptions/{subscription_id}/activate":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"post":{"operationId":"ActivateSubscription","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"responses":{"200":{"description":"The subscription, now active (it must have been trialing)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/subscriptions/{subscription_id}/pause":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"post":{"operationId":"PauseSubscription","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"effective_from":{"type":["string","null"],"enum":["next_billing_period","immediately",null]},"resume_at":{"type":["string","null"],"description":"RFC 3339 datetime to resume at.","pattern":"^20[2-3][0-9]-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9](\\\\.[0-9]+)?Z$"},"on_resume":{"type":"string","enum":["continue_existing_billing_period","start_new_billing_period"]}}}}}},"responses":{"200":{"description":"The subscription, paused now or scheduled to pause","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/subscriptions/{subscription_id}/resume":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"post":{"operationId":"ResumeSubscription","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["effective_from"],"properties":{"effective_from":{"type":"string","description":"\`immediately\`, or an RFC 3339 datetime to resume at.","oneOf":[{"type":"string","enum":["immediately"]},{"type":"string","pattern":"^20[2-3][0-9]-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9](\\\\.[0-9]+)?Z$"}]},"on_resume":{"type":"string","enum":["continue_existing_billing_period","start_new_billing_period"]}}}}}},"responses":{"200":{"description":"The subscription, active again or scheduled to resume","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/subscriptions/{subscription_id}/cancel":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"post":{"operationId":"CancelSubscription","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"effective_from":{"type":["string","null"],"enum":["next_billing_period","immediately",null]}}}}}},"responses":{"200":{"description":"The subscription, canceled now or scheduled to cancel","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/subscriptions/{subscription_id}/charge":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"post":{"operationId":"CreateSubscriptionCharge","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["effective_from","items"],"properties":{"effective_from":{"type":"string","enum":["next_billing_period","immediately"]},"items":{"type":"array","minItems":1,"maxItems":5,"items":{"$ref":"#/components/schemas/TransactionItemRequest"}},"on_payment_failure":{"type":"string","enum":["prevent_change","apply_change"]}}}}}},"responses":{"200":{"description":"The subscription; an immediate charge also creates a completed \`subscription_charge\` transaction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/subscriptions/{subscription_id}/charge/preview":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"post":{"operationId":"PreviewSubscriptionCharge","x-mockingbird":{"supported":false,"reason":"One-time charge previews are not modelled; create the charge instead."},"responses":{"200":{"description":"A preview of the charge","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}}}}},"/subscriptions/{subscription_id}/update-payment-method-transaction":{"parameters":[{"$ref":"#/components/parameters/SubscriptionId"}],"get":{"operationId":"GetSubscriptionPaymentMethodChangeTransaction","x-mockingbird":{"supported":false,"reason":"Payment method changes go through the hosted checkout, which the mock does not serve."},"responses":{"200":{"description":"A zero-amount transaction for updating the payment method","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionResponse"}}}}}}},"/events":{"get":{"operationId":"ListEvents","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/OrderBy"}],"responses":{"200":{"description":"Every event the account produced, newest first","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Event"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/notification-settings":{"get":{"operationId":"ListNotificationSettings","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/OrderBy"}],"responses":{"200":{"description":"Notification destinations, newest first. Secrets are not included.","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/NotificationSetting"}},"meta":{"$ref":"#/components/schemas/MetaPaginated"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"operationId":"CreateNotificationSetting","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationSettingCreate"}}}},"responses":{"201":{"description":"The created destination, including its endpoint secret","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationSettingResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/notification-settings/{notification_setting_id}":{"parameters":[{"name":"notification_setting_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"notification_setting","missing":"ntfset_00000000000000000000000000"}}}],"get":{"operationId":"GetNotificationSetting","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"The notification destination, without its secret","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationSettingResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"operationId":"UpdateNotificationSetting","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationSettingUpdate"}}}},"responses":{"200":{"description":"The updated destination. The existing secret stays valid and is not returned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationSettingResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/discounts":{"get":{"operationId":"ListDiscounts","x-mockingbird":{"supported":false,"reason":"Discounts are not modelled; totals carry a zero discount."},"responses":{"200":{"description":"Discounts","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"operationId":"CreateDiscount","x-mockingbird":{"supported":false,"reason":"Discounts are not modelled; totals carry a zero discount."},"responses":{"201":{"description":"The created discount","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/adjustments":{"get":{"operationId":"ListAdjustments","x-mockingbird":{"supported":false,"reason":"Refunds and credits (adjustments) are not modelled."},"responses":{"200":{"description":"Adjustments","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"operationId":"CreateAdjustment","x-mockingbird":{"supported":false,"reason":"Refunds and credits (adjustments) are not modelled."},"responses":{"201":{"description":"The created adjustment","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/customers/{customer_id}/portal-sessions":{"parameters":[{"$ref":"#/components/parameters/CustomerId"}],"post":{"operationId":"CreateCustomerPortalSession","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortalSessionCreate"}}}},"responses":{"201":{"description":"The created portal session and its temporary https links","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortalSessionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"\`Authorization: Bearer pdl_sdbx_apikey_\u2026\` (any key; none is 403 \`authentication_missing\`)"}},"parameters":{"After":{"name":"after","in":"query","description":"Return entities after this id (the cursor from \`meta.pagination.next\`).","schema":{"type":"string","maxLength":40}},"PerPage":{"name":"per_page","in":"query","schema":{"type":"integer","minimum":1,"maximum":200}},"OrderBy":{"name":"order_by","in":"query","schema":{"type":"string","enum":["id[ASC]","id[DESC]"]}},"StatusFilter":{"name":"status","in":"query","description":"Comma-separated statuses.","schema":{"type":"string","enum":["active","archived","active,archived"]}},"TransactionInclude":{"name":"include","in":"query","description":"Comma-separated relations to embed.","schema":{"type":"string","enum":["customer","address","business","customer,address","customer,address,business"]}},"CustomerId":{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"customer","missing":"ctm_00000000000000000000000000"}}},"AddressId":{"name":"address_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"address","missing":"add_00000000000000000000000000"}}},"BusinessId":{"name":"business_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"business","missing":"biz_00000000000000000000000000"}}},"ProductId":{"name":"product_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"product","missing":"pro_00000000000000000000000000"}}},"PriceId":{"name":"price_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"price","missing":"pri_00000000000000000000000000"}}},"TransactionId":{"name":"transaction_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"transaction","missing":"txn_00000000000000000000000000"}}},"SubscriptionId":{"name":"subscription_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"subscription","missing":"sub_00000000000000000000000000"}}}},"responses":{"BadRequest":{"description":"Validation failed (\`invalid_field\`, with \`errors[]\`) or the request is malformed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"description":"Missing, malformed or rejected API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"No such entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Conflict":{"description":"The change conflicts with existing state (a customer with that email exists)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"schemas":{"RequestId":{"type":"string","x-mockingbird-volatile":{"kind":"opaque"}},"Meta":{"type":"object","required":["request_id"],"properties":{"request_id":{"$ref":"#/components/schemas/RequestId"}}},"MetaPaginated":{"type":"object","required":["request_id","pagination"],"properties":{"request_id":{"$ref":"#/components/schemas/RequestId"},"pagination":{"type":"object","required":["per_page","next","has_more","estimated_total"],"properties":{"per_page":{"type":"integer"},"next":{"type":"string","x-mockingbird-volatile":{"kind":"url"}},"has_more":{"type":"boolean"},"estimated_total":{"type":"integer"}}}}},"ErrorResponse":{"type":"object","required":["error","meta"],"properties":{"error":{"type":"object","required":["type","code","detail","documentation_url"],"properties":{"type":{"type":"string","enum":["request_error","api_error"]},"code":{"type":"string"},"detail":{"type":"string"},"documentation_url":{"type":"string"},"errors":{"type":"array","items":{"type":"object","required":["field","message"],"properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}},"meta":{"$ref":"#/components/schemas/Meta"}}},"Timestamp":{"type":"string","x-mockingbird-volatile":{"kind":"timestamp"}},"NullableTimestamp":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"timestamp"}},"Status":{"type":"string","enum":["active","archived"]},"CatalogType":{"type":"string","enum":["standard","custom"]},"CurrencyCode":{"type":"string","enum":["USD","EUR","GBP","CAD","AUD","JPY"]},"CountryCode":{"type":"string","enum":["US","GB","DE","FR","CA","AU","NL","ES","IE","JP"]},"TaxCategory":{"type":"string","enum":["standard","saas","digital-goods","ebooks","implementation-services","professional-services","software-programming-services","training-services","website-hosting"]},"TaxMode":{"type":"string","enum":["account_setting","external","internal","location"]},"Interval":{"type":"string","enum":["day","week","month","year"]},"CollectionMode":{"type":"string","enum":["automatic","manual"]},"TransactionStatus":{"type":"string","enum":["draft","ready","billed","paid","completed","canceled","past_due"]},"TransactionOrigin":{"type":"string","enum":["api","subscription_charge","subscription_payment_method_change","subscription_recurring","subscription_update","web"]},"SubscriptionStatus":{"type":"string","enum":["active","canceled","past_due","paused","trialing"]},"CustomData":{"type":["object","null"],"description":"Your own key-value data, echoed back unchanged.","maxProperties":10,"additionalProperties":{"type":["string","number","boolean","null"]}},"ImportMeta":{"type":["object","null"],"required":["imported_from"],"properties":{"external_id":{"type":["string","null"]},"imported_from":{"type":"string"}}},"Email":{"type":"string","description":"An email address.","pattern":"^[A-Za-z0-9._+-]+@[A-Za-z0-9-]+(\\\\.[A-Za-z0-9-]+)+$","maxLength":120},"Locale":{"type":"string","pattern":"^[a-z]{2}(-[A-Z]{2})?$"},"Money":{"type":"object","required":["amount","currency_code"],"properties":{"amount":{"type":"string","description":"In the currency's lowest unit, as a string of digits.","pattern":"^[0-9]{1,9}$"},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"}}},"TimePeriod":{"type":"object","required":["interval","frequency"],"properties":{"interval":{"$ref":"#/components/schemas/Interval"},"frequency":{"type":"integer","minimum":1,"maximum":365}}},"TrialPeriod":{"type":"object","required":["interval","frequency"],"properties":{"interval":{"$ref":"#/components/schemas/Interval"},"frequency":{"type":"integer","minimum":1,"maximum":365},"requires_payment_method":{"type":"boolean"}}},"PriceQuantity":{"type":"object","required":["minimum","maximum"],"properties":{"minimum":{"type":"integer","minimum":1,"maximum":999},"maximum":{"type":"integer","minimum":1,"maximum":999}}},"UnitPriceOverride":{"type":"object","required":["country_codes","unit_price"],"properties":{"country_codes":{"type":"array","minItems":1,"maxItems":3,"items":{"$ref":"#/components/schemas/CountryCode"}},"unit_price":{"$ref":"#/components/schemas/Money"}}},"Customer":{"type":"object","required":["id","name","email","marketing_consent","status","custom_data","locale","created_at","updated_at","import_meta"],"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"customer","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"name":{"type":["string","null"]},"email":{"type":"string"},"marketing_consent":{"type":"boolean"},"status":{"$ref":"#/components/schemas/Status"},"custom_data":{"$ref":"#/components/schemas/CustomData"},"locale":{"type":"string"},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"},"import_meta":{"$ref":"#/components/schemas/ImportMeta"}}},"CustomerResponse":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Customer"},"meta":{"$ref":"#/components/schemas/Meta"}}},"CustomerCreate":{"type":"object","required":["email"],"properties":{"email":{"$ref":"#/components/schemas/Email"},"name":{"type":["string","null"],"maxLength":80},"custom_data":{"$ref":"#/components/schemas/CustomData"},"locale":{"$ref":"#/components/schemas/Locale"}}},"CustomerUpdate":{"type":"object","properties":{"email":{"$ref":"#/components/schemas/Email"},"name":{"type":["string","null"],"maxLength":80},"status":{"$ref":"#/components/schemas/Status"},"custom_data":{"$ref":"#/components/schemas/CustomData"},"locale":{"$ref":"#/components/schemas/Locale"}}},"Address":{"type":"object","required":["id","customer_id","description","first_line","second_line","city","postal_code","region","country_code","custom_data","status","created_at","updated_at","import_meta"],"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"address","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"customer_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"description":{"type":["string","null"]},"first_line":{"type":["string","null"]},"second_line":{"type":["string","null"]},"city":{"type":["string","null"]},"postal_code":{"type":["string","null"]},"region":{"type":["string","null"]},"country_code":{"type":"string"},"custom_data":{"$ref":"#/components/schemas/CustomData"},"status":{"$ref":"#/components/schemas/Status"},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"},"import_meta":{"$ref":"#/components/schemas/ImportMeta"}}},"AddressResponse":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Address"},"meta":{"$ref":"#/components/schemas/Meta"}}},"AddressFields":{"type":"object","properties":{"description":{"type":["string","null"],"maxLength":80},"first_line":{"type":["string","null"],"maxLength":120},"second_line":{"type":["string","null"],"maxLength":120},"city":{"type":["string","null"],"maxLength":60},"postal_code":{"type":["string","null"],"maxLength":20},"region":{"type":["string","null"],"maxLength":60},"custom_data":{"$ref":"#/components/schemas/CustomData"}}},"AddressCreate":{"allOf":[{"$ref":"#/components/schemas/AddressFields"},{"type":"object","required":["country_code"],"properties":{"country_code":{"$ref":"#/components/schemas/CountryCode"}}}]},"AddressUpdate":{"allOf":[{"$ref":"#/components/schemas/AddressFields"},{"type":"object","properties":{"country_code":{"$ref":"#/components/schemas/CountryCode"},"status":{"$ref":"#/components/schemas/Status"}}}]},"BusinessContact":{"type":"object","required":["email"],"properties":{"name":{"type":["string","null"],"maxLength":80},"email":{"$ref":"#/components/schemas/Email"}}},"Business":{"type":"object","required":["id","customer_id","name","company_number","tax_identifier","status","contacts","created_at","updated_at","custom_data","import_meta"],"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"business","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"customer_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"name":{"type":"string"},"company_number":{"type":["string","null"]},"tax_identifier":{"type":["string","null"]},"status":{"$ref":"#/components/schemas/Status"},"contacts":{"type":["array","null"],"items":{"type":"object","required":["name","email"],"properties":{"name":{"type":["string","null"]},"email":{"type":"string"}}}},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"},"custom_data":{"$ref":"#/components/schemas/CustomData"},"import_meta":{"$ref":"#/components/schemas/ImportMeta"}}},"BusinessResponse":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Business"},"meta":{"$ref":"#/components/schemas/Meta"}}},"BusinessCreate":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":120},"company_number":{"type":["string","null"],"maxLength":40},"tax_identifier":{"type":["string","null"],"maxLength":40},"contacts":{"type":["array","null"],"maxItems":3,"items":{"$ref":"#/components/schemas/BusinessContact"}},"custom_data":{"$ref":"#/components/schemas/CustomData"}}},"BusinessUpdate":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"company_number":{"type":["string","null"],"maxLength":40},"tax_identifier":{"type":["string","null"],"maxLength":40},"status":{"$ref":"#/components/schemas/Status"},"contacts":{"type":["array","null"],"maxItems":3,"items":{"$ref":"#/components/schemas/BusinessContact"}},"custom_data":{"$ref":"#/components/schemas/CustomData"}}},"Product":{"type":"object","required":["id","name","type","description","tax_category","image_url","custom_data","status","created_at","updated_at","import_meta"],"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"product","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"name":{"type":"string"},"type":{"$ref":"#/components/schemas/CatalogType"},"description":{"type":["string","null"]},"tax_category":{"$ref":"#/components/schemas/TaxCategory"},"image_url":{"type":["string","null"]},"custom_data":{"$ref":"#/components/schemas/CustomData"},"status":{"$ref":"#/components/schemas/Status"},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"},"import_meta":{"$ref":"#/components/schemas/ImportMeta"},"prices":{"type":"array","description":"Present with \`include=prices\`.","items":{"$ref":"#/components/schemas/Price"}}}},"ProductResponse":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Product"},"meta":{"$ref":"#/components/schemas/Meta"}}},"ProductCreate":{"type":"object","required":["name","tax_category"],"properties":{"name":{"type":"string","minLength":1,"maxLength":120},"tax_category":{"$ref":"#/components/schemas/TaxCategory"},"type":{"type":["string","null"],"enum":["standard","custom",null]},"description":{"type":["string","null"],"maxLength":500},"image_url":{"type":["string","null"],"pattern":"^https://[A-Za-z0-9./_-]+$","maxLength":200},"custom_data":{"$ref":"#/components/schemas/CustomData"}}},"ProductUpdate":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"tax_category":{"$ref":"#/components/schemas/TaxCategory"},"type":{"type":["string","null"],"enum":["standard","custom",null]},"description":{"type":["string","null"],"maxLength":500},"image_url":{"type":["string","null"],"pattern":"^https://[A-Za-z0-9./_-]+$","maxLength":200},"custom_data":{"$ref":"#/components/schemas/CustomData"},"status":{"$ref":"#/components/schemas/Status"}}},"Price":{"type":"object","required":["id","product_id","description","type","name","billing_cycle","trial_period","tax_mode","unit_price","unit_price_overrides","quantity","status","created_at","updated_at","custom_data","import_meta"],"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"price","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"product_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"description":{"type":"string"},"type":{"$ref":"#/components/schemas/CatalogType"},"name":{"type":["string","null"]},"billing_cycle":{"oneOf":[{"$ref":"#/components/schemas/TimePeriod"},{"type":"null"}]},"trial_period":{"oneOf":[{"$ref":"#/components/schemas/TrialPeriod"},{"type":"null"}]},"tax_mode":{"$ref":"#/components/schemas/TaxMode"},"unit_price":{"$ref":"#/components/schemas/Money"},"unit_price_overrides":{"type":"array","items":{"$ref":"#/components/schemas/UnitPriceOverride"}},"quantity":{"$ref":"#/components/schemas/PriceQuantity"},"status":{"$ref":"#/components/schemas/Status"},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"},"custom_data":{"$ref":"#/components/schemas/CustomData"},"import_meta":{"$ref":"#/components/schemas/ImportMeta"},"product":{"description":"Present with \`include=product\`.","$ref":"#/components/schemas/Product"}}},"PriceResponse":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Price"},"meta":{"$ref":"#/components/schemas/Meta"}}},"PriceFields":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":120},"name":{"type":["string","null"],"maxLength":80},"type":{"type":["string","null"],"enum":["standard","custom",null]},"billing_cycle":{"oneOf":[{"$ref":"#/components/schemas/TimePeriod"},{"type":"null"}]},"trial_period":{"oneOf":[{"$ref":"#/components/schemas/TrialPeriod"},{"type":"null"}]},"tax_mode":{"$ref":"#/components/schemas/TaxMode"},"unit_price":{"$ref":"#/components/schemas/Money"},"unit_price_overrides":{"type":"array","maxItems":3,"items":{"$ref":"#/components/schemas/UnitPriceOverride"}},"quantity":{"$ref":"#/components/schemas/PriceQuantity"},"custom_data":{"$ref":"#/components/schemas/CustomData"}}},"PriceCreate":{"allOf":[{"$ref":"#/components/schemas/PriceFields"},{"type":"object","required":["description","product_id","unit_price"],"properties":{"product_id":{"type":"string","x-mockingbird-resource-ref":{"type":"product","missing":"pro_00000000000000000000000000"}}}}]},"PriceUpdate":{"allOf":[{"$ref":"#/components/schemas/PriceFields"},{"type":"object","properties":{"status":{"$ref":"#/components/schemas/Status"}}}]},"NonCatalogProduct":{"type":"object","required":["name","tax_category"],"properties":{"name":{"type":"string","minLength":1,"maxLength":120},"tax_category":{"$ref":"#/components/schemas/TaxCategory"},"description":{"type":["string","null"],"maxLength":500},"image_url":{"type":["string","null"],"pattern":"^https://[A-Za-z0-9./_-]+$","maxLength":200},"custom_data":{"$ref":"#/components/schemas/CustomData"}}},"NonCatalogPrice":{"type":"object","description":"A price created for this transaction only (type custom), for an existing product or a new custom product.","required":["description","unit_price"],"properties":{"description":{"type":"string","minLength":1,"maxLength":120},"name":{"type":["string","null"],"maxLength":80},"unit_price":{"$ref":"#/components/schemas/Money"},"billing_cycle":{"oneOf":[{"$ref":"#/components/schemas/TimePeriod"},{"type":"null"}]},"trial_period":{"oneOf":[{"$ref":"#/components/schemas/TrialPeriod"},{"type":"null"}]},"tax_mode":{"$ref":"#/components/schemas/TaxMode"},"quantity":{"$ref":"#/components/schemas/PriceQuantity"},"custom_data":{"$ref":"#/components/schemas/CustomData"},"product_id":{"type":"string","x-mockingbird-resource-ref":{"type":"product","missing":"pro_00000000000000000000000000"}},"product":{"$ref":"#/components/schemas/NonCatalogProduct"}}},"TransactionItemRequest":{"type":"object","required":["quantity"],"properties":{"quantity":{"type":"integer","minimum":1,"maximum":100},"price_id":{"type":"string","x-mockingbird-resource-ref":{"type":"price","missing":"pri_00000000000000000000000000"}},"price":{"$ref":"#/components/schemas/NonCatalogPrice"}}},"BillingDetails":{"type":"object","required":["payment_terms"],"properties":{"enable_checkout":{"type":"boolean"},"purchase_order_number":{"type":["string","null"],"maxLength":40},"additional_information":{"type":["string","null"],"maxLength":200},"payment_terms":{"$ref":"#/components/schemas/TimePeriod"}}},"BillingDetailsResponse":{"type":["object","null"],"required":["enable_checkout","purchase_order_number","additional_information","payment_terms"],"properties":{"enable_checkout":{"type":"boolean"},"purchase_order_number":{"type":["string","null"]},"additional_information":{"type":["string","null"]},"payment_terms":{"$ref":"#/components/schemas/TimePeriod"}}},"BillingPeriod":{"type":"object","required":["starts_at","ends_at"],"properties":{"starts_at":{"$ref":"#/components/schemas/Timestamp"},"ends_at":{"$ref":"#/components/schemas/Timestamp"}}},"TransactionFields":{"type":"object","properties":{"customer_id":{"type":["string","null"],"x-mockingbird-resource-ref":{"type":"customer","missing":"ctm_00000000000000000000000000"}},"address_id":{"type":["string","null"],"x-mockingbird-resource-ref":{"type":"address","missing":"add_00000000000000000000000000"}},"business_id":{"type":["string","null"],"x-mockingbird-resource-ref":{"type":"business","missing":"biz_00000000000000000000000000"}},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"},"collection_mode":{"$ref":"#/components/schemas/CollectionMode"},"billing_details":{"oneOf":[{"$ref":"#/components/schemas/BillingDetails"},{"type":"null"}]},"billing_period":{"oneOf":[{"$ref":"#/components/schemas/BillingPeriod"},{"type":"null"}]},"custom_data":{"$ref":"#/components/schemas/CustomData"},"checkout":{"type":["object","null"],"properties":{"url":{"type":["string","null"],"pattern":"^https://[A-Za-z0-9./_?=&-]+$","maxLength":200}}}}},"TransactionCreate":{"allOf":[{"$ref":"#/components/schemas/TransactionFields"},{"type":"object","required":["items"],"properties":{"items":{"type":"array","minItems":1,"maxItems":5,"items":{"$ref":"#/components/schemas/TransactionItemRequest"}},"status":{"type":"string","enum":["draft","ready","billed"]}}}]},"TransactionUpdate":{"allOf":[{"$ref":"#/components/schemas/TransactionFields"},{"type":"object","properties":{"items":{"type":"array","minItems":1,"maxItems":5,"items":{"$ref":"#/components/schemas/TransactionItemRequest"}},"status":{"type":"string","enum":["draft","ready","billed","canceled"]}}}]},"TransactionPreviewRequest":{"type":"object","required":["items"],"properties":{"items":{"type":"array","minItems":1,"maxItems":5,"items":{"allOf":[{"$ref":"#/components/schemas/TransactionItemRequest"},{"type":"object","properties":{"include_in_totals":{"type":"boolean"}}}]}},"customer_id":{"type":["string","null"],"x-mockingbird-resource-ref":{"type":"customer","missing":"ctm_00000000000000000000000000"}},"address_id":{"type":["string","null"],"x-mockingbird-resource-ref":{"type":"address","missing":"add_00000000000000000000000000"}},"business_id":{"type":["string","null"],"x-mockingbird-resource-ref":{"type":"business","missing":"biz_00000000000000000000000000"}},"currency_code":{"type":["string","null"],"enum":["USD","EUR","GBP","CAD","AUD","JPY",null]},"address":{"type":["object","null"],"required":["country_code"],"properties":{"postal_code":{"type":["string","null"],"maxLength":20},"country_code":{"$ref":"#/components/schemas/CountryCode"}}},"ignore_trials":{"type":["boolean","null"]}}},"Totals":{"type":"object","required":["subtotal","discount","tax","total"],"properties":{"subtotal":{"type":"string"},"discount":{"type":"string"},"tax":{"type":"string"},"total":{"type":"string"}}},"TransactionTotals":{"type":"object","required":["subtotal","discount","tax","total","credit","credit_to_balance","balance","grand_total","grand_total_tax","fee","earnings","currency_code"],"properties":{"subtotal":{"type":"string"},"discount":{"type":"string"},"tax":{"type":"string"},"total":{"type":"string"},"credit":{"type":"string"},"credit_to_balance":{"type":"string"},"balance":{"type":"string"},"grand_total":{"type":"string"},"grand_total_tax":{"type":"string"},"fee":{"type":["string","null"]},"earnings":{"type":["string","null"]},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"}}},"TaxRateUsed":{"type":"object","required":["tax_rate","totals"],"properties":{"tax_rate":{"type":"string"},"totals":{"$ref":"#/components/schemas/Totals"}}},"LineItem":{"type":"object","required":["id","price_id","quantity","proration","tax_rate","unit_totals","totals","product"],"properties":{"id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"price_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"quantity":{"type":"integer"},"proration":{"type":"null"},"tax_rate":{"type":"string"},"unit_totals":{"$ref":"#/components/schemas/Totals"},"totals":{"$ref":"#/components/schemas/Totals"},"product":{"$ref":"#/components/schemas/Product"}}},"TransactionDetails":{"type":"object","required":["tax_rates_used","totals","adjusted_totals","payout_totals","adjusted_payout_totals","line_items"],"properties":{"tax_rates_used":{"type":"array","items":{"$ref":"#/components/schemas/TaxRateUsed"}},"totals":{"$ref":"#/components/schemas/TransactionTotals"},"adjusted_totals":{"type":"object","required":["subtotal","tax","total","grand_total","grand_total_tax","fee","earnings","currency_code","retained_fee"],"properties":{"subtotal":{"type":"string"},"tax":{"type":"string"},"total":{"type":"string"},"grand_total":{"type":"string"},"grand_total_tax":{"type":"string"},"fee":{"type":["string","null"]},"earnings":{"type":["string","null"]},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"},"retained_fee":{"type":"string"}}},"payout_totals":{"type":"null"},"adjusted_payout_totals":{"type":"null"},"line_items":{"type":"array","items":{"$ref":"#/components/schemas/LineItem"}}}},"PaymentAttempt":{"type":"object","required":["payment_attempt_id","stored_payment_method_id","payment_method_id","amount","status","error_code","method_details","created_at","captured_at"],"properties":{"payment_attempt_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"stored_payment_method_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"payment_method_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"amount":{"type":"string"},"status":{"type":"string","enum":["authorized","authorized_flagged","canceled","captured","error","action_required","pending_no_action_required","created","unknown","dropped"]},"error_code":{"type":["string","null"]},"method_details":{"type":["object","null"],"required":["type","card","paypal","south_korea_local_card","underlying_details"],"properties":{"type":{"type":"string"},"card":{"type":["object","null"],"required":["type","last4","expiry_month","expiry_year","cardholder_name"],"properties":{"type":{"type":"string"},"last4":{"type":"string"},"expiry_month":{"type":"integer"},"expiry_year":{"type":"integer"},"cardholder_name":{"type":"string"}}},"paypal":{"type":"null"},"south_korea_local_card":{"type":"null"},"underlying_details":{"type":"null"}}},"created_at":{"$ref":"#/components/schemas/Timestamp"},"captured_at":{"$ref":"#/components/schemas/NullableTimestamp"}}},"Transaction":{"type":"object","required":["id","status","customer_id","address_id","business_id","custom_data","currency_code","origin","subscription_id","invoice_id","invoice_number","collection_mode","discount_id","billing_details","billing_period","items","details","payments","checkout","created_at","updated_at","billed_at","revised_at"],"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"transaction","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"status":{"$ref":"#/components/schemas/TransactionStatus"},"customer_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"address_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"business_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"custom_data":{"$ref":"#/components/schemas/CustomData"},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"},"origin":{"$ref":"#/components/schemas/TransactionOrigin"},"subscription_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"invoice_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"invoice_number":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"opaque"}},"collection_mode":{"$ref":"#/components/schemas/CollectionMode"},"discount_id":{"type":"null"},"billing_details":{"$ref":"#/components/schemas/BillingDetailsResponse"},"billing_period":{"oneOf":[{"$ref":"#/components/schemas/BillingPeriod"},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","required":["price_id","price","quantity","proration"],"properties":{"price_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"price":{"$ref":"#/components/schemas/Price"},"quantity":{"type":"integer"},"proration":{"type":"null"}}}},"details":{"$ref":"#/components/schemas/TransactionDetails"},"payments":{"type":"array","items":{"$ref":"#/components/schemas/PaymentAttempt"}},"checkout":{"type":["object","null"],"required":["url"],"properties":{"url":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"url"}}}},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"},"billed_at":{"$ref":"#/components/schemas/NullableTimestamp"},"revised_at":{"type":"null"},"customer":{"description":"Present with \`include=customer\`.","oneOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}]},"address":{"description":"Present with \`include=address\`.","oneOf":[{"$ref":"#/components/schemas/Address"},{"type":"null"}]},"business":{"description":"Present with \`include=business\`.","oneOf":[{"$ref":"#/components/schemas/Business"},{"type":"null"}]}}},"TransactionResponse":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Transaction"},"meta":{"$ref":"#/components/schemas/Meta"}}},"TransactionPreview":{"type":"object","required":["customer_id","address_id","business_id","currency_code","discount_id","customer_ip_address","address","ignore_trials","items","details","available_payment_methods"],"properties":{"customer_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"address_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"business_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"},"discount_id":{"type":"null"},"customer_ip_address":{"type":"null"},"address":{"type":["object","null"],"required":["postal_code","country_code"],"properties":{"postal_code":{"type":["string","null"]},"country_code":{"type":"string"}}},"ignore_trials":{"type":"boolean"},"items":{"type":"array","items":{"type":"object","required":["price","quantity","include_in_totals","proration"],"properties":{"price":{"$ref":"#/components/schemas/Price"},"quantity":{"type":"integer"},"include_in_totals":{"type":"boolean"},"proration":{"type":"null"}}}},"details":{"type":"object","required":["tax_rates_used","totals","line_items"],"properties":{"tax_rates_used":{"type":"array","items":{"$ref":"#/components/schemas/TaxRateUsed"}},"totals":{"$ref":"#/components/schemas/TransactionTotals"},"line_items":{"type":"array","items":{"type":"object","required":["price_id","quantity","tax_rate","unit_totals","totals","product","proration"],"properties":{"price_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"quantity":{"type":"integer"},"tax_rate":{"type":"string"},"unit_totals":{"$ref":"#/components/schemas/Totals"},"totals":{"$ref":"#/components/schemas/Totals"},"product":{"$ref":"#/components/schemas/Product"},"proration":{"type":"null"}}}}}},"available_payment_methods":{"type":"array","items":{"type":"string"}}}},"SubscriptionItem":{"type":"object","required":["status","quantity","recurring","created_at","updated_at","previously_billed_at","next_billed_at","trial_dates","price","product"],"properties":{"status":{"type":"string","enum":["active","inactive","trialing"]},"quantity":{"type":"integer"},"recurring":{"type":"boolean"},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"},"previously_billed_at":{"$ref":"#/components/schemas/NullableTimestamp"},"next_billed_at":{"$ref":"#/components/schemas/NullableTimestamp"},"trial_dates":{"oneOf":[{"$ref":"#/components/schemas/BillingPeriod"},{"type":"null"}]},"price":{"$ref":"#/components/schemas/Price"},"product":{"$ref":"#/components/schemas/Product"}}},"ScheduledChange":{"type":["object","null"],"required":["action","effective_at","resume_at"],"properties":{"action":{"type":"string","enum":["cancel","pause","resume"]},"effective_at":{"$ref":"#/components/schemas/Timestamp"},"resume_at":{"$ref":"#/components/schemas/NullableTimestamp"}}},"Subscription":{"type":"object","required":["id","status","customer_id","address_id","business_id","currency_code","created_at","updated_at","started_at","first_billed_at","next_billed_at","paused_at","canceled_at","discount","collection_mode","billing_details","current_billing_period","billing_cycle","scheduled_change","management_urls","items","custom_data","import_meta"],"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"subscription","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"status":{"$ref":"#/components/schemas/SubscriptionStatus"},"customer_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"address_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"business_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"},"started_at":{"$ref":"#/components/schemas/NullableTimestamp"},"first_billed_at":{"$ref":"#/components/schemas/NullableTimestamp"},"next_billed_at":{"$ref":"#/components/schemas/NullableTimestamp"},"paused_at":{"$ref":"#/components/schemas/NullableTimestamp"},"canceled_at":{"$ref":"#/components/schemas/NullableTimestamp"},"discount":{"type":"null"},"collection_mode":{"$ref":"#/components/schemas/CollectionMode"},"billing_details":{"$ref":"#/components/schemas/BillingDetailsResponse"},"current_billing_period":{"oneOf":[{"$ref":"#/components/schemas/BillingPeriod"},{"type":"null"}]},"billing_cycle":{"$ref":"#/components/schemas/TimePeriod"},"scheduled_change":{"$ref":"#/components/schemas/ScheduledChange"},"management_urls":{"type":"object","required":["update_payment_method","cancel"],"properties":{"update_payment_method":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"url"}},"cancel":{"type":"string","x-mockingbird-volatile":{"kind":"url"}}}},"items":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionItem"}},"custom_data":{"$ref":"#/components/schemas/CustomData"},"import_meta":{"$ref":"#/components/schemas/ImportMeta"},"next_transaction":{"description":"Present with \`include=next_transaction\` (null once canceled).","type":["object","null"],"required":["billing_period","details","adjustments"],"properties":{"billing_period":{"$ref":"#/components/schemas/BillingPeriod"},"details":{"$ref":"#/components/schemas/PreviewDetails"},"adjustments":{"type":"array","items":{"type":"object"}}}},"recurring_transaction_details":{"description":"Present with \`include=recurring_transaction_details\`.","$ref":"#/components/schemas/PreviewDetails"}}},"PreviewDetails":{"type":"object","required":["tax_rates_used","totals","line_items"],"properties":{"tax_rates_used":{"type":"array","items":{"$ref":"#/components/schemas/TaxRateUsed"}},"totals":{"$ref":"#/components/schemas/TransactionTotals"},"line_items":{"type":"array","items":{"type":"object","required":["price_id","quantity","tax_rate","unit_totals","totals","product","proration"],"properties":{"price_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"quantity":{"type":"integer"},"tax_rate":{"type":"string"},"unit_totals":{"$ref":"#/components/schemas/Totals"},"totals":{"$ref":"#/components/schemas/Totals"},"product":{"$ref":"#/components/schemas/Product"},"proration":{"type":"null"}}}}}},"SubscriptionResponse":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Subscription"},"meta":{"$ref":"#/components/schemas/Meta"}}},"SubscriptionUpdate":{"type":"object","properties":{"customer_id":{"type":"string","x-mockingbird-resource-ref":{"type":"customer","missing":"ctm_00000000000000000000000000"}},"address_id":{"type":"string","x-mockingbird-resource-ref":{"type":"address","missing":"add_00000000000000000000000000"}},"business_id":{"type":["string","null"],"x-mockingbird-resource-ref":{"type":"business","missing":"biz_00000000000000000000000000"}},"currency_code":{"$ref":"#/components/schemas/CurrencyCode"},"next_billed_at":{"type":"string","pattern":"^20[2-3][0-9]-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9](\\\\.[0-9]+)?Z$"},"collection_mode":{"$ref":"#/components/schemas/CollectionMode"},"billing_details":{"oneOf":[{"$ref":"#/components/schemas/BillingDetails"},{"type":"null"}]},"scheduled_change":{"type":"null","description":"Only \`null\` is accepted, to remove a scheduled change."},"items":{"type":"array","minItems":1,"maxItems":5,"items":{"$ref":"#/components/schemas/TransactionItemRequest"}},"custom_data":{"$ref":"#/components/schemas/CustomData"},"proration_billing_mode":{"type":"string","enum":["prorated_immediately","prorated_next_billing_period","full_immediately","full_next_billing_period","do_not_bill"]},"on_payment_failure":{"type":"string","enum":["prevent_change","apply_change"]}}},"Event":{"type":"object","required":["event_id","event_type","occurred_at","notification_id","data"],"properties":{"event_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"event_type":{"type":"string"},"occurred_at":{"$ref":"#/components/schemas/Timestamp"},"notification_id":{"type":"null"},"data":{"type":"object"}}},"NotificationEventName":{"type":"string","enum":["customer.created","customer.updated","transaction.created","transaction.updated","transaction.paid","transaction.completed","subscription.created","subscription.imported","subscription.updated","subscription.activated","subscription.trialing","subscription.past_due","subscription.paused","subscription.resumed","subscription.canceled"]},"NotificationEvent":{"oneOf":[{"$ref":"#/components/schemas/NotificationEventName"},{"type":"object","required":["name"],"properties":{"name":{"$ref":"#/components/schemas/NotificationEventName"}}}]},"NotificationDestination":{"type":"string","minLength":1,"maxLength":200,"pattern":"^(https://[A-Za-z0-9./_-]+|[A-Za-z0-9._+-]+@[A-Za-z0-9-]+(\\\\.[A-Za-z0-9-]+)+)$"},"NotificationSetting":{"type":"object","required":["id","description","type","destination","active","api_version","traffic_source","include_sensitive_fields","subscribed_events","created_at","updated_at"],"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"notification_setting","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"description":{"type":"string"},"type":{"type":"string","enum":["url","email"]},"destination":{"type":"string"},"active":{"type":"boolean"},"api_version":{"type":"integer"},"traffic_source":{"type":"string","enum":["platform","simulation","all"]},"include_sensitive_fields":{"type":"boolean"},"subscribed_events":{"type":"array","items":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}}},"endpoint_secret_key":{"type":"string","description":"Present on create only.","x-mockingbird-volatile":{"kind":"token"}},"created_at":{"$ref":"#/components/schemas/Timestamp"},"updated_at":{"$ref":"#/components/schemas/Timestamp"}}},"NotificationSettingResponse":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/NotificationSetting"},"meta":{"$ref":"#/components/schemas/Meta"}}},"NotificationSettingCreate":{"type":"object","required":["description","destination","type","subscribed_events"],"properties":{"description":{"type":"string","minLength":1,"maxLength":200},"destination":{"$ref":"#/components/schemas/NotificationDestination"},"type":{"type":"string","enum":["url","email"]},"active":{"type":"boolean"},"subscribed_events":{"type":"array","minItems":1,"maxItems":20,"items":{"$ref":"#/components/schemas/NotificationEvent"}},"api_version":{"type":"integer","minimum":1,"maximum":1},"traffic_source":{"type":"string","enum":["platform","simulation","all"]},"include_sensitive_fields":{"type":"boolean"}}},"NotificationSettingUpdate":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":200},"destination":{"$ref":"#/components/schemas/NotificationDestination"},"type":{"type":"string","enum":["url","email"]},"active":{"type":"boolean"},"subscribed_events":{"type":"array","minItems":1,"maxItems":20,"items":{"$ref":"#/components/schemas/NotificationEvent"}},"api_version":{"type":"integer","minimum":1,"maximum":1},"traffic_source":{"type":"string","enum":["platform","simulation","all"]},"include_sensitive_fields":{"type":"boolean"}}},"PortalSession":{"type":"object","required":["id","customer_id","urls","created_at"],"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"portal_session","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"customer_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"urls":{"type":"object","required":["general","subscriptions"],"properties":{"general":{"type":"object","required":["overview"],"properties":{"overview":{"type":"string","x-mockingbird-volatile":{"kind":"url"}}}},"subscriptions":{"type":"array","items":{"type":"object","required":["id","cancel_subscription","update_subscription_payment_method","update_subscription"],"properties":{"id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"cancel_subscription":{"type":"string","x-mockingbird-volatile":{"kind":"url"}},"update_subscription_payment_method":{"type":"string","x-mockingbird-volatile":{"kind":"url"}},"update_subscription":{"type":"string","x-mockingbird-volatile":{"kind":"url"}}}}}}},"created_at":{"$ref":"#/components/schemas/Timestamp"}}},"PortalSessionResponse":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/PortalSession"},"meta":{"$ref":"#/components/schemas/Meta"}}},"PortalSessionCreate":{"type":"object","properties":{"subscription_ids":{"type":"array","maxItems":20,"items":{"type":"string","x-mockingbird-resource-ref":{"type":"subscription","missing":"sub_00000000000000000000000000"}}}}}}}}`);
3750
+ var operationIds = ["ListCustomers", "CreateCustomer", "GetCustomer", "UpdateCustomer", "GetCustomerCreditBalances", "CreateCustomerAuthToken", "ListAddresses", "CreateAddress", "GetAddress", "UpdateAddress", "ListBusinesses", "CreateBusiness", "GetBusiness", "UpdateBusiness", "ListProducts", "CreateProduct", "GetProduct", "UpdateProduct", "ListPrices", "CreatePrice", "GetPrice", "UpdatePrice", "ListTransactions", "CreateTransaction", "PreviewTransaction", "GetTransaction", "UpdateTransaction", "GetTransactionInvoice", "ReviseTransaction", "ListSubscriptions", "GetSubscription", "UpdateSubscription", "PreviewSubscriptionUpdate", "ActivateSubscription", "PauseSubscription", "ResumeSubscription", "CancelSubscription", "CreateSubscriptionCharge", "PreviewSubscriptionCharge", "GetSubscriptionPaymentMethodChangeTransaction", "ListEvents", "ListNotificationSettings", "CreateNotificationSetting", "GetNotificationSetting", "UpdateNotificationSetting", "ListDiscounts", "CreateDiscount", "ListAdjustments", "CreateAdjustment", "CreateCustomerPortalSession"];
3751
+ var supportedOperationIds = ["ListCustomers", "CreateCustomer", "GetCustomer", "UpdateCustomer", "GetCustomerCreditBalances", "CreateCustomerAuthToken", "ListAddresses", "CreateAddress", "GetAddress", "UpdateAddress", "ListBusinesses", "CreateBusiness", "GetBusiness", "UpdateBusiness", "ListProducts", "CreateProduct", "GetProduct", "UpdateProduct", "ListPrices", "CreatePrice", "GetPrice", "UpdatePrice", "ListTransactions", "CreateTransaction", "PreviewTransaction", "GetTransaction", "UpdateTransaction", "GetTransactionInvoice", "ListSubscriptions", "GetSubscription", "UpdateSubscription", "ActivateSubscription", "PauseSubscription", "ResumeSubscription", "CancelSubscription", "CreateSubscriptionCharge", "ListEvents", "ListNotificationSettings", "CreateNotificationSetting", "GetNotificationSetting", "UpdateNotificationSetting", "CreateCustomerPortalSession"];
3722
3752
 
3723
3753
  // src/lists.ts
3724
3754
  var asString = (value) => typeof value === "string" ? value : void 0;
@@ -3780,6 +3810,8 @@ var ID_PREFIX = {
3780
3810
  subscription: "sub",
3781
3811
  event: "evt",
3782
3812
  notification: "ntf",
3813
+ notification_setting: "ntfset",
3814
+ portal_session: "cpls",
3783
3815
  line_item: "txnitm",
3784
3816
  payment_attempt: "payatt",
3785
3817
  payment_method: "paymtd",
@@ -3796,6 +3828,8 @@ var PaddleState = class {
3796
3828
  /** Queued one-time charges per subscription id. */
3797
3829
  pendingCharges;
3798
3830
  events;
3831
+ notificationSettings;
3832
+ portalSessions;
3799
3833
  ids;
3800
3834
  constructor(sqlite, namespace) {
3801
3835
  this.customers = new Collection(sqlite, namespace, "customers");
@@ -3807,6 +3841,8 @@ var PaddleState = class {
3807
3841
  this.subscriptions = new Collection(sqlite, namespace, "subscriptions");
3808
3842
  this.pendingCharges = new Collection(sqlite, namespace, "pending_charges");
3809
3843
  this.events = new Collection(sqlite, namespace, "events");
3844
+ this.notificationSettings = new Collection(sqlite, namespace, "notification_settings");
3845
+ this.portalSessions = new Collection(sqlite, namespace, "portal_sessions");
3810
3846
  this.ids = new IdSequence(sqlite, namespace, "paddle");
3811
3847
  }
3812
3848
  /**
@@ -3927,13 +3963,21 @@ var adminRoutes = () => (runtime) => ({
3927
3963
  });
3928
3964
  var createRuntime2 = (options = {}) => {
3929
3965
  const { retryDelaysMs, fetch: send, ...endpoint } = options.webhooks ?? { url: "" };
3966
+ const configuredId = "we_configured";
3930
3967
  const hub = createWebhookHub({
3931
3968
  signer: paddleSigner(),
3932
3969
  ...retryDelaysMs ? { retryDelaysMs } : {},
3933
3970
  ...send ? { fetch: send } : {},
3934
- endpoints: options.webhooks ? [endpoint] : []
3971
+ endpoints: options.webhooks ? [{ ...endpoint, id: configuredId }] : []
3935
3972
  });
3936
- const runtime = createRuntime({
3973
+ let runtime;
3974
+ const setOwn = hub.setEndpoints.bind(hub);
3975
+ const isAdmin = (candidate) => candidate.id !== configuredId && !candidate.id?.startsWith("ntfset_");
3976
+ hub.setEndpoints = (namespace, endpoints) => setOwn(namespace, [
3977
+ ...endpoints.filter(isAdmin),
3978
+ ...runtime?.instance(namespace).notificationDestinations() ?? []
3979
+ ]);
3980
+ const runtimeBuilt = createRuntime({
3937
3981
  name: PADDLE_NAMESPACE,
3938
3982
  document,
3939
3983
  ...options.sqlite ? { sqlite: options.sqlite } : {},
@@ -3962,6 +4006,10 @@ var createRuntime2 = (options = {}) => {
3962
4006
  body: { ...event, notification_id: event.event_id.replace(/^evt_/, "ntf_") },
3963
4007
  tags: { event: event.event_type.split(".")[0] ?? event.event_type }
3964
4008
  });
4009
+ },
4010
+ onDestinations: (endpoints) => {
4011
+ const admin = hub.endpoints(publicNamespace).filter(isAdmin);
4012
+ setOwn(publicNamespace, [...admin, ...endpoints]);
3965
4013
  }
3966
4014
  });
3967
4015
  return api;
@@ -3973,7 +4021,8 @@ var createRuntime2 = (options = {}) => {
3973
4021
  }),
3974
4022
  admin: (base) => adminRoutes()(base)
3975
4023
  });
3976
- return Object.assign(runtime, { webhooks: hub });
4024
+ runtime = runtimeBuilt;
4025
+ return Object.assign(runtimeBuilt, { webhooks: hub });
3977
4026
  };
3978
4027
 
3979
4028
  // src/index.ts
@@ -4007,6 +4056,7 @@ var PaddleAPI = class {
4007
4056
  publicNamespace;
4008
4057
  paymentLink;
4009
4058
  onEvent;
4059
+ onDestinations;
4010
4060
  fixtures;
4011
4061
  requestIds = /* @__PURE__ */ new WeakMap();
4012
4062
  requestCounter = 0;
@@ -4020,6 +4070,7 @@ var PaddleAPI = class {
4020
4070
  this.publicNamespace = options.publicNamespace;
4021
4071
  this.paymentLink = options.paymentLink;
4022
4072
  this.onEvent = options.onEvent;
4073
+ this.onDestinations = options.onDestinations;
4023
4074
  this.fixtures = options.fixtures === true;
4024
4075
  this.state = new PaddleState(sqlite, namespace);
4025
4076
  const handlers = defineOperations({
@@ -4059,7 +4110,12 @@ var PaddleAPI = class {
4059
4110
  ResumeSubscription: (c) => this.resumeSubscription(c),
4060
4111
  CancelSubscription: (c) => this.cancelSubscription(c),
4061
4112
  CreateSubscriptionCharge: (c) => this.chargeSubscription(c),
4062
- ListEvents: (c) => this.listEvents(c)
4113
+ ListEvents: (c) => this.listEvents(c),
4114
+ ListNotificationSettings: (c) => this.listNotificationSettings(c),
4115
+ CreateNotificationSetting: (c) => this.createNotificationSetting(c),
4116
+ GetNotificationSetting: (c) => this.getNotificationSetting(c),
4117
+ UpdateNotificationSetting: (c) => this.updateNotificationSetting(c),
4118
+ CreateCustomerPortalSession: (c) => this.createPortalSession(c)
4063
4119
  });
4064
4120
  this.service = createService({
4065
4121
  document,
@@ -4110,6 +4166,7 @@ var PaddleAPI = class {
4110
4166
  async reset() {
4111
4167
  await this.service.reset();
4112
4168
  if (this.fixtures) this.seedFixtures();
4169
+ this.syncDestinations();
4113
4170
  }
4114
4171
  /** Every event the account produced, oldest first. */
4115
4172
  events() {
@@ -6145,6 +6202,142 @@ var PaddleAPI = class {
6145
6202
  );
6146
6203
  }
6147
6204
  // ---------------------------------------------------------------------------------------
6205
+ // Notification destinations and customer portal sessions
6206
+ /**
6207
+ * Active `url` destinations as webhook endpoints. Derived from the notification-settings
6208
+ * collection so a timeline restore brings the same rows back; the runtime merges them
6209
+ * into the webhook hub beside admin endpoints.
6210
+ */
6211
+ notificationDestinations() {
6212
+ return this.state.notificationSettings.list({ order: "oldest" }).map((row) => row.value).filter((setting) => setting.active && setting.type === "url").map((setting) => ({
6213
+ id: setting.id,
6214
+ url: setting.destination,
6215
+ secret: setting.endpoint_secret_key,
6216
+ events: [...setting.subscribed_events]
6217
+ }));
6218
+ }
6219
+ syncDestinations() {
6220
+ this.onDestinations?.(this.notificationDestinations());
6221
+ }
6222
+ eventNames(value) {
6223
+ if (!Array.isArray(value)) return [];
6224
+ const names = value.map(
6225
+ (item) => typeof item === "string" ? item : String(item.name ?? "")
6226
+ );
6227
+ return [...new Set(names.filter((name) => name !== ""))];
6228
+ }
6229
+ notificationView(setting, discloseSecret) {
6230
+ const { endpoint_secret_key: secret, subscribed_events: names, ...rest } = setting;
6231
+ return {
6232
+ ...rest,
6233
+ subscribed_events: names.map((name) => ({ name })),
6234
+ ...discloseSecret ? { endpoint_secret_key: secret } : {}
6235
+ };
6236
+ }
6237
+ mustNotificationSetting(id) {
6238
+ const setting = this.state.notificationSettings.get(id);
6239
+ if (!setting) throw notFound(id);
6240
+ return setting;
6241
+ }
6242
+ listNotificationSettings(context) {
6243
+ const rows = this.state.notificationSettings.list().map((row) => this.notificationView(row.value, false));
6244
+ return this.page(context, rows);
6245
+ }
6246
+ createNotificationSetting(context) {
6247
+ const body = this.body(context);
6248
+ const at = this.iso();
6249
+ const setting = {
6250
+ id: this.state.nextId("notification_setting"),
6251
+ description: String(body.description),
6252
+ type: body.type === "email" ? "email" : "url",
6253
+ destination: String(body.destination),
6254
+ active: typeof body.active === "boolean" ? body.active : true,
6255
+ api_version: typeof body.api_version === "number" ? body.api_version : 1,
6256
+ traffic_source: body.traffic_source === "simulation" || body.traffic_source === "all" ? body.traffic_source : "platform",
6257
+ include_sensitive_fields: body.include_sensitive_fields === true,
6258
+ subscribed_events: this.eventNames(body.subscribed_events),
6259
+ endpoint_secret_key: this.state.nextToken("pdl_ntfset_", 26),
6260
+ created_at: at,
6261
+ updated_at: at
6262
+ };
6263
+ this.state.notificationSettings.insert(setting.id, setting);
6264
+ this.syncDestinations();
6265
+ return this.ok(context, 201, this.notificationView(setting, true), {
6266
+ notificationSettingId: setting.id
6267
+ });
6268
+ }
6269
+ getNotificationSetting(context) {
6270
+ const setting = this.mustNotificationSetting(context.params.notification_setting_id ?? "");
6271
+ return this.ok(context, 200, this.notificationView(setting, false), {
6272
+ notificationSettingId: setting.id
6273
+ });
6274
+ }
6275
+ updateNotificationSetting(context) {
6276
+ const current = this.mustNotificationSetting(context.params.notification_setting_id ?? "");
6277
+ const body = this.body(context);
6278
+ const updated = {
6279
+ ...current,
6280
+ ...body.description !== void 0 ? { description: String(body.description) } : {},
6281
+ ...body.type === "url" || body.type === "email" ? { type: body.type } : {},
6282
+ ...body.destination !== void 0 ? { destination: String(body.destination) } : {},
6283
+ ...typeof body.active === "boolean" ? { active: body.active } : {},
6284
+ ...typeof body.api_version === "number" ? { api_version: body.api_version } : {},
6285
+ ...body.traffic_source === "platform" || body.traffic_source === "simulation" || body.traffic_source === "all" ? { traffic_source: body.traffic_source } : {},
6286
+ ...typeof body.include_sensitive_fields === "boolean" ? { include_sensitive_fields: body.include_sensitive_fields } : {},
6287
+ ...body.subscribed_events !== void 0 ? { subscribed_events: this.eventNames(body.subscribed_events) } : {},
6288
+ updated_at: this.iso()
6289
+ };
6290
+ this.state.notificationSettings.update(updated.id, updated);
6291
+ this.syncDestinations();
6292
+ return this.ok(context, 200, this.notificationView(updated, false), {
6293
+ notificationSettingId: updated.id
6294
+ });
6295
+ }
6296
+ portalLink(sessionId, token, page) {
6297
+ return `https://sandbox-customer-portal.paddle.com/${sessionId}/${page}?token=${token}`;
6298
+ }
6299
+ createPortalSession(context) {
6300
+ const customerId = context.params.customer_id ?? "";
6301
+ this.mustCustomer(customerId);
6302
+ const body = this.body(context);
6303
+ const requested = Array.isArray(body.subscription_ids) ? body.subscription_ids.map(String) : [];
6304
+ const subscriptions = requested.map((id2) => {
6305
+ const subscription = this.state.subscriptions.get(id2);
6306
+ if (!subscription) throw notFound(id2);
6307
+ if (subscription.customer_id !== customerId) {
6308
+ throw invalidField([
6309
+ {
6310
+ field: "subscription_ids",
6311
+ message: `subscription_ids: subscription ${id2} is not for this customer`
6312
+ }
6313
+ ]);
6314
+ }
6315
+ return id2;
6316
+ });
6317
+ const id = this.state.nextId("portal_session");
6318
+ const token = this.state.nextToken("cpls_", 24);
6319
+ const session = {
6320
+ id,
6321
+ customer_id: customerId,
6322
+ created_at: this.iso(),
6323
+ urls: {
6324
+ general: { overview: this.portalLink(id, token, "overview") },
6325
+ subscriptions: subscriptions.map((subscriptionId) => ({
6326
+ id: subscriptionId,
6327
+ cancel_subscription: this.portalLink(id, token, `${subscriptionId}/cancel`),
6328
+ update_subscription_payment_method: this.portalLink(
6329
+ id,
6330
+ token,
6331
+ `${subscriptionId}/payment-method`
6332
+ ),
6333
+ update_subscription: this.portalLink(id, token, `${subscriptionId}/update`)
6334
+ }))
6335
+ }
6336
+ };
6337
+ this.state.portalSessions.insert(session.id, session);
6338
+ return this.ok(context, 201, session, { portalSessionId: session.id, customerId });
6339
+ }
6340
+ // ---------------------------------------------------------------------------------------
6148
6341
  // Fixtures
6149
6342
  /**
6150
6343
  * A small account to start from: a customer with an address and a business, a "Pro" product
@@ -6266,4 +6459,4 @@ export {
6266
6459
  AUTH_TOKEN_TTL_MS,
6267
6460
  PaddleAPI
6268
6461
  };
6269
- //# sourceMappingURL=chunk-5LSJN227.js.map
6462
+ //# sourceMappingURL=chunk-RX7CMM47.js.map