paddle_rust_sdk/entities.rs
1//! Contains all Paddle entity types.
2
3use std::collections::HashMap;
4
5use chrono::DateTime;
6use chrono::FixedOffset;
7use chrono::Utc;
8use serde::{Deserialize, Serialize};
9
10use crate::enums::*;
11use crate::ids::*;
12
13/// Import information for this entity. `null` if this entity is not imported.
14#[derive(Clone, Debug, Serialize, Deserialize)]
15pub struct ImportMeta {
16 /// Reference or identifier for this entity from the solution where it was imported from.
17 pub external_id: Option<String>,
18 /// Name of the platform where this entity was imported from.
19 pub imported_from: String,
20}
21
22/// Represents an address entity.
23#[derive(Clone, Debug, Serialize, Deserialize)]
24pub struct Address {
25 /// Unique Paddle ID for this address entity, prefixed with `add_`.
26 pub id: AddressID,
27 /// Unique Paddle ID for this customer entity, prefixed with `ctm_`.
28 pub customer_id: CustomerID,
29 /// Memorable description for this address.
30 pub description: Option<String>,
31 /// First line of this address.
32 pub first_line: Option<String>,
33 /// Second line of this address.
34 pub second_line: Option<String>,
35 /// City of this address.
36 pub city: Option<String>,
37 /// ZIP or postal code of this address. Required for some countries.
38 pub postal_code: Option<String>,
39 /// State, county, or region of this address.
40 pub region: Option<String>,
41 /// Supported two-letter ISO 3166-1 alpha-2 country code.
42 pub country_code: CountryCodeSupported,
43 /// Your own structured key-value data.
44 pub custom_data: Option<HashMap<String, String>>,
45 /// Whether this entity can be used in Paddle.
46 pub status: Status,
47 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
48 pub created_at: DateTime<Utc>,
49 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
50 pub updated_at: DateTime<Utc>,
51 /// Import information for this entity. `null` if this entity is not imported.
52 pub import_meta: Option<ImportMeta>,
53}
54
55/// Represents an address entity when creating addresses.
56#[derive(Clone, Debug, Serialize, Deserialize)]
57pub struct AddressCreate {
58 /// Unique Paddle ID for this address entity, prefixed with `add_`.
59 pub id: AddressID,
60 /// Memorable description for this address.
61 pub description: Option<String>,
62 /// First line of this address.
63 pub first_line: Option<String>,
64 /// Second line of this address.
65 pub second_line: Option<String>,
66 /// City of this address.
67 pub city: Option<String>,
68 /// ZIP or postal code of this address. Required for some countries.
69 pub postal_code: Option<String>,
70 /// State, county, or region of this address.
71 pub region: Option<String>,
72 /// Supported two-letter ISO 3166-1 alpha-2 country code.
73 pub country_code: CountryCodeSupported,
74 /// Your own structured key-value data.
75 pub custom_data: Option<HashMap<String, String>>,
76 /// Import information for this entity. `null` if this entity is not imported.
77 pub import_meta: ImportMeta,
78}
79
80/// Represents an address entity when previewing addresses.
81#[derive(Clone, Debug, Serialize, Deserialize)]
82pub struct AddressPreview {
83 /// ZIP or postal code of this address. Include for more accurate tax calculations.
84 pub postal_code: Option<String>,
85 /// Supported two-letter ISO 3166-1 alpha-2 country code.
86 pub country_code: CountryCodeSupported,
87}
88
89/// Represents an address entity when updating addresses.
90#[derive(Clone, Debug, Serialize, Deserialize)]
91pub struct AddressUpdate {
92 /// Memorable description for this address.
93 pub description: Option<String>,
94 /// First line of this address.
95 pub first_line: Option<String>,
96 /// Second line of this address.
97 pub second_line: Option<String>,
98 /// City of this address.
99 pub city: Option<String>,
100 /// ZIP or postal code of this address. Required for some countries.
101 pub postal_code: Option<String>,
102 /// State, county, or region of this address.
103 pub region: Option<String>,
104 /// Supported two-letter ISO 3166-1 alpha-2 country code.
105 pub country_code: CountryCodeSupported,
106 /// Your own structured key-value data.
107 pub custom_data: Option<HashMap<String, String>>,
108 /// Whether this entity can be used in Paddle.
109 pub status: Status,
110}
111
112/// Breakdown of the total for an adjustment.
113#[derive(Clone, Debug, Serialize, Deserialize)]
114pub struct AdjustmentTotals {
115 /// Total before tax. For tax adjustments, the value is 0.
116 pub subtotal: String,
117 /// Total tax on the subtotal.
118 pub tax: String,
119 /// Total after tax.
120 pub total: String,
121 /// Total fee taken by Paddle for this adjustment.
122 pub fee: String,
123 /// Total earnings. This is the subtotal minus the Paddle fee.
124 /// For tax adjustments, this value is negative, which means a positive effect in the transaction earnings.
125 /// This is because the fee is originally calculated from the transaction total, so if a tax adjustment is made,
126 /// then the fee portion of it is returned.
127 pub earnings: String,
128 /// Supported three-letter ISO 4217 currency code.
129 pub currency_code: CurrencyCode,
130}
131
132/// Chargeback fee before conversion to the payout currency. `null` when the chargeback fee is the same as the payout currency.
133#[derive(Clone, Debug, Serialize, Deserialize)]
134pub struct Original {
135 /// Fee amount for this chargeback in the original currency.
136 pub amount: String,
137 /// Three-letter ISO 4217 currency code for chargeback fees.
138 pub currency_code: CurrencyCodeChargebacks,
139}
140
141/// Chargeback fees incurred for this adjustment. Only returned when the adjustment `action` is `chargeback` or `chargeback_warning`.
142#[derive(Clone, Debug, Serialize, Deserialize)]
143pub struct ChargebackFee {
144 /// Chargeback fee converted into the payout currency.
145 pub amount: String,
146 /// Chargeback fee before conversion to the payout currency. `null` when the chargeback fee is the same as the payout currency.
147 pub original: Original,
148}
149
150/// Breakdown of how this adjustment affects your payout balance.
151#[derive(Clone, Debug, Serialize, Deserialize)]
152pub struct AdjustmentPayoutTotals {
153 /// Adjustment total before tax and fees.
154 pub subtotal: String,
155 /// Total tax on the adjustment subtotal.
156 pub tax: String,
157 /// Adjustment total after tax.
158 pub total: String,
159 /// Adjusted Paddle fee.
160 pub fee: String,
161 /// Chargeback fees incurred for this adjustment. Only returned when the adjustment `action` is `chargeback` or `chargeback_warning`.
162 pub chargeback_fee: ChargebackFee,
163 /// Adjusted payout earnings. This is the adjustment total plus adjusted Paddle fees, excluding chargeback fees.
164 pub earnings: String,
165 /// Supported three-letter ISO 4217 currency code for payouts from Paddle.
166 pub currency_code: CurrencyCodePayouts,
167}
168
169/// Calculated totals for the tax applied to this adjustment.
170#[derive(Clone, Debug, Serialize, Deserialize)]
171pub struct AdjustmentTaxRateUsedTotals {
172 /// Total before tax. For tax adjustments, the value is 0.
173 pub subtotal: String,
174 /// Total tax on the subtotal.
175 pub tax: String,
176 /// Total after tax.
177 pub total: String,
178}
179
180#[derive(Clone, Debug, Serialize, Deserialize)]
181pub struct AdjustmentTaxRateUsed {
182 /// Rate used to calculate tax for this adjustment.
183 pub tax_rate: String,
184 /// Calculated totals for the tax applied to this adjustment.
185 pub totals: AdjustmentTaxRateUsedTotals,
186}
187
188/// Represents an adjustment entity.
189#[derive(Clone, Debug, Serialize, Deserialize)]
190pub struct Adjustment {
191 /// Unique Paddle ID for this adjustment entity, prefixed with `adj_`.
192 pub id: AdjustmentID,
193 /// How this adjustment impacts the related transaction.
194 pub action: AdjustmentAction,
195 /// Type of adjustment. Use `full` to adjust the grand total for the related transaction. Include an `items` array when creating a `partial` adjustment. If omitted, defaults to `partial`.
196 pub r#type: AdjustmentType,
197 /// Unique Paddle ID for this transaction entity, prefixed with `txn_`.
198 pub transaction_id: TransactionID,
199 /// Paddle ID for the subscription related to this adjustment, prefixed with `sub_`.
200 /// Set automatically by Paddle based on the `subscription_id` of the related transaction.
201 pub subscription_id: Option<SubscriptionID>,
202 /// Unique Paddle ID for this customer entity, prefixed with `ctm_`.
203 pub customer_id: CustomerID,
204 /// Why this adjustment was created. Appears in the Paddle dashboard. Retained for record-keeping purposes.
205 pub reason: String,
206 /// Whether this adjustment was applied to the related customer's credit balance. Only returned for `credit` adjustments.
207 pub credit_applied_to_balance: Option<bool>,
208 /// Supported three-letter ISO 4217 currency code.
209 pub currency_code: CurrencyCode,
210 /// Status of this adjustment. Set automatically by Paddle.
211 ///
212 /// Most refunds for live accounts are created with the status of `pending_approval` until reviewed by Paddle, but some are automatically approved. For sandbox accounts, Paddle automatically approves refunds every ten minutes.
213 ///
214 /// Credit adjustments don't require approval from Paddle, so they're created as `approved`.
215 pub status: AdjustmentStatus,
216 /// List of items on this adjustment. Required if `type` is not populated or set to `partial`.
217 pub items: Vec<AdjustmentItem>,
218 /// Breakdown of the total for an adjustment.
219 pub totals: AdjustmentTotals,
220 /// Breakdown of how this adjustment affects your payout balance.
221 pub payout_totals: Option<AdjustmentPayoutTotals>,
222 /// List of tax rates applied for this adjustment.
223 pub tax_rates_used: Vec<AdjustmentTaxRateUsed>,
224 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
225 pub created_at: String,
226 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
227 pub updated_at: String,
228}
229
230/// Represents an adjustment entity when creating adjustments.
231#[derive(Clone, Debug, Serialize, Deserialize)]
232pub struct AdjustmentCreate {
233 /// Unique Paddle ID for this adjustment entity, prefixed with `adj_`.
234 pub id: AdjustmentID,
235 /// How this adjustment impacts the related transaction.
236 pub action: AdjustmentAction,
237 /// Type of adjustment. Use `full` to adjust the grand total for the related transaction. Include an `items` array when creating a `partial` adjustment. If omitted, defaults to `partial`.
238 pub r#type: AdjustmentType,
239 /// Unique Paddle ID for this transaction entity, prefixed with `txn_`.
240 pub transaction_id: TransactionID,
241 /// Paddle ID for the subscription related to this adjustment, prefixed with `sub_`.
242 /// Set automatically by Paddle based on the `subscription_id` of the related transaction.
243 pub subscription_id: SubscriptionID,
244 /// Unique Paddle ID for this customer entity, prefixed with `ctm_`.
245 pub customer_id: CustomerID,
246 /// Why this adjustment was created. Appears in the Paddle dashboard. Retained for recordkeeping purposes.
247 pub reason: String,
248 /// Whether this adjustment was applied to the related customer's credit balance. Only returned for `credit` adjustments.
249 pub credit_applied_to_balance: Option<bool>,
250 /// Supported three-letter ISO 4217 currency code.
251 pub currency_code: CurrencyCode,
252 /// Status of this adjustment. Set automatically by Paddle.
253 ///
254 /// Most refunds for live accounts are created with the status of `pending_approval` until reviewed by Paddle, but some are automatically approved. For sandbox accounts, Paddle automatically approves refunds every ten minutes.
255 ///
256 /// Credit adjustments don't require approval from Paddle, so they're created as `approved`.
257 pub status: AdjustmentStatus,
258 /// List of transaction items to adjust. Required if `type` is not populated or set to `partial`.
259 pub items: Option<Vec<AdjustmentItem>>,
260 /// Breakdown of the total for an adjustment.
261 pub totals: AdjustmentTotals,
262 /// Breakdown of how this adjustment affects your payout balance.
263 pub payout_totals: Option<AdjustmentPayoutTotals>,
264 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
265 pub created_at: String,
266 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
267 pub updated_at: String,
268}
269
270#[derive(Clone, Debug, Serialize, Deserialize)]
271pub struct TimePeriod {
272 /// RFC 3339 datetime string.
273 pub starts_at: String,
274 /// RFC 3339 datetime string.
275 pub ends_at: String,
276}
277
278/// How proration was calculated for this item. Populated when a transaction is created from a subscription change, where `proration_billing_mode` was `prorated_immediately` or `prorated_next_billing_period`. Set automatically by Paddle.
279#[derive(Clone, Debug, Serialize, Deserialize)]
280pub struct Proration {
281 /// Rate used to calculate proration.
282 pub rate: String,
283 pub billing_period: TimePeriod,
284}
285
286/// Breakdown of the total for an adjustment item.
287#[derive(Clone, Debug, Serialize, Deserialize)]
288pub struct AdjustmentItemTotals {
289 /// Amount multiplied by quantity.
290 pub subtotal: String,
291 /// Total tax on the subtotal.
292 pub tax: String,
293 /// Total after tax.
294 pub total: String,
295}
296
297#[derive(Clone, Debug, Serialize, Deserialize)]
298pub struct AdjustmentItem {
299 /// Unique Paddle ID for this transaction item, prefixed with `txnitm_`. Used when working with [adjustments](https://developer.paddle.com/build/transactions/create-transaction-adjustments).
300 pub item_id: TransactionItemID,
301 /// Type of adjustment for this transaction item. `tax` adjustments are automatically created by Paddle.
302 /// Include `amount` when creating a `partial` adjustment.
303 pub r#type: AdjustmentItemType,
304 /// Amount adjusted for this transaction item. Required when item type is `partial`.
305 pub amount: Option<String>,
306 /// How proration was calculated for this adjustment item.
307 pub proration: Option<Proration>,
308 /// Breakdown of the total for an adjustment item.
309 pub totals: AdjustmentItemTotals,
310}
311
312/// Represents an adjustment entity when previewing adjustments.
313#[derive(Clone, Debug, Serialize, Deserialize)]
314pub struct AdjustmentPreview {
315 /// Unique Paddle ID for this transaction entity, prefixed with `txn_`.
316 pub transaction_id: TransactionID,
317 /// List of transaction items that this adjustment is for.
318 pub items: Vec<AdjustmentItem>,
319 /// Breakdown of the total for an adjustment.
320 pub totals: AdjustmentTotals,
321}
322
323#[derive(Clone, Debug, Serialize, Deserialize)]
324pub struct Duration {
325 /// Unit of time.
326 pub interval: Interval,
327 /// Amount of time.
328 pub frequency: u64,
329}
330
331/// Details for invoicing. Required if `collection_mode` is `manual`.
332#[derive(Clone, Debug, Serialize, Deserialize)]
333pub struct BillingDetails {
334 /// Whether the related transaction may be paid using Paddle Checkout. If omitted when creating a transaction, defaults to `false`.
335 pub enable_checkout: bool,
336 /// Customer purchase order number. Appears on invoice documents.
337 pub purchase_order_number: String,
338 /// Notes or other information to include on this invoice. Appears on invoice documents.
339 pub additional_information: Option<String>,
340 pub payment_terms: Duration,
341}
342
343/// Details for invoicing. Required if `collection_mode` is `manual`.
344#[derive(Clone, Debug, Serialize, Deserialize)]
345pub struct BillingDetailsUpdate {
346 /// Whether the related transaction may be paid using Paddle Checkout.
347 pub enable_checkout: bool,
348 /// Customer purchase order number. Appears on invoice documents.
349 pub purchase_order_number: String,
350 /// Notes or other information to include on this invoice. Appears on invoice documents.
351 pub additional_information: Option<String>,
352 pub payment_terms: Duration,
353}
354
355#[derive(Clone, Debug, Serialize, Deserialize)]
356pub struct Contacts {
357 /// Full name.
358 pub name: String,
359 /// Email address for this entity.
360 pub email: String,
361}
362
363/// Represents a business entity.
364#[derive(Clone, Debug, Serialize, Deserialize)]
365pub struct Business {
366 /// Unique Paddle ID for this business entity, prefixed with `biz_`.
367 pub id: BusinessID,
368 /// Unique Paddle ID for this customer entity, prefixed with `ctm_`.
369 pub customer_id: CustomerID,
370 /// Full name.
371 pub name: String,
372 /// Company number for this business.
373 pub company_number: Option<String>,
374 /// Tax or VAT Number for this business.
375 pub tax_identifier: Option<String>,
376 /// Whether this entity can be used in Paddle.
377 pub status: Status,
378 /// List of contacts related to this business, typically used for sending invoices.
379 pub contacts: Vec<Contacts>,
380 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
381 pub created_at: String,
382 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
383 pub updated_at: String,
384 /// Your own structured key-value data.
385 pub custom_data: Option<HashMap<String, String>>,
386 /// Import information for this entity. `null` if this entity is not imported.
387 pub import_meta: ImportMeta,
388}
389
390/// Represents a business entity when creating businesses.
391#[derive(Clone, Debug, Serialize, Deserialize)]
392pub struct BusinessCreate {
393 /// Unique Paddle ID for this business entity, prefixed with `biz_`.
394 pub id: BusinessID,
395 /// Full name.
396 pub name: String,
397 /// Company number for this business.
398 pub company_number: Option<String>,
399 /// Tax or VAT Number for this business.
400 pub tax_identifier: Option<String>,
401 /// List of contacts related to this business, typically used for sending invoices.
402 pub contacts: Contacts,
403 /// Your own structured key-value data.
404 pub custom_data: Option<HashMap<String, String>>,
405 /// Import information for this entity. `null` if this entity is not imported.
406 pub import_meta: ImportMeta,
407}
408
409/// Represents a business entity when updating businesses.
410#[derive(Clone, Debug, Serialize, Deserialize)]
411pub struct BusinessUpdate {
412 /// Full name.
413 pub name: String,
414 /// Company number for this business.
415 pub company_number: Option<String>,
416 /// Tax or VAT Number for this business.
417 pub tax_identifier: Option<String>,
418 /// Whether this entity can be used in Paddle.
419 pub status: Status,
420 /// List of contacts related to this business, typically used for sending invoices.
421 pub contacts: Contacts,
422 /// Your own structured key-value data.
423 pub custom_data: Option<HashMap<String, String>>,
424}
425
426/// Card metadata
427#[derive(Clone, Debug, Serialize, Deserialize)]
428pub struct Card {
429 /// Type of credit or debit card used to pay.
430 pub r#type: CardType,
431 /// Last four digits of the card used to pay.
432 pub last4: String,
433 /// Month of the expiry date of the card used to pay.
434 pub expiry_month: i64,
435 /// Year of the expiry date of the card used to pay.
436 pub expiry_year: i64,
437 /// The name on the card used to pay.
438 pub cardholder_name: String,
439}
440
441#[derive(Clone, Debug, Serialize, Deserialize)]
442pub struct CustomerBalance {
443 /// Total amount of credit available to use.
444 pub available: String,
445 /// Total amount of credit temporarily reserved for `billed` transactions.
446 pub reserved: String,
447 /// Total amount of credit used.
448 pub used: String,
449}
450
451/// Represents a credit balance for a customer.
452#[derive(Clone, Debug, Serialize, Deserialize)]
453pub struct CreditBalance {
454 /// Unique Paddle ID for this customer entity, prefixed with `ctm_`.
455 pub customer_id: CustomerID,
456 /// Supported three-letter ISO 4217 currency code.
457 pub currency_code: CurrencyCode,
458 pub balance: CustomerBalance,
459}
460
461/// Represents a customer entity.
462#[derive(Clone, Debug, Serialize, Deserialize)]
463pub struct Customer {
464 /// Unique Paddle ID for this customer entity, prefixed with `ctm_`.
465 pub id: CustomerID,
466 /// Full name of this customer. Required when creating transactions where `collection_mode` is `manual` (invoices).
467 pub name: Option<String>,
468 /// Email address for this entity.
469 pub email: String,
470 /// Whether this customer opted into marketing from you. `false` unless customers check the marketing consent box
471 /// when using Paddle Checkout. Set automatically by Paddle.
472 pub marketing_consent: bool,
473 /// Whether this entity can be used in Paddle.
474 pub status: Status,
475 /// Your own structured key-value data.
476 pub custom_data: Option<HashMap<String, String>>,
477 /// Valid IETF BCP 47 short form locale tag. If omitted, defaults to `en`.
478 pub locale: String,
479 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
480 pub created_at: DateTime<Utc>,
481 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
482 pub updated_at: DateTime<Utc>,
483 /// Import information for this entity. `null` if this entity is not imported.
484 pub import_meta: Option<ImportMeta>,
485}
486
487/// Represents a customer entity when creating customers.
488#[derive(Clone, Debug, Serialize, Deserialize)]
489pub struct CustomerCreate {
490 /// Unique Paddle ID for this customer entity, prefixed with `ctm_`.
491 pub id: CustomerID,
492 /// Full name of this customer. Required when creating transactions where `collection_mode` is `manual` (invoices).
493 pub name: Option<String>,
494 /// Email address for this entity.
495 pub email: String,
496 /// Whether this customer opted into marketing from you. `false` unless customers check the marketing consent box
497 /// when using Paddle Checkout. Set automatically by Paddle.
498 pub marketing_consent: bool,
499 /// Your own structured key-value data.
500 pub custom_data: Option<HashMap<String, String>>,
501 /// Valid IETF BCP 47 short form locale tag. If omitted, defaults to `en`.
502 pub locale: String,
503 /// Import information for this entity. `null` if this entity is not imported.
504 pub import_meta: ImportMeta,
505}
506
507/// PayPal metadata
508#[derive(Clone, Debug, Serialize, Deserialize)]
509pub struct PayPal {
510 /// Email address associated with the PayPal account.
511 pub email: String,
512 /// PayPal payment method identifier.
513 pub reference: String,
514}
515
516/// Represents a customer payment method entity.
517#[derive(Clone, Debug, Serialize, Deserialize)]
518pub struct PaymentMethod {
519 /// Unique Paddle ID for this payment method entity, prefixed with `paymtd_`.
520 pub id: PaymentMethodID,
521 /// Unique Paddle ID for this customer entity, prefixed with `ctm_`.
522 pub customer_id: CustomerID,
523 /// Unique Paddle ID for this address entity, prefixed with `add_`.
524 pub address_id: AddressID,
525 /// Type of payment method saved.
526 pub r#type: SavedPaymentMethodType,
527 /// Information about the credit or debit card saved. `null` unless `type` is `card`.
528 pub card: Card,
529 /// Information about the PayPal payment method saved. `null` unless `type` is `paypal`.
530 pub paypal: Option<PayPal>,
531 /// Describes how this payment method was saved.
532 pub origin: PaymentMethodOrigin,
533 /// RFC 3339 datetime string of when this entity was saved. Set automatically by Paddle.
534 pub saved_at: String,
535 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
536 pub updated_at: String,
537}
538
539/// Authenticated customer portal deep links that aren't associated with a specific entity.
540#[derive(Clone, Debug, Serialize, Deserialize)]
541pub struct CustomerPortalSessionGeneralUrls {
542 /// Link to the overview page in the customer portal.
543 pub overview: String,
544}
545
546#[derive(Clone, Debug, Serialize, Deserialize)]
547pub struct CustomerPortalSessionSubscriptionUrls {
548 /// Unique Paddle ID for this subscription entity, prefixed with `sub_`.
549 pub id: SubscriptionID,
550 /// Link to the page for this subscription in the customer portal with the subscription cancellation form pre-opened. Use as part of cancel subscription workflows.
551 pub cancel_subscription: String,
552 /// Link to the page for this subscription in the customer portal with the payment method update form pre-opened. Use as part of workflows to let customers update their payment details.
553 ///
554 /// If a manually-collected subscription, opens the overview page for this subscription.
555 pub update_subscription_payment_method: String,
556}
557
558/// Authenticated customer portal deep links. For security, the `token` appended to each link is temporary. You shouldn't store these links.
559#[derive(Clone, Debug, Serialize, Deserialize)]
560pub struct CustomerPortalSessionUrls {
561 /// Authenticated customer portal deep links that aren't associated with a specific entity.
562 pub general: CustomerPortalSessionGeneralUrls,
563 /// List of generated authenticated customer portal deep links for the subscriptions passed in the `subscription_ids` array in the request.
564 ///
565 /// If subscriptions are paused or canceled, links open the overview page for a subscription.
566 ///
567 /// Empty if no subscriptions passed in the request.
568 pub subscriptions: Vec<CustomerPortalSessionSubscriptionUrls>,
569}
570
571/// Represents a customer portal session.
572#[derive(Clone, Debug, Serialize, Deserialize)]
573pub struct CustomerPortalSession {
574 /// Unique Paddle ID for this customer portal session entity, prefixed with `cpls_`.
575 pub id: CustomerPortalSessionID,
576 /// Unique Paddle ID for this customer entity, prefixed with `ctm_`.
577 pub customer_id: CustomerID,
578 /// Authenticated customer portal deep links. For security, the `token` appended to each link is temporary. You shouldn't store these links.
579 pub urls: CustomerPortalSessionUrls,
580 /// RFC 3339 datetime string.
581 pub created_at: String,
582}
583
584/// Represents a customer portal session creation request.
585#[derive(Clone, Debug, Serialize, Deserialize)]
586pub struct CustomerPortalSessionCreate {
587 /// List of subscriptions to create authenticated customer portal deep links for.
588 pub subscription_ids: Vec<SubscriptionID>,
589}
590
591/// Represents a customer entity when updating customers.
592#[derive(Clone, Debug, Serialize, Deserialize)]
593pub struct CustomerUpdate {
594 /// Full name of this customer. Required when creating transactions where `collection_mode` is `manual` (invoices).
595 pub name: Option<String>,
596 /// Email address for this entity.
597 pub email: String,
598 /// Whether this customer opted into marketing from you. `false` unless customers check the marketing consent box
599 /// when using Paddle Checkout. Set automatically by Paddle.
600 pub marketing_consent: bool,
601 /// Whether this entity can be used in Paddle.
602 pub status: Status,
603 /// Your own structured key-value data.
604 pub custom_data: Option<HashMap<String, String>>,
605 /// Valid IETF BCP 47 short form locale tag.
606 pub locale: String,
607 /// Import information for this entity. `null` if this entity is not imported.
608 pub import_meta: ImportMeta,
609}
610
611/// Represents a customer authentication token.
612#[derive(Clone, Debug, Serialize, Deserialize)]
613pub struct CustomerAuthenticationToken {
614 /// Authentication token generated by Paddle for this customer. Pass to Paddle.js when opening a checkout to let customers work with saved payment methods.
615 pub customer_auth_token: String,
616 /// RFC 3339 datetime string.
617 pub expires_at: DateTime<Utc>,
618}
619
620/// Represents a discount entity.
621#[derive(Clone, Debug, Serialize, Deserialize)]
622pub struct Discount {
623 /// Unique Paddle ID for this discount, prefixed with `dsc_`.
624 pub id: DiscountID,
625 /// Whether this entity can be used in Paddle.
626 pub status: DiscountStatus,
627 /// Short description for this discount for your reference. Not shown to customers.
628 pub description: String,
629 /// Whether this discount can be redeemed by customers at checkout (`true`) or not (`false`).
630 pub enabled_for_checkout: bool,
631 /// Unique code that customers can use to redeem this discount at checkout. Not case-sensitive.
632 pub code: Option<String>,
633 /// Type of discount. Determines how this discount impacts the checkout or transaction total.
634 pub r#type: DiscountType,
635 /// Amount to discount by. For `percentage` discounts, must be an amount between `0.01` and `100`. For `flat` and `flat_per_seat` discounts, amount in the lowest denomination for a currency.
636 pub amount: String,
637 /// Supported three-letter ISO 4217 currency code. Required where discount type is `flat` or `flat_per_seat`.
638 pub currency_code: Option<CurrencyCode>,
639 /// Whether this discount applies for multiple subscription billing periods (`true`) or not (`false`).
640 pub recur: bool,
641 /// Number of subscription billing periods that this discount recurs for. Requires `recur`. `null` if this discount recurs forever.
642 ///
643 /// Subscription renewals, midcycle changes, and one-time charges billed to a subscription aren't considered a redemption. `times_used` is not incremented in these cases.
644 pub maximum_recurring_intervals: Option<i64>,
645 /// Maximum number of times this discount can be redeemed. This is an overall limit for this discount, rather than a per-customer limit. `null` if this discount can be redeemed an unlimited amount of times.
646 ///
647 /// Paddle counts a usage as a redemption on a checkout, transaction, or the initial application against a subscription. Transactions created for subscription renewals, midcycle changes, and one-time charges aren't considered a redemption.
648 pub usage_limit: Option<i64>,
649 /// Product or price IDs that this discount is for. When including a product ID, all prices for that product can be discounted. `null` if this discount applies to all products and prices.
650 pub restrict_to: Option<Vec<String>>,
651 /// RFC 3339 datetime string of when this discount expires. Discount can no longer be redeemed after this date has elapsed. `null` if this discount can be redeemed forever.
652 ///
653 /// Expired discounts can't be redeemed against transactions or checkouts, but can be applied when updating subscriptions.
654 pub expires_at: Option<DateTime<Utc>>,
655 /// Your own structured key-value data.
656 pub custom_data: Option<HashMap<String, String>>,
657 /// How many times this discount has been redeemed. Automatically incremented by Paddle.
658 ///
659 /// Paddle counts a usage as a redemption on a checkout, transaction, or subscription. Transactions created for subscription renewals, midcycle changes, and one-time charges aren't considered a redemption.
660 pub times_used: i64,
661 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
662 pub created_at: DateTime<Utc>,
663 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
664 pub updated_at: DateTime<Utc>,
665 /// Import information for this entity. `null` if this entity is not imported.
666 pub import_meta: Option<ImportMeta>,
667}
668
669/// Represents a discount entity when creating discounts.
670#[derive(Clone, Debug, Serialize, Deserialize)]
671pub struct DiscountCreate {
672 /// Unique Paddle ID for this discount, prefixed with `dsc_`.
673 pub id: DiscountID,
674 /// Whether this entity can be used in Paddle.
675 pub status: DiscountStatus,
676 /// Short description for this discount for your reference. Not shown to customers.
677 pub description: String,
678 /// Whether this discount can be redeemed by customers at checkout (`true`) or not (`false`).
679 pub enabled_for_checkout: bool,
680 /// Unique code that customers can use to redeem this discount at checkout. Use letters and numbers only, up to 16 characters. Not case-sensitive.
681 ///
682 /// If omitted and `enabled_for_checkout` is `true`, Paddle generates a random 10-character code.
683 pub code: Option<String>,
684 /// Type of discount. Determines how this discount impacts the checkout or transaction total.
685 pub r#type: DiscountType,
686 /// Amount to discount by. For `percentage` discounts, must be an amount between `0.01` and `100`. For `flat` and `flat_per_seat` discounts, amount in the lowest denomination for a currency.
687 pub amount: String,
688 /// Supported three-letter ISO 4217 currency code. Required where discount type is `flat` or `flat_per_seat`.
689 pub currency_code: CurrencyCode,
690 /// Whether this discount applies for multiple subscription billing periods (`true`) or not (`false`). If omitted, defaults to `false`.
691 pub recur: bool,
692 /// Number of subscription billing periods that this discount recurs for. Requires `recur`. `null` if this discount recurs forever.
693 ///
694 /// Subscription renewals, midcycle changes, and one-time charges billed to a subscription aren't considered a redemption. `times_used` is not incremented in these cases.
695 pub maximum_recurring_intervals: Option<i64>,
696 /// Maximum number of times this discount can be redeemed. This is an overall limit for this discount, rather than a per-customer limit. `null` if this discount can be redeemed an unlimited amount of times.
697 ///
698 /// Paddle counts a usage as a redemption on a checkout, transaction, or the initial application against a subscription. Transactions created for subscription renewals, midcycle changes, and one-time charges aren't considered a redemption.
699 pub usage_limit: Option<i64>,
700 /// Product or price IDs that this discount is for. When including a product ID, all prices for that product can be discounted. `null` if this discount applies to all products and prices.
701 pub restrict_to: Option<Vec<String>>,
702 /// RFC 3339 datetime string of when this discount expires. Discount can no longer be redeemed after this date has elapsed. `null` if this discount can be redeemed forever.
703 ///
704 /// Expired discounts can't be redeemed against transactions or checkouts, but can be applied when updating subscriptions.
705 pub expires_at: Option<DateTime<FixedOffset>>,
706 /// Your own structured key-value data.
707 pub custom_data: Option<HashMap<String, String>>,
708 /// How many times this discount has been redeemed. Automatically incremented by Paddle.
709 ///
710 /// Paddle counts a usage as a redemption on a checkout, transaction, or subscription. Transactions created for subscription renewals, midcycle changes, and one-time charges aren't considered a redemption.
711 pub times_used: i64,
712 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
713 pub created_at: String,
714 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
715 pub updated_at: String,
716 /// Import information for this entity. `null` if this entity is not imported.
717 pub import_meta: ImportMeta,
718}
719
720/// Details of the discount applied to this subscription.
721#[derive(Clone, Debug, Serialize, Deserialize)]
722pub struct SubscriptionDiscountTimePeriod {
723 /// Unique Paddle ID for this discount, prefixed with `dsc_`.
724 pub id: DiscountID,
725 /// RFC 3339 datetime string of when this discount was first applied. `null` for canceled subscriptions where a discount was redeemed but never applied to a transaction.
726 pub starts_at: Option<DateTime<FixedOffset>>,
727 /// RFC 3339 datetime string of when this discount no longer applies. Where a discount has `maximum_recurring_intervals`, this is the date of the last billing period where this discount applies. `null` where a discount recurs forever.
728 pub ends_at: Option<DateTime<FixedOffset>>,
729}
730
731#[derive(Clone, Debug, Serialize, Deserialize)]
732pub struct Errors {
733 /// Field where validation error occurred.
734 pub field: String,
735 /// Information about how the field failed validation.
736 pub message: String,
737}
738
739/// Represents an error.
740#[derive(Clone, Debug, Serialize, Deserialize)]
741pub struct Error {
742 /// Type of error encountered.
743 pub r#type: Type,
744 /// Short snake case string that describes this error. Use to search the error reference.
745 pub code: String,
746 /// Some information about what went wrong as a human-readable string.
747 pub detail: String,
748 /// Link to a page in the error reference for this specific error.
749 pub documentation_url: String,
750 /// List of validation errors. Only returned when there's a validation error.
751 pub errors: Vec<Errors>,
752}
753
754/// Information about this response.
755#[derive(Clone, Debug, Serialize, Deserialize)]
756pub struct Meta {
757 /// Unique ID for the request relating to this response. Provide this when contacting Paddle support about a specific request.
758 pub request_id: String,
759}
760
761#[derive(Clone, Debug, Serialize, Deserialize)]
762pub struct ValidationError {
763 /// Represents an error.
764 pub error: Error,
765 /// Information about this response.
766 pub meta: Meta,
767}
768
769/// Represents an event entity.
770#[derive(Clone, Debug, Serialize, Deserialize)]
771pub struct Event {
772 /// Unique Paddle ID for this event, prefixed with `evt_`.
773 pub event_id: EventID,
774 /// Type of event sent by Paddle, in the format `entity.event_type`.
775 pub event_type: EventTypeName,
776 /// RFC 3339 datetime string.
777 pub occurred_at: String,
778 /// New or changed entity.
779 pub data: HashMap<String, String>,
780}
781
782/// Represents an event type.
783#[derive(Clone, Debug, Serialize, Deserialize)]
784pub struct EventType {
785 /// Type of event sent by Paddle, in the format `entity.event_type`.
786 pub name: EventTypeName,
787 /// Short description of this event type.
788 pub description: String,
789 /// Group for this event type. Typically the entity that this event relates to.
790 pub group: String,
791 /// List of API versions that this event type supports.
792 pub available_versions: Vec<u64>,
793}
794
795/// A base representation of monetary value unformatted in the lowest denomination with currency code.
796#[derive(Clone, Debug, Serialize, Deserialize)]
797pub struct Money {
798 /// Amount in the lowest denomination for the currency, e.g. 10 USD = 1000 (cents). Although represented as a string, this value must be a valid integer.
799 pub amount: String,
800 /// Supported three-letter ISO 4217 currency code.
801 pub currency_code: CurrencyCode,
802}
803
804#[derive(Clone, Debug, Serialize, Deserialize)]
805pub struct UnitPriceOverride {
806 /// Supported two-letter ISO 3166-1 alpha-2 country code. Customers located in the listed countries are charged the override price.
807 pub country_codes: Vec<CountryCodeSupported>,
808 /// A base representation of monetary value unformatted in the lowest denomination with currency code.
809 pub unit_price: Money,
810}
811
812#[derive(Clone, Debug, Serialize, Deserialize)]
813pub struct PriceQuantity {
814 /// Minimum quantity of the product related to this price that can be bought. Required if `maximum` set.
815 pub minimum: u64,
816 /// Maximum quantity of the product related to this price that can be bought. Required if `minimum` set. Must be greater than or equal to the `minimum` value.
817 pub maximum: u64,
818}
819
820/// Represents a price entity.
821#[derive(Clone, Debug, Serialize, Deserialize)]
822pub struct Price {
823 /// Unique Paddle ID for this price, prefixed with `pri_`.
824 pub id: PriceID,
825 /// Unique Paddle ID for this product, prefixed with `pro_`.
826 pub product_id: ProductID,
827 /// Internal description for this price, not shown to customers. Typically notes for your team.
828 pub description: String,
829 /// Type of item. Standard items are considered part of your catalog and are shown on the Paddle dashboard.
830 pub r#type: CatalogType,
831 /// Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
832 pub name: Option<String>,
833 /// How often this price should be charged. `null` if price is non-recurring (one-time).
834 pub billing_cycle: Option<Duration>,
835 /// Trial period for the product related to this price. The billing cycle begins once the trial period is over. `null` for no trial period. Requires `billing_cycle`.
836 pub trial_period: Option<Duration>,
837 /// How tax is calculated for this price.
838 pub tax_mode: TaxMode,
839 /// A base representation of monetary value unformatted in the lowest denomination with currency code.
840 pub unit_price: Money,
841 /// List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
842 #[serde(default)]
843 pub unit_price_overrides: Vec<UnitPriceOverride>,
844 pub quantity: PriceQuantity,
845 /// Whether this entity can be used in Paddle.
846 pub status: Status,
847 /// Your own structured key-value data.
848 pub custom_data: Option<HashMap<String, String>>,
849 /// Import information for this entity. `null` if this entity is not imported.
850 pub import_meta: Option<ImportMeta>,
851 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
852 pub created_at: DateTime<Utc>,
853 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
854 pub updated_at: DateTime<Utc>,
855}
856
857/// Represents a product entity.
858#[derive(Clone, Debug, Serialize, Deserialize)]
859pub struct Product {
860 /// Unique Paddle ID for this product, prefixed with `pro_`.
861 pub id: ProductID,
862 /// Name of this product.
863 pub name: String,
864 /// Short description for this product.
865 pub description: Option<String>,
866 /// Type of item. Standard items are considered part of your catalog and are shown on the Paddle dashboard.
867 pub r#type: CatalogType,
868 /// Tax category for this product. Used for charging the correct rate of tax. Selected tax category must be enabled on your Paddle account.
869 pub tax_category: TaxCategory,
870 /// Image for this product. Included in the checkout and on some customer documents.
871 pub image_url: Option<String>,
872 /// Your own structured key-value data.
873 pub custom_data: Option<HashMap<String, String>>,
874 /// Whether this entity can be used in Paddle.
875 pub status: Status,
876 /// Import information for this entity. `null` if this entity is not imported.
877 pub import_meta: Option<ImportMeta>,
878 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
879 pub created_at: DateTime<Utc>,
880 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
881 pub updated_at: DateTime<Utc>,
882}
883
884/// Represents a subscription item.
885#[derive(Clone, Debug, Serialize, Deserialize)]
886pub struct SubscriptionItem {
887 /// Status of this subscription item. Set automatically by Paddle.
888 pub status: SubscriptionItemStatus,
889 /// Quantity of this item on the subscription.
890 pub quantity: i64,
891 /// Whether this is a recurring item. `false` if one-time.
892 pub recurring: bool,
893 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
894 pub created_at: String,
895 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
896 pub updated_at: String,
897 /// RFC 3339 datetime string of when this item was last billed.
898 pub previously_billed_at: Option<DateTime<FixedOffset>>,
899 /// RFC 3339 datetime string of when this item is next scheduled to be billed.
900 pub next_billed_at: Option<DateTime<FixedOffset>>,
901 /// Trial dates for this item.
902 pub trial_dates: Option<TimePeriod>,
903 /// Represents a price entity.
904 pub price: Price,
905 /// Represents a product entity.
906 pub product: Product,
907}
908
909/// Keys used for working with paginated results.
910#[derive(Clone, Debug, Serialize, Deserialize)]
911pub struct Pagination {
912 /// Number of entities per page for this response. May differ from the number requested if the requested number is greater than the maximum.
913 pub per_page: i64,
914 /// URL containing the query parameters of the original request, along with the `after` parameter that marks the starting point of the next page. Always returned, even if `has_more` is `false`.
915 pub next: String,
916 /// Whether this response has another page.
917 pub has_more: bool,
918 /// Estimated number of entities for this response.
919 pub estimated_total: i64,
920}
921
922/// Information about this response.
923#[derive(Clone, Debug, Serialize, Deserialize)]
924pub struct MetaPaginated {
925 /// Unique ID for the request relating to this response. Provide this when contacting Paddle support about a specific request.
926 pub request_id: String,
927 /// Keys used for working with paginated results.
928 pub pagination: Pagination,
929}
930
931/// Information about the payment method used for a payment attempt.
932#[derive(Clone, Debug, Serialize, Deserialize)]
933pub struct MethodDetails {
934 /// Type of payment method used for this payment attempt.
935 pub r#type: PaymentMethodType,
936 /// Information about the credit or debit card used to pay. `null` unless `type` is `card`.
937 pub card: Card,
938}
939
940/// Notification payload. Includes the new or changed event.
941#[derive(Clone, Debug, Serialize, Deserialize)]
942pub struct NotificationPayload {
943 /// Unique Paddle ID for this notification, prefixed with `ntf_`.
944 pub notification_id: NotificationID,
945 /// Unique Paddle ID for this event, prefixed with `evt_`.
946 pub event_id: EventID,
947 /// Type of event sent by Paddle, in the format `entity.event_type`.
948 pub event_type: EventTypeName,
949 /// RFC 3339 datetime string.
950 pub occurred_at: String,
951 /// New or changed entity.
952 pub data: HashMap<String, String>,
953}
954
955/// Represents a notification entity.
956#[derive(Clone, Debug, Serialize, Deserialize)]
957pub struct Notification {
958 /// Unique Paddle ID for this notification, prefixed with `ntf_`.
959 pub id: NotificationID,
960 /// Type of event sent by Paddle, in the format `entity.event_type`.
961 pub r#type: EventTypeName,
962 /// Status of this notification.
963 pub status: NotificationStatus,
964 pub payload: NotificationPayload,
965 /// RFC 3339 datetime string.
966 pub occurred_at: DateTime<FixedOffset>,
967 /// RFC 3339 datetime string of when this notification was delivered. `null` if not yet delivered successfully.
968 pub delivered_at: Option<DateTime<FixedOffset>>,
969 /// RFC 3339 datetime string of when this notification was replayed. `null` if not replayed.
970 pub replayed_at: Option<DateTime<FixedOffset>>,
971 /// Describes how this notification was created.
972 pub origin: NotificationOrigin,
973 /// RFC 3339 datetime string of when this notification was last attempted.
974 pub last_attempt_at: Option<DateTime<FixedOffset>>,
975 /// RFC 3339 datetime string of when this notification is scheduled to be retried.
976 pub retry_at: Option<DateTime<FixedOffset>>,
977 /// How many times delivery of this notification has been attempted. Automatically incremented by Paddle after an attempt.
978 pub times_attempted: i64,
979 /// Unique Paddle ID for this notification setting, prefixed with `ntfset_`.
980 pub notification_setting_id: NotificationSettingID,
981}
982
983/// Represents a notification log entity.
984#[derive(Clone, Debug, Serialize, Deserialize)]
985pub struct NotificationLog {
986 /// Unique Paddle ID for this notification log, prefixed with `ntflog_`.
987 pub id: NotificationLogID,
988 /// HTTP code sent by the responding server.
989 pub response_code: i64,
990 /// Content-Type sent by the responding server.
991 pub response_content_type: Option<String>,
992 /// Response body sent by the responding server. Typically empty for success responses.
993 pub response_body: String,
994 /// RFC 3339 datetime string.
995 pub attempted_at: String,
996}
997
998/// Represents a notification destination.
999#[derive(Clone, Debug, Serialize, Deserialize)]
1000pub struct NotificationSetting {
1001 /// Unique Paddle ID for this notification setting, prefixed with `ntfset_`.
1002 pub id: NotificationSettingID,
1003 /// Short description for this notification destination. Shown in the Paddle dashboard.
1004 pub description: String,
1005 /// Where notifications should be sent for this destination.
1006 pub r#type: NotificationSettingType,
1007 /// Webhook endpoint URL or email address.
1008 pub destination: String,
1009 /// Whether Paddle should try to deliver events to this notification destination.
1010 pub active: bool,
1011 /// API version that returned objects for events should conform to. Must be a valid version of the Paddle API. Can't be a version older than your account default.
1012 pub api_version: i64,
1013 /// Whether potentially sensitive fields should be sent to this notification destination.
1014 pub include_sensitive_fields: bool,
1015 /// Subscribed events for this notification destination.
1016 pub subscribed_events: Vec<EventType>,
1017 /// Webhook destination secret key, prefixed with `pdl_ntfset_`. Used for signature verification.
1018 pub endpoint_secret_key: EndpointSecretKey,
1019 /// Whether Paddle should deliver real platform events, simulation events or both to this notification destination.
1020 pub traffic_source: TrafficSource,
1021}
1022
1023/// Represents a notification destination when creating notification destinations.
1024#[derive(Clone, Debug, Serialize, Deserialize)]
1025pub struct NotificationSettingCreate {
1026 /// Unique Paddle ID for this notification setting, prefixed with `ntfset_`.
1027 pub id: NotificationSettingID,
1028 /// Short description for this notification destination. Shown in the Paddle Dashboard.
1029 pub description: String,
1030 /// Where notifications should be sent for this destination.
1031 pub r#type: NotificationSettingType,
1032 /// Webhook endpoint URL or email address.
1033 pub destination: String,
1034 /// Whether Paddle should try to deliver events to this notification destination.
1035 pub active: bool,
1036 /// API version that returned objects for events should conform to. Must be a valid version of the Paddle API. Can't be a version older than your account default. If omitted, defaults to your account default version.
1037 pub api_version: i64,
1038 /// Whether potentially sensitive fields should be sent to this notification destination. If omitted, defaults to `false`.
1039 pub include_sensitive_fields: bool,
1040 /// Subscribed events for this notification destination. When creating or updating a notification destination, pass an array of event type names only. Paddle returns the complete event type object.
1041 pub subscribed_events: Vec<String>,
1042 /// Webhook destination secret key, prefixed with `pdl_ntfset_`. Used for signature verification.
1043 pub endpoint_secret_key: EndpointSecretKey,
1044 /// Whether Paddle should deliver real platform events, simulation events or both to this notification destination. If omitted, defaults to `platform`.
1045 pub traffic_source: TrafficSource,
1046}
1047
1048/// Represents a notification destination when updating notification destinations.
1049#[derive(Clone, Debug, Serialize, Deserialize)]
1050pub struct NotificationSettingUpdate {
1051 /// Short description for this notification destination. Shown in the Paddle Dashboard.
1052 pub description: String,
1053 /// Webhook endpoint URL or email address.
1054 pub destination: String,
1055 /// Whether Paddle should try to deliver events to this notification destination.
1056 pub active: bool,
1057 /// API version that returned objects for events should conform to. Must be a valid version of the Paddle API. Can't be a version older than your account default. Defaults to your account default if omitted.
1058 pub api_version: i64,
1059 /// Whether potentially sensitive fields should be sent to this notification destination.
1060 pub include_sensitive_fields: bool,
1061 /// Subscribed events for this notification destination. When creating or updating a notification destination, pass an array of event type names only. Paddle returns the complete event type object.
1062 pub subscribed_events: Option<Vec<String>>,
1063 /// Whether Paddle should deliver real platform events, simulation events or both to this notification destination.
1064 pub traffic_source: TrafficSource,
1065}
1066
1067/// Represents a price entity when creating prices.
1068#[derive(Clone, Debug, Serialize, Deserialize)]
1069pub struct PriceCreate {
1070 /// Unique Paddle ID for this price, prefixed with `pri_`.
1071 pub id: PriceID,
1072 /// Internal description for this price, not shown to customers. Typically notes for your team.
1073 pub description: String,
1074 /// Type of item. Standard items are considered part of your catalog and are shown on the Paddle dashboard.
1075 pub r#type: CatalogType,
1076 /// Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
1077 pub name: Option<String>,
1078 /// Unique Paddle ID for this product, prefixed with `pro_`.
1079 pub product_id: ProductID,
1080 /// How often this price should be charged. `null` if price is non-recurring (one-time). If omitted, defaults to `null`.
1081 pub billing_cycle: Option<Duration>,
1082 /// Trial period for the product related to this price. The billing cycle begins once the trial period is over.
1083 /// `null` for no trial period. Requires `billing_cycle`. If omitted, defaults to `null`.
1084 pub trial_period: Option<Duration>,
1085 /// How tax is calculated for this price.
1086 pub tax_mode: TaxMode,
1087 /// A base representation of monetary value unformatted in the lowest denomination with currency code.
1088 pub unit_price: Money,
1089 /// List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
1090 pub unit_price_overrides: Vec<UnitPriceOverride>,
1091 pub quantity: PriceQuantity,
1092 /// Your own structured key-value data.
1093 pub custom_data: Option<HashMap<String, String>>,
1094 /// Import information for this entity. `null` if this entity is not imported.
1095 pub import_meta: ImportMeta,
1096}
1097
1098/// Represents a price preview entity.
1099#[derive(Clone, Debug, Serialize, Deserialize)]
1100pub struct PricePreview {
1101 /// Unique Paddle ID for this price, prefixed with `pri_`.
1102 /// The value is null for custom prices being previewed.
1103 pub id: Option<PriceID>,
1104 /// Paddle ID for the product that this price is for, prefixed with `pro_`.
1105 /// The value is null for custom products being previewed.
1106 pub product_id: Option<ProductID>,
1107 /// Internal description for this price, not shown to customers. Typically notes for your team.
1108 pub description: String,
1109 /// Type of item. Standard items are considered part of your catalog and are shown on the Paddle dashboard.
1110 pub r#type: CatalogType,
1111 /// Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
1112 pub name: Option<String>,
1113 /// How often this price should be charged. `null` if price is non-recurring (one-time).
1114 pub billing_cycle: Option<Duration>,
1115 /// Trial period for the product related to this price. The billing cycle begins once the trial period is over. `null` for no trial period. Requires `billing_cycle`.
1116 pub trial_period: Option<Duration>,
1117 /// How tax is calculated for this price.
1118 pub tax_mode: TaxMode,
1119 /// A base representation of monetary value unformatted in the lowest denomination with currency code.
1120 pub unit_price: Money,
1121 /// List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
1122 pub unit_price_overrides: Vec<UnitPriceOverride>,
1123 pub quantity: PriceQuantity,
1124 /// Whether this entity can be used in Paddle.
1125 pub status: Status,
1126 /// Your own structured key-value data.
1127 pub custom_data: Option<HashMap<String, String>>,
1128 /// Import information for this entity. `null` if this entity is not imported.
1129 pub import_meta: ImportMeta,
1130 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
1131 pub created_at: String,
1132 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
1133 pub updated_at: String,
1134}
1135
1136/// Represents a price entity when updating prices.
1137#[derive(Clone, Debug, Serialize, Deserialize)]
1138pub struct PriceUpdate {
1139 /// Internal description for this price, not shown to customers. Typically notes for your team.
1140 pub description: String,
1141 /// Type of item. Standard items are considered part of your catalog and are shown on the Paddle dashboard.
1142 pub r#type: CatalogType,
1143 /// Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
1144 pub name: Option<String>,
1145 /// How often this price should be charged. `null` if price is non-recurring (one-time).
1146 pub billing_cycle: Option<Duration>,
1147 /// Trial period for the product related to this price. The billing cycle begins once the trial period is over. `null` for no trial period. Requires `billing_cycle`.
1148 pub trial_period: Option<Duration>,
1149 /// How tax is calculated for this price.
1150 pub tax_mode: TaxMode,
1151 /// A base representation of monetary value unformatted in the lowest denomination with currency code.
1152 pub unit_price: Money,
1153 /// List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
1154 pub unit_price_overrides: Vec<UnitPriceOverride>,
1155 pub quantity: PriceQuantity,
1156 /// Whether this entity can be used in Paddle.
1157 pub status: Status,
1158 /// Your own structured key-value data.
1159 pub custom_data: Option<HashMap<String, String>>,
1160}
1161
1162/// Represents a product entity when creating products.
1163#[derive(Clone, Debug, Serialize, Deserialize)]
1164pub struct ProductCreate {
1165 /// Unique Paddle ID for this product, prefixed with `pro_`.
1166 pub id: ProductID,
1167 /// Name of this product.
1168 pub name: Option<String>,
1169 /// Short description for this product.
1170 pub description: Option<String>,
1171 /// Type of item. Standard items are considered part of your catalog and are shown on the Paddle dashboard.
1172 pub r#type: CatalogType,
1173 /// Tax category for this product. Used for charging the correct rate of tax. Selected tax category must be enabled on your Paddle account.
1174 pub tax_category: TaxCategory,
1175 /// Image for this product. Included in the checkout and on some customer documents.
1176 pub image_url: Option<String>,
1177 /// Your own structured key-value data.
1178 pub custom_data: Option<HashMap<String, String>>,
1179 /// Import information for this entity. `null` if this entity is not imported.
1180 pub import_meta: ImportMeta,
1181}
1182
1183/// Represents a product (preview) entity.
1184#[derive(Clone, Debug, Serialize, Deserialize)]
1185pub struct ProductPreview {
1186 /// Unique Paddle ID for this product, prefixed with `pro_`.
1187 /// The value is null for custom products being previewed.
1188 pub id: ProductID,
1189 /// Name of this product.
1190 pub name: String,
1191 /// Short description for this product.
1192 pub description: Option<String>,
1193 /// Type of item. Standard items are considered part of your catalog and are shown on the Paddle dashboard.
1194 pub r#type: CatalogType,
1195 /// Tax category for this product. Used for charging the correct rate of tax. Selected tax category must be enabled on your Paddle account.
1196 pub tax_category: TaxCategory,
1197 /// Image for this product. Included in the checkout and on some customer documents.
1198 pub image_url: Option<String>,
1199 /// Your own structured key-value data.
1200 pub custom_data: Option<HashMap<String, String>>,
1201 /// Whether this entity can be used in Paddle.
1202 pub status: Status,
1203 /// Import information for this entity. `null` if this entity is not imported.
1204 pub import_meta: ImportMeta,
1205 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
1206 pub created_at: String,
1207 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
1208 pub updated_at: String,
1209}
1210
1211/// Represents a product entity when updating products.
1212#[derive(Clone, Debug, Serialize, Deserialize)]
1213pub struct ProductUpdate {
1214 /// Name of this product.
1215 pub name: Option<String>,
1216 /// Short description for this product.
1217 pub description: Option<String>,
1218 /// Type of item. Standard items are considered part of your catalog and are shown on the Paddle dashboard.
1219 pub r#type: CatalogType,
1220 /// Tax category for this product. Used for charging the correct rate of tax. Selected tax category must be enabled on your Paddle account.
1221 pub tax_category: TaxCategory,
1222 /// Image for this product. Included in the checkout and on some customer documents.
1223 pub image_url: Option<String>,
1224 /// Your own structured key-value data.
1225 pub custom_data: Option<HashMap<String, String>>,
1226 /// Whether this entity can be used in Paddle.
1227 pub status: Status,
1228}
1229
1230/// Represents a report entity.
1231#[derive(Clone, Debug, Serialize, Deserialize)]
1232pub struct ReportBase {
1233 /// Unique Paddle ID for this entity.
1234 pub id: PaddleID,
1235 /// Status of this report. Set automatically by Paddle.
1236 ///
1237 /// Reports are created as `pending` initially, then move to `ready` when they're available to download.
1238 pub status: ReportStatus,
1239 /// Number of records in this report. `null` if the report is `pending`.
1240 pub rows: Option<i64>,
1241 /// RFC 3339 datetime string of when this report expires. The report is no longer available to download after this date.
1242 pub expires_at: Option<DateTime<FixedOffset>>,
1243 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
1244 pub updated_at: DateTime<FixedOffset>,
1245 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
1246 pub created_at: DateTime<FixedOffset>,
1247}
1248
1249#[derive(Clone, Debug, Serialize, Deserialize)]
1250pub enum ReportFilterValue {
1251 String(String),
1252 Array(Vec<String>),
1253}
1254
1255/// Filter criteria for this report. If omitted when creating, reports are filtered to include data updated in the last 30 days. This means `updated_at` is greater than or equal to (`gte`) the date 30 days ago from the time the report was generated.
1256#[derive(Clone, Debug, Serialize, Deserialize)]
1257pub struct ReportFilters {
1258 /// Field name to filter by.
1259 pub name: AdjustmentsReportFilterName,
1260 /// Operator to use when filtering. Valid when filtering by `updated_at`, `null` otherwise.
1261 pub operator: Option<FilterOperator>,
1262 /// Value to filter by. Check the allowed values descriptions for the `name` field to see valid values for a field.
1263 pub value: ReportFilterValue,
1264}
1265
1266/// Information about the request. Sent by Paddle as part of the simulation.
1267#[derive(Clone, Debug, Serialize, Deserialize)]
1268pub struct SimulationEventRequest {
1269 /// Request body sent by Paddle.
1270 pub body: String,
1271}
1272
1273/// Information about the response. Sent by the responding server for the notification setting.
1274#[derive(Clone, Debug, Serialize, Deserialize)]
1275pub struct SimulationEventResponse {
1276 /// Response body sent by the responding server. May be empty for success responses.
1277 pub body: String,
1278 /// HTTP status code sent by the responding server.
1279 pub status_code: i64,
1280}
1281
1282/// Represents a simulation event.
1283#[derive(Clone, Debug, Serialize, Deserialize)]
1284pub struct SimulationEvent {
1285 /// Unique Paddle ID for this simulation event, prefixed with `ntfsimevt_`.
1286 pub id: SimulationEventID,
1287 /// Status of this simulation run log.
1288 pub status: SimulationEventStatus,
1289 /// Type of event sent by Paddle, in the format `entity.event_type`.
1290 pub event_type: EventTypeName,
1291 /// Simulation payload. Pass a JSON object that matches the schema for an event type to simulate a custom payload. If omitted, Paddle populates with a demo example.
1292 pub payload: serde_json::Value,
1293 /// Information about the request. Sent by Paddle as part of the simulation.
1294 pub request: SimulationEventRequest,
1295 /// Information about the response. Sent by the responding server for the notification setting.
1296 pub response: SimulationEventResponse,
1297 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
1298 pub created_at: String,
1299 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
1300 pub updated_at: String,
1301}
1302
1303/// Represents a simulation run entity for a scenario.
1304#[derive(Clone, Debug, Serialize, Deserialize)]
1305pub struct SimulationRunScenario {
1306 /// Unique Paddle ID for this simulation run, prefixed with `ntfsimrun_`.
1307 pub id: SimulationRunID,
1308 /// Status of this simulation run.
1309 pub status: SimulationRunStatus,
1310 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
1311 pub created_at: String,
1312 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
1313 pub updated_at: String,
1314 /// Scenario for a simulation.
1315 pub r#type: SimulationScenarioType,
1316}
1317
1318/// Represents a simulation run entity for a single event.
1319#[derive(Clone, Debug, Serialize, Deserialize)]
1320pub struct SimulationRunSingleEvent {
1321 /// Unique Paddle ID for this simulation run, prefixed with `ntfsimrun_`.
1322 pub id: SimulationRunID,
1323 /// Status of this simulation run.
1324 pub status: SimulationRunStatus,
1325 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
1326 pub created_at: String,
1327 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
1328 pub updated_at: String,
1329 /// Type of event sent by Paddle, in the format `entity.event_type`.
1330 pub r#type: EventTypeName,
1331}
1332
1333/// Represents a simulation entity for a scenario.
1334#[derive(Clone, Debug, Serialize, Deserialize)]
1335pub struct SimulationScenario {
1336 /// Unique Paddle ID for this simulation, prefixed with `ntfsim_`.
1337 pub id: SimulationID,
1338 /// Whether this entity can be used in Paddle.
1339 pub status: Status,
1340 /// Unique Paddle ID for this notification setting, prefixed with `ntfset_`.
1341 pub notification_setting_id: NotificationSettingID,
1342 /// Name of this simulation.
1343 pub name: String,
1344 /// Scenario for a simulation.
1345 pub r#type: SimulationScenarioType,
1346 /// Simulation payload. `null` for scenarios.
1347 pub payload: Option<serde_json::Value>,
1348 /// RFC 3339 datetime string of when this simulation was last run. `null` until run. Set automatically by Paddle.
1349 pub last_run_at: Option<DateTime<FixedOffset>>,
1350 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
1351 pub created_at: String,
1352 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
1353 pub updated_at: String,
1354}
1355
1356/// Represents a simulation entity for a scenario when creating.
1357#[derive(Clone, Debug, Serialize, Deserialize)]
1358pub struct SimulationScenarioCreate {
1359 /// Unique Paddle ID for this notification setting, prefixed with `ntfset_`.
1360 pub notification_setting_id: NotificationSettingID,
1361 /// Name of this simulation.
1362 pub name: String,
1363 /// Scenario for a simulation.
1364 pub r#type: SimulationScenarioType,
1365}
1366
1367/// Represents a simulation entity for a scenario when updating.
1368#[derive(Clone, Debug, Serialize, Deserialize)]
1369pub struct SimulationScenarioUpdate {
1370 /// Unique Paddle ID for this notification setting, prefixed with `ntfset_`.
1371 pub notification_setting_id: NotificationSettingID,
1372 /// Name of this simulation.
1373 pub name: Option<String>,
1374 /// Whether this entity can be used in Paddle.
1375 pub status: Status,
1376 /// Scenario for a simulation.
1377 pub r#type: SimulationScenarioType,
1378}
1379
1380/// Represents a simulation entity for a single event when creating.
1381#[derive(Clone, Debug, Serialize, Deserialize)]
1382pub struct SimulationSingleEventCreate {
1383 /// Unique Paddle ID for this notification setting, prefixed with `ntfset_`.
1384 pub notification_setting_id: NotificationSettingID,
1385 /// Name of this simulation.
1386 pub name: Option<String>,
1387 /// Type of event sent by Paddle, in the format `entity.event_type`.
1388 pub r#type: EventTypeName,
1389 /// Simulation payload. Pass a JSON object that matches the schema for an event type to simulate a custom payload. If omitted, Paddle populates with a demo example.
1390 pub payload: Option<serde_json::Value>,
1391}
1392
1393/// Represents a simulation entity for a single event when updating.
1394#[derive(Clone, Debug, Serialize, Deserialize)]
1395pub struct SimulationSingleEventUpdate {
1396 /// Unique Paddle ID for this notification setting, prefixed with `ntfset_`.
1397 pub notification_setting_id: NotificationSettingID,
1398 /// Name of this simulation.
1399 pub name: Option<String>,
1400 /// Whether this entity can be used in Paddle.
1401 pub status: Status,
1402 /// Type of event sent by Paddle, in the format `entity.event_type`.
1403 pub r#type: EventTypeName,
1404 /// Simulation payload. Pass a JSON object that matches the schema for an event type to simulate a custom payload. Set to `null` to clear and populate with a demo example.
1405 pub payload: Option<serde_json::Value>,
1406}
1407
1408/// Represents a simulation type.
1409#[derive(Clone, Debug, Serialize, Deserialize)]
1410pub struct SimulationType {
1411 /// Type of simulation sent by Paddle. Single event simulations are in the format `entity.event_type`; scenario simulations are in `snake_case`.
1412 pub name: String,
1413 /// Descriptive label for this simulation type. Typically gives more context about a scenario. Single event simulations are in the format `entity.event_type`.
1414 pub label: String,
1415 /// Short description of this simulation type.
1416 pub description: String,
1417 /// Group for this simulation type. Typically the entity that this event relates to.
1418 pub group: String,
1419 /// Type of simulation.
1420 pub r#type: SimulationKind,
1421 /// List of events that will be sent for this simulation type.
1422 pub events: Vec<EventTypeName>,
1423}
1424
1425/// Change that's scheduled to be applied to a subscription. Use the pause subscription, cancel subscription, and resume subscription operations to create scheduled changes. `null` if no scheduled changes.
1426#[derive(Clone, Debug, Serialize, Deserialize)]
1427pub struct SubscriptionScheduledChange {
1428 /// Kind of change that's scheduled to be applied to this subscription.
1429 pub action: ScheduledChangeAction,
1430 /// RFC 3339 datetime string.
1431 pub effective_at: DateTime<FixedOffset>,
1432 /// RFC 3339 datetime string of when a paused subscription should resume. Only used for `pause` scheduled changes.
1433 pub resume_at: Option<DateTime<FixedOffset>>,
1434}
1435
1436/// Authenticated customer portal deep links for this subscription. For security, the `token` appended to each link is temporary. You shouldn't store these links.
1437#[derive(Clone, Debug, Serialize, Deserialize)]
1438pub struct SubscriptionManagementUrls {
1439 /// Link to the page for this subscription in the customer portal with the payment method update form pre-opened. Use as part of workflows to let customers update their payment details. `null` for manually-collected subscriptions.
1440 pub update_payment_method: Option<String>,
1441 /// Link to the page for this subscription in the customer portal with the subscription cancellation form pre-opened. Use as part of cancel subscription workflows.
1442 pub cancel: String,
1443}
1444
1445/// Represents a subscription entity.
1446#[derive(Clone, Debug, Serialize, Deserialize)]
1447pub struct Subscription {
1448 /// Unique Paddle ID for this subscription entity, prefixed with `sub_`.
1449 pub id: SubscriptionID,
1450 /// Status of this subscription. Set automatically by Paddle. Use the pause subscription or cancel subscription operations to change.
1451 pub status: SubscriptionStatus,
1452 /// Unique Paddle ID for this customer entity, prefixed with `ctm_`.
1453 pub customer_id: CustomerID,
1454 /// Unique Paddle ID for this address entity, prefixed with `add_`.
1455 pub address_id: AddressID,
1456 /// Paddle ID of the business that this subscription is for, prefixed with `biz_`.
1457 pub business_id: Option<BusinessID>,
1458 /// Supported three-letter ISO 4217 currency code.
1459 pub currency_code: CurrencyCode,
1460 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
1461 pub created_at: String,
1462 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
1463 pub updated_at: String,
1464 /// RFC 3339 datetime string of when this subscription started. This may be different from `first_billed_at` if the subscription started in trial.
1465 pub started_at: Option<DateTime<FixedOffset>>,
1466 /// RFC 3339 datetime string of when this subscription was first billed. This may be different from `started_at` if the subscription started in trial.
1467 pub first_billed_at: Option<DateTime<FixedOffset>>,
1468 /// RFC 3339 datetime string of when this subscription is next scheduled to be billed.
1469 pub next_billed_at: DateTime<FixedOffset>,
1470 /// RFC 3339 datetime string of when this subscription was paused. Set automatically by Paddle when the pause subscription operation is used. `null` if not paused.
1471 pub paused_at: Option<DateTime<FixedOffset>>,
1472 /// RFC 3339 datetime string of when this subscription was canceled. Set automatically by Paddle when the cancel subscription operation is used. `null` if not canceled.
1473 pub canceled_at: Option<DateTime<FixedOffset>>,
1474 /// Details of the discount applied to this subscription.
1475 pub discount: Discount,
1476 /// How payment is collected. `automatic` for checkout, `manual` for invoices.
1477 pub collection_mode: CollectionMode,
1478 /// Details for invoicing. Required if `collection_mode` is `manual`.
1479 pub billing_details: BillingDetails,
1480 /// Current billing period for this subscription. Set automatically by Paddle based on the billing cycle. `null` for `paused` and `canceled` subscriptions.
1481 pub current_billing_period: Option<TimePeriod>,
1482 pub billing_cycle: Duration,
1483 /// Change that's scheduled to be applied to a subscription. Use the pause subscription, cancel subscription, and resume subscription operations to create scheduled changes. `null` if no scheduled changes.
1484 pub scheduled_change: Option<SubscriptionScheduledChange>,
1485 /// Authenticated customer portal deep links for this subscription. For security, the `token` appended to each link is temporary. You shouldn't store these links.
1486 pub management_urls: SubscriptionManagementUrls,
1487 /// List of items on this subscription. Only recurring items are returned.
1488 pub items: Vec<SubscriptionItem>,
1489 /// Your own structured key-value data.
1490 pub custom_data: Option<HashMap<String, String>>,
1491 /// Import information for this entity. `null` if this entity is not imported.
1492 pub import_meta: ImportMeta,
1493}
1494
1495#[derive(Clone, Debug, Serialize, Deserialize)]
1496pub enum SubscriptionChargeItem {
1497 /// Add a catalog item to a subscription. In this case, the product and price that you're billing for exist in your product catalog in Paddle.
1498 CatalogItem(SubscriptionItemCreateWithPriceId),
1499 /// Add a non-catalog price for an existing product in your catalog to a subscription. In this case, the product you're billing for is a catalog product, but you charge a specific price for it.
1500 NonCatalogExistingProduct(SubscriptionChargeCreateWithPrice),
1501 /// Add a non-catalog price for a non-catalog product in your catalog to a subscription. In this case, the product and price that you're billing for are specific to this subscription.
1502 NonCatalogPriceAndProduct(SubscriptionChargeCreateWithPriceAndProduct),
1503}
1504
1505/// Represents a one-time charge for a subscription.
1506#[derive(Clone, Debug, Serialize, Deserialize)]
1507pub struct SubscriptionCharge {
1508 /// When this subscription change should take effect from. Defaults to `next_billing_period`, which creates a
1509 /// `scheduled_change` to apply the subscription change at the end of the billing period.
1510 pub effective_from: EffectiveFrom,
1511 /// List of one-time charges to bill for. Only prices where the `billing_cycle` is `null` may be added.
1512 ///
1513 /// You can charge for items that you've added to your catalog by passing the Paddle ID of an existing price entity, or you can charge for non-catalog items by passing a price object.
1514 ///
1515 /// Non-catalog items can be for existing products, or you can pass a product object as part of your price to charge for a non-catalog product.
1516 pub items: Vec<SubscriptionChargeItem>,
1517 /// How Paddle should handle changes made to a subscription or its items if the payment fails during update. If omitted, defaults to `prevent_change`.
1518 pub on_payment_failure: SubscriptionOnPaymentFailure,
1519}
1520
1521/// Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
1522#[derive(Clone, Debug, Serialize, Deserialize)]
1523pub struct Totals {
1524 /// Subtotal before discount, tax, and deductions. If an item, unit price multiplied by quantity.
1525 pub subtotal: String,
1526 /// Total discount as a result of any discounts applied.
1527 ///
1528 /// Except for percentage discounts, Paddle applies tax to discounts based on the line item `price.tax_mode`. If `price.tax_mode` for a line item is `internal`, Paddle removes tax from the discount applied.
1529 pub discount: Discount,
1530 /// Total tax on the subtotal.
1531 pub tax: String,
1532 /// Total after discount and tax.
1533 pub total: String,
1534}
1535
1536#[derive(Clone, Debug, Serialize, Deserialize)]
1537pub struct TaxRatesUsed {
1538 /// Rate used to calculate tax for this transaction preview.
1539 pub tax_rate: String,
1540 /// Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
1541 pub totals: Totals,
1542}
1543
1544/// Breakdown of the total for a transaction. These numbers can be negative when dealing with subscription updates that result in credit.
1545#[derive(Clone, Debug, Serialize, Deserialize)]
1546pub struct TransactionTotals {
1547 /// Subtotal before discount, tax, and deductions. If an item, unit price multiplied by quantity.
1548 pub subtotal: String,
1549 /// Total discount as a result of any discounts applied.
1550 ///
1551 /// Except for percentage discounts, Paddle applies tax to discounts based on the line item `price.tax_mode`. If `price.tax_mode` for a line item is `internal`, Paddle removes tax from the discount applied.
1552 pub discount: Discount,
1553 /// Total tax on the subtotal.
1554 pub tax: String,
1555 /// Total after discount and tax.
1556 pub total: String,
1557 /// Total credit applied to this transaction. This includes credits applied using a customer's credit balance and adjustments to a `billed` transaction.
1558 pub credit: String,
1559 /// Additional credit generated from negative `details.line_items`. This credit is added to the customer balance.
1560 pub credit_to_balance: String,
1561 /// Total due on a transaction after credits and any payments.
1562 pub balance: String,
1563 /// Total due on a transaction after credits but before any payments.
1564 pub grand_total: String,
1565 /// Total fee taken by Paddle for this transaction. `null` until the transaction is `completed` and the fee is processed.
1566 pub fee: Option<String>,
1567 /// Total earnings for this transaction. This is the total minus the Paddle fee. `null` until the transaction is `completed` and the fee is processed.
1568 pub earnings: Option<String>,
1569 /// Three-letter ISO 4217 currency code of the currency used for this transaction.
1570 pub currency_code: CurrencyCode,
1571}
1572
1573/// SubscriptionTransactionDetailsPreview requires same fields as TransactionLineItemPreview but proration is optional
1574#[derive(Clone, Debug, Serialize, Deserialize)]
1575pub struct SubscriptionTransactionDetailsPreviewItem {
1576 /// Paddle ID for the price related to this transaction line item, prefixed with `pri_`.
1577 /// The value is null for custom prices being previewed.
1578 pub price_id: Option<PriceID>,
1579 /// Quantity of this transaction line item.
1580 pub quantity: i64,
1581 /// Rate used to calculate tax for this transaction line item.
1582 pub tax_rate: String,
1583 /// Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
1584 pub unit_totals: Totals,
1585 /// Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
1586 pub totals: Totals,
1587 /// Represents a product (preview) entity.
1588 pub product: ProductPreview,
1589 /// How proration was calculated for this item.
1590 pub proration: Option<Proration>,
1591}
1592
1593/// Calculated totals for a transaction preview, including discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction preview.
1594#[derive(Clone, Debug, Serialize, Deserialize)]
1595pub struct SubscriptionTransactionDetailsPreview {
1596 /// List of tax rates applied to this transaction preview.
1597 pub tax_rates_used: Vec<TaxRatesUsed>,
1598 /// Breakdown of the total for a transaction. These numbers can be negative when dealing with subscription updates that result in credit.
1599 pub totals: TransactionTotals,
1600 /// Information about line items for this transaction preview. Different from transaction preview `items` as they include totals calculated by Paddle. Considered the source of truth for line item totals.
1601 pub line_items: Vec<SubscriptionTransactionDetailsPreviewItem>,
1602}
1603
1604/// Preview of the next transaction for this subscription. May include prorated charges that aren't yet billed and one-time charges. `null` if the subscription is scheduled to cancel or pause.
1605#[derive(Clone, Debug, Serialize, Deserialize)]
1606pub struct NextTransaction {
1607 pub billing_period: TimePeriod,
1608 /// Calculated totals for a transaction preview, including discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction preview.
1609 pub details: SubscriptionTransactionDetailsPreview,
1610 /// Preview of adjustments for the next transaction.
1611 pub adjustments: Vec<AdjustmentPreview>,
1612}
1613
1614/// Details of the result of credits and charges. Where the total of any credit adjustments is greater than the total charge, the result is a prorated credit; otherwise, the result is a prorated charge.
1615#[derive(Clone, Debug, Serialize, Deserialize)]
1616pub struct UpdateSummaryResult {
1617 /// Whether the subscription change results in a prorated credit or a charge.
1618 pub action: UpdateSummaryResultAction,
1619 /// Amount representing the result of this update, either a charge or a credit.
1620 pub amount: String,
1621 /// Supported three-letter ISO 4217 currency code.
1622 pub currency_code: CurrencyCode,
1623}
1624
1625/// Impact of this subscription change. Includes whether the change results in a charge or credit, and totals for prorated amounts.
1626#[derive(Clone, Debug, Serialize, Deserialize)]
1627pub struct SubscriptionPreviewUpdateSummary {
1628 /// A base representation of monetary value unformatted in the lowest denomination with currency code.
1629 pub credit: Money,
1630 /// A base representation of monetary value unformatted in the lowest denomination with currency code.
1631 pub charge: Money,
1632 /// Details of the result of credits and charges. Where the total of any credit adjustments is greater than the total charge, the result is a prorated credit; otherwise, the result is a prorated charge.
1633 pub result: UpdateSummaryResult,
1634}
1635
1636/// Represents a subscription preview when previewing a subscription.
1637#[derive(Clone, Debug, Serialize, Deserialize)]
1638pub struct SubscriptionPreview {
1639 /// Status of this subscription. Set automatically by Paddle. Use the pause subscription or cancel subscription operations to change.
1640 pub status: SubscriptionStatus,
1641 /// Unique Paddle ID for this customer entity, prefixed with `ctm_`.
1642 pub customer_id: CustomerID,
1643 /// Unique Paddle ID for this address entity, prefixed with `add_`.
1644 pub address_id: AddressID,
1645 /// Paddle ID of the business that this subscription is for, prefixed with `biz_`.
1646 pub business_id: BusinessID,
1647 /// Supported three-letter ISO 4217 currency code.
1648 pub currency_code: CurrencyCode,
1649 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
1650 pub created_at: DateTime<FixedOffset>,
1651 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
1652 pub updated_at: DateTime<FixedOffset>,
1653 /// RFC 3339 datetime string of when this subscription started. This may be different from `first_billed_at` if the subscription started in trial.
1654 pub started_at: Option<DateTime<FixedOffset>>,
1655 /// RFC 3339 datetime string of when this subscription was first billed. This may be different from `started_at` if the subscription started in trial.
1656 pub first_billed_at: Option<DateTime<FixedOffset>>,
1657 /// RFC 3339 datetime string of when this subscription is next scheduled to be billed.
1658 pub next_billed_at: Option<DateTime<FixedOffset>>,
1659 /// RFC 3339 datetime string of when this subscription was paused. Set automatically by Paddle when the pause subscription operation is used. `null` if not paused.
1660 pub paused_at: Option<DateTime<FixedOffset>>,
1661 /// RFC 3339 datetime string of when this subscription was canceled. Set automatically by Paddle when the cancel subscription operation is used. `null` if not canceled.
1662 pub canceled_at: Option<DateTime<FixedOffset>>,
1663 /// Details of the discount applied to this subscription.
1664 pub discount: Discount,
1665 /// How payment is collected. `automatic` for checkout, `manual` for invoices.
1666 pub collection_mode: CollectionMode,
1667 /// Details for invoicing. Required if `collection_mode` is `manual`.
1668 pub billing_details: BillingDetails,
1669 /// Current billing period for this subscription. Set automatically by Paddle based on the billing cycle. `null` for `paused` and `canceled` subscriptions.
1670 pub current_billing_period: Option<TimePeriod>,
1671 pub billing_cycle: Duration,
1672 /// Change that's scheduled to be applied to a subscription. Use the pause subscription, cancel subscription, and resume subscription operations to create scheduled changes. `null` if no scheduled changes.
1673 pub scheduled_change: Option<SubscriptionScheduledChange>,
1674 /// Authenticated customer portal deep links for this subscription. For security, the `token` appended to each link is temporary. You shouldn't store these links.
1675 pub management_urls: SubscriptionManagementUrls,
1676 /// List of items on this subscription. Only recurring items are returned.
1677 pub items: Vec<SubscriptionItem>,
1678 /// Your own structured key-value data.
1679 pub custom_data: Option<HashMap<String, String>>,
1680 /// Preview of the immediate transaction created as a result of changes to the subscription. Returns a complete object where `proration_billing_mode` is `prorated_immediately` or `full_immediately`; `null` otherwise.
1681 pub immediate_transaction: Option<NextTransaction>,
1682 /// Preview of the next transaction for this subscription. Includes charges created where `proration_billing_mode` is `prorated_next_billing_period` or `full_next_billing_period`, as well as one-time charges. `null` if the subscription is scheduled to cancel or pause.
1683 pub next_transaction: NextTransaction,
1684 /// Calculated totals for a transaction preview, including discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction preview.
1685 pub recurring_transaction_details: SubscriptionTransactionDetailsPreview,
1686 pub update_summary: Option<SubscriptionPreviewUpdateSummary>,
1687 /// Import information for this entity. `null` if this entity is not imported.
1688 pub import_meta: ImportMeta,
1689}
1690
1691/// Details of the discount applied to this subscription. Include to add a discount to a subscription. `null` to remove a discount.
1692#[derive(Clone, Debug, Serialize, Deserialize)]
1693pub struct SubscriptionDiscountEffectiveFrom {
1694 /// Unique Paddle ID for this discount, prefixed with `dsc_`.
1695 pub id: DiscountID,
1696 /// When this subscription change should take effect from. Defaults to `next_billing_period`, which creates a
1697 /// `scheduled_change` to apply the subscription change at the end of the billing period.
1698 pub effective_from: EffectiveFrom,
1699}
1700
1701/// Represents a subscription entity when updating subscriptions.
1702#[derive(Clone, Debug, Serialize, Deserialize)]
1703pub struct SubscriptionUpdate {
1704 /// Unique Paddle ID for this customer entity, prefixed with `ctm_`.
1705 pub customer_id: CustomerID,
1706 /// Unique Paddle ID for this address entity, prefixed with `add_`.
1707 pub address_id: AddressID,
1708 /// Paddle ID of the business that this subscription is for, prefixed with `biz_`. Include to change the business for a subscription.
1709 pub business_id: BusinessID,
1710 /// Supported three-letter ISO 4217 currency code.
1711 pub currency_code: CurrencyCode,
1712 /// RFC 3339 datetime string.
1713 pub next_billed_at: DateTime<FixedOffset>,
1714 /// Details of the discount applied to this subscription. Include to add a discount to a subscription. `null` to remove a discount.
1715 pub discount: SubscriptionDiscountEffectiveFrom,
1716 /// How payment is collected. `automatic` for checkout, `manual` for invoices.
1717 pub collection_mode: CollectionMode,
1718 /// Details for invoicing. Required if `collection_mode` is `manual`. `null` if changing `collection_mode` to `automatic`.
1719 pub billing_details: BillingDetails,
1720 /// Change that's scheduled to be applied to a subscription. When updating, you may only set to `null` to remove a scheduled change. Use the pause subscription, cancel subscription, and resume subscription operations to create scheduled changes.
1721 pub scheduled_change: Option<()>,
1722 /// List of items on this subscription. Only recurring items may be added. Send the complete list of items that should be on this subscription, including existing items to retain.
1723 pub items: Vec<SubscriptionChargeItem>,
1724 /// Your own structured key-value data.
1725 pub custom_data: Option<HashMap<String, String>>,
1726 /// How Paddle should handle proration calculation for changes made to a subscription or its items. Required when making
1727 /// changes that impact billing.
1728 ///
1729 /// For automatically-collected subscriptions, responses may take longer than usual if a proration billing mode that
1730 /// collects for payment immediately is used.
1731 pub proration_billing_mode: ProrationBillingMode,
1732 /// How Paddle should handle changes made to a subscription or its items if the payment fails during update. If omitted, defaults to `prevent_change`.
1733 pub on_payment_failure: SubscriptionOnPaymentFailure,
1734}
1735
1736/// Price object for a non-catalog item to bill for. Include a `product_id` to relate this non-catalog price to an existing catalog price.
1737#[derive(Clone, Debug, Serialize, Deserialize)]
1738pub struct SubscriptionChargeCreateWithPricePrice {
1739 /// Unique Paddle ID for this product, prefixed with `pro_`.
1740 pub product_id: ProductID,
1741 /// Internal description for this price, not shown to customers. Typically notes for your team.
1742 pub description: String,
1743 /// Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
1744 pub name: Option<String>,
1745 /// How tax is calculated for this price.
1746 pub tax_mode: TaxMode,
1747 /// A base representation of monetary value unformatted in the lowest denomination with currency code.
1748 pub unit_price: Money,
1749 /// List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
1750 pub unit_price_overrides: Vec<UnitPriceOverride>,
1751 pub quantity: PriceQuantity,
1752 /// Your own structured key-value data.
1753 pub custom_data: Option<HashMap<String, String>>,
1754}
1755
1756/// Price object for a non-catalog item to charge for. Include a `product` object to create a non-catalog product for this non-catalog price.
1757#[derive(Clone, Debug, Serialize, Deserialize)]
1758pub struct SubscriptionChargeCreateWithPriceAndProduct {
1759 /// Internal description for this price, not shown to customers. Typically notes for your team.
1760 pub description: String,
1761 /// Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
1762 pub name: Option<String>,
1763 /// How tax is calculated for this price.
1764 pub tax_mode: TaxMode,
1765 /// A base representation of monetary value unformatted in the lowest denomination with currency code.
1766 pub unit_price: Money,
1767 /// List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
1768 pub unit_price_overrides: Vec<UnitPriceOverride>,
1769 pub quantity: PriceQuantity,
1770 /// Your own structured key-value data.
1771 pub custom_data: Option<HashMap<String, String>>,
1772 /// Product object for a non-catalog item to charge for.
1773 pub product: TransactionSubscriptionProductCreate,
1774}
1775
1776#[derive(Clone, Debug, Serialize, Deserialize)]
1777pub struct SubscriptionChargeCreateWithPrice {
1778 /// Quantity to bill for.
1779 pub quantity: i64,
1780 /// Price object for a non-catalog item to bill for. Include a `product_id` to relate this non-catalog price to an existing catalog price.
1781 pub price: SubscriptionChargeCreateWithPricePrice,
1782}
1783
1784#[derive(Clone, Debug, Serialize, Deserialize)]
1785pub struct TransactionPriceCreateWithProductId {
1786 /// Internal description for this price, not shown to customers. Typically notes for your team.
1787 pub description: String,
1788 /// Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
1789 pub name: Option<String>,
1790 /// How often this price should be charged. `null` if price is non-recurring (one-time).
1791 pub billing_cycle: Option<Duration>,
1792 /// Trial period for the product related to this price. The billing cycle begins once the trial period is over. `null` for no trial period. Requires `billing_cycle`.
1793 pub trial_period: Option<Duration>,
1794 /// How tax is calculated for this price.
1795 pub tax_mode: TaxMode,
1796 /// A base representation of monetary value unformatted in the lowest denomination with currency code.
1797 pub unit_price: Money,
1798 /// List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
1799 pub unit_price_overrides: Vec<UnitPriceOverride>,
1800 pub quantity: PriceQuantity,
1801 /// Your own structured key-value data.
1802 pub custom_data: Option<HashMap<String, String>>,
1803 /// Paddle ID for the product that this price is for, prefixed with `pro_`.
1804 pub product_id: ProductID,
1805}
1806
1807#[derive(Clone, Debug, Serialize, Deserialize)]
1808pub struct SubscriptionItemCreateWithPrice {
1809 /// Quantity to bill for.
1810 pub quantity: i64,
1811 pub price: TransactionPriceCreateWithProductId,
1812}
1813
1814#[derive(Clone, Debug, Serialize, Deserialize)]
1815pub struct SubscriptionItemCreateWithPriceId {
1816 /// Quantity to bill for.
1817 pub quantity: i64,
1818 /// Unique Paddle ID for this price, prefixed with `pri_`.
1819 pub price_id: PriceID,
1820}
1821
1822#[derive(Clone, Debug, Serialize, Deserialize)]
1823pub struct SubscriptionUpdateItem {
1824 /// Unique Paddle ID for this price, prefixed with `pri_`.
1825 pub price_id: PriceID,
1826 /// Quantity of this item to add to the subscription. If updating an existing item and not changing the quantity, you may omit `quantity`.
1827 pub quantity: i64,
1828}
1829
1830/// Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
1831#[derive(Clone, Debug, Serialize, Deserialize)]
1832pub struct TotalsWithoutDiscount {
1833 /// Subtotal before tax, and deductions. If an item, unit price multiplied by quantity.
1834 pub subtotal: String,
1835 /// Total tax on the subtotal.
1836 pub tax: String,
1837 /// Total after tax.
1838 pub total: String,
1839}
1840
1841#[derive(Clone, Debug, Serialize, Deserialize)]
1842pub struct TransactionItem {
1843 /// Unique Paddle ID for this price, prefixed with `pri_`.
1844 pub price_id: PriceID,
1845 /// Represents a price entity.
1846 pub price: Price,
1847 /// Quantity of this item on the transaction.
1848 pub quantity: i64,
1849 /// How proration was calculated for this item. Populated when a transaction is created from a subscription change, where `proration_billing_mode` was `prorated_immediately` or `prorated_next_billing_period`. Set automatically by Paddle.
1850 pub proration: Proration,
1851}
1852
1853/// Breakdown of the totals for a transaction after adjustments.
1854#[derive(Clone, Debug, Serialize, Deserialize)]
1855pub struct TransactionTotalsAdjusted {
1856 /// Subtotal before discount, tax, and deductions. If an item, unit price multiplied by quantity.
1857 pub subtotal: String,
1858 /// Total tax on the subtotal.
1859 pub tax: String,
1860 /// Total after tax.
1861 pub total: String,
1862 /// Total due after credits but before any payments.
1863 pub grand_total: String,
1864 /// Total fee taken by Paddle for this transaction. `null` until the transaction is `completed` and the fee is processed.
1865 pub fee: Option<String>,
1866 /// Total earnings for this transaction. This is the total minus the Paddle fee.
1867 /// `null` until the transaction is `completed` and the fee is processed.
1868 pub earnings: Option<String>,
1869 /// Supported three-letter ISO 4217 currency code.
1870 pub currency_code: CurrencyCode,
1871}
1872
1873/// Breakdown of the payout total for a transaction after adjustments. `null` until the transaction is `completed`.
1874#[derive(Clone, Debug, Serialize, Deserialize)]
1875pub struct TransactionPayoutTotalsAdjusted {
1876 /// Total before tax and fees.
1877 pub subtotal: String,
1878 /// Total tax on the subtotal.
1879 pub tax: String,
1880 /// Total after tax.
1881 pub total: String,
1882 /// Total fee taken by Paddle for this payout.
1883 pub fee: String,
1884 /// Details of any chargeback fees incurred for this transaction.
1885 pub chargeback_fee: ChargebackFee,
1886 /// Total earnings for this payout. This is the subtotal minus the Paddle fee, excluding chargeback fees.
1887 pub earnings: String,
1888 /// Supported three-letter ISO 4217 currency code for payouts from Paddle.
1889 pub currency_code: CurrencyCodePayouts,
1890}
1891
1892/// Information about line items for this transaction. Different from transaction `items` as they include totals calculated by Paddle. Considered the source of truth for line item totals.
1893#[derive(Clone, Debug, Serialize, Deserialize)]
1894pub struct TransactionLineItemWithId {
1895 /// Unique Paddle ID for this transaction item, prefixed with `txnitm_`.
1896 pub id: TransactionItemID,
1897 /// Unique Paddle ID for this price, prefixed with `pri_`.
1898 pub price_id: PriceID,
1899 /// Quantity of this transaction line item.
1900 pub quantity: i64,
1901 /// How proration was calculated for this item. Populated when a transaction is created from a subscription change, where `proration_billing_mode` was `prorated_immediately` or `prorated_next_billing_period`. Set automatically by Paddle.
1902 pub proration: Proration,
1903 /// Rate used to calculate tax for this transaction line item.
1904 pub tax_rate: String,
1905 /// Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
1906 pub unit_totals: Totals,
1907 /// Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
1908 pub totals: Totals,
1909 /// Represents a product entity.
1910 pub product: Product,
1911}
1912
1913/// Calculated totals for a transaction, including proration, discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction.
1914#[derive(Clone, Debug, Serialize, Deserialize)]
1915pub struct TransactionDetails {
1916 /// List of tax rates applied for this transaction.
1917 pub tax_rates_used: TaxRatesUsed,
1918 /// Breakdown of the total for a transaction. These numbers can be negative when dealing with subscription updates that result in credit.
1919 pub totals: TransactionTotals,
1920 /// Breakdown of the totals for a transaction after adjustments.
1921 pub adjusted_totals: TransactionTotalsAdjusted,
1922 /// Breakdown of the payout total for a transaction. `null` until the transaction is `completed`. Returned in your payout currency.
1923 pub payout_totals: Option<TransactionPayoutTotals>,
1924 /// Breakdown of the payout total for a transaction after adjustments. `null` until the transaction is `completed`.
1925 pub adjusted_payout_totals: Option<TransactionPayoutTotalsAdjusted>,
1926 /// Information about line items for this transaction. Different from transaction `items` as they include totals calculated by Paddle. Considered the source of truth for line item totals.
1927 pub line_items: Vec<TransactionLineItemWithId>,
1928}
1929
1930#[derive(Clone, Debug, Serialize, Deserialize)]
1931pub struct TransactionPaymentAttempt {
1932 /// UUID for this payment attempt.
1933 pub payment_attempt_id: String,
1934 /// UUID for the stored payment method used for this payment attempt. Deprecated - use `payment_method_id` instead.
1935 pub stored_payment_method_id: String,
1936 /// Paddle ID of the payment method used for this payment attempt, prefixed with `paymtd_`.
1937 pub payment_method_id: Option<PaymentMethodID>,
1938 /// Amount for collection in the lowest denomination of a currency (e.g. cents for USD).
1939 pub amount: String,
1940 /// Status of this payment attempt.
1941 pub status: PaymentAttemptStatus,
1942 /// Reason why a payment attempt failed. Returns `null` if payment captured successfully.
1943 pub error_code: ErrorCode,
1944 /// Information about the payment method used for a payment attempt.
1945 pub method_details: MethodDetails,
1946 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
1947 pub created_at: String,
1948 /// RFC 3339 datetime string of when this payment was captured. `null` if `status` is not `captured`.
1949 pub captured_at: Option<DateTime<FixedOffset>>,
1950}
1951
1952/// Paddle Checkout details for this transaction. Returned for automatically-collected transactions and where `billing_details.enable_checkout` is `true` for manually-collected transactions; `null` otherwise.
1953#[derive(Clone, Debug, Serialize, Deserialize)]
1954pub struct TransactionCheckout {
1955 /// Paddle Checkout URL for this transaction, composed of the URL passed in the request or your default payment URL + `?_ptxn=` and the Paddle ID for this transaction.
1956 pub url: Option<String>,
1957}
1958
1959/// Represents a transaction entity.
1960#[derive(Clone, Debug, Serialize, Deserialize)]
1961pub struct Transaction {
1962 /// Unique Paddle ID for this transaction entity, prefixed with `txn_`.
1963 pub id: TransactionID,
1964 /// Status of this transaction. You may set a transaction to `billed` or `canceled`, other statuses are set automatically by Paddle. Automatically-collected transactions may return `completed` if payment is captured successfully, or `past_due` if payment failed.
1965 pub status: TransactionStatus,
1966 /// Paddle ID of the customer that this transaction is for, prefixed with `ctm_`.
1967 pub customer_id: Option<CustomerID>,
1968 /// Paddle ID of the address that this transaction is for, prefixed with `add_`.
1969 pub address_id: Option<AddressID>,
1970 /// Paddle ID of the business that this transaction is for, prefixed with `biz_`.
1971 pub business_id: BusinessID,
1972 /// Your own structured key-value data.
1973 pub custom_data: Option<HashMap<String, String>>,
1974 /// Supported three-letter ISO 4217 currency code.
1975 pub currency_code: CurrencyCode,
1976 /// Describes how this transaction was created.
1977 pub origin: TransactionOrigin,
1978 /// Paddle ID of the subscription that this transaction is for, prefixed with `sub_`.
1979 pub subscription_id: SubscriptionID,
1980 /// Paddle ID of the invoice that this transaction is related to, prefixed with `inv_`. Used for compatibility with the Paddle Invoice API, which is now deprecated. This field is scheduled to be removed in the next version of the Paddle API.
1981 pub invoice_id: InvoiceId,
1982 /// Invoice number for this transaction. Automatically generated by Paddle when you mark a transaction as `billed` where `collection_mode` is `manual`.
1983 pub invoice_number: Option<String>,
1984 /// How payment is collected. `automatic` for checkout, `manual` for invoices.
1985 pub collection_mode: CollectionMode,
1986 /// Paddle ID of the discount applied to this transaction, prefixed with `dsc_`.
1987 pub discount_id: Option<DiscountID>,
1988 /// Details for invoicing. Required if `collection_mode` is `manual`.
1989 pub billing_details: BillingDetails,
1990 /// Time period that this transaction is for. Set automatically by Paddle for subscription renewals to describe the period that charges are for.
1991 pub billing_period: Option<TimePeriod>,
1992 /// List of items on this transaction. For calculated totals, use `details.line_items`.
1993 pub items: Vec<TransactionItem>,
1994 /// Calculated totals for a transaction, including proration, discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction.
1995 pub details: TransactionDetails,
1996 /// List of payment attempts for this transaction, including successful payments. Sorted by `created_at` in descending order, so most recent attempts are returned first.
1997 pub payments: Vec<TransactionPaymentAttempt>,
1998 /// Paddle Checkout details for this transaction. Returned for automatically-collected transactions and where `billing_details.enable_checkout` is `true` for manually-collected transactions; `null` otherwise.
1999 pub checkout: TransactionCheckout,
2000 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
2001 pub created_at: DateTime<FixedOffset>,
2002 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
2003 pub updated_at: DateTime<FixedOffset>,
2004 /// RFC 3339 datetime string of when this transaction was marked as `billed`. `null` for transactions that aren't `billed` or `completed`. Set automatically by Paddle.
2005 pub billed_at: Option<DateTime<FixedOffset>>,
2006 /// RFC 3339 datetime string of when a transaction was revised. Revisions describe an update to customer information for a billed or completed transaction. `null` if not revised. Set automatically by Paddle.
2007 pub revised_at: Option<DateTime<FixedOffset>>,
2008}
2009
2010/// Represents a transaction entity when creating transactions.
2011#[derive(Clone, Debug, Serialize, Deserialize)]
2012pub struct TransactionCreate {
2013 /// Unique Paddle ID for this transaction entity, prefixed with `txn_`.
2014 pub id: TransactionID,
2015 /// Status of this transaction. You may set a transaction to `billed` or `canceled`, other statuses are set automatically by Paddle. Automatically-collected transactions may return `completed` if payment is captured successfully, or `past_due` if payment failed.
2016 pub status: TransactionStatus,
2017 /// Paddle ID of the customer that this transaction is for, prefixed with `ctm_`. If omitted, transaction status is `draft`.
2018 pub customer_id: CustomerID,
2019 /// Paddle ID of the address that this transaction is for, prefixed with `add_`. Requires `customer_id`. If omitted, transaction status is `draft`.
2020 pub address_id: AddressID,
2021 /// Paddle ID of the business that this transaction is for, prefixed with `biz_`. Requires `customer_id`.
2022 pub business_id: BusinessID,
2023 /// Your own structured key-value data.
2024 pub custom_data: Option<HashMap<String, String>>,
2025 /// Supported three-letter ISO 4217 currency code. Must be `USD`, `EUR`, or `GBP` if `collection_mode` is `manual`.
2026 pub currency_code: CurrencyCode,
2027 /// Describes how this transaction was created.
2028 pub origin: TransactionOrigin,
2029 /// Paddle ID of the subscription that this transaction is for, prefixed with `sub_`.
2030 pub subscription_id: SubscriptionID,
2031 /// Paddle ID of the invoice that this transaction is related to, prefixed with `inv_`. Used for compatibility with the Paddle Invoice API, which is now deprecated. This field is scheduled to be removed in the next version of the Paddle API.
2032 pub invoice_id: InvoiceId,
2033 /// Invoice number for this transaction. Automatically generated by Paddle when you mark a transaction as `billed` where `collection_mode` is `manual`.
2034 pub invoice_number: Option<String>,
2035 /// How payment is collected. `automatic` for checkout, `manual` for invoices.
2036 pub collection_mode: CollectionMode,
2037 /// Paddle ID of the discount applied to this transaction, prefixed with `dsc_`.
2038 pub discount_id: DiscountID,
2039 /// Details for invoicing. Required if `collection_mode` is `manual`.
2040 pub billing_details: BillingDetails,
2041 /// Time period that this transaction is for. Set automatically by Paddle for subscription renewals to describe the period that charges are for.
2042 pub billing_period: Option<TimePeriod>,
2043 /// List of items to charge for. You can charge for items that you've added to your catalog by passing the Paddle ID of an existing price entity, or you can charge for non-catalog items by passing a price object.
2044 ///
2045 /// Non-catalog items can be for existing products, or you can pass a product object as part of your price to charge for a non-catalog product.
2046 pub items: Vec<SubscriptionChargeItem>,
2047 /// Calculated totals for a transaction, including proration, discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction.
2048 pub details: TransactionDetails,
2049 /// List of payment attempts for this transaction, including successful payments. Sorted by `created_at` in descending order, so most recent attempts are returned first.
2050 pub payments: Vec<TransactionPaymentAttempt>,
2051 /// Paddle Checkout details for this transaction. You may pass a URL when creating or updating an automatically-collected transaction, or when creating or updating a manually-collected transaction where `billing_details.enable_checkout` is `true`.
2052 pub checkout: TransactionCheckout,
2053 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
2054 pub created_at: DateTime<FixedOffset>,
2055 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
2056 pub updated_at: DateTime<FixedOffset>,
2057 /// RFC 3339 datetime string of when this transaction was marked as `billed`. `null` for transactions that aren't `billed` or `completed`. Set automatically by Paddle.
2058 pub billed_at: Option<DateTime<FixedOffset>>,
2059}
2060
2061/// Information about line items for this transaction preview. Different from transaction preview `items` as they include totals calculated by Paddle. Considered the source of truth for line item totals.
2062#[derive(Clone, Debug, Serialize, Deserialize)]
2063pub struct TransactionLineItemPreview {
2064 /// Paddle ID for the price related to this transaction line item, prefixed with `pri_`.
2065 /// The value is null for custom prices being previewed.
2066 pub price_id: Option<PriceID>,
2067 /// Quantity of this transaction line item.
2068 pub quantity: i64,
2069 /// Rate used to calculate tax for this transaction line item.
2070 pub tax_rate: String,
2071 /// Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
2072 pub unit_totals: Totals,
2073 /// Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
2074 pub totals: Totals,
2075 /// Represents a product (preview) entity.
2076 pub product: ProductPreview,
2077 /// How proration was calculated for this item.
2078 pub proration: Proration,
2079}
2080
2081/// Calculated totals for a transaction preview, including discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction preview.
2082#[derive(Clone, Debug, Serialize, Deserialize)]
2083pub struct TransactionDetailsPreview {
2084 /// List of tax rates applied to this transaction preview.
2085 pub tax_rates_used: TaxRatesUsed,
2086 /// Breakdown of the total for a transaction. These numbers can be negative when dealing with subscription updates that result in credit.
2087 pub totals: TransactionTotals,
2088 /// Information about line items for this transaction preview. Different from transaction preview `items` as they include totals calculated by Paddle. Considered the source of truth for line item totals.
2089 pub line_items: Vec<TransactionLineItemPreview>,
2090}
2091
2092/// Represents a transaction entity when previewing transactions.
2093#[derive(Clone, Debug, Serialize, Deserialize)]
2094pub struct TransactionPreview {
2095 /// Paddle ID of the customer that this transaction preview is for, prefixed with `ctm_`.
2096 pub customer_id: CustomerID,
2097 /// Paddle ID of the address that this transaction preview is for, prefixed with `add_`. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
2098 pub address_id: AddressID,
2099 /// Paddle ID of the business that this transaction preview is for, prefixed with `biz_`.
2100 pub business_id: BusinessID,
2101 /// Supported three-letter ISO 4217 currency code.
2102 pub currency_code: CurrencyCode,
2103 /// Paddle ID of the discount applied to this transaction preview, prefixed with `dsc_`.
2104 pub discount_id: DiscountID,
2105 /// IP address for this transaction preview. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
2106 pub customer_ip_address: Option<String>,
2107 /// Address for this transaction preview. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
2108 pub address: Address,
2109 /// Whether trials should be ignored for transaction preview calculations.
2110 ///
2111 /// By default, recurring items with trials are considered to have a zero charge when previewing. Set to `true` to disable this.
2112 pub ignore_trials: bool,
2113 /// List of items to preview transaction calculations for.
2114 pub items: Vec<HashMap<String, String>>,
2115 /// Calculated totals for a transaction preview, including discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction preview.
2116 pub details: TransactionDetailsPreview,
2117 pub available_payment_methods: Vec<PaymentMethodType>,
2118}
2119
2120/// Represents a transaction entity when previewing.
2121#[derive(Clone, Debug, Serialize, Deserialize)]
2122pub struct TransactionPreviewCreate {
2123 /// Paddle ID of the customer that this transaction preview is for, prefixed with `ctm_`.
2124 pub customer_id: CustomerID,
2125 /// Supported three-letter ISO 4217 currency code.
2126 pub currency_code: CurrencyCode,
2127 /// Paddle ID of the discount applied to this transaction preview, prefixed with `dsc_`.
2128 pub discount_id: DiscountID,
2129 /// Whether trials should be ignored for transaction preview calculations.
2130 ///
2131 /// By default, recurring items with trials are considered to have a zero charge when previewing. Set to `true` to disable this.
2132 pub ignore_trials: bool,
2133 /// List of items to preview charging for. You can preview charging for items that you've added to your catalog by passing the Paddle ID of an existing price entity, or you can preview charging for non-catalog items by passing a price object.
2134 ///
2135 /// Non-catalog items can be for existing products, or you can pass a product object as part of your price to preview charging for a non-catalog product.
2136 pub items: Vec<SubscriptionChargeItem>,
2137}
2138
2139/// Represents a price entity.
2140#[derive(Clone, Debug, Serialize, Deserialize)]
2141pub struct TransactionPriceCreateBase {
2142 /// Internal description for this price, not shown to customers. Typically notes for your team.
2143 pub description: String,
2144 /// Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
2145 pub name: Option<String>,
2146 /// How often this price should be charged. `null` if price is non-recurring (one-time).
2147 pub billing_cycle: Option<Duration>,
2148 /// Trial period for the product related to this price. The billing cycle begins once the trial period is over. `null` for no trial period. Requires `billing_cycle`.
2149 pub trial_period: Option<Duration>,
2150 /// How tax is calculated for this price.
2151 pub tax_mode: TaxMode,
2152 /// A base representation of monetary value unformatted in the lowest denomination with currency code.
2153 pub unit_price: Money,
2154 /// List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
2155 pub unit_price_overrides: Vec<UnitPriceOverride>,
2156 pub quantity: PriceQuantity,
2157 /// Your own structured key-value data.
2158 pub custom_data: Option<HashMap<String, String>>,
2159}
2160
2161/// Represents a customer information revision for a transaction.
2162#[derive(Clone, Debug, Serialize, Deserialize)]
2163pub struct TransactionRevise {
2164 /// Revised customer information for this transaction.
2165 pub customer: Customer,
2166 /// Revised business information for this transaction.
2167 pub business: Business,
2168 /// Revised address information for this transaction.
2169 pub address: Address,
2170}
2171
2172#[derive(Clone, Debug, Serialize, Deserialize)]
2173pub struct TransactionSubscriptionProductCreate {
2174 /// Name of this product.
2175 pub name: String,
2176 /// Short description for this product.
2177 pub description: Option<String>,
2178 /// Tax category for this product. Used for charging the correct rate of tax. Selected tax category must be enabled on your Paddle account.
2179 pub tax_category: TaxCategory,
2180 /// Image for this product. Included in the checkout and on some customer documents.
2181 pub image_url: Option<String>,
2182 /// Your own structured key-value data.
2183 pub custom_data: Option<HashMap<String, String>>,
2184}
2185
2186/// Represents a transaction entity when updating transactions.
2187#[derive(Clone, Debug, Serialize, Deserialize)]
2188pub struct TransactionUpdate {
2189 /// Unique Paddle ID for this transaction entity, prefixed with `txn_`.
2190 pub id: TransactionID,
2191 /// Status of this transaction. You may set a transaction to `billed` or `canceled`, other statuses are set automatically by Paddle. Automatically-collected transactions may return `completed` if payment is captured successfully, or `past_due` if payment failed.
2192 pub status: TransactionStatus,
2193 /// Paddle ID of the customer that this transaction is for, prefixed with `ctm_`.
2194 pub customer_id: CustomerID,
2195 /// Paddle ID of the address that this transaction is for, prefixed with `add_`.
2196 pub address_id: AddressID,
2197 /// Paddle ID of the business that this transaction is for, prefixed with `biz_`.
2198 pub business_id: BusinessID,
2199 /// Your own structured key-value data.
2200 pub custom_data: Option<HashMap<String, String>>,
2201 /// Supported three-letter ISO 4217 currency code. Must be `USD`, `EUR`, or `GBP` if `collection_mode` is `manual`.
2202 pub currency_code: CurrencyCode,
2203 /// Describes how this transaction was created.
2204 pub origin: TransactionOrigin,
2205 /// Paddle ID of the subscription that this transaction is for, prefixed with `sub_`.
2206 pub subscription_id: SubscriptionID,
2207 /// Paddle ID of the invoice that this transaction is related to, prefixed with `inv_`. Used for compatibility with the Paddle Invoice API, which is now deprecated. This field is scheduled to be removed in the next version of the Paddle API.
2208 pub invoice_id: InvoiceId,
2209 /// Invoice number for this transaction. Automatically generated by Paddle when you mark a transaction as `billed` where `collection_mode` is `manual`.
2210 pub invoice_number: Option<String>,
2211 /// How payment is collected. `automatic` for checkout, `manual` for invoices.
2212 pub collection_mode: CollectionMode,
2213 /// Paddle ID of the discount applied to this transaction, prefixed with `dsc_`.
2214 pub discount_id: DiscountID,
2215 /// Details for invoicing. Required if `collection_mode` is `manual`.
2216 pub billing_details: BillingDetails,
2217 /// Time period that this transaction is for. Set automatically by Paddle for subscription renewals to describe the period that charges are for.
2218 pub billing_period: Option<TimePeriod>,
2219 /// List of items on this transaction.
2220 ///
2221 /// When making a request, each object must contain either a `price_id` or a `price` object, and a `quantity`.
2222 ///
2223 /// Include a `price_id` to charge for an existing catalog item, or a `price` object to charge for a non-catalog item.
2224 pub items: Vec<SubscriptionChargeItem>,
2225 /// Calculated totals for a transaction, including proration, discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction.
2226 pub details: TransactionDetails,
2227 /// List of payment attempts for this transaction, including successful payments. Sorted by `created_at` in descending order, so most recent attempts are returned first.
2228 pub payments: Vec<TransactionPaymentAttempt>,
2229 /// Paddle Checkout details for this transaction. You may pass a URL when creating or updating an automatically-collected transaction, or when creating or updating a manually-collected transaction where `billing_details.enable_checkout` is `true`.
2230 pub checkout: TransactionCheckout,
2231 /// RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
2232 pub created_at: DateTime<FixedOffset>,
2233 /// RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
2234 pub updated_at: DateTime<FixedOffset>,
2235 /// RFC 3339 datetime string of when this transaction was marked as `billed`. `null` for transactions that aren't `billed` or `completed`. Set automatically by Paddle.
2236 pub billed_at: Option<DateTime<FixedOffset>>,
2237}
2238
2239#[derive(Clone, Debug, Serialize, Deserialize)]
2240pub struct TransactionItemCreateBase {
2241 /// Quantity of this item on the transaction.
2242 pub quantity: i64,
2243 /// How proration was calculated for this item. Populated when a transaction is created from a subscription change, where `proration_billing_mode` was `prorated_immediately` or `prorated_next_billing_period`. Set automatically by Paddle.
2244 pub proration: Proration,
2245}
2246
2247/// Information about line items for this transaction. Different from transaction `items` as they include totals calculated by Paddle. Considered the source of truth for line item totals.
2248#[derive(Clone, Debug, Serialize, Deserialize)]
2249pub struct TransactionLineItem {
2250 /// Unique Paddle ID for this price, prefixed with `pri_`.
2251 pub price_id: PriceID,
2252 /// Quantity of this transaction line item.
2253 pub quantity: i64,
2254 /// How proration was calculated for this item. Populated when a transaction is created from a subscription change, where `proration_billing_mode` was `prorated_immediately` or `prorated_next_billing_period`. Set automatically by Paddle.
2255 pub proration: Proration,
2256 /// Rate used to calculate tax for this transaction line item.
2257 pub tax_rate: String,
2258 /// Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
2259 pub unit_totals: Totals,
2260 /// Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
2261 pub totals: Totals,
2262 /// Represents a product entity.
2263 pub product: Product,
2264}
2265
2266/// Breakdown of the payout total for a transaction. `null` until the transaction is `completed`. Returned in your payout currency.
2267#[derive(Clone, Debug, Serialize, Deserialize)]
2268pub struct TransactionPayoutTotals {
2269 /// Total before tax and fees.
2270 pub subtotal: String,
2271 /// Total discount as a result of any discounts applied.
2272 /// Except for percentage discounts, Paddle applies tax to discounts based on the line item `price.tax_mode`. If `price.tax_mode` for a line item is `internal`, Paddle removes tax from the discount applied.
2273 pub discount: Discount,
2274 /// Total tax on the subtotal.
2275 pub tax: String,
2276 /// Total after tax.
2277 pub total: String,
2278 /// Total credit applied to this transaction. This includes credits applied using a customer's credit balance and adjustments to a `billed` transaction.
2279 pub credit: String,
2280 /// Additional credit generated from negative `details.line_items`. This credit is added to the customer balance.
2281 pub credit_to_balance: String,
2282 /// Total due on a transaction after credits and any payments.
2283 pub balance: String,
2284 /// Total due on a transaction after credits but before any payments.
2285 pub grand_total: String,
2286 /// Total fee taken by Paddle for this payout.
2287 pub fee: String,
2288 /// Total earnings for this payout. This is the subtotal minus the Paddle fee.
2289 pub earnings: String,
2290 /// Supported three-letter ISO 4217 currency code for payouts from Paddle.
2291 pub currency_code: CurrencyCodePayouts,
2292}
2293
2294#[derive(Clone, Debug, Serialize, Deserialize)]
2295pub struct TransactionItemPreviewBase {
2296 /// Quantity of this item on the transaction.
2297 pub quantity: i64,
2298 /// Whether this item should be included in totals for this transaction preview. Typically used to exclude one-time charges from calculations.
2299 pub include_in_totals: bool,
2300 /// How proration was calculated for this item. `null` for transaction previews.
2301 pub proration: Proration,
2302}
2303
2304#[derive(Clone, Debug, Serialize, Deserialize)]
2305pub struct PricePreviewBase {
2306 /// Paddle ID of the customer that this preview is for, prefixed with `ctm_`.
2307 pub customer_id: CustomerID,
2308 /// Paddle ID of the address that this preview is for, prefixed with `add_`. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
2309 pub address_id: AddressID,
2310 /// Paddle ID of the business that this preview is for, prefixed with `biz_`.
2311 pub business_id: BusinessID,
2312 /// Supported three-letter ISO 4217 currency code.
2313 pub currency_code: CurrencyCode,
2314 /// Paddle ID of the discount applied to this preview, prefixed with `dsc_`.
2315 pub discount_id: DiscountID,
2316 /// Address for this preview. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
2317 pub address: Address,
2318 /// IP address for this transaction preview. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
2319 pub customer_ip_address: Option<String>,
2320}
2321
2322/// Array of discounts applied to this preview line item. Empty if no discounts applied.
2323#[derive(Clone, Debug, Serialize, Deserialize)]
2324pub struct PricePreviewDiscounts {
2325 /// Represents a discount entity.
2326 pub discount: Discount,
2327 /// Total amount discounted as a result of this discount.
2328 pub total: String,
2329 /// Total amount discounted as a result of this discount in the format of a given currency. '
2330 pub formatted_total: String,
2331}
2332
2333/// Information about line items for this preview. Includes totals calculated by Paddle. Considered the source of truth for line item totals.
2334#[derive(Clone, Debug, Serialize, Deserialize)]
2335pub struct PricePreviewLineItem {
2336 /// Represents a price entity.
2337 pub price: Price,
2338 /// Quantity of this preview line item.
2339 pub quantity: i64,
2340 /// Rate used to calculate tax for this preview line item.
2341 pub tax_rate: String,
2342 /// Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
2343 pub unit_totals: Totals,
2344 /// Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
2345 pub formatted_unit_totals: Totals,
2346 /// Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
2347 pub totals: Totals,
2348 /// Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
2349 pub formatted_totals: Totals,
2350 /// Represents a product entity.
2351 pub product: Product,
2352 pub discounts: Vec<PricePreviewDiscounts>,
2353}
2354
2355/// Calculated totals for a price preview, including discounts, tax, and currency conversion.
2356#[derive(Clone, Debug, Serialize, Deserialize)]
2357pub struct PricePreviewDetails {
2358 pub line_items: Vec<PricePreviewLineItem>,
2359}
2360
2361#[derive(Clone, Debug, Serialize, Deserialize)]
2362pub struct PricePreviewItem {
2363 /// Unique Paddle ID for this price, prefixed with `pri_`.
2364 pub price_id: PriceID,
2365 /// Quantity of the item to preview.
2366 pub quantity: i64,
2367}