@flexprice/sdk 2.0.12 → 2.0.13
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.
- package/README.md +78 -0
- package/docs/sdk/models/dto-create-customer-request.md +0 -1
- package/docs/sdk/models/dto-customer-response.md +1 -0
- package/docs/sdk/models/dto-invoice-response.md +1 -0
- package/docs/sdk/models/{dto-create-entity-integration-mapping-request.md → dto-link-integration-mapping-request.md} +4 -4
- package/docs/sdk/models/dto-link-integration-mapping-response.md +15 -0
- package/docs/sdk/models/dto-update-customer-request.md +0 -1
- package/docs/sdk/models/invoice-status.md +1 -1
- package/docs/sdk/models/schedule-draft-finalization-response.md +16 -0
- package/docs/sdk/models/scheduled-task-interval.md +1 -1
- package/docs/sdks/integrations/README.md +18 -235
- package/docs/sdks/scheduledtasks/README.md +73 -2
- package/esm/funcs/coupons-create-coupon.d.ts +2 -0
- package/esm/funcs/coupons-create-coupon.d.ts.map +1 -1
- package/esm/funcs/coupons-create-coupon.js +3 -1
- package/esm/funcs/coupons-create-coupon.js.map +1 -1
- package/esm/funcs/coupons-delete-coupon.d.ts +2 -0
- package/esm/funcs/coupons-delete-coupon.d.ts.map +1 -1
- package/esm/funcs/coupons-delete-coupon.js +3 -1
- package/esm/funcs/coupons-delete-coupon.js.map +1 -1
- package/esm/funcs/coupons-update-coupon.d.ts +2 -0
- package/esm/funcs/coupons-update-coupon.d.ts.map +1 -1
- package/esm/funcs/coupons-update-coupon.js +3 -1
- package/esm/funcs/coupons-update-coupon.js.map +1 -1
- package/esm/funcs/credit-notes-create-credit-note.d.ts +2 -0
- package/esm/funcs/credit-notes-create-credit-note.d.ts.map +1 -1
- package/esm/funcs/credit-notes-create-credit-note.js +3 -1
- package/esm/funcs/credit-notes-create-credit-note.js.map +1 -1
- package/esm/funcs/credit-notes-process-credit-note.d.ts +2 -0
- package/esm/funcs/credit-notes-process-credit-note.d.ts.map +1 -1
- package/esm/funcs/credit-notes-process-credit-note.js +3 -1
- package/esm/funcs/credit-notes-process-credit-note.js.map +1 -1
- package/esm/funcs/credit-notes-void-credit-note.d.ts +2 -0
- package/esm/funcs/credit-notes-void-credit-note.d.ts.map +1 -1
- package/esm/funcs/credit-notes-void-credit-note.js +3 -1
- package/esm/funcs/credit-notes-void-credit-note.js.map +1 -1
- package/esm/funcs/{integrations-get-integration.d.ts → integrations-link-integration-mapping.d.ts} +4 -4
- package/esm/funcs/integrations-link-integration-mapping.d.ts.map +1 -0
- package/esm/funcs/{entity-integration-mappings-create-entity-integration-mapping.js → integrations-link-integration-mapping.js} +9 -9
- package/esm/funcs/integrations-link-integration-mapping.js.map +1 -0
- package/esm/funcs/scheduled-tasks-schedule-draft-finalization.d.ts +17 -0
- package/esm/funcs/scheduled-tasks-schedule-draft-finalization.d.ts.map +1 -0
- package/esm/funcs/{integrations-list-linked-integrations.js → scheduled-tasks-schedule-draft-finalization.js} +9 -9
- package/esm/funcs/scheduled-tasks-schedule-draft-finalization.js.map +1 -0
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/lib/config.js.map +1 -1
- package/esm/lib/security.d.ts +1 -1
- package/esm/lib/security.d.ts.map +1 -1
- package/esm/lib/security.js +19 -8
- package/esm/lib/security.js.map +1 -1
- package/esm/sdk/integrations.d.ts +3 -24
- package/esm/sdk/integrations.d.ts.map +1 -1
- package/esm/sdk/integrations.js +5 -35
- package/esm/sdk/integrations.js.map +1 -1
- package/esm/sdk/models/dto-create-customer-request.d.ts +0 -6
- package/esm/sdk/models/dto-create-customer-request.d.ts.map +1 -1
- package/esm/sdk/models/dto-create-customer-request.js +0 -3
- package/esm/sdk/models/dto-create-customer-request.js.map +1 -1
- package/esm/sdk/models/dto-customer-response.d.ts +2 -0
- package/esm/sdk/models/dto-customer-response.d.ts.map +1 -1
- package/esm/sdk/models/dto-customer-response.js +2 -0
- package/esm/sdk/models/dto-customer-response.js.map +1 -1
- package/esm/sdk/models/dto-invoice-response.d.ts +4 -0
- package/esm/sdk/models/dto-invoice-response.d.ts.map +1 -1
- package/esm/sdk/models/dto-invoice-response.js +2 -0
- package/esm/sdk/models/dto-invoice-response.js.map +1 -1
- package/esm/sdk/models/dto-link-integration-mapping-request.d.ts +25 -0
- package/esm/sdk/models/dto-link-integration-mapping-request.d.ts.map +1 -0
- package/esm/sdk/models/{dto-create-entity-integration-mapping-request.js → dto-link-integration-mapping-request.js} +4 -4
- package/esm/sdk/models/dto-link-integration-mapping-request.js.map +1 -0
- package/esm/sdk/models/dto-link-integration-mapping-response.d.ts +11 -0
- package/esm/sdk/models/dto-link-integration-mapping-response.d.ts.map +1 -0
- package/esm/sdk/models/dto-link-integration-mapping-response.js +15 -0
- package/esm/sdk/models/dto-link-integration-mapping-response.js.map +1 -0
- package/esm/sdk/models/dto-update-customer-request.d.ts +0 -6
- package/esm/sdk/models/dto-update-customer-request.d.ts.map +1 -1
- package/esm/sdk/models/dto-update-customer-request.js +0 -3
- package/esm/sdk/models/dto-update-customer-request.js.map +1 -1
- package/esm/sdk/models/index.d.ts +3 -8
- package/esm/sdk/models/index.d.ts.map +1 -1
- package/esm/sdk/models/index.js +3 -8
- package/esm/sdk/models/index.js.map +1 -1
- package/esm/sdk/models/invoice-status.d.ts +1 -0
- package/esm/sdk/models/invoice-status.d.ts.map +1 -1
- package/esm/sdk/models/invoice-status.js +1 -0
- package/esm/sdk/models/invoice-status.js.map +1 -1
- package/esm/sdk/models/schedule-draft-finalization-op.d.ts +11 -0
- package/esm/sdk/models/schedule-draft-finalization-op.d.ts.map +1 -0
- package/esm/sdk/models/schedule-draft-finalization-op.js +11 -0
- package/esm/sdk/models/schedule-draft-finalization-op.js.map +1 -0
- package/esm/sdk/models/scheduled-task-interval.d.ts +1 -0
- package/esm/sdk/models/scheduled-task-interval.d.ts.map +1 -1
- package/esm/sdk/models/scheduled-task-interval.js +1 -0
- package/esm/sdk/models/scheduled-task-interval.js.map +1 -1
- package/esm/sdk/models/secret-provider.d.ts +0 -2
- package/esm/sdk/models/secret-provider.d.ts.map +1 -1
- package/esm/sdk/models/secret-provider.js +0 -2
- package/esm/sdk/models/secret-provider.js.map +1 -1
- package/esm/sdk/scheduled-tasks.d.ts +7 -0
- package/esm/sdk/scheduled-tasks.d.ts.map +1 -1
- package/esm/sdk/scheduled-tasks.js +10 -0
- package/esm/sdk/scheduled-tasks.js.map +1 -1
- package/esm/sdk/sdk.d.ts +2 -5
- package/esm/sdk/sdk.d.ts.map +1 -1
- package/esm/sdk/sdk.js +4 -9
- package/esm/sdk/sdk.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/coupons-create-coupon.ts +3 -1
- package/src/funcs/coupons-delete-coupon.ts +3 -1
- package/src/funcs/coupons-update-coupon.ts +3 -1
- package/src/funcs/credit-notes-create-credit-note.ts +3 -1
- package/src/funcs/credit-notes-process-credit-note.ts +3 -1
- package/src/funcs/credit-notes-void-credit-note.ts +3 -1
- package/src/funcs/{entity-integration-mappings-create-entity-integration-mapping.ts → integrations-link-integration-mapping.ts} +14 -17
- package/src/funcs/{integrations-list-linked-integrations.ts → scheduled-tasks-schedule-draft-finalization.ts} +12 -11
- package/src/lib/config.ts +3 -3
- package/src/lib/security.ts +14 -2
- package/src/sdk/integrations.ts +8 -62
- package/src/sdk/models/dto-create-customer-request.ts +0 -16
- package/src/sdk/models/dto-customer-response.ts +8 -0
- package/src/sdk/models/dto-invoice-response.ts +6 -0
- package/src/sdk/models/dto-link-integration-mapping-request.ts +59 -0
- package/src/sdk/models/dto-link-integration-mapping-response.ts +35 -0
- package/src/sdk/models/dto-update-customer-request.ts +0 -16
- package/src/sdk/models/index.ts +3 -8
- package/src/sdk/models/invoice-status.ts +1 -0
- package/src/sdk/models/schedule-draft-finalization-op.ts +29 -0
- package/src/sdk/models/scheduled-task-interval.ts +1 -0
- package/src/sdk/models/secret-provider.ts +0 -5
- package/src/sdk/scheduled-tasks.ts +16 -0
- package/src/sdk/sdk.ts +5 -13
- package/docs/sdk/models/create-or-update-integration-request.md +0 -26
- package/docs/sdk/models/delete-entity-integration-mapping-request.md +0 -17
- package/docs/sdk/models/delete-integration-request.md +0 -17
- package/docs/sdk/models/dto-create-integration-request.md +0 -21
- package/docs/sdk/models/dto-integration-entity-mapping.md +0 -21
- package/docs/sdk/models/dto-linked-integrations-response.md +0 -15
- package/docs/sdk/models/get-integration-request.md +0 -17
- package/docs/sdk/models/provider.md +0 -17
- package/docs/sdks/entityintegrationmappings/README.md +0 -160
- package/esm/funcs/entity-integration-mappings-create-entity-integration-mapping.d.ts +0 -17
- package/esm/funcs/entity-integration-mappings-create-entity-integration-mapping.d.ts.map +0 -1
- package/esm/funcs/entity-integration-mappings-create-entity-integration-mapping.js.map +0 -1
- package/esm/funcs/entity-integration-mappings-delete-entity-integration-mapping.d.ts +0 -17
- package/esm/funcs/entity-integration-mappings-delete-entity-integration-mapping.d.ts.map +0 -1
- package/esm/funcs/entity-integration-mappings-delete-entity-integration-mapping.js +0 -90
- package/esm/funcs/entity-integration-mappings-delete-entity-integration-mapping.js.map +0 -1
- package/esm/funcs/integrations-create-or-update-integration.d.ts +0 -17
- package/esm/funcs/integrations-create-or-update-integration.d.ts.map +0 -1
- package/esm/funcs/integrations-create-or-update-integration.js +0 -92
- package/esm/funcs/integrations-create-or-update-integration.js.map +0 -1
- package/esm/funcs/integrations-delete-integration.d.ts +0 -17
- package/esm/funcs/integrations-delete-integration.d.ts.map +0 -1
- package/esm/funcs/integrations-delete-integration.js +0 -90
- package/esm/funcs/integrations-delete-integration.js.map +0 -1
- package/esm/funcs/integrations-get-integration.d.ts.map +0 -1
- package/esm/funcs/integrations-get-integration.js +0 -90
- package/esm/funcs/integrations-get-integration.js.map +0 -1
- package/esm/funcs/integrations-list-linked-integrations.d.ts +0 -17
- package/esm/funcs/integrations-list-linked-integrations.d.ts.map +0 -1
- package/esm/funcs/integrations-list-linked-integrations.js.map +0 -1
- package/esm/sdk/entity-integration-mappings.d.ts +0 -19
- package/esm/sdk/entity-integration-mappings.d.ts.map +0 -1
- package/esm/sdk/entity-integration-mappings.js +0 -28
- package/esm/sdk/entity-integration-mappings.js.map +0 -1
- package/esm/sdk/models/create-or-update-integration-op.d.ts +0 -21
- package/esm/sdk/models/create-or-update-integration-op.d.ts.map +0 -1
- package/esm/sdk/models/create-or-update-integration-op.js +0 -14
- package/esm/sdk/models/create-or-update-integration-op.js.map +0 -1
- package/esm/sdk/models/delete-entity-integration-mapping-op.d.ts +0 -15
- package/esm/sdk/models/delete-entity-integration-mapping-op.d.ts.map +0 -1
- package/esm/sdk/models/delete-entity-integration-mapping-op.js +0 -12
- package/esm/sdk/models/delete-entity-integration-mapping-op.js.map +0 -1
- package/esm/sdk/models/delete-integration-op.d.ts +0 -15
- package/esm/sdk/models/delete-integration-op.d.ts.map +0 -1
- package/esm/sdk/models/delete-integration-op.js +0 -12
- package/esm/sdk/models/delete-integration-op.js.map +0 -1
- package/esm/sdk/models/dto-create-entity-integration-mapping-request.d.ts +0 -25
- package/esm/sdk/models/dto-create-entity-integration-mapping-request.d.ts.map +0 -1
- package/esm/sdk/models/dto-create-entity-integration-mapping-request.js.map +0 -1
- package/esm/sdk/models/dto-create-integration-request.d.ts +0 -21
- package/esm/sdk/models/dto-create-integration-request.d.ts.map +0 -1
- package/esm/sdk/models/dto-create-integration-request.js +0 -15
- package/esm/sdk/models/dto-create-integration-request.js.map +0 -1
- package/esm/sdk/models/dto-integration-entity-mapping.d.ts +0 -38
- package/esm/sdk/models/dto-integration-entity-mapping.d.ts.map +0 -1
- package/esm/sdk/models/dto-integration-entity-mapping.js +0 -23
- package/esm/sdk/models/dto-integration-entity-mapping.js.map +0 -1
- package/esm/sdk/models/dto-linked-integrations-response.d.ts +0 -10
- package/esm/sdk/models/dto-linked-integrations-response.d.ts.map +0 -1
- package/esm/sdk/models/dto-linked-integrations-response.js +0 -14
- package/esm/sdk/models/dto-linked-integrations-response.js.map +0 -1
- package/esm/sdk/models/get-integration-op.d.ts +0 -15
- package/esm/sdk/models/get-integration-op.d.ts.map +0 -1
- package/esm/sdk/models/get-integration-op.js +0 -12
- package/esm/sdk/models/get-integration-op.js.map +0 -1
- package/src/funcs/entity-integration-mappings-delete-entity-integration-mapping.ts +0 -183
- package/src/funcs/integrations-create-or-update-integration.ts +0 -187
- package/src/funcs/integrations-delete-integration.ts +0 -179
- package/src/funcs/integrations-get-integration.ts +0 -181
- package/src/sdk/entity-integration-mappings.ts +0 -45
- package/src/sdk/models/create-or-update-integration-op.ts +0 -46
- package/src/sdk/models/delete-entity-integration-mapping-op.ts +0 -36
- package/src/sdk/models/delete-integration-op.ts +0 -33
- package/src/sdk/models/dto-create-entity-integration-mapping-request.ts +0 -61
- package/src/sdk/models/dto-create-integration-request.ts +0 -42
- package/src/sdk/models/dto-integration-entity-mapping.ts +0 -63
- package/src/sdk/models/dto-linked-integrations-response.ts +0 -31
- package/src/sdk/models/get-integration-op.ts +0 -33
package/README.md
CHANGED
|
@@ -131,6 +131,84 @@ For a full list of operations, see the [API reference](https://docs.flexprice.io
|
|
|
131
131
|
- **Validation or 4xx errors:** Confirm request body field names (snake_case vs camelCase) and required fields against the [API docs](https://docs.flexprice.io).
|
|
132
132
|
- **Parameter passing:** Pass the request object directly to methods (e.g. `ingestEvent({ ... })`), not wrapped in an extra key, unless the SDK docs say otherwise.
|
|
133
133
|
|
|
134
|
+
## Handling Webhooks
|
|
135
|
+
|
|
136
|
+
Flexprice sends webhook events to your server for async updates on payments, invoices, subscriptions, wallets, and more.
|
|
137
|
+
|
|
138
|
+
**Flow:**
|
|
139
|
+
1. Register your endpoint URL in the Flexprice dashboard
|
|
140
|
+
2. Receive `POST` with raw JSON body
|
|
141
|
+
3. Read `event_type` to route
|
|
142
|
+
4. Parse payload using SDK helpers
|
|
143
|
+
5. Handle business logic idempotently
|
|
144
|
+
6. Return `200` quickly
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import {
|
|
148
|
+
WebhookEventName,
|
|
149
|
+
webhookDtoPaymentWebhookPayloadFromJSON,
|
|
150
|
+
webhookDtoSubscriptionWebhookPayloadFromJSON,
|
|
151
|
+
webhookDtoInvoiceWebhookPayloadFromJSON,
|
|
152
|
+
} from "@flexprice/sdk";
|
|
153
|
+
|
|
154
|
+
function handleWebhook(rawBody: string): void {
|
|
155
|
+
const env = JSON.parse(rawBody) as { event_type: string };
|
|
156
|
+
|
|
157
|
+
switch (env.event_type as WebhookEventName) {
|
|
158
|
+
case WebhookEventName.PaymentSuccess:
|
|
159
|
+
case WebhookEventName.PaymentFailed:
|
|
160
|
+
case WebhookEventName.PaymentUpdated: {
|
|
161
|
+
const result = webhookDtoPaymentWebhookPayloadFromJSON(rawBody);
|
|
162
|
+
if (!result.ok) { console.error("parse error", result.error); break; }
|
|
163
|
+
const { payment } = result.value;
|
|
164
|
+
console.log("payment", payment?.id);
|
|
165
|
+
// TODO: update payment record
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
case WebhookEventName.SubscriptionActivated:
|
|
170
|
+
case WebhookEventName.SubscriptionCancelled:
|
|
171
|
+
case WebhookEventName.SubscriptionUpdated: {
|
|
172
|
+
const result = webhookDtoSubscriptionWebhookPayloadFromJSON(rawBody);
|
|
173
|
+
if (!result.ok) { console.error("parse error", result.error); break; }
|
|
174
|
+
console.log("subscription", result.value.subscription?.id);
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
case WebhookEventName.InvoiceUpdateFinalized:
|
|
179
|
+
case WebhookEventName.InvoicePaymentOverdue: {
|
|
180
|
+
const result = webhookDtoInvoiceWebhookPayloadFromJSON(rawBody);
|
|
181
|
+
if (!result.ok) { console.error("parse error", result.error); break; }
|
|
182
|
+
console.log("invoice", result.value.invoice?.id);
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
default:
|
|
187
|
+
console.log("unhandled event:", env.event_type);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
> Fields are auto-camelCased by the SDK: `event_type` → `eventType`, `invoice_status` → `invoiceStatus`. The `fromJSON` helpers return a `SafeParseResult<T>` — always check `.ok` before accessing `.value`.
|
|
193
|
+
|
|
194
|
+
### Event types
|
|
195
|
+
|
|
196
|
+
| Category | Events |
|
|
197
|
+
|---|---|
|
|
198
|
+
| **Payment** | `payment.created` · `payment.updated` · `payment.success` · `payment.failed` · `payment.pending` |
|
|
199
|
+
| **Invoice** | `invoice.create.drafted` · `invoice.update` · `invoice.update.finalized` · `invoice.update.payment` · `invoice.update.voided` · `invoice.payment.overdue` · `invoice.communication.triggered` |
|
|
200
|
+
| **Subscription** | `subscription.created` · `subscription.draft.created` · `subscription.activated` · `subscription.updated` · `subscription.paused` · `subscription.resumed` · `subscription.cancelled` · `subscription.renewal.due` |
|
|
201
|
+
| **Subscription Phase** | `subscription.phase.created` · `subscription.phase.updated` · `subscription.phase.deleted` |
|
|
202
|
+
| **Customer** | `customer.created` · `customer.updated` · `customer.deleted` |
|
|
203
|
+
| **Wallet** | `wallet.created` · `wallet.updated` · `wallet.terminated` · `wallet.transaction.created` · `wallet.credit_balance.dropped` · `wallet.credit_balance.recovered` · `wallet.ongoing_balance.dropped` · `wallet.ongoing_balance.recovered` |
|
|
204
|
+
| **Feature / Entitlement** | `feature.created` · `feature.updated` · `feature.deleted` · `feature.wallet_balance.alert` · `entitlement.created` · `entitlement.updated` · `entitlement.deleted` |
|
|
205
|
+
| **Credit Note** | `credit_note.created` · `credit_note.updated` |
|
|
206
|
+
|
|
207
|
+
**Production rules:**
|
|
208
|
+
- Keep handlers idempotent — Flexprice retries on non-`2xx`
|
|
209
|
+
- Return `200` for unknown event types — prevents unnecessary retries
|
|
210
|
+
- Do heavy processing async — respond fast, queue the work
|
|
211
|
+
|
|
134
212
|
## Documentation
|
|
135
213
|
|
|
136
214
|
- [FlexPrice API documentation](https://docs.flexprice.io)
|
|
@@ -24,7 +24,6 @@ let value: DtoCreateCustomerRequest = {
|
|
|
24
24
|
| `addressState` | *string* | :heavy_minus_sign: | address_state is the state, province, or region name with maximum 100 characters |
|
|
25
25
|
| `email` | *string* | :heavy_minus_sign: | email is the customer's email address and must be a valid email format if provided |
|
|
26
26
|
| `externalId` | *string* | :heavy_check_mark: | external_id is the unique identifier from your system to reference this customer (required) |
|
|
27
|
-
| `integrationEntityMapping` | [models.DtoIntegrationEntityMapping](../../sdk/models/dto-integration-entity-mapping.md)[] | :heavy_minus_sign: | integration_entity_mapping contains provider integration mappings for this customer |
|
|
28
27
|
| `metadata` | Record<string, *string*> | :heavy_minus_sign: | metadata contains additional key-value pairs for storing extra information |
|
|
29
28
|
| `name` | *string* | :heavy_minus_sign: | name is the full name or company name of the customer |
|
|
30
29
|
| `parentCustomerExternalId` | *string* | :heavy_minus_sign: | Deprecated: See ParentCustomerID.<br/>parent_customer_external_id is the external ID of the parent customer from your system.<br/>Exactly one of parent_customer_id or parent_customer_external_id may be provided. |
|
|
@@ -26,6 +26,7 @@ let value: DtoCustomerResponse = {};
|
|
|
26
26
|
| `environmentId` | *string* | :heavy_minus_sign: | EnvironmentID is the environment identifier for the customer |
|
|
27
27
|
| `externalId` | *string* | :heavy_minus_sign: | ExternalID is the external identifier for the customer |
|
|
28
28
|
| `id` | *string* | :heavy_minus_sign: | ID is the unique identifier for the customer |
|
|
29
|
+
| `integrations` | [models.DtoEntityIntegrationMappingResponse](../../sdk/models/dto-entity-integration-mapping-response.md)[] | :heavy_minus_sign: | N/A |
|
|
29
30
|
| `metadata` | Record<string, *string*> | :heavy_minus_sign: | Metadata |
|
|
30
31
|
| `name` | *string* | :heavy_minus_sign: | Name is the name of the customer |
|
|
31
32
|
| `parentCustomer` | [models.DtoCustomerResponse](../../sdk/models/dto-customer-response.md) | :heavy_minus_sign: | Customer response object containing all customer information |
|
|
@@ -44,6 +44,7 @@ let value: DtoInvoiceResponse = {
|
|
|
44
44
|
| `invoicePdfUrl` | *string* | :heavy_minus_sign: | invoice_pdf_url is the URL where customers can download the PDF version of this invoice |
|
|
45
45
|
| `invoiceStatus` | [models.InvoiceStatus](../../sdk/models/invoice-status.md) | :heavy_minus_sign: | N/A |
|
|
46
46
|
| `invoiceType` | [models.InvoiceType](../../sdk/models/invoice-type.md) | :heavy_minus_sign: | N/A |
|
|
47
|
+
| `lastComputedAt` | *string* | :heavy_minus_sign: | last_computed_at is the timestamp when this invoice was last computed by ComputeInvoice |
|
|
47
48
|
| `lineItems` | [models.DtoInvoiceLineItemResponse](../../sdk/models/dto-invoice-line-item-response.md)[] | :heavy_minus_sign: | line_items contains the individual items that make up this invoice (overrides embedded field) |
|
|
48
49
|
| `metadata` | Record<string, *string*> | :heavy_minus_sign: | N/A |
|
|
49
50
|
| `overpaidAmount` | *string* | :heavy_minus_sign: | overpaid_amount is the amount overpaid if payment_status is OVERPAID (amount_paid - total) |
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# DtoLinkIntegrationMappingRequest
|
|
2
2
|
|
|
3
3
|
## Example Usage
|
|
4
4
|
|
|
5
5
|
```typescript
|
|
6
|
-
import {
|
|
6
|
+
import { DtoLinkIntegrationMappingRequest } from "@flexprice/sdk/sdk/models";
|
|
7
7
|
|
|
8
|
-
let value:
|
|
8
|
+
let value: DtoLinkIntegrationMappingRequest = {
|
|
9
9
|
entityId: "<id>",
|
|
10
|
-
entityType: "
|
|
10
|
+
entityType: "plan",
|
|
11
11
|
providerEntityId: "<id>",
|
|
12
12
|
providerType: "<value>",
|
|
13
13
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# DtoLinkIntegrationMappingResponse
|
|
2
|
+
|
|
3
|
+
## Example Usage
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import { DtoLinkIntegrationMappingResponse } from "@flexprice/sdk/sdk/models";
|
|
7
|
+
|
|
8
|
+
let value: DtoLinkIntegrationMappingResponse = {};
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Fields
|
|
12
|
+
|
|
13
|
+
| Field | Type | Required | Description |
|
|
14
|
+
| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| `mapping` | [models.DtoEntityIntegrationMappingResponse](../../sdk/models/dto-entity-integration-mapping-response.md) | :heavy_minus_sign: | N/A |
|
|
@@ -22,7 +22,6 @@ let value: DtoUpdateCustomerRequest = {};
|
|
|
22
22
|
| `addressState` | *string* | :heavy_minus_sign: | address_state is the updated state, province, or region name with maximum 100 characters |
|
|
23
23
|
| `email` | *string* | :heavy_minus_sign: | email is the updated email address and must be a valid email format if provided |
|
|
24
24
|
| `externalId` | *string* | :heavy_minus_sign: | external_id is the updated external identifier for the customer |
|
|
25
|
-
| `integrationEntityMapping` | [models.DtoIntegrationEntityMapping](../../sdk/models/dto-integration-entity-mapping.md)[] | :heavy_minus_sign: | integration_entity_mapping contains provider integration mappings for this customer |
|
|
26
25
|
| `metadata` | Record<string, *string*> | :heavy_minus_sign: | metadata contains updated key-value pairs that will replace existing metadata |
|
|
27
26
|
| `name` | *string* | :heavy_minus_sign: | name is the updated name or company name for the customer |
|
|
28
27
|
| `parentCustomerExternalId` | *string* | :heavy_minus_sign: | Deprecated: See ParentCustomerID.<br/>parent_customer_external_id is the external ID of the parent customer from your system.<br/>Exactly one of parent_customer_id or parent_customer_external_id may be provided.<br/>If you provide the external ID, the parent customer value will be ignored. |
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# ScheduleDraftFinalizationResponse
|
|
2
|
+
|
|
3
|
+
OK
|
|
4
|
+
|
|
5
|
+
## Example Usage
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { ScheduleDraftFinalizationResponse } from "@flexprice/sdk/sdk/models";
|
|
9
|
+
|
|
10
|
+
let value: ScheduleDraftFinalizationResponse = {};
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Fields
|
|
14
|
+
|
|
15
|
+
| Field | Type | Required | Description |
|
|
16
|
+
| ----------- | ----------- | ----------- | ----------- |
|
|
@@ -4,18 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
### Available Operations
|
|
6
6
|
|
|
7
|
-
* [
|
|
8
|
-
* [createOrUpdateIntegration](#createorupdateintegration) - Create or update an integration
|
|
9
|
-
* [listLinkedIntegrations](#listlinkedintegrations) - List linked integrations
|
|
10
|
-
* [deleteIntegration](#deleteintegration) - Delete an integration
|
|
7
|
+
* [linkIntegrationMapping](#linkintegrationmapping) - Link integration mapping
|
|
11
8
|
|
|
12
|
-
##
|
|
9
|
+
## linkIntegrationMapping
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
Link a FlexPrice entity to provider entity with provider-specific side effects.
|
|
15
12
|
|
|
16
13
|
### Example Usage
|
|
17
14
|
|
|
18
|
-
<!-- UsageSnippet language="typescript" operationID="
|
|
15
|
+
<!-- UsageSnippet language="typescript" operationID="linkIntegrationMapping" method="post" path="/integrations/mappings/link" -->
|
|
19
16
|
```typescript
|
|
20
17
|
import { Flexprice } from "@flexprice/sdk";
|
|
21
18
|
|
|
@@ -24,83 +21,11 @@ const flexprice = new Flexprice({
|
|
|
24
21
|
});
|
|
25
22
|
|
|
26
23
|
async function run() {
|
|
27
|
-
const result = await flexprice.integrations.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
run();
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Standalone function
|
|
36
|
-
|
|
37
|
-
The standalone function version of this method:
|
|
38
|
-
|
|
39
|
-
```typescript
|
|
40
|
-
import { FlexpriceCore } from "@flexprice/sdk/core.js";
|
|
41
|
-
import { integrationsGetIntegration } from "@flexprice/sdk/funcs/integrations-get-integration.js";
|
|
42
|
-
|
|
43
|
-
// Use `FlexpriceCore` for best tree-shaking performance.
|
|
44
|
-
// You can create one instance of it to use across an application.
|
|
45
|
-
const flexprice = new FlexpriceCore({
|
|
46
|
-
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
async function run() {
|
|
50
|
-
const res = await integrationsGetIntegration(flexprice, "<value>");
|
|
51
|
-
if (res.ok) {
|
|
52
|
-
const { value: result } = res;
|
|
53
|
-
console.log(result);
|
|
54
|
-
} else {
|
|
55
|
-
console.log("integrationsGetIntegration failed:", res.error);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
run();
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Parameters
|
|
63
|
-
|
|
64
|
-
| Parameter | Type | Required | Description |
|
|
65
|
-
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
66
|
-
| `provider` | *string* | :heavy_check_mark: | Integration provider |
|
|
67
|
-
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
68
|
-
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
69
|
-
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
70
|
-
|
|
71
|
-
### Response
|
|
72
|
-
|
|
73
|
-
**Promise\<[models.DtoSecretResponse](../../sdk/models/dto-secret-response.md)\>**
|
|
74
|
-
|
|
75
|
-
### Errors
|
|
76
|
-
|
|
77
|
-
| Error Type | Status Code | Content Type |
|
|
78
|
-
| -------------------------------- | -------------------------------- | -------------------------------- |
|
|
79
|
-
| models.ErrorsErrorsErrorResponse | 404 | application/json |
|
|
80
|
-
| models.ErrorsErrorsErrorResponse | 500 | application/json |
|
|
81
|
-
| models.SDKError | 4XX, 5XX | \*/\* |
|
|
82
|
-
|
|
83
|
-
## createOrUpdateIntegration
|
|
84
|
-
|
|
85
|
-
Use when storing or updating credentials for an external integration (e.g. Stripe, HubSpot). Secrets are encrypted at rest.
|
|
86
|
-
|
|
87
|
-
### Example Usage
|
|
88
|
-
|
|
89
|
-
<!-- UsageSnippet language="typescript" operationID="createOrUpdateIntegration" method="post" path="/secrets/integrations/create/{provider}" -->
|
|
90
|
-
```typescript
|
|
91
|
-
import { Flexprice } from "@flexprice/sdk";
|
|
92
|
-
|
|
93
|
-
const flexprice = new Flexprice({
|
|
94
|
-
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
async function run() {
|
|
98
|
-
const result = await flexprice.integrations.createOrUpdateIntegration("<value>", {
|
|
99
|
-
credentials: {
|
|
100
|
-
"key": "<value>",
|
|
101
|
-
},
|
|
102
|
-
name: "<value>",
|
|
103
|
-
provider: "quickbooks",
|
|
24
|
+
const result = await flexprice.integrations.linkIntegrationMapping({
|
|
25
|
+
entityId: "<id>",
|
|
26
|
+
entityType: "item_price",
|
|
27
|
+
providerEntityId: "<id>",
|
|
28
|
+
providerType: "<value>",
|
|
104
29
|
});
|
|
105
30
|
|
|
106
31
|
console.log(result);
|
|
@@ -115,7 +40,7 @@ The standalone function version of this method:
|
|
|
115
40
|
|
|
116
41
|
```typescript
|
|
117
42
|
import { FlexpriceCore } from "@flexprice/sdk/core.js";
|
|
118
|
-
import {
|
|
43
|
+
import { integrationsLinkIntegrationMapping } from "@flexprice/sdk/funcs/integrations-link-integration-mapping.js";
|
|
119
44
|
|
|
120
45
|
// Use `FlexpriceCore` for best tree-shaking performance.
|
|
121
46
|
// You can create one instance of it to use across an application.
|
|
@@ -124,18 +49,17 @@ const flexprice = new FlexpriceCore({
|
|
|
124
49
|
});
|
|
125
50
|
|
|
126
51
|
async function run() {
|
|
127
|
-
const res = await
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
provider: "quickbooks",
|
|
52
|
+
const res = await integrationsLinkIntegrationMapping(flexprice, {
|
|
53
|
+
entityId: "<id>",
|
|
54
|
+
entityType: "item_price",
|
|
55
|
+
providerEntityId: "<id>",
|
|
56
|
+
providerType: "<value>",
|
|
133
57
|
});
|
|
134
58
|
if (res.ok) {
|
|
135
59
|
const { value: result } = res;
|
|
136
60
|
console.log(result);
|
|
137
61
|
} else {
|
|
138
|
-
console.log("
|
|
62
|
+
console.log("integrationsLinkIntegrationMapping failed:", res.error);
|
|
139
63
|
}
|
|
140
64
|
}
|
|
141
65
|
|
|
@@ -146,15 +70,14 @@ run();
|
|
|
146
70
|
|
|
147
71
|
| Parameter | Type | Required | Description |
|
|
148
72
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
149
|
-
| `
|
|
150
|
-
| `body` | [models.DtoCreateIntegrationRequest](../../sdk/models/dto-create-integration-request.md) | :heavy_check_mark: | Integration creation request |
|
|
73
|
+
| `request` | [models.DtoLinkIntegrationMappingRequest](../../sdk/models/dto-link-integration-mapping-request.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
151
74
|
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
152
75
|
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
153
76
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
154
77
|
|
|
155
78
|
### Response
|
|
156
79
|
|
|
157
|
-
**Promise\<[models.
|
|
80
|
+
**Promise\<[models.DtoLinkIntegrationMappingResponse](../../sdk/models/dto-link-integration-mapping-response.md)\>**
|
|
158
81
|
|
|
159
82
|
### Errors
|
|
160
83
|
|
|
@@ -162,144 +85,4 @@ run();
|
|
|
162
85
|
| -------------------------------- | -------------------------------- | -------------------------------- |
|
|
163
86
|
| models.ErrorsErrorsErrorResponse | 400 | application/json |
|
|
164
87
|
| models.ErrorsErrorsErrorResponse | 500 | application/json |
|
|
165
|
-
| models.SDKError | 4XX, 5XX | \*/\* |
|
|
166
|
-
|
|
167
|
-
## listLinkedIntegrations
|
|
168
|
-
|
|
169
|
-
Use when showing which integrations are connected (e.g. settings page). Returns providers that have valid linked credentials.
|
|
170
|
-
|
|
171
|
-
### Example Usage
|
|
172
|
-
|
|
173
|
-
<!-- UsageSnippet language="typescript" operationID="listLinkedIntegrations" method="get" path="/secrets/integrations/linked" -->
|
|
174
|
-
```typescript
|
|
175
|
-
import { Flexprice } from "@flexprice/sdk";
|
|
176
|
-
|
|
177
|
-
const flexprice = new Flexprice({
|
|
178
|
-
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
async function run() {
|
|
182
|
-
const result = await flexprice.integrations.listLinkedIntegrations();
|
|
183
|
-
|
|
184
|
-
console.log(result);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
run();
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### Standalone function
|
|
191
|
-
|
|
192
|
-
The standalone function version of this method:
|
|
193
|
-
|
|
194
|
-
```typescript
|
|
195
|
-
import { FlexpriceCore } from "@flexprice/sdk/core.js";
|
|
196
|
-
import { integrationsListLinkedIntegrations } from "@flexprice/sdk/funcs/integrations-list-linked-integrations.js";
|
|
197
|
-
|
|
198
|
-
// Use `FlexpriceCore` for best tree-shaking performance.
|
|
199
|
-
// You can create one instance of it to use across an application.
|
|
200
|
-
const flexprice = new FlexpriceCore({
|
|
201
|
-
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
async function run() {
|
|
205
|
-
const res = await integrationsListLinkedIntegrations(flexprice);
|
|
206
|
-
if (res.ok) {
|
|
207
|
-
const { value: result } = res;
|
|
208
|
-
console.log(result);
|
|
209
|
-
} else {
|
|
210
|
-
console.log("integrationsListLinkedIntegrations failed:", res.error);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
run();
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### Parameters
|
|
218
|
-
|
|
219
|
-
| Parameter | Type | Required | Description |
|
|
220
|
-
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
221
|
-
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
222
|
-
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
223
|
-
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
224
|
-
|
|
225
|
-
### Response
|
|
226
|
-
|
|
227
|
-
**Promise\<[models.DtoLinkedIntegrationsResponse](../../sdk/models/dto-linked-integrations-response.md)\>**
|
|
228
|
-
|
|
229
|
-
### Errors
|
|
230
|
-
|
|
231
|
-
| Error Type | Status Code | Content Type |
|
|
232
|
-
| -------------------------------- | -------------------------------- | -------------------------------- |
|
|
233
|
-
| models.ErrorsErrorsErrorResponse | 500 | application/json |
|
|
234
|
-
| models.SDKError | 4XX, 5XX | \*/\* |
|
|
235
|
-
|
|
236
|
-
## deleteIntegration
|
|
237
|
-
|
|
238
|
-
Use when disconnecting an integration (e.g. switching provider or removing OAuth). Deletes stored credentials.
|
|
239
|
-
|
|
240
|
-
### Example Usage
|
|
241
|
-
|
|
242
|
-
<!-- UsageSnippet language="typescript" operationID="deleteIntegration" method="delete" path="/secrets/integrations/{id}" -->
|
|
243
|
-
```typescript
|
|
244
|
-
import { Flexprice } from "@flexprice/sdk";
|
|
245
|
-
|
|
246
|
-
const flexprice = new Flexprice({
|
|
247
|
-
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
async function run() {
|
|
251
|
-
await flexprice.integrations.deleteIntegration("<id>");
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
run();
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### Standalone function
|
|
260
|
-
|
|
261
|
-
The standalone function version of this method:
|
|
262
|
-
|
|
263
|
-
```typescript
|
|
264
|
-
import { FlexpriceCore } from "@flexprice/sdk/core.js";
|
|
265
|
-
import { integrationsDeleteIntegration } from "@flexprice/sdk/funcs/integrations-delete-integration.js";
|
|
266
|
-
|
|
267
|
-
// Use `FlexpriceCore` for best tree-shaking performance.
|
|
268
|
-
// You can create one instance of it to use across an application.
|
|
269
|
-
const flexprice = new FlexpriceCore({
|
|
270
|
-
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
async function run() {
|
|
274
|
-
const res = await integrationsDeleteIntegration(flexprice, "<id>");
|
|
275
|
-
if (res.ok) {
|
|
276
|
-
const { value: result } = res;
|
|
277
|
-
|
|
278
|
-
} else {
|
|
279
|
-
console.log("integrationsDeleteIntegration failed:", res.error);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
run();
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
### Parameters
|
|
287
|
-
|
|
288
|
-
| Parameter | Type | Required | Description |
|
|
289
|
-
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
290
|
-
| `id` | *string* | :heavy_check_mark: | Integration ID |
|
|
291
|
-
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
292
|
-
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
293
|
-
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
294
|
-
|
|
295
|
-
### Response
|
|
296
|
-
|
|
297
|
-
**Promise\<void\>**
|
|
298
|
-
|
|
299
|
-
### Errors
|
|
300
|
-
|
|
301
|
-
| Error Type | Status Code | Content Type |
|
|
302
|
-
| -------------------------------- | -------------------------------- | -------------------------------- |
|
|
303
|
-
| models.ErrorsErrorsErrorResponse | 404 | application/json |
|
|
304
|
-
| models.ErrorsErrorsErrorResponse | 500 | application/json |
|
|
305
88
|
| models.SDKError | 4XX, 5XX | \*/\* |
|