1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933
// ======================================
// This file was automatically generated.
// ======================================
use serde::{Deserialize, Serialize};
use crate::client::{Client, Response};
use crate::ids::{CustomerId, SubscriptionScheduleId};
use crate::params::{Expand, Expandable, List, Metadata, Object, Paginable, RangeQuery, Timestamp};
use crate::resources::{
Account, Application, CollectionMethod, ConnectAccountReference, Coupon, Currency, Customer,
PaymentMethod, Plan, Price, Scheduled, Subscription, SubscriptionBillingThresholds,
SubscriptionItemBillingThresholds, SubscriptionTransferData, TaxId, TaxRate,
TestHelpersTestClock,
};
/// The resource representing a Stripe "SubscriptionSchedule".
///
/// For more details see <https://stripe.com/docs/api/subscription_schedules/object>
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SubscriptionSchedule {
/// Unique identifier for the object.
pub id: SubscriptionScheduleId,
/// ID of the Connect Application that created the schedule.
pub application: Option<Expandable<Application>>,
/// Time at which the subscription schedule was canceled.
///
/// Measured in seconds since the Unix epoch.
pub canceled_at: Option<Timestamp>,
/// Time at which the subscription schedule was completed.
///
/// Measured in seconds since the Unix epoch.
pub completed_at: Option<Timestamp>,
/// Time at which the object was created.
///
/// Measured in seconds since the Unix epoch.
pub created: Timestamp,
/// Object representing the start and end dates for the current phase of the subscription schedule, if it is `active`.
pub current_phase: Option<SubscriptionScheduleCurrentPhase>,
/// ID of the customer who owns the subscription schedule.
pub customer: Expandable<Customer>,
pub default_settings: SubscriptionScheduleDefaultSettings,
/// Behavior of the subscription schedule and underlying subscription when it ends.
///
/// Possible values are `release` or `cancel` with the default being `release`.
/// `release` will end the subscription schedule and keep the underlying subscription running.
/// `cancel` will end the subscription schedule and cancel the underlying subscription.
pub end_behavior: SubscriptionScheduleEndBehavior,
/// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
pub livemode: bool,
/// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
///
/// This can be useful for storing additional information about the object in a structured format.
pub metadata: Option<Metadata>,
/// Configuration for the subscription schedule's phases.
pub phases: Vec<SubscriptionSchedulePhaseConfiguration>,
/// Time at which the subscription schedule was released.
///
/// Measured in seconds since the Unix epoch.
pub released_at: Option<Timestamp>,
/// ID of the subscription once managed by the subscription schedule (if it is released).
pub released_subscription: Option<String>,
/// The present status of the subscription schedule.
///
/// Possible values are `not_started`, `active`, `completed`, `released`, and `canceled`.
/// You can read more about the different states in our [behavior guide](https://stripe.com/docs/billing/subscriptions/subscription-schedules).
pub status: SubscriptionScheduleStatus,
/// ID of the subscription managed by the subscription schedule.
pub subscription: Option<Expandable<Subscription>>,
/// ID of the test clock this subscription schedule belongs to.
pub test_clock: Option<Expandable<TestHelpersTestClock>>,
}
impl SubscriptionSchedule {
/// Retrieves the list of your subscription schedules.
pub fn list(
client: &Client,
params: &ListSubscriptionSchedules<'_>,
) -> Response<List<SubscriptionSchedule>> {
client.get_query("/subscription_schedules", params)
}
/// Creates a new subscription schedule object.
///
/// Each customer can have up to 500 active or scheduled subscriptions.
pub fn create(
client: &Client,
params: CreateSubscriptionSchedule<'_>,
) -> Response<SubscriptionSchedule> {
#[allow(clippy::needless_borrows_for_generic_args)]
client.post_form("/subscription_schedules", ¶ms)
}
/// Retrieves the details of an existing subscription schedule.
///
/// You only need to supply the unique subscription schedule identifier that was returned upon subscription schedule creation.
pub fn retrieve(
client: &Client,
id: &SubscriptionScheduleId,
expand: &[&str],
) -> Response<SubscriptionSchedule> {
client.get_query(&format!("/subscription_schedules/{}", id), Expand { expand })
}
/// Updates an existing subscription schedule.
pub fn update(
client: &Client,
id: &SubscriptionScheduleId,
params: UpdateSubscriptionSchedule<'_>,
) -> Response<SubscriptionSchedule> {
#[allow(clippy::needless_borrows_for_generic_args)]
client.post_form(&format!("/subscription_schedules/{}", id), ¶ms)
}
}
impl Object for SubscriptionSchedule {
type Id = SubscriptionScheduleId;
fn id(&self) -> Self::Id {
self.id.clone()
}
fn object(&self) -> &'static str {
"subscription_schedule"
}
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SubscriptionScheduleCurrentPhase {
/// The end of this phase of the subscription schedule.
pub end_date: Timestamp,
/// The start of this phase of the subscription schedule.
pub start_date: Timestamp,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SubscriptionSchedulePhaseConfiguration {
/// A list of prices and quantities that will generate invoice items appended to the next invoice for this phase.
pub add_invoice_items: Vec<SubscriptionScheduleAddInvoiceItem>,
/// A non-negative decimal between 0 and 100, with at most two decimal places.
///
/// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account during this phase of the schedule.
pub application_fee_percent: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub automatic_tax: Option<SchedulesPhaseAutomaticTax>,
/// Possible values are `phase_start` or `automatic`.
///
/// If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase.
/// If `automatic` then the billing cycle anchor is automatically modified as needed when entering the phase.
/// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
pub billing_cycle_anchor: Option<SubscriptionSchedulePhaseConfigurationBillingCycleAnchor>,
/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
pub billing_thresholds: Option<SubscriptionBillingThresholds>,
/// Either `charge_automatically`, or `send_invoice`.
///
/// When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer.
/// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.
pub collection_method: Option<CollectionMethod>,
/// ID of the coupon to use during this phase of the subscription schedule.
pub coupon: Option<Expandable<Coupon>>,
/// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
///
/// Must be a [supported currency](https://stripe.com/docs/currencies).
pub currency: Currency,
/// ID of the default payment method for the subscription schedule.
///
/// It must belong to the customer associated with the subscription schedule.
/// If not set, invoices will use the default payment method in the customer's invoice settings.
pub default_payment_method: Option<Expandable<PaymentMethod>>,
/// The default tax rates to apply to the subscription during this phase of the subscription schedule.
#[serde(skip_serializing_if = "Option::is_none")]
pub default_tax_rates: Option<Vec<TaxRate>>,
/// Subscription description, meant to be displayable to the customer.
///
/// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
pub description: Option<String>,
/// The end of this phase of the subscription schedule.
pub end_date: Timestamp,
/// The invoice settings applicable during this phase.
pub invoice_settings: Option<InvoiceSettingSubscriptionSchedulePhaseSetting>,
/// Subscription items to configure the subscription to during this phase of the subscription schedule.
pub items: Vec<SubscriptionScheduleConfigurationItem>,
/// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a phase.
///
/// Metadata on a schedule's phase will update the underlying subscription's `metadata` when the phase is entered.
/// Updating the underlying subscription's `metadata` directly will not affect the current phase's `metadata`.
pub metadata: Option<Metadata>,
/// The account (if any) the charge was made on behalf of for charges associated with the schedule's subscription.
///
/// See the Connect documentation for details.
pub on_behalf_of: Option<Expandable<Account>>,
/// If the subscription schedule will prorate when transitioning to this phase.
///
/// Possible values are `create_prorations` and `none`.
pub proration_behavior: SubscriptionProrationBehavior,
/// The start of this phase of the subscription schedule.
pub start_date: Timestamp,
/// The account (if any) the associated subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.
pub transfer_data: Option<SubscriptionTransferData>,
/// When the trial ends within the phase.
pub trial_end: Option<Timestamp>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct InvoiceSettingSubscriptionSchedulePhaseSetting {
/// The account tax IDs associated with this phase of the subscription schedule.
///
/// Will be set on invoices generated by this phase of the subscription schedule.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_tax_ids: Option<Vec<Expandable<TaxId>>>,
/// Number of days within which a customer must pay invoices generated by this subscription schedule.
///
/// This value will be `null` for subscription schedules where `billing=charge_automatically`.
pub days_until_due: Option<u32>,
/// The connected account that issues the invoice.
///
/// The invoice is presented with the branding and support information of the specified account.
pub issuer: Option<ConnectAccountReference>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SchedulesPhaseAutomaticTax {
/// Whether Stripe automatically computes tax on invoices created during this phase.
pub enabled: bool,
/// The account that's liable for tax.
///
/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account.
/// The tax transaction is returned in the report of the connected account.
pub liability: Option<ConnectAccountReference>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SubscriptionScheduleAddInvoiceItem {
/// ID of the price used to generate the invoice item.
pub price: Expandable<Price>,
/// The quantity of the invoice item.
pub quantity: Option<u64>,
/// The tax rates which apply to the item.
///
/// When set, the `default_tax_rates` do not apply to this item.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax_rates: Option<Vec<TaxRate>>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SubscriptionScheduleConfigurationItem {
/// Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period.
pub billing_thresholds: Option<SubscriptionItemBillingThresholds>,
/// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an item.
///
/// Metadata on this item will update the underlying subscription item's `metadata` when the phase is entered.
pub metadata: Option<Metadata>,
/// ID of the plan to which the customer should be subscribed.
pub plan: Expandable<Plan>,
/// ID of the price to which the customer should be subscribed.
pub price: Expandable<Price>,
/// Quantity of the plan to which the customer should be subscribed.
#[serde(skip_serializing_if = "Option::is_none")]
pub quantity: Option<u64>,
/// The tax rates which apply to this `phase_item`.
///
/// When set, the `default_tax_rates` on the phase do not apply to this `phase_item`.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax_rates: Option<Vec<TaxRate>>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SubscriptionScheduleDefaultSettings {
/// A non-negative decimal between 0 and 100, with at most two decimal places.
///
/// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account during this phase of the schedule.
pub application_fee_percent: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub automatic_tax: Option<SubscriptionSchedulesResourceDefaultSettingsAutomaticTax>,
/// Possible values are `phase_start` or `automatic`.
///
/// If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase.
/// If `automatic` then the billing cycle anchor is automatically modified as needed when entering the phase.
/// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
pub billing_cycle_anchor: SubscriptionScheduleDefaultSettingsBillingCycleAnchor,
/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
pub billing_thresholds: Option<SubscriptionBillingThresholds>,
/// Either `charge_automatically`, or `send_invoice`.
///
/// When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer.
/// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.
pub collection_method: Option<SubscriptionScheduleDefaultSettingsCollectionMethod>,
/// ID of the default payment method for the subscription schedule.
///
/// If not set, invoices will use the default payment method in the customer's invoice settings.
pub default_payment_method: Option<Expandable<PaymentMethod>>,
/// Subscription description, meant to be displayable to the customer.
///
/// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
pub description: Option<String>,
pub invoice_settings: SubscriptionScheduleInvoiceSettings,
/// The account (if any) the charge was made on behalf of for charges associated with the schedule's subscription.
///
/// See the Connect documentation for details.
pub on_behalf_of: Option<Expandable<Account>>,
/// The account (if any) the associated subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.
pub transfer_data: Option<SubscriptionTransferData>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SubscriptionSchedulesResourceDefaultSettingsAutomaticTax {
/// Whether Stripe automatically computes tax on invoices created during this phase.
pub enabled: bool,
/// The account that's liable for tax.
///
/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account.
/// The tax transaction is returned in the report of the connected account.
pub liability: Option<ConnectAccountReference>,
}
/// The parameters for `SubscriptionSchedule::create`.
#[derive(Clone, Debug, Serialize, Default)]
pub struct CreateSubscriptionSchedule<'a> {
/// The identifier of the customer to create the subscription schedule for.
#[serde(skip_serializing_if = "Option::is_none")]
pub customer: Option<CustomerId>,
/// Object representing the subscription schedule's default settings.
#[serde(skip_serializing_if = "Option::is_none")]
pub default_settings: Option<SubscriptionScheduleDefaultSettingsParams>,
/// Behavior of the subscription schedule and underlying subscription when it ends.
///
/// Possible values are `release` or `cancel` with the default being `release`.
/// `release` will end the subscription schedule and keep the underlying subscription running.
/// `cancel` will end the subscription schedule and cancel the underlying subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_behavior: Option<SubscriptionScheduleEndBehavior>,
/// Specifies which fields in the response should be expanded.
#[serde(skip_serializing_if = "Expand::is_empty")]
pub expand: &'a [&'a str],
/// Migrate an existing subscription to be managed by a subscription schedule.
///
/// If this parameter is set, a subscription schedule will be created using the subscription's item(s), set to auto-renew using the subscription's interval.
/// When using this parameter, other parameters (such as phase values) cannot be set.
/// To create a subscription schedule with other modifications, we recommend making two separate API calls.
#[serde(skip_serializing_if = "Option::is_none")]
pub from_subscription: Option<&'a str>,
/// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
///
/// This can be useful for storing additional information about the object in a structured format.
/// Individual keys can be unset by posting an empty value to them.
/// All keys can be unset by posting an empty value to `metadata`.
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<Metadata>,
/// List representing phases of the subscription schedule.
///
/// Each phase can be customized to have different durations, plans, and coupons.
/// If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase.
#[serde(skip_serializing_if = "Option::is_none")]
pub phases: Option<Vec<CreateSubscriptionSchedulePhases>>,
/// When the subscription schedule starts.
///
/// We recommend using `now` so that it starts the subscription immediately.
/// You can also use a Unix timestamp to backdate the subscription so that it starts on a past date, or set a future date for the subscription to start on.
#[serde(skip_serializing_if = "Option::is_none")]
pub start_date: Option<Scheduled>,
}
impl<'a> CreateSubscriptionSchedule<'a> {
pub fn new() -> Self {
CreateSubscriptionSchedule {
customer: Default::default(),
default_settings: Default::default(),
end_behavior: Default::default(),
expand: Default::default(),
from_subscription: Default::default(),
metadata: Default::default(),
phases: Default::default(),
start_date: Default::default(),
}
}
}
/// The parameters for `SubscriptionSchedule::list`.
#[derive(Clone, Debug, Serialize, Default)]
pub struct ListSubscriptionSchedules<'a> {
/// Only return subscription schedules that were created canceled the given date interval.
#[serde(skip_serializing_if = "Option::is_none")]
pub canceled_at: Option<RangeQuery<Timestamp>>,
/// Only return subscription schedules that completed during the given date interval.
#[serde(skip_serializing_if = "Option::is_none")]
pub completed_at: Option<RangeQuery<Timestamp>>,
/// Only return subscription schedules that were created during the given date interval.
#[serde(skip_serializing_if = "Option::is_none")]
pub created: Option<RangeQuery<Timestamp>>,
/// Only return subscription schedules for the given customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub customer: Option<CustomerId>,
/// A cursor for use in pagination.
///
/// `ending_before` is an object ID that defines your place in the list.
/// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
#[serde(skip_serializing_if = "Option::is_none")]
pub ending_before: Option<SubscriptionScheduleId>,
/// Specifies which fields in the response should be expanded.
#[serde(skip_serializing_if = "Expand::is_empty")]
pub expand: &'a [&'a str],
/// A limit on the number of objects to be returned.
///
/// Limit can range between 1 and 100, and the default is 10.
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<u64>,
/// Only return subscription schedules that were released during the given date interval.
#[serde(skip_serializing_if = "Option::is_none")]
pub released_at: Option<RangeQuery<Timestamp>>,
/// Only return subscription schedules that have not started yet.
#[serde(skip_serializing_if = "Option::is_none")]
pub scheduled: Option<bool>,
/// A cursor for use in pagination.
///
/// `starting_after` is an object ID that defines your place in the list.
/// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
#[serde(skip_serializing_if = "Option::is_none")]
pub starting_after: Option<SubscriptionScheduleId>,
}
impl<'a> ListSubscriptionSchedules<'a> {
pub fn new() -> Self {
ListSubscriptionSchedules {
canceled_at: Default::default(),
completed_at: Default::default(),
created: Default::default(),
customer: Default::default(),
ending_before: Default::default(),
expand: Default::default(),
limit: Default::default(),
released_at: Default::default(),
scheduled: Default::default(),
starting_after: Default::default(),
}
}
}
impl Paginable for ListSubscriptionSchedules<'_> {
type O = SubscriptionSchedule;
fn set_last(&mut self, item: Self::O) {
self.starting_after = Some(item.id());
}
}
/// The parameters for `SubscriptionSchedule::update`.
#[derive(Clone, Debug, Serialize, Default)]
pub struct UpdateSubscriptionSchedule<'a> {
/// Object representing the subscription schedule's default settings.
#[serde(skip_serializing_if = "Option::is_none")]
pub default_settings: Option<SubscriptionScheduleDefaultSettingsParams>,
/// Behavior of the subscription schedule and underlying subscription when it ends.
///
/// Possible values are `release` or `cancel` with the default being `release`.
/// `release` will end the subscription schedule and keep the underlying subscription running.
/// `cancel` will end the subscription schedule and cancel the underlying subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_behavior: Option<SubscriptionScheduleEndBehavior>,
/// Specifies which fields in the response should be expanded.
#[serde(skip_serializing_if = "Expand::is_empty")]
pub expand: &'a [&'a str],
/// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
///
/// This can be useful for storing additional information about the object in a structured format.
/// Individual keys can be unset by posting an empty value to them.
/// All keys can be unset by posting an empty value to `metadata`.
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<Metadata>,
/// List representing phases of the subscription schedule.
///
/// Each phase can be customized to have different durations, plans, and coupons.
/// If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase.
/// Note that past phases can be omitted.
#[serde(skip_serializing_if = "Option::is_none")]
pub phases: Option<Vec<UpdateSubscriptionSchedulePhases>>,
/// If the update changes the current phase, indicates whether the changes should be prorated.
///
/// The default value is `create_prorations`.
#[serde(skip_serializing_if = "Option::is_none")]
pub proration_behavior: Option<SubscriptionProrationBehavior>,
}
impl<'a> UpdateSubscriptionSchedule<'a> {
pub fn new() -> Self {
UpdateSubscriptionSchedule {
default_settings: Default::default(),
end_behavior: Default::default(),
expand: Default::default(),
metadata: Default::default(),
phases: Default::default(),
proration_behavior: Default::default(),
}
}
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateSubscriptionSchedulePhases {
/// A list of prices and quantities that will generate invoice items appended to the next invoice for this phase.
///
/// You may pass up to 20 items.
#[serde(skip_serializing_if = "Option::is_none")]
pub add_invoice_items: Option<Vec<AddInvoiceItems>>,
/// A non-negative decimal between 0 and 100, with at most two decimal places.
///
/// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account.
/// The request must be made by a platform account on a connected account in order to set an application fee percentage.
/// For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
#[serde(skip_serializing_if = "Option::is_none")]
pub application_fee_percent: Option<f64>,
/// Automatic tax settings for this phase.
#[serde(skip_serializing_if = "Option::is_none")]
pub automatic_tax: Option<CreateSubscriptionSchedulePhasesAutomaticTax>,
/// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed.
///
/// Cannot be set to `phase_start` if this phase specifies a trial.
/// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
#[serde(skip_serializing_if = "Option::is_none")]
pub billing_cycle_anchor: Option<CreateSubscriptionSchedulePhasesBillingCycleAnchor>,
/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
///
/// Pass an empty string to remove previously-defined thresholds.
#[serde(skip_serializing_if = "Option::is_none")]
pub billing_thresholds: Option<SubscriptionBillingThresholds>,
/// Either `charge_automatically`, or `send_invoice`.
///
/// When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer.
/// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.
/// Defaults to `charge_automatically` on creation.
#[serde(skip_serializing_if = "Option::is_none")]
pub collection_method: Option<CollectionMethod>,
/// The identifier of the coupon to apply to this phase of the subscription schedule.
#[serde(skip_serializing_if = "Option::is_none")]
pub coupon: Option<String>,
/// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
///
/// Must be a [supported currency](https://stripe.com/docs/currencies).
#[serde(skip_serializing_if = "Option::is_none")]
pub currency: Option<Currency>,
/// ID of the default payment method for the subscription schedule.
///
/// It must belong to the customer associated with the subscription schedule.
/// If not set, invoices will use the default payment method in the customer's invoice settings.
#[serde(skip_serializing_if = "Option::is_none")]
pub default_payment_method: Option<String>,
/// A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids.
///
/// These Tax Rates will set the Subscription's [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates), which means they will be the Invoice's [`default_tax_rates`](https://stripe.com/docs/api/invoices/create#create_invoice-default_tax_rates) for any Invoices issued by the Subscription during this Phase.
#[serde(skip_serializing_if = "Option::is_none")]
pub default_tax_rates: Option<Vec<String>>,
/// Subscription description, meant to be displayable to the customer.
///
/// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// The date at which this phase of the subscription schedule ends.
///
/// If set, `iterations` must not be set.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date: Option<Scheduled>,
/// All invoices will be billed using the specified settings.
#[serde(skip_serializing_if = "Option::is_none")]
pub invoice_settings: Option<SubscriptionScheduleInvoiceSettings>,
/// List of configuration items, each with an attached price, to apply during this phase of the subscription schedule.
pub items: Vec<CreateSubscriptionSchedulePhasesItems>,
/// Integer representing the multiplier applied to the price interval.
///
/// For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`.
/// If set, `end_date` must not be set.
#[serde(skip_serializing_if = "Option::is_none")]
pub iterations: Option<i64>,
/// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a phase.
///
/// Metadata on a schedule's phase will update the underlying subscription's `metadata` when the phase is entered, adding new keys and replacing existing keys in the subscription's `metadata`.
/// Individual keys in the subscription's `metadata` can be unset by posting an empty value to them in the phase's `metadata`.
/// To unset all keys in the subscription's `metadata`, update the subscription directly or unset every key individually from the phase's `metadata`.
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<Metadata>,
/// The account on behalf of which to charge, for each of the associated subscription's invoices.
#[serde(skip_serializing_if = "Option::is_none")]
pub on_behalf_of: Option<String>,
/// Whether the subscription schedule will create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase.
///
/// The default value is `create_prorations`.
/// This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase.
/// It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase.
#[serde(skip_serializing_if = "Option::is_none")]
pub proration_behavior: Option<SubscriptionProrationBehavior>,
/// The data with which to automatically create a Transfer for each of the associated subscription's invoices.
#[serde(skip_serializing_if = "Option::is_none")]
pub transfer_data: Option<CreateSubscriptionSchedulePhasesTransferData>,
/// If set to true the entire phase is counted as a trial and the customer will not be charged for any fees.
#[serde(skip_serializing_if = "Option::is_none")]
pub trial: Option<bool>,
/// Sets the phase to trialing from the start date to this date.
///
/// Must be before the phase end date, can not be combined with `trial`.
#[serde(skip_serializing_if = "Option::is_none")]
pub trial_end: Option<Scheduled>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SubscriptionScheduleDefaultSettingsParams {
/// A non-negative decimal between 0 and 100, with at most two decimal places.
///
/// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account.
/// The request must be made by a platform account on a connected account in order to set an application fee percentage.
/// For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
#[serde(skip_serializing_if = "Option::is_none")]
pub application_fee_percent: Option<f64>,
/// Default settings for automatic tax computation.
#[serde(skip_serializing_if = "Option::is_none")]
pub automatic_tax: Option<SubscriptionScheduleDefaultSettingsParamsAutomaticTax>,
/// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed.
///
/// Cannot be set to `phase_start` if this phase specifies a trial.
/// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
#[serde(skip_serializing_if = "Option::is_none")]
pub billing_cycle_anchor: Option<SubscriptionScheduleDefaultSettingsParamsBillingCycleAnchor>,
/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
///
/// Pass an empty string to remove previously-defined thresholds.
#[serde(skip_serializing_if = "Option::is_none")]
pub billing_thresholds: Option<SubscriptionScheduleBillingThresholds>,
/// Either `charge_automatically`, or `send_invoice`.
///
/// When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer.
/// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.
/// Defaults to `charge_automatically` on creation.
#[serde(skip_serializing_if = "Option::is_none")]
pub collection_method: Option<CollectionMethod>,
/// ID of the default payment method for the subscription schedule.
///
/// It must belong to the customer associated with the subscription schedule.
/// If not set, invoices will use the default payment method in the customer's invoice settings.
#[serde(skip_serializing_if = "Option::is_none")]
pub default_payment_method: Option<String>,
/// Subscription description, meant to be displayable to the customer.
///
/// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// All invoices will be billed using the specified settings.
#[serde(skip_serializing_if = "Option::is_none")]
pub invoice_settings: Option<SubscriptionScheduleInvoiceSettings>,
/// The account on behalf of which to charge, for each of the associated subscription's invoices.
#[serde(skip_serializing_if = "Option::is_none")]
pub on_behalf_of: Option<String>,
/// The data with which to automatically create a Transfer for each of the associated subscription's invoices.
#[serde(skip_serializing_if = "Option::is_none")]
pub transfer_data: Option<SubscriptionScheduleDefaultSettingsParamsTransferData>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UpdateSubscriptionSchedulePhases {
/// A list of prices and quantities that will generate invoice items appended to the next invoice for this phase.
///
/// You may pass up to 20 items.
#[serde(skip_serializing_if = "Option::is_none")]
pub add_invoice_items: Option<Vec<AddInvoiceItems>>,
/// A non-negative decimal between 0 and 100, with at most two decimal places.
///
/// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account.
/// The request must be made by a platform account on a connected account in order to set an application fee percentage.
/// For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
#[serde(skip_serializing_if = "Option::is_none")]
pub application_fee_percent: Option<f64>,
/// Automatic tax settings for this phase.
#[serde(skip_serializing_if = "Option::is_none")]
pub automatic_tax: Option<UpdateSubscriptionSchedulePhasesAutomaticTax>,
/// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed.
///
/// Cannot be set to `phase_start` if this phase specifies a trial.
/// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
#[serde(skip_serializing_if = "Option::is_none")]
pub billing_cycle_anchor: Option<UpdateSubscriptionSchedulePhasesBillingCycleAnchor>,
/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
///
/// Pass an empty string to remove previously-defined thresholds.
#[serde(skip_serializing_if = "Option::is_none")]
pub billing_thresholds: Option<SubscriptionBillingThresholds>,
/// Either `charge_automatically`, or `send_invoice`.
///
/// When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer.
/// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.
/// Defaults to `charge_automatically` on creation.
#[serde(skip_serializing_if = "Option::is_none")]
pub collection_method: Option<CollectionMethod>,
/// The identifier of the coupon to apply to this phase of the subscription schedule.
#[serde(skip_serializing_if = "Option::is_none")]
pub coupon: Option<String>,
/// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
///
/// Must be a [supported currency](https://stripe.com/docs/currencies).
#[serde(skip_serializing_if = "Option::is_none")]
pub currency: Option<Currency>,
/// ID of the default payment method for the subscription schedule.
///
/// It must belong to the customer associated with the subscription schedule.
/// If not set, invoices will use the default payment method in the customer's invoice settings.
#[serde(skip_serializing_if = "Option::is_none")]
pub default_payment_method: Option<String>,
/// A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids.
///
/// These Tax Rates will set the Subscription's [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates), which means they will be the Invoice's [`default_tax_rates`](https://stripe.com/docs/api/invoices/create#create_invoice-default_tax_rates) for any Invoices issued by the Subscription during this Phase.
#[serde(skip_serializing_if = "Option::is_none")]
pub default_tax_rates: Option<Vec<String>>,
/// Subscription description, meant to be displayable to the customer.
///
/// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// The date at which this phase of the subscription schedule ends.
///
/// If set, `iterations` must not be set.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date: Option<Scheduled>,
/// All invoices will be billed using the specified settings.
#[serde(skip_serializing_if = "Option::is_none")]
pub invoice_settings: Option<SubscriptionScheduleInvoiceSettings>,
/// List of configuration items, each with an attached price, to apply during this phase of the subscription schedule.
pub items: Vec<UpdateSubscriptionSchedulePhasesItems>,
/// Integer representing the multiplier applied to the price interval.
///
/// For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`.
/// If set, `end_date` must not be set.
#[serde(skip_serializing_if = "Option::is_none")]
pub iterations: Option<i64>,
/// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a phase.
///
/// Metadata on a schedule's phase will update the underlying subscription's `metadata` when the phase is entered, adding new keys and replacing existing keys in the subscription's `metadata`.
/// Individual keys in the subscription's `metadata` can be unset by posting an empty value to them in the phase's `metadata`.
/// To unset all keys in the subscription's `metadata`, update the subscription directly or unset every key individually from the phase's `metadata`.
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<Metadata>,
/// The account on behalf of which to charge, for each of the associated subscription's invoices.
#[serde(skip_serializing_if = "Option::is_none")]
pub on_behalf_of: Option<String>,
/// Whether the subscription schedule will create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase.
///
/// The default value is `create_prorations`.
/// This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase.
/// It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase.
#[serde(skip_serializing_if = "Option::is_none")]
pub proration_behavior: Option<SubscriptionProrationBehavior>,
/// The date at which this phase of the subscription schedule starts or `now`.
///
/// Must be set on the first phase.
#[serde(skip_serializing_if = "Option::is_none")]
pub start_date: Option<Scheduled>,
/// The data with which to automatically create a Transfer for each of the associated subscription's invoices.
#[serde(skip_serializing_if = "Option::is_none")]
pub transfer_data: Option<UpdateSubscriptionSchedulePhasesTransferData>,
/// If set to true the entire phase is counted as a trial and the customer will not be charged for any fees.
#[serde(skip_serializing_if = "Option::is_none")]
pub trial: Option<bool>,
/// Sets the phase to trialing from the start date to this date.
///
/// Must be before the phase end date, can not be combined with `trial`.
#[serde(skip_serializing_if = "Option::is_none")]
pub trial_end: Option<Scheduled>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct AddInvoiceItems {
/// The ID of the price object.
#[serde(skip_serializing_if = "Option::is_none")]
pub price: Option<String>,
/// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
#[serde(skip_serializing_if = "Option::is_none")]
pub price_data: Option<InvoiceItemPriceData>,
/// Quantity for this item.
///
/// Defaults to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub quantity: Option<u64>,
/// The tax rates which apply to the item.
///
/// When set, the `default_tax_rates` do not apply to this item.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax_rates: Option<Vec<String>>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateSubscriptionSchedulePhasesAutomaticTax {
/// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
pub enabled: bool,
/// The account that's liable for tax.
///
/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account.
/// The tax transaction is returned in the report of the connected account.
#[serde(skip_serializing_if = "Option::is_none")]
pub liability: Option<CreateSubscriptionSchedulePhasesAutomaticTaxLiability>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateSubscriptionSchedulePhasesItems {
/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
///
/// When updating, pass an empty string to remove previously-defined thresholds.
#[serde(skip_serializing_if = "Option::is_none")]
pub billing_thresholds: Option<CreateSubscriptionSchedulePhasesItemsBillingThresholds>,
/// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a configuration item.
///
/// Metadata on a configuration item will update the underlying subscription item's `metadata` when the phase is entered, adding new keys and replacing existing keys.
/// Individual keys in the subscription item's `metadata` can be unset by posting an empty value to them in the configuration item's `metadata`.
/// To unset all keys in the subscription item's `metadata`, update the subscription item directly or unset every key individually from the configuration item's `metadata`.
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<Metadata>,
/// The plan ID to subscribe to.
///
/// You may specify the same ID in `plan` and `price`.
#[serde(skip_serializing_if = "Option::is_none")]
pub plan: Option<String>,
/// The ID of the price object.
#[serde(skip_serializing_if = "Option::is_none")]
pub price: Option<String>,
/// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
#[serde(skip_serializing_if = "Option::is_none")]
pub price_data: Option<CreateSubscriptionSchedulePhasesItemsPriceData>,
/// Quantity for the given price.
///
/// Can be set only if the price's `usage_type` is `licensed` and not `metered`.
#[serde(skip_serializing_if = "Option::is_none")]
pub quantity: Option<u64>,
/// A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids.
///
/// These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription.
/// When updating, pass an empty string to remove previously-defined tax rates.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax_rates: Option<Vec<String>>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateSubscriptionSchedulePhasesTransferData {
/// A non-negative decimal between 0 and 100, with at most two decimal places.
///
/// This represents the percentage of the subscription invoice total that will be transferred to the destination account.
/// By default, the entire amount is transferred to the destination.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount_percent: Option<f64>,
/// ID of an existing, connected Stripe account.
pub destination: String,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SubscriptionScheduleBillingThresholds {
/// Monetary threshold that triggers the subscription to advance to a new billing period.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount_gte: Option<i64>,
/// Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached.
///
/// If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.
#[serde(skip_serializing_if = "Option::is_none")]
pub reset_billing_cycle_anchor: Option<bool>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SubscriptionScheduleDefaultSettingsParamsAutomaticTax {
/// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
pub enabled: bool,
/// The account that's liable for tax.
///
/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account.
/// The tax transaction is returned in the report of the connected account.
#[serde(skip_serializing_if = "Option::is_none")]
pub liability: Option<SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiability>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SubscriptionScheduleDefaultSettingsParamsTransferData {
/// A non-negative decimal between 0 and 100, with at most two decimal places.
///
/// This represents the percentage of the subscription invoice total that will be transferred to the destination account.
/// By default, the entire amount is transferred to the destination.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount_percent: Option<f64>,
/// ID of an existing, connected Stripe account.
pub destination: String,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SubscriptionScheduleInvoiceSettings {
/// The account tax IDs associated with this phase of the subscription schedule.
///
/// Will be set on invoices generated by this phase of the subscription schedule.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_tax_ids: Option<Vec<String>>,
/// Number of days within which a customer must pay invoices generated by this subscription schedule.
///
/// This value will be `null` for subscription schedules where `billing=charge_automatically`.
#[serde(skip_serializing_if = "Option::is_none")]
pub days_until_due: Option<u32>,
/// The connected account that issues the invoice.
///
/// The invoice is presented with the branding and support information of the specified account.
#[serde(skip_serializing_if = "Option::is_none")]
pub issuer: Option<SubscriptionScheduleInvoiceSettingsIssuer>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UpdateSubscriptionSchedulePhasesAutomaticTax {
/// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
pub enabled: bool,
/// The account that's liable for tax.
///
/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account.
/// The tax transaction is returned in the report of the connected account.
#[serde(skip_serializing_if = "Option::is_none")]
pub liability: Option<UpdateSubscriptionSchedulePhasesAutomaticTaxLiability>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UpdateSubscriptionSchedulePhasesItems {
/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
///
/// When updating, pass an empty string to remove previously-defined thresholds.
#[serde(skip_serializing_if = "Option::is_none")]
pub billing_thresholds: Option<UpdateSubscriptionSchedulePhasesItemsBillingThresholds>,
/// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a configuration item.
///
/// Metadata on a configuration item will update the underlying subscription item's `metadata` when the phase is entered, adding new keys and replacing existing keys.
/// Individual keys in the subscription item's `metadata` can be unset by posting an empty value to them in the configuration item's `metadata`.
/// To unset all keys in the subscription item's `metadata`, update the subscription item directly or unset every key individually from the configuration item's `metadata`.
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<Metadata>,
/// The plan ID to subscribe to.
///
/// You may specify the same ID in `plan` and `price`.
#[serde(skip_serializing_if = "Option::is_none")]
pub plan: Option<String>,
/// The ID of the price object.
#[serde(skip_serializing_if = "Option::is_none")]
pub price: Option<String>,
/// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
#[serde(skip_serializing_if = "Option::is_none")]
pub price_data: Option<UpdateSubscriptionSchedulePhasesItemsPriceData>,
/// Quantity for the given price.
///
/// Can be set only if the price's `usage_type` is `licensed` and not `metered`.
#[serde(skip_serializing_if = "Option::is_none")]
pub quantity: Option<u64>,
/// A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids.
///
/// These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription.
/// When updating, pass an empty string to remove previously-defined tax rates.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax_rates: Option<Vec<String>>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UpdateSubscriptionSchedulePhasesTransferData {
/// A non-negative decimal between 0 and 100, with at most two decimal places.
///
/// This represents the percentage of the subscription invoice total that will be transferred to the destination account.
/// By default, the entire amount is transferred to the destination.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount_percent: Option<f64>,
/// ID of an existing, connected Stripe account.
pub destination: String,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateSubscriptionSchedulePhasesAutomaticTaxLiability {
/// The connected account being referenced when `type` is `account`.
#[serde(skip_serializing_if = "Option::is_none")]
pub account: Option<String>,
/// Type of the account referenced in the request.
#[serde(rename = "type")]
pub type_: CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateSubscriptionSchedulePhasesItemsBillingThresholds {
/// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)).
pub usage_gte: i64,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateSubscriptionSchedulePhasesItemsPriceData {
/// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
///
/// Must be a [supported currency](https://stripe.com/docs/currencies).
pub currency: Currency,
/// The ID of the product that this price will belong to.
pub product: String,
/// The recurring components of a price such as `interval` and `interval_count`.
pub recurring: CreateSubscriptionSchedulePhasesItemsPriceDataRecurring,
/// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings.
///
/// Specifies whether the price is considered inclusive of taxes or exclusive of taxes.
/// One of `inclusive`, `exclusive`, or `unspecified`.
/// Once specified as either `inclusive` or `exclusive`, it cannot be changed.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax_behavior: Option<CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior>,
/// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
#[serde(skip_serializing_if = "Option::is_none")]
pub unit_amount: Option<i64>,
/// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places.
///
/// Only one of `unit_amount` and `unit_amount_decimal` can be set.
#[serde(skip_serializing_if = "Option::is_none")]
pub unit_amount_decimal: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct InvoiceItemPriceData {
/// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
///
/// Must be a [supported currency](https://stripe.com/docs/currencies).
pub currency: Currency,
/// The ID of the product that this price will belong to.
pub product: String,
/// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings.
///
/// Specifies whether the price is considered inclusive of taxes or exclusive of taxes.
/// One of `inclusive`, `exclusive`, or `unspecified`.
/// Once specified as either `inclusive` or `exclusive`, it cannot be changed.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax_behavior: Option<InvoiceItemPriceDataTaxBehavior>,
/// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
#[serde(skip_serializing_if = "Option::is_none")]
pub unit_amount: Option<i64>,
/// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places.
///
/// Only one of `unit_amount` and `unit_amount_decimal` can be set.
#[serde(skip_serializing_if = "Option::is_none")]
pub unit_amount_decimal: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiability {
/// The connected account being referenced when `type` is `account`.
#[serde(skip_serializing_if = "Option::is_none")]
pub account: Option<String>,
/// Type of the account referenced in the request.
#[serde(rename = "type")]
pub type_: SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiabilityType,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SubscriptionScheduleInvoiceSettingsIssuer {
/// The connected account being referenced when `type` is `account`.
#[serde(skip_serializing_if = "Option::is_none")]
pub account: Option<String>,
/// Type of the account referenced in the request.
#[serde(rename = "type")]
pub type_: SubscriptionScheduleInvoiceSettingsIssuerType,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UpdateSubscriptionSchedulePhasesAutomaticTaxLiability {
/// The connected account being referenced when `type` is `account`.
#[serde(skip_serializing_if = "Option::is_none")]
pub account: Option<String>,
/// Type of the account referenced in the request.
#[serde(rename = "type")]
pub type_: UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UpdateSubscriptionSchedulePhasesItemsBillingThresholds {
/// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)).
pub usage_gte: i64,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UpdateSubscriptionSchedulePhasesItemsPriceData {
/// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
///
/// Must be a [supported currency](https://stripe.com/docs/currencies).
pub currency: Currency,
/// The ID of the product that this price will belong to.
pub product: String,
/// The recurring components of a price such as `interval` and `interval_count`.
pub recurring: UpdateSubscriptionSchedulePhasesItemsPriceDataRecurring,
/// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings.
///
/// Specifies whether the price is considered inclusive of taxes or exclusive of taxes.
/// One of `inclusive`, `exclusive`, or `unspecified`.
/// Once specified as either `inclusive` or `exclusive`, it cannot be changed.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax_behavior: Option<UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior>,
/// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
#[serde(skip_serializing_if = "Option::is_none")]
pub unit_amount: Option<i64>,
/// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places.
///
/// Only one of `unit_amount` and `unit_amount_decimal` can be set.
#[serde(skip_serializing_if = "Option::is_none")]
pub unit_amount_decimal: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateSubscriptionSchedulePhasesItemsPriceDataRecurring {
/// Specifies billing frequency.
///
/// Either `day`, `week`, `month` or `year`.
pub interval: CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval,
/// The number of intervals between subscription billings.
///
/// For example, `interval=month` and `interval_count=3` bills every 3 months.
/// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
#[serde(skip_serializing_if = "Option::is_none")]
pub interval_count: Option<u64>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UpdateSubscriptionSchedulePhasesItemsPriceDataRecurring {
/// Specifies billing frequency.
///
/// Either `day`, `week`, `month` or `year`.
pub interval: UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval,
/// The number of intervals between subscription billings.
///
/// For example, `interval=month` and `interval_count=3` bills every 3 months.
/// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
#[serde(skip_serializing_if = "Option::is_none")]
pub interval_count: Option<u64>,
}
/// An enum representing the possible values of an `CreateSubscriptionSchedulePhasesAutomaticTaxLiability`'s `type` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
Account,
#[serde(rename = "self")]
Self_,
}
impl CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
pub fn as_str(self) -> &'static str {
match self {
CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType::Account => "account",
CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType::Self_ => "self",
}
}
}
impl AsRef<str> for CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
fn default() -> Self {
Self::Account
}
}
/// An enum representing the possible values of an `CreateSubscriptionSchedulePhases`'s `billing_cycle_anchor` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum CreateSubscriptionSchedulePhasesBillingCycleAnchor {
Automatic,
PhaseStart,
}
impl CreateSubscriptionSchedulePhasesBillingCycleAnchor {
pub fn as_str(self) -> &'static str {
match self {
CreateSubscriptionSchedulePhasesBillingCycleAnchor::Automatic => "automatic",
CreateSubscriptionSchedulePhasesBillingCycleAnchor::PhaseStart => "phase_start",
}
}
}
impl AsRef<str> for CreateSubscriptionSchedulePhasesBillingCycleAnchor {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for CreateSubscriptionSchedulePhasesBillingCycleAnchor {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for CreateSubscriptionSchedulePhasesBillingCycleAnchor {
fn default() -> Self {
Self::Automatic
}
}
/// An enum representing the possible values of an `CreateSubscriptionSchedulePhasesItemsPriceDataRecurring`'s `interval` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
Day,
Month,
Week,
Year,
}
impl CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
pub fn as_str(self) -> &'static str {
match self {
CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::Day => "day",
CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::Month => "month",
CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::Week => "week",
CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::Year => "year",
}
}
}
impl AsRef<str> for CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
fn default() -> Self {
Self::Day
}
}
/// An enum representing the possible values of an `CreateSubscriptionSchedulePhasesItemsPriceData`'s `tax_behavior` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
Exclusive,
Inclusive,
Unspecified,
}
impl CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
pub fn as_str(self) -> &'static str {
match self {
CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Exclusive => "exclusive",
CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Inclusive => "inclusive",
CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Unspecified => "unspecified",
}
}
}
impl AsRef<str> for CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
fn default() -> Self {
Self::Exclusive
}
}
/// An enum representing the possible values of an `InvoiceItemPriceData`'s `tax_behavior` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum InvoiceItemPriceDataTaxBehavior {
Exclusive,
Inclusive,
Unspecified,
}
impl InvoiceItemPriceDataTaxBehavior {
pub fn as_str(self) -> &'static str {
match self {
InvoiceItemPriceDataTaxBehavior::Exclusive => "exclusive",
InvoiceItemPriceDataTaxBehavior::Inclusive => "inclusive",
InvoiceItemPriceDataTaxBehavior::Unspecified => "unspecified",
}
}
}
impl AsRef<str> for InvoiceItemPriceDataTaxBehavior {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for InvoiceItemPriceDataTaxBehavior {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for InvoiceItemPriceDataTaxBehavior {
fn default() -> Self {
Self::Exclusive
}
}
/// An enum representing the possible values of an `SubscriptionSchedulePhaseConfiguration`'s `proration_behavior` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SubscriptionProrationBehavior {
AlwaysInvoice,
CreateProrations,
None,
}
impl SubscriptionProrationBehavior {
pub fn as_str(self) -> &'static str {
match self {
SubscriptionProrationBehavior::AlwaysInvoice => "always_invoice",
SubscriptionProrationBehavior::CreateProrations => "create_prorations",
SubscriptionProrationBehavior::None => "none",
}
}
}
impl AsRef<str> for SubscriptionProrationBehavior {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for SubscriptionProrationBehavior {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for SubscriptionProrationBehavior {
fn default() -> Self {
Self::AlwaysInvoice
}
}
/// An enum representing the possible values of an `SubscriptionScheduleDefaultSettings`'s `billing_cycle_anchor` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SubscriptionScheduleDefaultSettingsBillingCycleAnchor {
Automatic,
PhaseStart,
}
impl SubscriptionScheduleDefaultSettingsBillingCycleAnchor {
pub fn as_str(self) -> &'static str {
match self {
SubscriptionScheduleDefaultSettingsBillingCycleAnchor::Automatic => "automatic",
SubscriptionScheduleDefaultSettingsBillingCycleAnchor::PhaseStart => "phase_start",
}
}
}
impl AsRef<str> for SubscriptionScheduleDefaultSettingsBillingCycleAnchor {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for SubscriptionScheduleDefaultSettingsBillingCycleAnchor {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for SubscriptionScheduleDefaultSettingsBillingCycleAnchor {
fn default() -> Self {
Self::Automatic
}
}
/// An enum representing the possible values of an `SubscriptionScheduleDefaultSettings`'s `collection_method` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SubscriptionScheduleDefaultSettingsCollectionMethod {
ChargeAutomatically,
SendInvoice,
}
impl SubscriptionScheduleDefaultSettingsCollectionMethod {
pub fn as_str(self) -> &'static str {
match self {
SubscriptionScheduleDefaultSettingsCollectionMethod::ChargeAutomatically => {
"charge_automatically"
}
SubscriptionScheduleDefaultSettingsCollectionMethod::SendInvoice => "send_invoice",
}
}
}
impl AsRef<str> for SubscriptionScheduleDefaultSettingsCollectionMethod {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for SubscriptionScheduleDefaultSettingsCollectionMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for SubscriptionScheduleDefaultSettingsCollectionMethod {
fn default() -> Self {
Self::ChargeAutomatically
}
}
/// An enum representing the possible values of an `SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiability`'s `type` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiabilityType {
Account,
#[serde(rename = "self")]
Self_,
}
impl SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiabilityType {
pub fn as_str(self) -> &'static str {
match self {
SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiabilityType::Account => {
"account"
}
SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiabilityType::Self_ => "self",
}
}
}
impl AsRef<str> for SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiabilityType {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiabilityType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiabilityType {
fn default() -> Self {
Self::Account
}
}
/// An enum representing the possible values of an `SubscriptionScheduleDefaultSettingsParams`'s `billing_cycle_anchor` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SubscriptionScheduleDefaultSettingsParamsBillingCycleAnchor {
Automatic,
PhaseStart,
}
impl SubscriptionScheduleDefaultSettingsParamsBillingCycleAnchor {
pub fn as_str(self) -> &'static str {
match self {
SubscriptionScheduleDefaultSettingsParamsBillingCycleAnchor::Automatic => "automatic",
SubscriptionScheduleDefaultSettingsParamsBillingCycleAnchor::PhaseStart => {
"phase_start"
}
}
}
}
impl AsRef<str> for SubscriptionScheduleDefaultSettingsParamsBillingCycleAnchor {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for SubscriptionScheduleDefaultSettingsParamsBillingCycleAnchor {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for SubscriptionScheduleDefaultSettingsParamsBillingCycleAnchor {
fn default() -> Self {
Self::Automatic
}
}
/// An enum representing the possible values of an `SubscriptionSchedule`'s `end_behavior` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SubscriptionScheduleEndBehavior {
Cancel,
None,
Release,
Renew,
}
impl SubscriptionScheduleEndBehavior {
pub fn as_str(self) -> &'static str {
match self {
SubscriptionScheduleEndBehavior::Cancel => "cancel",
SubscriptionScheduleEndBehavior::None => "none",
SubscriptionScheduleEndBehavior::Release => "release",
SubscriptionScheduleEndBehavior::Renew => "renew",
}
}
}
impl AsRef<str> for SubscriptionScheduleEndBehavior {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for SubscriptionScheduleEndBehavior {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for SubscriptionScheduleEndBehavior {
fn default() -> Self {
Self::Cancel
}
}
/// An enum representing the possible values of an `SubscriptionScheduleInvoiceSettingsIssuer`'s `type` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SubscriptionScheduleInvoiceSettingsIssuerType {
Account,
#[serde(rename = "self")]
Self_,
}
impl SubscriptionScheduleInvoiceSettingsIssuerType {
pub fn as_str(self) -> &'static str {
match self {
SubscriptionScheduleInvoiceSettingsIssuerType::Account => "account",
SubscriptionScheduleInvoiceSettingsIssuerType::Self_ => "self",
}
}
}
impl AsRef<str> for SubscriptionScheduleInvoiceSettingsIssuerType {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for SubscriptionScheduleInvoiceSettingsIssuerType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for SubscriptionScheduleInvoiceSettingsIssuerType {
fn default() -> Self {
Self::Account
}
}
/// An enum representing the possible values of an `SubscriptionSchedulePhaseConfiguration`'s `billing_cycle_anchor` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
Automatic,
PhaseStart,
}
impl SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
pub fn as_str(self) -> &'static str {
match self {
SubscriptionSchedulePhaseConfigurationBillingCycleAnchor::Automatic => "automatic",
SubscriptionSchedulePhaseConfigurationBillingCycleAnchor::PhaseStart => "phase_start",
}
}
}
impl AsRef<str> for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
fn default() -> Self {
Self::Automatic
}
}
/// An enum representing the possible values of an `SubscriptionSchedule`'s `status` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SubscriptionScheduleStatus {
Active,
Canceled,
Completed,
NotStarted,
Released,
}
impl SubscriptionScheduleStatus {
pub fn as_str(self) -> &'static str {
match self {
SubscriptionScheduleStatus::Active => "active",
SubscriptionScheduleStatus::Canceled => "canceled",
SubscriptionScheduleStatus::Completed => "completed",
SubscriptionScheduleStatus::NotStarted => "not_started",
SubscriptionScheduleStatus::Released => "released",
}
}
}
impl AsRef<str> for SubscriptionScheduleStatus {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for SubscriptionScheduleStatus {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for SubscriptionScheduleStatus {
fn default() -> Self {
Self::Active
}
}
/// An enum representing the possible values of an `UpdateSubscriptionSchedulePhasesAutomaticTaxLiability`'s `type` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
Account,
#[serde(rename = "self")]
Self_,
}
impl UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
pub fn as_str(self) -> &'static str {
match self {
UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType::Account => "account",
UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType::Self_ => "self",
}
}
}
impl AsRef<str> for UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
fn default() -> Self {
Self::Account
}
}
/// An enum representing the possible values of an `UpdateSubscriptionSchedulePhases`'s `billing_cycle_anchor` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum UpdateSubscriptionSchedulePhasesBillingCycleAnchor {
Automatic,
PhaseStart,
}
impl UpdateSubscriptionSchedulePhasesBillingCycleAnchor {
pub fn as_str(self) -> &'static str {
match self {
UpdateSubscriptionSchedulePhasesBillingCycleAnchor::Automatic => "automatic",
UpdateSubscriptionSchedulePhasesBillingCycleAnchor::PhaseStart => "phase_start",
}
}
}
impl AsRef<str> for UpdateSubscriptionSchedulePhasesBillingCycleAnchor {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for UpdateSubscriptionSchedulePhasesBillingCycleAnchor {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for UpdateSubscriptionSchedulePhasesBillingCycleAnchor {
fn default() -> Self {
Self::Automatic
}
}
/// An enum representing the possible values of an `UpdateSubscriptionSchedulePhasesItemsPriceDataRecurring`'s `interval` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
Day,
Month,
Week,
Year,
}
impl UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
pub fn as_str(self) -> &'static str {
match self {
UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::Day => "day",
UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::Month => "month",
UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::Week => "week",
UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::Year => "year",
}
}
}
impl AsRef<str> for UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
fn default() -> Self {
Self::Day
}
}
/// An enum representing the possible values of an `UpdateSubscriptionSchedulePhasesItemsPriceData`'s `tax_behavior` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
Exclusive,
Inclusive,
Unspecified,
}
impl UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
pub fn as_str(self) -> &'static str {
match self {
UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Exclusive => "exclusive",
UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Inclusive => "inclusive",
UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Unspecified => "unspecified",
}
}
}
impl AsRef<str> for UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
fn default() -> Self {
Self::Exclusive
}
}