chargebee 2.51.0 → 2.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/lib/chargebee.js +1 -1
  3. package/lib/resources/api_endpoints.js +103 -5
  4. package/package.json +1 -1
  5. package/types/core.d.ts +6 -6
  6. package/types/index.d.ts +10 -0
  7. package/types/resources/Addon.d.ts +3 -3
  8. package/types/resources/Address.d.ts +2 -194
  9. package/types/resources/AdvanceInvoiceSchedule.d.ts +5 -67
  10. package/types/resources/AttachedItem.d.ts +1 -1
  11. package/types/resources/Attribute.d.ts +4 -1
  12. package/types/resources/BillingConfiguration.d.ts +21 -0
  13. package/types/resources/Brand.d.ts +12 -0
  14. package/types/resources/BusinessEntity.d.ts +10 -8
  15. package/types/resources/BusinessEntityTransfer.d.ts +10 -7
  16. package/types/resources/Card.d.ts +11 -311
  17. package/types/resources/Comment.d.ts +10 -125
  18. package/types/resources/Contact.d.ts +2 -44
  19. package/types/resources/ContractTerm.d.ts +4 -72
  20. package/types/resources/Coupon.d.ts +4 -41
  21. package/types/resources/CouponCode.d.ts +67 -35
  22. package/types/resources/CouponSet.d.ts +12 -121
  23. package/types/resources/CreditNote.d.ts +89 -95
  24. package/types/resources/Currency.d.ts +8 -5
  25. package/types/resources/Customer.d.ts +96 -95
  26. package/types/resources/CustomerEntitlement.d.ts +3 -1
  27. package/types/resources/DifferentialPrice.d.ts +1 -1
  28. package/types/resources/Discount.d.ts +5 -90
  29. package/types/resources/Download.d.ts +2 -14
  30. package/types/resources/Entitlement.d.ts +15 -103
  31. package/types/resources/EntitlementOverride.d.ts +4 -89
  32. package/types/resources/Estimate.d.ts +6 -14
  33. package/types/resources/Event.d.ts +24 -109
  34. package/types/resources/Export.d.ts +116 -432
  35. package/types/resources/Feature.d.ts +19 -321
  36. package/types/resources/GatewayErrorDetail.d.ts +6 -48
  37. package/types/resources/Gift.d.ts +34 -294
  38. package/types/resources/Hierarchy.d.ts +4 -24
  39. package/types/resources/HostedPage.d.ts +4 -4
  40. package/types/resources/ImpactedCustomer.d.ts +23 -0
  41. package/types/resources/ImpactedItem.d.ts +4 -36
  42. package/types/resources/ImpactedItemPrice.d.ts +5 -2
  43. package/types/resources/ImpactedSubscription.d.ts +3 -30
  44. package/types/resources/InAppSubscription.d.ts +13 -355
  45. package/types/resources/Invoice.d.ts +112 -126
  46. package/types/resources/InvoiceEstimate.d.ts +1 -1
  47. package/types/resources/Item.d.ts +4 -11
  48. package/types/resources/ItemEntitlement.d.ts +15 -155
  49. package/types/resources/ItemFamily.d.ts +3 -3
  50. package/types/resources/ItemPrice.d.ts +7 -7
  51. package/types/resources/NonSubscription.d.ts +9 -6
  52. package/types/resources/OmnichannelOneTimeOrder.d.ts +90 -0
  53. package/types/resources/OmnichannelOneTimeOrderItem.d.ts +24 -0
  54. package/types/resources/OmnichannelSubscription.d.ts +2 -2
  55. package/types/resources/OmnichannelSubscriptionItem.d.ts +1 -1
  56. package/types/resources/OmnichannelSubscriptionItemScheduledChange.d.ts +1 -1
  57. package/types/resources/Order.d.ts +3 -3
  58. package/types/resources/PaymentIntent.d.ts +9 -255
  59. package/types/resources/PaymentReferenceNumber.d.ts +3 -20
  60. package/types/resources/PaymentSource.d.ts +4 -4
  61. package/types/resources/PaymentVoucher.d.ts +22 -205
  62. package/types/resources/Plan.d.ts +3 -3
  63. package/types/resources/PortalSession.d.ts +4 -146
  64. package/types/resources/PriceVariant.d.ts +2 -2
  65. package/types/resources/PricingPageSession.d.ts +2 -2
  66. package/types/resources/PromotionalCredit.d.ts +12 -215
  67. package/types/resources/Purchase.d.ts +5 -3
  68. package/types/resources/Quote.d.ts +32 -14
  69. package/types/resources/QuotedCharge.d.ts +7 -0
  70. package/types/resources/QuotedRamp.d.ts +11 -16
  71. package/types/resources/Ramp.d.ts +7 -7
  72. package/types/resources/RecordedPurchase.d.ts +8 -1
  73. package/types/resources/ResourceMigration.d.ts +2 -54
  74. package/types/resources/SiteMigrationDetail.d.ts +13 -55
  75. package/types/resources/Subscription.d.ts +33 -29
  76. package/types/resources/SubscriptionEntitlement.d.ts +6 -106
  77. package/types/resources/SubscriptionEntitlementsCreatedDetail.d.ts +12 -0
  78. package/types/resources/SubscriptionEntitlementsUpdatedDetail.d.ts +12 -0
  79. package/types/resources/SubscriptionEstimate.d.ts +14 -11
  80. package/types/resources/TaxWithheld.d.ts +14 -26
  81. package/types/resources/ThirdPartyPaymentMethod.d.ts +2 -19
  82. package/types/resources/TimeMachine.d.ts +3 -64
  83. package/types/resources/Token.d.ts +3 -60
  84. package/types/resources/Transaction.d.ts +8 -8
  85. package/types/resources/UnbilledCharge.d.ts +1 -1
  86. package/types/resources/Usage.d.ts +21 -165
  87. package/types/resources/UsageFile.d.ts +5 -5
  88. package/types/resources/VirtualBankAccount.d.ts +1 -1
  89. package/types/resources/WebhookEndpoint.d.ts +117 -0
@@ -1,51 +1,24 @@
1
1
  ///<reference path='./../core.d.ts'/>
2
+ ///<reference path='./../index.d.ts'/>
2
3
  declare module 'chargebee' {
3
4
  export interface ImpactedSubscription {
4
5
 
5
- /**
6
- * @description The total count of affected subscriptions.
7
6
 
8
- */
9
-
10
7
  count?:number;
11
-
12
- /**
13
- * @description The impacted subscription IDs. This list contains up to 1,000 IDs. The complete list of subscription IDs is in the &#x60;download&#x60; resource, which can store up to 100,000 IDs.
14
8
 
15
- */
16
-
9
+ download?:ImpactedSubscription.Download;
10
+
17
11
  subscription_ids?:any[];
18
-
19
- /**
20
- * @description This [download](downloads) resource contains the impacted subscription IDs. These IDs are in a JSON array in the file at &#x60;download.url&#x60; until &#x60;download.valid_till&#x60;. The file at this URL stores up to 100,000 subscription IDs. [Contact Support](https://support.chargebee.com/support/home) to increase this limit for your Chargebee site.
21
12
 
22
- */
23
-
24
- download?:ImpactedSubscription.Download;
25
13
  }
26
14
  export namespace ImpactedSubscription {
27
15
 
28
16
 
29
17
  export interface Download {
30
- /**
31
- * @description The download URL for the file.
32
-
33
- */
34
-
35
18
  download_url:string;
36
19
 
37
- /**
38
- * @description The expiration time for the &#x60;download_url&#x60;.
39
-
40
- */
41
-
42
20
  valid_till:number;
43
21
 
44
- /**
45
- * @description The [media type](https://en.wikipedia.org/wiki/Media_type) of the file.
46
-
47
- */
48
-
49
22
  mime_type?:string;
50
23
  }
51
24
  }
@@ -1,321 +1,30 @@
1
1
  ///<reference path='./../core.d.ts'/>
2
+ ///<reference path='./../index.d.ts'/>
2
3
  declare module 'chargebee' {
3
4
  export interface InAppSubscription {
4
5
 
5
- /**
6
- * @description The &#x60;id&#x60; of the [subscription](subscriptions#subscription_id) for which the receipt was sent.
7
6
 
8
- */
9
-
7
+ app_id:string;
8
+
10
9
  subscription_id:string;
11
-
12
- /**
13
- * @description The &#x60;id&#x60; of the [customer](customers#customer_id) object to which the subscription belongs.
14
10
 
15
- */
16
-
17
11
  customer_id?:string;
18
-
19
- /**
20
- * @description The &#x60;id&#x60; of the plan-item price of the subscription.
21
12
 
22
- */
23
-
24
13
  plan_id?:string;
25
-
26
- /**
27
- * @description The status of the subscription for the store \* paused - When the subscription is paused. \* in_trial - When the subscription is in trial. \* active - When the subscription is active. \* cancelled - When the subscription is cancelled.
28
14
 
29
- */
30
-
31
- store_status?:'in_trial' | 'paused' | 'active' | 'cancelled';
32
-
33
- /**
34
- * @description The &#x60;id&#x60; of the invoice generated in Chargebee
15
+ store_status?:'in_trial' | 'active' | 'cancelled' | 'paused';
35
16
 
36
- */
37
-
38
17
  invoice_id?:string;
18
+
39
19
  }
40
20
  export namespace InAppSubscription {
41
21
  export class InAppSubscriptionResource {
42
- /**
43
- * @description Verifies an in-app purchase made by your customer and creates a subscription in Chargebee.
44
- **Tip**
45
-
46
- The recommended approach is to call this endpoint from the client-side app directly. However, if you are using this API to replace an existing direct integration with Apple or Google, then you may choose to call this API from the server-side.
47
- **Note:**
48
-
49
- if App Store or Play Store products have not been imported to Chargebee and this API is invoked, Chargebee will automatically create plans that correspond to the store product IDs. However, if historical subscriptions are to be imported using the [import receipt](https://apidocs.chargebee.com/docs/api/in_app_subscriptions#import_receipt) API, importing products is mandatory. [Learn more](https://www.chargebee.com/docs/mobile_subscriptions.html).
50
-
51
- Apple App Store {#app_store}
52
- ----------------------------
53
-
54
- This section provides details of the Process Purchase Command operation when performed for the Apple App Store. This API processes only the latest in-app transaction on the receipt. Sync historical subscriptions into Chargebee using [bulk import](https://www.chargebee.com/docs/2.0/mobile-app-store-product-iap.html#import-in-app-purchase-receipts) of In-App Purchase receipts.
55
- **Important**
56
-
57
- * [Integrate Chargebee](https://www.chargebee.com/docs/mobile-app-store-connect.html#connnect-with-your-chargebee-site) with your Apple App Store account using your shared secret from Apple.
58
- * It is strongly recommended to use this endpoint to notify Chargebee of **new** purchases only.
59
- * For updates to existing subscriptions, we recommend that you configure Apple App Store to send server notifications to Chargebee.
60
-
61
- Chargebee validates the &#x60;receipt&#x60; with Apple App Store and does the following once validation succeeds:
62
-
63
- 1. Look for [item_family.id](/docs/api/item_families?prod_cat_ver&#x3D;2#item_family_id) that matches the value Apple-App-Store, and create such a product family if not found.
64
- 2. Look for [item.id](/docs/api/items?prod_cat_ver&#x3D;2#item_id) that matches &#x60;product[id]&#x60; and if not found, create such a plan-item under the item family described in the previous step.
65
- 3. Look for [item_price.id](/docs/api/item_prices?prod_cat_ver&#x3D;2#item_price_id) that matches the concatenation of &#x60;product[id]&#x60; and &#x60;product[currency_code]&#x60;, and if not found, create such an item price under the item described in the previous step.
66
- 4. Create/update a subscription:
67
- * If the receipt is for a new purchase, a new subscription is created for the plan-item price described in the previous step. The subscription has the following details:
68
- * &#x60;id&#x60; set to [original_transaction_id](https://developer.apple.com/documentation/appstorereceipts/original_transaction_id?language&#x3D;objc)
69
- * &#x60;start_date&#x60; set to [responseBody.Latest_receipt_info.purchase_date_ms](https://developer.apple.com/documentation/appstorereceipts/responsebody/latest_receipt_info?language&#x3D;objc)
70
- * &#x60;current_term_end&#x60; set to &#x60;responseBody.Latest_receipt_info.expires_date_ms&#x60;
71
- * Instead, if the receipt belongs to an existing subscription in Chargebee, it is updated to reflect the current state of the subscription at Apple.
72
- 5. The payment is recorded against the subscription invoice. The associated transaction is updated with the following details:
73
- * The [transaction.reference_number](/docs/api/transactions?prod_cat_ver&#x3D;2#transaction_reference_number) is set to the [transaction_id](https://developer.apple.com/documentation/appstorereceipts/transaction_id?language&#x3D;objc) of the payment.
74
- * The [transaction.payment_method](/docs/api/transactions#transaction_payment_method) is set to &#x60;apple_pay&#x60;.
75
-
76
- Google Play Store {#app_store}
77
- ------------------------------
78
-
79
- This section provides details of the Process Purchase Command operation when performed for the Google Play Store. This API processes only the latest in-app transaction using the purchase token.
80
- **Important**
81
-
82
- * [Integrate Chargebee](https://www.chargebee.com/docs/2.0/mobile-playstore-connect.html#chargebee-configuration) with your Google Play Store account using the service account credentials JSON.
83
- * It is strongly recommended to use this endpoint to notify Chargebee of **new** purchases only.
84
- * For updates to existing subscriptions, we recommend that you configure Chargebee to receive Google&#x27;s server notifications through pub/sub topic. [Learn more](https://developer.android.com/google/play/billing/getting-ready#setup-pubsub).
85
-
86
- Chargebee validates the purchase **token** with Google Play Store and does the following once validation succeeds:
87
-
88
- 1. Look for [item_family.id](/docs/api/item_families?prod_cat_ver&#x3D;2#item_family_id) that matches the value &#x60;Google-Play-Store&#x60;, and create such a product family if not found.
89
- 2. Look for [item.id](/docs/api/items?prod_cat_ver&#x3D;2#item_id) that matches &#x60;product[id]&#x60; and if not found, create such a [plan-item](/docs/api/items?prod_cat_ver&#x3D;2#item_type) under the item family described in the previous step.
90
- 3. Look for [item_price.id](/docs/api/item_prices?prod_cat_ver&#x3D;2#item_price_id) that matches the concatenation of &#x60;product[id]&#x60; and [priceCurrencyCode](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions?hl&#x3D;en#SubscriptionPurchase.FIELDS.price_currency_code), and if not found, create such an item price under the item described in the previous step.
91
- 4. Create/update a subscription:
92
- * If this token is for a new purchase, a new subscription is created for the plan-item price described in the previous step. The subscription has the following details:
93
- * &#x60;id&#x60; set to unique identifier generated by Chargebee and mapped to **token** of the [SubscriptionPurchase](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions?hl&#x3D;en) object from Google response.
94
- * &#x60;start_date&#x60; set to &#x60;SubscriptionPurchase.startTimeMillis&#x60;.
95
- * &#x60;current_term_end&#x60; set to &#x60;SubscriptionPurchase.expiryTimeMillis&#x60;.
96
- * Instead, if the token belongs to an existing subscription in Chargebee, it is updated to reflect the current state of the subscription at Google.
97
- 5. The payment is recorded against the subscription invoice. The associated transaction is updated with the following details:
98
- * The [transaction.reference_number](/docs/api/transactions?prod_cat_ver&#x3D;2#transaction_reference_number) is set to the [orderId](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions?hl&#x3D;en#SubscriptionPurchase.FIELDS.order_id) of the payment.
99
- * The [transaction.payment_method](/docs/api/transactions#transaction_payment_method) is set to &#x60;play_store&#x60;.
100
-
101
- Path Parameter {#path_param_pcv2}
102
- ---------------------------------
103
-
104
- &#x60;{in_app_subscription_app_id}&#x60;: The handle created by Chargebee for your Apple App Store or Google Play Store app. It can be obtained from the Chargebee web app.
105
-
106
- The following are instructions to obtain the value of the path parameter for the Apple App Store and Google Play Store.
107
-
108
- * **Apple App Store** : To obtain the value for &#x60;{in_app_subscription_app_id}&#x60;, click **View Keys** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-app-store-product-iap.html#resource-id).
109
- * **Google Play Store** : To obtain the value for &#x60;{in_app_subscription_app_id}&#x60;, click **Set up notifications** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-playstore-notifications.html#app-id).
110
-
111
-
112
-
113
-
114
- */
115
-
116
22
  process_receipt(in_app_subscription_app_id:string, input:ProcessReceiptInputParam):ChargebeeRequest<ProcessReceiptResponse>;
117
23
 
118
- /**
119
- * @description Verifies an Apple App Store or Google Play Store in-app purchase [receipt](https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language&#x3D;objc#overview) and imports [subscriptions](/docs/api/subscriptions) for all historical purchases made by the customer.
120
- **Tip**
121
- An &#x60;in_app_subscription&#x60; is created for every unique &#x60;original_transaction_id&#x60;. Apple creates &#x60;original_transaction_id&#x60; for every create, upgrade, or downgrade of the subscription. A receipt hardly contains more than 100 &#x60;original_transaction_id&#x60;s. If a receipt contains more than 100 &#x60;original_transaction_id&#x60;s, Chargebee creates all subscription records but this endpoint returns the first 100 records in the response.
122
-
123
- CSV upload has a file size [limitation](https://www.chargebee.com/docs/mobile-app-store-product-iap.html#upload-in-app-receipts) that increases the processing time and the number of receipts. This API removes such limitations and allows you to import historical in-app subscription receipts.
124
- **Note** : This API verifies receipt or token through Apple or Google and then processes them via Chargebee. For bulk imports, limit API calls to **6** per minute (**10** seconds apart) to ensure successful subscription imports.
125
-
126
- Apple App Store {#app_store}
127
- ----------------------------
128
-
129
- This section provides details of the Import Receipt operation performed for the Apple App Store. This API processes only the historical in-app transaction receipts.
130
- **Important**
131
-
132
- * [Integrate Chargebee](https://www.chargebee.com/docs/mobile-app-store-connect.html#connnect-with-your-chargebee-site) with your Apple App Store account using your shared secret from Apple.
133
- * It is strongly recommended to use this endpoint to import historical in-app subscriptions only.
134
- * You must [import Apple App Store products](https://www.chargebee.com/docs/2.0/mobile-app-store-product-iap.html#import-products) using Chargebee&#x27;s user interface before importing receipts using this API.
135
-
136
- Chargebee validates the &#x60;receipt&#x60; with Apple App Store and does the following once validation succeeds:
137
-
138
- #### Subscriptions {#ir_apple_app_store_pcv2}
139
-
140
- [Subscriptions](/docs/api/subscriptions) are imported as follows:
141
-
142
- 1. A subscription is imported for every unique value of the [original_transaction_id](https://developer.apple.com/documentation/appstorereceipts/original_transaction_id?language&#x3D;objc) in the Apple receipt.
143
- **Note** : This is not done for &#x60;original_transaction_id&#x60;s for which a subscription already exists in Chargebee.
144
- 2. Each subscription imported has the following attributes set:
145
- * &#x60;id&#x60; set to &#x60;original_transaction_id&#x60;.
146
- * &#x60;start_date&#x60; set to the earliest [purchase_date_ms](https://developer.apple.com/documentation/appstorereceipts/responsebody/latest_receipt_info?language&#x3D;objc).
147
- * &#x60;current_term_start&#x60; set to latest [purchase_date_ms](https://developer.apple.com/documentation/appstorereceipts/responsebody/latest_receipt_info?language&#x3D;objc).
148
- * &#x60;current_term_end&#x60; set to [expires_date_ms](https://developer.apple.com/documentation/appstorereceipts/responsebody/latest_receipt_info?language&#x3D;objc) of the same &#x60;Latest_receipt_info&#x60; element with the latest &#x60;purchase_date_ms&#x60;.
149
- * &#x60;item_price_id&#x60; set to &#x60;product_id&#x60;.
150
- * &#x60;status&#x60; set to &#x60;in_trial&#x60; if there is only one element of [Latest_receipt_info](https://developer.apple.com/documentation/appstorereceipts/responsebody/latest_receipt_info?language&#x3D;objc) with the &#x60;original_transaction_id&#x60; and the field &#x60;is_trial_period&#x60; is &#x60;true&#x60;, then consider the subscription is currently in trial. No invoices are created for this subscription.
151
-
152
- #### Invoices for the subscription
153
-
154
- [Invoices](/docs/api/invoices) are imported as follows:
155
-
156
- 1. An invoice is imported to Chargebee for every element of the array [Latest_receipt_info](https://developer.apple.com/documentation/appstorereceipts/responsebody/latest_receipt_info?language&#x3D;objc) which has [is_trial_period](https://developer.apple.com/documentation/appstorereceipts/is_trial_period?language&#x3D;objc) as &#x60;false&#x60;.
157
- 2. Each imported invoice has the &#x60;subscription_id&#x60; set to &#x60;original_transaction_id&#x60;.
158
-
159
- #### Transactions for the invoices
160
-
161
- A [transaction](/docs/api/transactions) is imported for each invoice with the following details:
162
-
163
- 1. &#x60;reference_number&#x60; set to the &#x60;transaction_id&#x60;.
164
- 2. &#x60;payment_method&#x60; set to &#x60;apple_store&#x60;.
165
-
166
-
167
-
168
- Google Play Store {#app_store}
169
- ------------------------------
170
-
171
- This section provides details of the Import Receipt operation performed for the Google Play Store. This API is used to process only the historical in-app purchase subscriptions.
172
- **Important**
173
-
174
- * [Integrate Chargebee](https://www.chargebee.com/docs/2.0/mobile-playstore-connect.html) with your Google Play Store account using your [service account credentials JSON](https://www.chargebee.com/docs/2.0/mobile-playstore-connect.html#generate-service-account-credentials-json).
175
- * It is strongly recommended to use this endpoint to import historical in-app subscriptions only.
176
- * It is recommended to pass only the latest purchase &#x60;token&#x60;. If any other purchase &#x60;token&#x60; is passed instead of the latest one, there is a possibility of returning incorrect transaction details. If an expired purchase &#x60;token&#x60; is passed, then it returns an error.
177
- * The Google purchase token is [valid for 60 days](https://developer.android.com/google/play/billing/subscriptions#lifecycle) from the subscription purchase date. After the &#x60;token&#x60; expires, an API request to Google Developers API returns an error.
178
-
179
- Chargebee validates the purchase &#x60;token&#x60; with Google Play Store and does the following once validation succeeds:
180
-
181
- #### Subscriptions {#ir_google_play_store_pcv2}
182
-
183
- * A [subscription](/docs/api/subscriptions) is imported for every unique purchase token if it is not linked to an existing purchase &#x60;token&#x60;( &#x60;linkedPurchaseToken&#x60; field in &#x60;SubscriptionsV2.get&#x60; API Response).
184
-
185
- * Each subscription imported has the following attributes set:
186
-
187
- * &#x60;id&#x60; set to a unique identifier generated by Chargebee and mapped to the &#x60;token&#x60; and &#x60;latestOrderId&#x60; of the &#x60;SubscriptionPurchaseV2&#x60; object from Google response.
188
-
189
- * &#x60;start_date&#x60; set to the earliest &#x60;SubscriptionPurchaseV2.startTime&#x60;.
190
-
191
- * &#x60;current_term_start&#x60; set to latest &#x60;SubscriptionPurchaseV2.startTime&#x60;.
192
-
193
- * &#x60;current_term_end&#x60; set to &#x60;expiryTime&#x60; of the same &#x60;SubscriptionPurchaseV2&#x60; element with the latest purchase.
194
-
195
- * &#x60;item_price_id&#x60; set to the concatenation of &#x60;product[id]&#x60; and &#x60;priceCurrencyCode&#x60; from Google.
196
-
197
- * &#x60;status&#x60; set to &#x60;in_trial&#x60; if the free trial configuration is enabled in Google and the [monetization.subscriptions.basePlans.offers.State](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.subscriptions.basePlans.offers#State) is &#x60;Active&#x60; with a [SubscriptionOfferPhase.duration](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.subscriptions.basePlans.offers#subscriptionofferphase), then consider the subscription is currently in trial. No invoices are created for this subscription.
198
-
199
- #### Invoices for the subscription
200
-
201
- Invoices are imported as follows:
202
-
203
- * An [invoice](/docs/api/invoices &quot;https://apidocs.chargebee.com/docs/api/invoices?prod_cat_ver&#x3D;2&quot;) is imported to Chargebee for every new subscription and renewal of an existing subscription using &#x60;latestOrderId&#x60;.
204
-
205
- * Each imported invoice has the &#x60;subscription_id&#x60; set to a unique identifier generated by Chargebee and mapped to the &#x60;token&#x60; and &#x60;latestOrderId&#x60;.
206
-
207
- #### Transactions for the invoices
208
-
209
- A [transaction](/docs/api/transactions) is imported for each invoice with the following details:
210
-
211
- * &#x60;transaction.reference_number&#x60; is set to the &#x60;latestOrderId&#x60;.
212
-
213
- * &#x60;transaction.payment_method&#x60; is set to &#x60;play_store&#x60;.
214
-
215
- Path Parameter {#path_param}
216
- ----------------------------
217
-
218
- &#x60;{in_app_subscription_app_id}&#x60;: The handle created by Chargebee for your Apple App Store or Google Play Store app. It can be obtained from the Chargebee web app.
219
-
220
- The following are instructions to obtain the value of the path parameter for the Apple App Store and Google Play Store.
221
-
222
- * **Apple App Store** : To obtain the value for &#x60;{in_app_subscription_app_id}&#x60;, click **View Keys** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-app-store-product-iap.html#connection-keys_app-id).
223
- * **Google Play Store** : To obtain the value for &#x60;{in_app_subscription_app_id}&#x60;, click **Set up notifications** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-playstore-notifications.html#app-id).
224
-
225
-
226
-
227
-
228
- */
229
-
230
24
  import_receipt(in_app_subscription_app_id:string, input:ImportReceiptInputParam):ChargebeeRequest<ImportReceiptResponse>;
231
25
 
232
- /**
233
- * @description The Import Subscriptions endpoint is a Chargebee API that allows you to import historic In-App Subscriptions without using a valid Apple App Store receipt. This endpoint is useful if you do not have access to the receipt data which is required for the [Import Receipt](https://apidocs.chargebee.com/docs/api/in_app_subscriptions#import_receipt) API.
234
-
235
- With this API, you can import subscriptions and corresponding invoices for historic In-App purchases. The API returns the [in-app-subscriptions object](https://apidocs.chargebee.com/docs/api/in_app_subscriptions#in_app_subscription_attributes) once the historic subscription is successfully imported into Chargebee.
236
- **Note** :
237
-
238
- * Subscriptions cannot be imported from the Google Play Store without a receipt or token. Therefore; Chargebee does not allow you to use this API for the Google Play Store.
239
- * Enable V1 notifications in the Apple App Store for subscriptions created without receipts. Chargebee depends on receipt data to update subscription statuses. Apple&#x27;s V2 notifications do not have receipt information; therefore, Chargebee cannot process V2 notifications for subscriptions imported without receipts. Learn more about [++app store notifications++](https://apidocs.chargebee.com/docs/api/in_app_purchase_events?prod_cat_ver&#x3D;2#app_store_notifications) and [++notification URL configuration++](https://www.chargebee.com/docs/mobile-app-store-product-iap.html#connection-keys_notification-url).
240
-
241
- ### Apple App Store
242
-
243
- This section provides details of the Import Subscription operation when performed for the Apple App Store. This API creates a historic subscription if the incoming subscription is unknown. For a known subscription, it creates an invoice for the mentioned period.
244
- **Important**
245
-
246
- * [Integrate Chargebee](https://www.chargebee.com/docs/mobile-app-store-connect.html#connnect-with-your-chargebee-site) with your Apple App Store account using your shared secret from Apple.
247
-
248
- * It is strongly recommended to use this endpoint to create a historic In-App subscription only.
249
-
250
- * You must import App Store products using Chargebee&#x27;s user interface before importing receipts using this API.
251
-
252
- Chargebee validates the application ID with Apple App Store and does the following once validation succeeds:
253
-
254
- #### Subscription
255
-
256
- 1. Import the subscription from the &#x60;latest_receipt_info&#x60; array from Apple and a new subscription is imported for the item-price.
257
- **Note:** The subscription is not imported if it already exists in Chargebee but we will import the associated invoice using the subscription\[transaction_id\] in the payload.
258
-
259
- 2. Each subscription imported has the following attribute set:
260
-
261
- * &#x60;id&#x60; set to &#x60;subscription[id]&#x60; . This &#x60;subscription[id]&#x60; is &#x60;original_transaction_id&#x60; in the receipts.
262
-
263
- * &#x60;start_date&#x60; set to &#x60;subscription[start_date]&#x60;. You need to provide this information from the oldest &#x60;Latest_receipt_info.purchase_date_ms&#x60;.
264
-
265
- * &#x60;term_start&#x60; set to &#x60;subscription[term_start]&#x60;. You need to provide this information from the oldest &#x60;Latest_receipt_info.purchase_date_ms)&#x60;.
266
-
267
- * &#x60;term_end&#x60; set to &#x60;subscription[term_end]&#x60;. You need to provide this information from the oldest &#x60;Latest_receipt_info.expires_date_ms&#x60;.
268
-
269
- * &#x60;item_price_id&#x60; set to &#x60;subscription[product_id] + subscription[currency_code].&#x60; You need to provide this information from the &#x60;Latest_receipt_info.product_id&#x60;.
270
-
271
- * Chargebee records the subscription in a **Trial** state if the &#x60;is_trial_period&#x60; is &#x60;true&#x60;.
272
-
273
- * Chargebee records the subscription in a **Canceled** state if the &#x60;term_end&#x60; is less than the &#x60;System.currentTime()&#x60;.
274
-
275
- #### Invoice for the subscription
276
-
277
- 1. The payment is recorded against the subscription invoice.
278
-
279
- * Imported invoice has the &#x60;subscription_id&#x60; set to &#x60;original_transaction_id&#x60;.
280
-
281
- **Transactions for the invoice**
282
-
283
- 1. The associated transaction is updated with the following details:
284
-
285
- * The &#x60;transaction.reference_number&#x60; is set to the &#x60;transaction_id&#x60; of the payment.
286
-
287
- * The &#x60;transaction.payment_method&#x60; is set to &#x60;apple_store&#x60;.
288
-
289
- #### Path Parameter
290
-
291
- in_app_subscription_app_id
292
- required, string
293
-
294
- The handle created by Chargebee for your App Store app. It can be obtained from within the Chargebee web app.
295
-
296
- To obtain the value of &#x60;in_app_subscription_app_id &#x60;for the Apple App Store, click **View Keys** within the **Sync Overview** page of the web app, and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/mobile-app-store-product-iap.html#connection-keys_app-id).
297
-
298
- */
299
-
300
- import_subscription(in_app_subscription_app_id:string, input?:ImportSubscriptionInputParam):ChargebeeRequest<ImportSubscriptionResponse>;
26
+ import_subscription(in_app_subscription_app_id:string, input:ImportSubscriptionInputParam):ChargebeeRequest<ImportSubscriptionResponse>;
301
27
 
302
- /**
303
- * @description This API verifies the application id &#x60;{in_app_subscription_app_id}&#x60; and &#x60;receipt&#x60; then returns the subscription details associated with the purchase.
304
-
305
- #### Path Parameter
306
-
307
- in_app_subscription_app_id
308
- required, string
309
-
310
- The handle is created by Chargebee for your Apple App Store or Google Play Store app. It can be obtained from the Chargebee web app.
311
-
312
- The following are instructions to obtain the value of the path parameter for the Apple App Store and Google Play Store.
313
-
314
- * **Apple App Store** : To obtain the value for &#x60;{in_app_subscription_app_id}&#x60;, click **View Keys** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-app-store-product-iap.html#resource-id).
315
- * **Google Play Store** : To obtain the value for &#x60;{in_app_subscription_app_id}&#x60;, click **Set up notifications** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-playstore-notifications.html#app-id).
316
-
317
- */
318
-
319
28
  retrieve_store_subs(in_app_subscription_app_id:string, input:RetrieveStoreSubsInputParam):ChargebeeRequest<RetrieveStoreSubsResponse>;
320
29
  }
321
30
  export interface ProcessReceiptResponse {
@@ -323,73 +32,29 @@ The following are instructions to obtain the value of the path parameter for the
323
32
  }
324
33
  export interface ProcessReceiptInputParam {
325
34
 
326
- /**
327
- * @description **Apple App Store** : The Base64 encoded [App Store in-app purchase receipt](https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language&#x3D;objc#overview) taken from the Apple device after successful creation of the in-app purchase subscription.
328
-
329
- **Google Play Store** : The purchase &#x60;token&#x60; taken from the Android device after the successful creation of an in-app purchase subscription.
330
-
331
- */
332
-
333
- receipt:string;
334
-
335
- /**
336
- * @description Parameters for product
337
-
338
- */
339
-
340
- product?:{currency_code:string,id:string,name?:string,period?:string,period_unit?:string,price:number,price_in_decimal?:string};
341
-
342
- /**
343
- * @description Parameters for customer
344
-
345
- */
35
+ product:{currency_code:string,id:string,name?:string,period?:string,period_unit?:string,price:number,price_in_decimal?:string};
346
36
 
347
37
  customer?:{email?:string,first_name?:string,id?:string,last_name?:string};
38
+
39
+ receipt:string;
348
40
  }
349
41
  export interface ImportReceiptResponse {
350
42
  in_app_subscriptions:InAppSubscription[];
351
43
  }
352
44
  export interface ImportReceiptInputParam {
353
45
 
354
- /**
355
- * @description **Apple App Store** : The Base64 encoded [App Store in-app purchase receipt](https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language&#x3D;objc#overview) taken from the Apple device after successful creation of the in-app purchase subscription.
356
-
357
- **Google Play Store** : The purchase &#x60;token&#x60; taken from the Android device after the successful creation of an in-app purchase subscription.
358
-
359
- */
360
-
361
- receipt:string;
362
-
363
- /**
364
- * @description Parameters for product
365
-
366
- */
367
-
368
- product?:{currency_code:string};
369
-
370
- /**
371
- * @description Parameters for customer
372
-
373
- */
46
+ product:{currency_code:string};
374
47
 
375
48
  customer?:{email?:string,id?:string};
49
+
50
+ receipt:string;
376
51
  }
377
52
  export interface ImportSubscriptionResponse {
378
53
  in_app_subscription:InAppSubscription;
379
54
  }
380
55
  export interface ImportSubscriptionInputParam {
381
56
 
382
- /**
383
- * @description Parameters for subscription
384
-
385
- */
386
-
387
- subscription?:{currency_code:string,id:string,is_trial?:boolean,product_id:string,started_at:number,term_end:number,term_start:number,transaction_id:string};
388
-
389
- /**
390
- * @description Parameters for customer
391
-
392
- */
57
+ subscription:{currency_code:string,id:string,is_trial?:boolean,product_id:string,started_at:number,term_end:number,term_start:number,transaction_id:string};
393
58
 
394
59
  customer?:{email?:string,id?:string};
395
60
  }
@@ -398,13 +63,6 @@ The following are instructions to obtain the value of the path parameter for the
398
63
  }
399
64
  export interface RetrieveStoreSubsInputParam {
400
65
 
401
- /**
402
- * @description **Apple App Store** : The Base64 encoded [App Store in-app purchase receipt](https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language&#x3D;objc#overview) taken from the Apple device after successful creation of the in-app purchase subscription.
403
-
404
- **Google Play Store** : The purchase &#x60;token&#x60; taken from the Android device after the successful creation of an in-app purchase subscription.
405
-
406
- */
407
-
408
66
  receipt:string;
409
67
  }
410
68