recurly 3.9.0 → 3.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Recurly
2
- VERSION = "3.9.0"
2
+ VERSION = "3.10.0"
3
3
  end
@@ -157,11 +157,13 @@ x-tagGroups:
157
157
  - subscription_change
158
158
  - shipping_address
159
159
  - purchase
160
+ - usage
160
161
  - name: Products and Promotions
161
162
  tags:
162
163
  - item
163
164
  - plan
164
165
  - add-on
166
+ - measured_unit
165
167
  - coupon
166
168
  - coupon_redemption
167
169
  - unique_coupon_code
@@ -198,6 +200,11 @@ tags:
198
200
  x-displayName: Add-on
199
201
  description: An add-on is a charge billed each billing period in addition to a subscription’s
200
202
  base charge. Each plan may have one or more add-ons associated with it.
203
+ - name: measured_unit
204
+ x-displayName: Measured Unit
205
+ description: A measured unit describes a usage-based add-on's usage. If different
206
+ usage-based add-ons share the same measured unit, you can report on customer usage
207
+ for those add-ons at the aggregated measured unit level.
201
208
  - name: account
202
209
  x-displayName: Account
203
210
  description: Accounts are core to managing your customers inside of Recurly. The
@@ -250,6 +257,11 @@ tags:
250
257
  description: A purchase is a checkout containing at least one or more subscriptions
251
258
  or one-time charges (line items) and supports both coupon and gift card redemptions.
252
259
  All items purchased will be on one invoice and paid for with one transaction.
260
+ - name: usage
261
+ x-displayName: Usage
262
+ description: Send Recurly your customer usage and we will automatically bill them
263
+ in arrears at the end of the billing cycle. For more info on usage-based billing,
264
+ [click here](https://docs.recurly.com/docs/usage-based-billing).
253
265
  - name: transaction
254
266
  x-displayName: Transaction
255
267
  description: Purchasing information is sent to your payment gateway in an action
@@ -275,10 +287,12 @@ paths:
275
287
  get:
276
288
  operationId: list_sites
277
289
  summary: List sites
290
+ description: |
291
+ This route is most useful for finding a site's ID for subsequent requests.
292
+
293
+ See the [Pagination Guide](/guides/pagination.html) to learn how to use pagination in the API and Client Libraries.
278
294
  tags:
279
295
  - site
280
- description: This route is most useful for finding a site's ID for subsequent
281
- requests.
282
296
  parameters:
283
297
  - "$ref": "#/components/parameters/ids"
284
298
  - "$ref": "#/components/parameters/limit"
@@ -475,6 +489,8 @@ paths:
475
489
  - account
476
490
  operationId: list_accounts
477
491
  summary: List a site's accounts
492
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
493
+ to use pagination in the API and Client Libraries.
478
494
  parameters:
479
495
  - "$ref": "#/components/parameters/site_id"
480
496
  - "$ref": "#/components/parameters/ids"
@@ -768,7 +784,7 @@ paths:
768
784
  - lang: PHP
769
785
  source: |
770
786
  try {
771
- $account_create = array(
787
+ $account_create = [
772
788
  "code" => $account_code,
773
789
  "first_name" => "Douglas",
774
790
  "last_name" => "DuMonde",
@@ -783,7 +799,7 @@ paths:
783
799
  "country" => "US"
784
800
  ]
785
801
  ]
786
- );
802
+ ];
787
803
 
788
804
  $account = $client->createAccount($account_create);
789
805
 
@@ -1062,10 +1078,10 @@ paths:
1062
1078
  - lang: PHP
1063
1079
  source: |
1064
1080
  try {
1065
- $account_update = array(
1081
+ $account_update = [
1066
1082
  "first_name" => "Douglas",
1067
1083
  "last_name" => "Du Monde",
1068
- );
1084
+ ];
1069
1085
 
1070
1086
  $account = $client->updateAccount($account_id, $account_update);
1071
1087
 
@@ -1458,11 +1474,11 @@ paths:
1458
1474
  - lang: PHP
1459
1475
  source: |
1460
1476
  try {
1461
- $acquisition_update = array(
1477
+ $acquisition_update = [
1462
1478
  "campaign" => "big-event-campaign",
1463
1479
  "channel" => "social_media",
1464
1480
  "subchannel" => "twitter"
1465
- );
1481
+ ];
1466
1482
  $acquisition = $client->updateAccountAcquisition($account_id, $acquisition_update);
1467
1483
 
1468
1484
  echo 'Updated AccountAcquisition:' . PHP_EOL;
@@ -2097,10 +2113,10 @@ paths:
2097
2113
  - lang: PHP
2098
2114
  source: |
2099
2115
  try {
2100
- $binfo_update = array(
2116
+ $binfo_update = [
2101
2117
  "first_name" => "Douglas",
2102
2118
  "last_name" => "Du Monde",
2103
- );
2119
+ ];
2104
2120
  $binfo = $client->updateBillingInfo($account_id, $binfo_update);
2105
2121
 
2106
2122
  echo 'Updated BillingInfo:' . PHP_EOL;
@@ -2237,6 +2253,8 @@ paths:
2237
2253
  - coupon_redemption
2238
2254
  operationId: list_account_coupon_redemptions
2239
2255
  summary: Show the coupon redemptions for an account
2256
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
2257
+ to use pagination in the API and Client Libraries.
2240
2258
  parameters:
2241
2259
  - "$ref": "#/components/parameters/site_id"
2242
2260
  - "$ref": "#/components/parameters/account_id"
@@ -2544,10 +2562,10 @@ paths:
2544
2562
  - lang: PHP
2545
2563
  source: |-
2546
2564
  try {
2547
- $redemption_create = array(
2565
+ $redemption_create = [
2548
2566
  "currency" => "USD",
2549
2567
  "coupon_id" => "code-$coupon_code"
2550
- );
2568
+ ];
2551
2569
  $redemption = $client->createCouponRedemption($account_id, $redemption_create);
2552
2570
  echo "Created Redemption:" . PHP_EOL;
2553
2571
  var_dump($redemption);
@@ -2689,6 +2707,8 @@ paths:
2689
2707
  - credit_payment
2690
2708
  operationId: list_account_credit_payments
2691
2709
  summary: List an account's credit payments
2710
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
2711
+ to use pagination in the API and Client Libraries.
2692
2712
  parameters:
2693
2713
  - "$ref": "#/components/parameters/site_id"
2694
2714
  - "$ref": "#/components/parameters/account_id"
@@ -2783,6 +2803,8 @@ paths:
2783
2803
  - account
2784
2804
  operationId: list_account_invoices
2785
2805
  summary: List an account's invoices
2806
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
2807
+ to use pagination in the API and Client Libraries.
2786
2808
  parameters:
2787
2809
  - "$ref": "#/components/parameters/site_id"
2788
2810
  - "$ref": "#/components/parameters/account_id"
@@ -3016,10 +3038,10 @@ paths:
3016
3038
  - lang: PHP
3017
3039
  source: |-
3018
3040
  try {
3019
- $invoice_create = array(
3041
+ $invoice_create = [
3020
3042
  "currency" => "USD",
3021
3043
  "collection_method" => "automatic"
3022
- );
3044
+ ];
3023
3045
  $invoice_collection = $client->createInvoice(
3024
3046
  $account_id,
3025
3047
  $invoice_create
@@ -3187,10 +3209,10 @@ paths:
3187
3209
  - lang: PHP
3188
3210
  source: |-
3189
3211
  try {
3190
- $invoice_preview = array(
3212
+ $invoice_preview = [
3191
3213
  "currency" => "USD",
3192
3214
  "collection_method" => "automatic"
3193
- );
3215
+ ];
3194
3216
  $invoice_collection = $client->previewInvoice(
3195
3217
  $account_id,
3196
3218
  $invoice_preview
@@ -3220,6 +3242,8 @@ paths:
3220
3242
  - line_item
3221
3243
  operationId: list_account_line_items
3222
3244
  summary: List an account's line items
3245
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
3246
+ to use pagination in the API and Client Libraries.
3223
3247
  parameters:
3224
3248
  - "$ref": "#/components/parameters/site_id"
3225
3249
  - "$ref": "#/components/parameters/account_id"
@@ -3487,6 +3511,8 @@ paths:
3487
3511
  - note
3488
3512
  operationId: list_account_notes
3489
3513
  summary: Fetch a list of an account's notes
3514
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
3515
+ to use pagination in the API and Client Libraries.
3490
3516
  parameters:
3491
3517
  - "$ref": "#/components/parameters/site_id"
3492
3518
  - "$ref": "#/components/parameters/account_id"
@@ -3695,6 +3721,8 @@ paths:
3695
3721
  - shipping_address
3696
3722
  operationId: list_shipping_addresses
3697
3723
  summary: Fetch a list of an account's shipping addresses
3724
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
3725
+ to use pagination in the API and Client Libraries.
3698
3726
  parameters:
3699
3727
  - "$ref": "#/components/parameters/site_id"
3700
3728
  - "$ref": "#/components/parameters/account_id"
@@ -3934,7 +3962,7 @@ paths:
3934
3962
  - lang: PHP
3935
3963
  source: |
3936
3964
  try {
3937
- $address_create = array(
3965
+ $address_create = [
3938
3966
  "nickname" => "Work",
3939
3967
  "street1" => "900 Camp St",
3940
3968
  "city" => "New Orleans",
@@ -3943,7 +3971,7 @@ paths:
3943
3971
  "postal_code" => "70115",
3944
3972
  "first_name" => "Douglas",
3945
3973
  "last_name" => "Du Monde"
3946
- );
3974
+ ];
3947
3975
  $shipping_address = $client->createShippingAddress($account_id, $address_create);
3948
3976
 
3949
3977
  echo "Created Shpping Address:" . PHP_EOL;
@@ -4236,10 +4264,10 @@ paths:
4236
4264
  - lang: PHP
4237
4265
  source: |
4238
4266
  try {
4239
- $shad_update = array(
4267
+ $shad_update = [
4240
4268
  "first_name" => "Douglas",
4241
4269
  "last_name" => "Du Monde",
4242
- );
4270
+ ];
4243
4271
  $shad = $client->updateShippingAddress($account_id, $shipping_address_id, $shad_update);
4244
4272
 
4245
4273
  echo 'Updated Shipping Address:' . PHP_EOL;
@@ -4377,6 +4405,8 @@ paths:
4377
4405
  - account
4378
4406
  operationId: list_account_subscriptions
4379
4407
  summary: List an account's subscriptions
4408
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
4409
+ to use pagination in the API and Client Libraries.
4380
4410
  parameters:
4381
4411
  - "$ref": "#/components/parameters/site_id"
4382
4412
  - "$ref": "#/components/parameters/account_id"
@@ -4472,6 +4502,8 @@ paths:
4472
4502
  - transaction
4473
4503
  operationId: list_account_transactions
4474
4504
  summary: List an account's transactions
4505
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
4506
+ to use pagination in the API and Client Libraries.
4475
4507
  parameters:
4476
4508
  - "$ref": "#/components/parameters/site_id"
4477
4509
  - "$ref": "#/components/parameters/account_id"
@@ -4568,6 +4600,8 @@ paths:
4568
4600
  - account
4569
4601
  operationId: list_child_accounts
4570
4602
  summary: List an account's child accounts
4603
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
4604
+ to use pagination in the API and Client Libraries.
4571
4605
  parameters:
4572
4606
  - "$ref": "#/components/parameters/site_id"
4573
4607
  - "$ref": "#/components/parameters/account_id"
@@ -4641,6 +4675,8 @@ paths:
4641
4675
  - account_acquisition
4642
4676
  operationId: list_account_acquisition
4643
4677
  summary: List a site's account acquisition data
4678
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
4679
+ to use pagination in the API and Client Libraries.
4644
4680
  parameters:
4645
4681
  - "$ref": "#/components/parameters/site_id"
4646
4682
  - "$ref": "#/components/parameters/ids"
@@ -4731,6 +4767,8 @@ paths:
4731
4767
  - coupon
4732
4768
  operationId: list_coupons
4733
4769
  summary: List a site's coupons
4770
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
4771
+ to use pagination in the API and Client Libraries.
4734
4772
  parameters:
4735
4773
  - "$ref": "#/components/parameters/site_id"
4736
4774
  - "$ref": "#/components/parameters/ids"
@@ -4978,7 +5016,7 @@ paths:
4978
5016
  - lang: PHP
4979
5017
  source: |
4980
5018
  try {
4981
- $coupon_create = array(
5019
+ $coupon_create = [
4982
5020
  "name" => "Promotional Coupon",
4983
5021
  "code" => $coupon_code,
4984
5022
  "discount_type" => "fixed",
@@ -4986,7 +5024,7 @@ paths:
4986
5024
  "currency" => "USD",
4987
5025
  "discount" => 10
4988
5026
  ]
4989
- );
5027
+ ];
4990
5028
 
4991
5029
  $coupon = $client->createCoupon($coupon_create);
4992
5030
 
@@ -5259,9 +5297,9 @@ paths:
5259
5297
  - lang: PHP
5260
5298
  source: |
5261
5299
  try {
5262
- $coupon_update = array(
5300
+ $coupon_update = [
5263
5301
  "name" => "New Coupon Name"
5264
- );
5302
+ ];
5265
5303
  $coupon = $client->updateCoupon($coupon_id, $coupon_update);
5266
5304
 
5267
5305
  echo 'Updated Coupon:' . PHP_EOL;
@@ -5444,6 +5482,8 @@ paths:
5444
5482
  - unique_coupon_code
5445
5483
  operationId: list_unique_coupon_codes
5446
5484
  summary: List unique coupon codes associated with a bulk coupon
5485
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
5486
+ to use pagination in the API and Client Libraries.
5447
5487
  parameters:
5448
5488
  - "$ref": "#/components/parameters/site_id"
5449
5489
  - "$ref": "#/components/parameters/coupon_id"
@@ -5479,6 +5519,8 @@ paths:
5479
5519
  - credit_payment
5480
5520
  operationId: list_credit_payments
5481
5521
  summary: List a site's credit payments
5522
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
5523
+ to use pagination in the API and Client Libraries.
5482
5524
  parameters:
5483
5525
  - "$ref": "#/components/parameters/site_id"
5484
5526
  - "$ref": "#/components/parameters/limit"
@@ -5596,6 +5638,8 @@ paths:
5596
5638
  - custom_field_definition
5597
5639
  operationId: list_custom_field_definitions
5598
5640
  summary: List a site's custom field definitions
5641
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
5642
+ to use pagination in the API and Client Libraries.
5599
5643
  parameters:
5600
5644
  - "$ref": "#/components/parameters/site_id"
5601
5645
  - "$ref": "#/components/parameters/ids"
@@ -5812,6 +5856,8 @@ paths:
5812
5856
  - item
5813
5857
  operationId: list_items
5814
5858
  summary: List a site's items
5859
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
5860
+ to use pagination in the API and Client Libraries.
5815
5861
  parameters:
5816
5862
  - "$ref": "#/components/parameters/site_id"
5817
5863
  - "$ref": "#/components/parameters/ids"
@@ -6079,11 +6125,11 @@ paths:
6079
6125
  - lang: PHP
6080
6126
  source: |
6081
6127
  try {
6082
- $item_create = array(
6128
+ $item_create = [
6083
6129
  "code" => $item_code,
6084
6130
  "name" => "Coffee Grinder",
6085
6131
  "description" => "A professional-grade bean grinder."
6086
- );
6132
+ ];
6087
6133
  $item = $client->createItem($item_create);
6088
6134
 
6089
6135
  echo 'Created Item:' . PHP_EOL;
@@ -6366,10 +6412,10 @@ paths:
6366
6412
  - lang: PHP
6367
6413
  source: |
6368
6414
  try {
6369
- $item_update = array(
6415
+ $item_update = [
6370
6416
  "name" => "Dark Roast Coffee Beans",
6371
6417
  "description" => "A special dark roast version.",
6372
- );
6418
+ ];
6373
6419
  $item = $client->updateItem($item_id, $item_update);
6374
6420
 
6375
6421
  echo 'Updated Item:' . PHP_EOL;
@@ -6632,12 +6678,200 @@ paths:
6632
6678
  validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected
6633
6679
  Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Reactivated
6634
6680
  Item: %s\", item.Id)"
6681
+ "/sites/{site_id}/measured_units":
6682
+ get:
6683
+ tags:
6684
+ - measured_unit
6685
+ operationId: list_measured_unit
6686
+ summary: List a site's measured units
6687
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
6688
+ to use pagination in the API and Client Libraries.
6689
+ parameters:
6690
+ - "$ref": "#/components/parameters/site_id"
6691
+ - "$ref": "#/components/parameters/ids"
6692
+ - "$ref": "#/components/parameters/limit"
6693
+ - "$ref": "#/components/parameters/order"
6694
+ - "$ref": "#/components/parameters/sort_dates"
6695
+ - "$ref": "#/components/parameters/filter_begin_time"
6696
+ - "$ref": "#/components/parameters/filter_end_time"
6697
+ - "$ref": "#/components/parameters/filter_state"
6698
+ responses:
6699
+ '200':
6700
+ description: A list of the site's measured units.
6701
+ content:
6702
+ application/json:
6703
+ schema:
6704
+ "$ref": "#/components/schemas/MeasuredUnitList"
6705
+ '404':
6706
+ description: Incorrect site ID.
6707
+ content:
6708
+ application/json:
6709
+ schema:
6710
+ "$ref": "#/components/schemas/Error"
6711
+ default:
6712
+ description: Unexpected error.
6713
+ content:
6714
+ application/json:
6715
+ schema:
6716
+ "$ref": "#/components/schemas/Error"
6717
+ x-code-samples: []
6718
+ post:
6719
+ tags:
6720
+ - measured_unit
6721
+ operationId: create_measured_unit
6722
+ summary: Create a new measured unit
6723
+ parameters:
6724
+ - "$ref": "#/components/parameters/site_id"
6725
+ requestBody:
6726
+ content:
6727
+ application/json:
6728
+ schema:
6729
+ "$ref": "#/components/schemas/MeasuredUnitCreate"
6730
+ required: true
6731
+ responses:
6732
+ '201':
6733
+ description: A new measured unit.
6734
+ content:
6735
+ application/json:
6736
+ schema:
6737
+ "$ref": "#/components/schemas/MeasuredUnit"
6738
+ '400':
6739
+ description: Bad request, perhaps invalid JSON?
6740
+ content:
6741
+ application/json:
6742
+ schema:
6743
+ "$ref": "#/components/schemas/Error"
6744
+ '404':
6745
+ description: Incorrect site ID.
6746
+ content:
6747
+ application/json:
6748
+ schema:
6749
+ "$ref": "#/components/schemas/Error"
6750
+ '422':
6751
+ description: Invalid request parameters.
6752
+ content:
6753
+ application/json:
6754
+ schema:
6755
+ "$ref": "#/components/schemas/Error"
6756
+ default:
6757
+ description: Unexpected error.
6758
+ content:
6759
+ application/json:
6760
+ schema:
6761
+ "$ref": "#/components/schemas/Error"
6762
+ x-code-samples: []
6763
+ "/sites/{site_id}/measured_units/{measured_unit_id}":
6764
+ get:
6765
+ tags:
6766
+ - measured_unit
6767
+ operationId: get_measured_unit
6768
+ summary: Fetch a measured unit
6769
+ parameters:
6770
+ - "$ref": "#/components/parameters/site_id"
6771
+ - "$ref": "#/components/parameters/measured_unit_id"
6772
+ responses:
6773
+ '200':
6774
+ description: An item.
6775
+ content:
6776
+ application/json:
6777
+ schema:
6778
+ "$ref": "#/components/schemas/MeasuredUnit"
6779
+ '404':
6780
+ description: Incorrect site or measured unit ID.
6781
+ content:
6782
+ application/json:
6783
+ schema:
6784
+ "$ref": "#/components/schemas/Error"
6785
+ default:
6786
+ description: Unexpected error.
6787
+ content:
6788
+ application/json:
6789
+ schema:
6790
+ "$ref": "#/components/schemas/Error"
6791
+ x-code-samples: []
6792
+ put:
6793
+ tags:
6794
+ - measured_unit
6795
+ operationId: update_measured_unit
6796
+ summary: Update a measured unit
6797
+ parameters:
6798
+ - "$ref": "#/components/parameters/site_id"
6799
+ - "$ref": "#/components/parameters/measured_unit_id"
6800
+ requestBody:
6801
+ content:
6802
+ application/json:
6803
+ schema:
6804
+ "$ref": "#/components/schemas/MeasuredUnitUpdate"
6805
+ required: true
6806
+ responses:
6807
+ '200':
6808
+ description: The updated measured_unit.
6809
+ content:
6810
+ application/json:
6811
+ schema:
6812
+ "$ref": "#/components/schemas/MeasuredUnit"
6813
+ '400':
6814
+ description: Bad request, perhaps invalid JSON?
6815
+ content:
6816
+ application/json:
6817
+ schema:
6818
+ "$ref": "#/components/schemas/Error"
6819
+ '404':
6820
+ description: Incorrect site or measured unit ID.
6821
+ content:
6822
+ application/json:
6823
+ schema:
6824
+ "$ref": "#/components/schemas/Error"
6825
+ '422':
6826
+ description: Invalid request parameters
6827
+ content:
6828
+ application/json:
6829
+ schema:
6830
+ "$ref": "#/components/schemas/Error"
6831
+ default:
6832
+ description: Unexpected error.
6833
+ content:
6834
+ application/json:
6835
+ schema:
6836
+ "$ref": "#/components/schemas/Error"
6837
+ x-code-samples: []
6838
+ delete:
6839
+ tags:
6840
+ - measured_unit
6841
+ operationId: remove_measured_unit
6842
+ summary: Remove a measured unit
6843
+ description: A mesured unit cannot be deleted if it is used by an active plan.
6844
+ parameters:
6845
+ - "$ref": "#/components/parameters/site_id"
6846
+ - "$ref": "#/components/parameters/measured_unit_id"
6847
+ responses:
6848
+ '200':
6849
+ description: A measured unit.
6850
+ content:
6851
+ application/json:
6852
+ schema:
6853
+ "$ref": "#/components/schemas/MeasuredUnit"
6854
+ '422':
6855
+ description: Measured unit may already be inactive.
6856
+ content:
6857
+ application/json:
6858
+ schema:
6859
+ "$ref": "#/components/schemas/Error"
6860
+ default:
6861
+ description: Unexpected error.
6862
+ content:
6863
+ application/json:
6864
+ schema:
6865
+ "$ref": "#/components/schemas/Error"
6866
+ x-code-samples: []
6635
6867
  "/sites/{site_id}/invoices":
6636
6868
  get:
6637
6869
  tags:
6638
6870
  - invoice
6639
6871
  operationId: list_invoices
6640
6872
  summary: List a site's invoices
6873
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
6874
+ to use pagination in the API and Client Libraries.
6641
6875
  parameters:
6642
6876
  - "$ref": "#/components/parameters/site_id"
6643
6877
  - "$ref": "#/components/parameters/ids"
@@ -6964,10 +7198,10 @@ paths:
6964
7198
  - lang: PHP
6965
7199
  source: |
6966
7200
  try {
6967
- $invoice_update = array(
7201
+ $invoice_update = [
6968
7202
  "customer_notes" => "New Notes",
6969
7203
  "terms_and_conditions" => "New terms and conditions",
6970
- );
7204
+ ];
6971
7205
  $invoice = $client->putInvoice($invoice_id, $invoice_update);
6972
7206
 
6973
7207
  echo 'Updated Invoice:' . PHP_EOL;
@@ -7817,6 +8051,8 @@ paths:
7817
8051
  - line_item
7818
8052
  operationId: list_invoice_line_items
7819
8053
  summary: List an invoice's line items
8054
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
8055
+ to use pagination in the API and Client Libraries.
7820
8056
  parameters:
7821
8057
  - "$ref": "#/components/parameters/site_id"
7822
8058
  - "$ref": "#/components/parameters/invoice_id"
@@ -7918,6 +8154,8 @@ paths:
7918
8154
  - coupon_redemption
7919
8155
  operationId: list_invoice_coupon_redemptions
7920
8156
  summary: Show the coupon redemptions applied to an invoice
8157
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
8158
+ to use pagination in the API and Client Libraries.
7921
8159
  parameters:
7922
8160
  - "$ref": "#/components/parameters/site_id"
7923
8161
  - "$ref": "#/components/parameters/invoice_id"
@@ -8012,6 +8250,8 @@ paths:
8012
8250
  Related invoices provide a link between credit invoices and the charge invoices that they are refunding.
8013
8251
  For a charge invoice the related invoices will be credit invoices.
8014
8252
  For a credit invoice the related invoices will be charge invoices.
8253
+
8254
+ See the [Pagination Guide](/guides/pagination.html) to learn how to use pagination in the API and Client Libraries.
8015
8255
  parameters:
8016
8256
  - "$ref": "#/components/parameters/site_id"
8017
8257
  - "$ref": "#/components/parameters/invoice_id"
@@ -8230,10 +8470,10 @@ paths:
8230
8470
  - lang: PHP
8231
8471
  source: |
8232
8472
  try {
8233
- $refund = array(
8473
+ $refund = [
8234
8474
  "type" => "amount",
8235
8475
  "amount" => 1
8236
- );
8476
+ ];
8237
8477
  $invoice_collection = $client->refundInvoice($invoice_id, $refund);
8238
8478
 
8239
8479
  echo 'Refunded Invoice:' . PHP_EOL;
@@ -8261,6 +8501,8 @@ paths:
8261
8501
  - line_item
8262
8502
  operationId: list_line_items
8263
8503
  summary: List a site's line items
8504
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
8505
+ to use pagination in the API and Client Libraries.
8264
8506
  parameters:
8265
8507
  - "$ref": "#/components/parameters/site_id"
8266
8508
  - "$ref": "#/components/parameters/ids"
@@ -8589,6 +8831,8 @@ paths:
8589
8831
  - plan
8590
8832
  operationId: list_plans
8591
8833
  summary: List a site's plans
8834
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
8835
+ to use pagination in the API and Client Libraries.
8592
8836
  parameters:
8593
8837
  - "$ref": "#/components/parameters/site_id"
8594
8838
  - "$ref": "#/components/parameters/ids"
@@ -8837,16 +9081,16 @@ paths:
8837
9081
  - lang: PHP
8838
9082
  source: |
8839
9083
  try {
8840
- $plan_create = array(
9084
+ $plan_create = [
8841
9085
  "name" => "Monthly Coffee Subscription",
8842
9086
  "code" => $plan_code,
8843
9087
  "currencies" => [
8844
- array(
9088
+ [
8845
9089
  "currency" => "USD",
8846
9090
  "unit_amount" => 10000
8847
- )
9091
+ ]
8848
9092
  ]
8849
- );
9093
+ ];
8850
9094
 
8851
9095
  $plan = $client->createPlan($plan_create);
8852
9096
 
@@ -9111,9 +9355,9 @@ paths:
9111
9355
  - lang: PHP
9112
9356
  source: |
9113
9357
  try {
9114
- $plan_update = array(
9358
+ $plan_update = [
9115
9359
  "name" => "Monthly Tea Subscription"
9116
- );
9360
+ ];
9117
9361
  $plan = $client->updatePlan($plan_id, $plan_update);
9118
9362
 
9119
9363
  echo 'Updated Plan:' . PHP_EOL;
@@ -9249,6 +9493,8 @@ paths:
9249
9493
  - plan
9250
9494
  operationId: list_plan_add_ons
9251
9495
  summary: List a plan's add-ons
9496
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
9497
+ to use pagination in the API and Client Libraries.
9252
9498
  parameters:
9253
9499
  - "$ref": "#/components/parameters/site_id"
9254
9500
  - "$ref": "#/components/parameters/plan_id"
@@ -9506,10 +9752,10 @@ paths:
9506
9752
  "code" => $add_on_code,
9507
9753
  "name" => "Fresh beans shipped monthly",
9508
9754
  "currencies" => [
9509
- array(
9755
+ [
9510
9756
  "currency" => "USD",
9511
9757
  "unit_amount" => 10
9512
- )
9758
+ ]
9513
9759
  ]
9514
9760
  ];
9515
9761
 
@@ -9777,9 +10023,9 @@ paths:
9777
10023
  - lang: PHP
9778
10024
  source: |
9779
10025
  try {
9780
- $add_on_update = array(
10026
+ $add_on_update = [
9781
10027
  "name" => "New AddOn Name",
9782
- );
10028
+ ];
9783
10029
  $add_on = $client->updatePlanAddOn($plan_id, $add_on_id, $add_on_update);
9784
10030
 
9785
10031
  echo ' Updated Plan AddOn:' . PHP_EOL;
@@ -9913,6 +10159,8 @@ paths:
9913
10159
  - add-on
9914
10160
  operationId: list_add_ons
9915
10161
  summary: List a site's add-ons
10162
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
10163
+ to use pagination in the API and Client Libraries.
9916
10164
  parameters:
9917
10165
  - "$ref": "#/components/parameters/site_id"
9918
10166
  - "$ref": "#/components/parameters/ids"
@@ -10121,6 +10369,8 @@ paths:
10121
10369
  - shipping_method
10122
10370
  operationId: list_shipping_methods
10123
10371
  summary: List a site's shipping methods
10372
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
10373
+ to use pagination in the API and Client Libraries.
10124
10374
  parameters:
10125
10375
  - "$ref": "#/components/parameters/site_id"
10126
10376
  - "$ref": "#/components/parameters/ids"
@@ -10370,6 +10620,8 @@ paths:
10370
10620
  - subscription
10371
10621
  operationId: list_subscriptions
10372
10622
  summary: List a site's subscriptions
10623
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
10624
+ to use pagination in the API and Client Libraries.
10373
10625
  parameters:
10374
10626
  - "$ref": "#/components/parameters/site_id"
10375
10627
  - "$ref": "#/components/parameters/ids"
@@ -10604,13 +10856,13 @@ paths:
10604
10856
  - lang: PHP
10605
10857
  source: |
10606
10858
  try {
10607
- $sub_create = array(
10859
+ $sub_create = [
10608
10860
  "plan_code" => $plan_code,
10609
10861
  "currency" => "USD",
10610
- "account" => array(
10862
+ "account" => [
10611
10863
  "code" => $account_code
10612
- ),
10613
- );
10864
+ ],
10865
+ ];
10614
10866
 
10615
10867
  $subscription = $client->createSubscription($sub_create);
10616
10868
 
@@ -10874,10 +11126,10 @@ paths:
10874
11126
  - lang: PHP
10875
11127
  source: |
10876
11128
  try {
10877
- $changes = array(
11129
+ $changes = [
10878
11130
  "terms_and_conditions" => "Some new terms and conditions",
10879
11131
  "customer_notes" => "Some new customer notes"
10880
- );
11132
+ ];
10881
11133
 
10882
11134
  $subscription = $client->modifySubscription($subscription_id, $changes);
10883
11135
 
@@ -11917,10 +12169,10 @@ paths:
11917
12169
  - lang: PHP
11918
12170
  source: |
11919
12171
  try {
11920
- $change_create = array(
12172
+ $change_create = [
11921
12173
  "plan_code" => $new_plan_code,
11922
12174
  "timeframe" => "now"
11923
- );
12175
+ ];
11924
12176
  $change = $client->createSubscriptionChange($subscription_id, $change_create);
11925
12177
 
11926
12178
  echo 'Created Subscription Change:' . PHP_EOL;
@@ -12108,6 +12360,8 @@ paths:
12108
12360
  - subscription
12109
12361
  operationId: list_subscription_invoices
12110
12362
  summary: List a subscription's invoices
12363
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
12364
+ to use pagination in the API and Client Libraries.
12111
12365
  parameters:
12112
12366
  - "$ref": "#/components/parameters/site_id"
12113
12367
  - "$ref": "#/components/parameters/subscription_id"
@@ -12203,6 +12457,8 @@ paths:
12203
12457
  - subscription
12204
12458
  operationId: list_subscription_line_items
12205
12459
  summary: List a subscription's line items
12460
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
12461
+ to use pagination in the API and Client Libraries.
12206
12462
  parameters:
12207
12463
  - "$ref": "#/components/parameters/site_id"
12208
12464
  - "$ref": "#/components/parameters/subscription_id"
@@ -12301,6 +12557,8 @@ paths:
12301
12557
  - coupon_redemption
12302
12558
  operationId: list_subscription_coupon_redemptions
12303
12559
  summary: Show the coupon redemptions for a subscription
12560
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
12561
+ to use pagination in the API and Client Libraries.
12304
12562
  parameters:
12305
12563
  - "$ref": "#/components/parameters/site_id"
12306
12564
  - "$ref": "#/components/parameters/subscription_id"
@@ -12380,29 +12638,31 @@ paths:
12380
12638
  e, ok := err.(*recurly.Error); ok {\n\t\tfmt.Printf(\"Failed to retrieve
12381
12639
  next page: %v\", e)\n\t\tbreak\n\t}\n\tfor i, redemption := range subCouponRedemptions.Data
12382
12640
  {\n\t\tfmt.Printf(\"Subscription Coupon Redemption %3d: %s\\n\",\n\t\t\ti,\n\t\t\tredemption.Id,\n\t\t)\n\t}\n}"
12383
- "/sites/{site_id}/transactions":
12641
+ "/sites/{site_id}/subscriptions/{subscription_id}/add_ons/{add_on_id}/usage":
12384
12642
  get:
12385
12643
  tags:
12386
- - transaction
12387
- operationId: list_transactions
12388
- summary: List a site's transactions
12644
+ - invoice
12645
+ - subscription
12646
+ - usage
12647
+ operationId: list_usage
12648
+ summary: List a subscription add-on's usage records
12389
12649
  parameters:
12390
12650
  - "$ref": "#/components/parameters/site_id"
12391
- - "$ref": "#/components/parameters/ids"
12651
+ - "$ref": "#/components/parameters/subscription_id"
12652
+ - "$ref": "#/components/parameters/add_on_id"
12392
12653
  - "$ref": "#/components/parameters/limit"
12393
12654
  - "$ref": "#/components/parameters/order"
12394
- - "$ref": "#/components/parameters/sort_dates"
12395
- - "$ref": "#/components/parameters/filter_begin_time"
12396
- - "$ref": "#/components/parameters/filter_end_time"
12397
- - "$ref": "#/components/parameters/filter_transaction_type"
12398
- - "$ref": "#/components/parameters/filter_transaction_success"
12655
+ - "$ref": "#/components/parameters/usage_sort_dates"
12656
+ - "$ref": "#/components/parameters/filter_usage_begin_time"
12657
+ - "$ref": "#/components/parameters/filter_usage_end_time"
12658
+ - "$ref": "#/components/parameters/billing_status"
12399
12659
  responses:
12400
12660
  '200':
12401
- description: A list of the site's transactions.
12661
+ description: A list of the subscription add-on's usage records.
12402
12662
  content:
12403
12663
  application/json:
12404
12664
  schema:
12405
- "$ref": "#/components/schemas/TransactionList"
12665
+ "$ref": "#/components/schemas/UsageList"
12406
12666
  '400':
12407
12667
  description: Invalid or unpermitted parameter.
12408
12668
  content:
@@ -12410,7 +12670,7 @@ paths:
12410
12670
  schema:
12411
12671
  "$ref": "#/components/schemas/Error"
12412
12672
  '404':
12413
- description: Incorrect site or subscription ID.
12673
+ description: Incorrect site or subscription ID or add-on id.
12414
12674
  content:
12415
12675
  application/json:
12416
12676
  schema:
@@ -12421,46 +12681,262 @@ paths:
12421
12681
  application/json:
12422
12682
  schema:
12423
12683
  "$ref": "#/components/schemas/Error"
12424
- x-code-samples:
12425
- - lang: Node.js
12426
- source: |
12427
- const transactions = client.listTransactions({ limit: 200 })
12428
-
12429
- for await (const transaction of transactions.each()) {
12430
- console.log(transaction.uuid)
12431
- }
12432
- - lang: Python
12433
- source: |
12434
- transactions = client.list_transactions(limit=200).items()
12435
- for transaction in transactions:
12436
- print(transaction.uuid)
12437
- - lang: ".NET"
12438
- source: |
12439
- var transactions = client.ListTransactions(limit: 200);
12440
- foreach(Transaction transaction in transactions)
12441
- {
12442
- Console.WriteLine(transaction.Uuid);
12443
- }
12444
- - lang: Ruby
12445
- source: |
12446
- transactions = @client.list_transactions(limit: 200)
12447
- transactions.each do |transaction|
12448
- puts "Transaction: #{transaction.uuid}"
12449
- end
12450
- - lang: Java
12451
- source: |
12452
- QueryParams params = new QueryParams();
12453
- params.setLimit(200); // Pull 200 records at a time
12454
- final Pager<Transaction> transactions = client.listTransactions(params);
12455
-
12456
- for (Transaction transaction : transactions) {
12457
- System.out.println(transaction.getUuid());
12458
- }
12459
- - lang: PHP
12460
- source: |
12461
- $params = ['limit' => 200];
12462
- $transactions = $client->listTransactions($params);
12463
-
12684
+ x-code-samples: []
12685
+ post:
12686
+ tags:
12687
+ - invoice
12688
+ - subscription
12689
+ - usage
12690
+ operationId: create_usage
12691
+ summary: Log a usage record on this subscription add-on
12692
+ parameters:
12693
+ - "$ref": "#/components/parameters/site_id"
12694
+ - "$ref": "#/components/parameters/subscription_id"
12695
+ - "$ref": "#/components/parameters/add_on_id"
12696
+ requestBody:
12697
+ content:
12698
+ application/json:
12699
+ schema:
12700
+ "$ref": "#/components/schemas/UsageCreate"
12701
+ required: true
12702
+ responses:
12703
+ '201':
12704
+ description: The created usage record.
12705
+ content:
12706
+ application/json:
12707
+ schema:
12708
+ "$ref": "#/components/schemas/Usage"
12709
+ '400':
12710
+ description: Invalid or unpermitted parameter.
12711
+ content:
12712
+ application/json:
12713
+ schema:
12714
+ "$ref": "#/components/schemas/Error"
12715
+ '404':
12716
+ description: Incorrect site or subscription ID or add-on id.
12717
+ content:
12718
+ application/json:
12719
+ schema:
12720
+ "$ref": "#/components/schemas/Error"
12721
+ '422':
12722
+ description: A validation error.
12723
+ content:
12724
+ application/json:
12725
+ schema:
12726
+ "$ref": "#/components/schemas/Error"
12727
+ default:
12728
+ description: Unexpected error.
12729
+ content:
12730
+ application/json:
12731
+ schema:
12732
+ "$ref": "#/components/schemas/Error"
12733
+ x-code-samples: []
12734
+ "/sites/{site_id}/usage/{usage_id}":
12735
+ get:
12736
+ tags:
12737
+ - invoice
12738
+ - subscription
12739
+ - usage
12740
+ operationId: get_usage
12741
+ summary: Get a usage record
12742
+ parameters:
12743
+ - "$ref": "#/components/parameters/site_id"
12744
+ - "$ref": "#/components/parameters/usage_id"
12745
+ responses:
12746
+ '200':
12747
+ description: The usage record.
12748
+ content:
12749
+ application/json:
12750
+ schema:
12751
+ "$ref": "#/components/schemas/Usage"
12752
+ '400':
12753
+ description: Invalid or unpermitted parameter.
12754
+ content:
12755
+ application/json:
12756
+ schema:
12757
+ "$ref": "#/components/schemas/Error"
12758
+ '404':
12759
+ description: Incorrect site or subscription, add-on, or usage ID.
12760
+ content:
12761
+ application/json:
12762
+ schema:
12763
+ "$ref": "#/components/schemas/Error"
12764
+ default:
12765
+ description: Unexpected error.
12766
+ content:
12767
+ application/json:
12768
+ schema:
12769
+ "$ref": "#/components/schemas/Error"
12770
+ x-code-samples: []
12771
+ put:
12772
+ tags:
12773
+ - invoice
12774
+ - subscription
12775
+ - usage
12776
+ operationId: update_usage
12777
+ summary: Update a usage record
12778
+ parameters:
12779
+ - "$ref": "#/components/parameters/site_id"
12780
+ - "$ref": "#/components/parameters/usage_id"
12781
+ requestBody:
12782
+ content:
12783
+ application/json:
12784
+ schema:
12785
+ "$ref": "#/components/schemas/UsageCreate"
12786
+ required: true
12787
+ responses:
12788
+ '200':
12789
+ description: The updated usage record.
12790
+ content:
12791
+ application/json:
12792
+ schema:
12793
+ "$ref": "#/components/schemas/Usage"
12794
+ '400':
12795
+ description: Invalid or unpermitted parameter.
12796
+ content:
12797
+ application/json:
12798
+ schema:
12799
+ "$ref": "#/components/schemas/Error"
12800
+ '404':
12801
+ description: Incorrect site or subscription, add-on, or usage ID.
12802
+ content:
12803
+ application/json:
12804
+ schema:
12805
+ "$ref": "#/components/schemas/Error"
12806
+ '422':
12807
+ description: A validation error.
12808
+ content:
12809
+ application/json:
12810
+ schema:
12811
+ "$ref": "#/components/schemas/Error"
12812
+ default:
12813
+ description: Unexpected error.
12814
+ content:
12815
+ application/json:
12816
+ schema:
12817
+ "$ref": "#/components/schemas/Error"
12818
+ x-code-samples: []
12819
+ delete:
12820
+ tags:
12821
+ - invoice
12822
+ - subscription
12823
+ - usage
12824
+ operationId: remove_usage
12825
+ summary: Delete a usage record.
12826
+ parameters:
12827
+ - "$ref": "#/components/parameters/site_id"
12828
+ - "$ref": "#/components/parameters/usage_id"
12829
+ responses:
12830
+ '204':
12831
+ description: Usage was successfully deleted.
12832
+ '400':
12833
+ description: Invalid or unpermitted parameter.
12834
+ content:
12835
+ application/json:
12836
+ schema:
12837
+ "$ref": "#/components/schemas/Error"
12838
+ '404':
12839
+ description: Incorrect site or subscription, add-on, or usage ID.
12840
+ content:
12841
+ application/json:
12842
+ schema:
12843
+ "$ref": "#/components/schemas/Error"
12844
+ '422':
12845
+ description: A validation error.
12846
+ content:
12847
+ application/json:
12848
+ schema:
12849
+ "$ref": "#/components/schemas/Error"
12850
+ default:
12851
+ description: Unexpected error.
12852
+ content:
12853
+ application/json:
12854
+ schema:
12855
+ "$ref": "#/components/schemas/Error"
12856
+ x-code-samples: []
12857
+ "/sites/{site_id}/transactions":
12858
+ get:
12859
+ tags:
12860
+ - transaction
12861
+ operationId: list_transactions
12862
+ summary: List a site's transactions
12863
+ description: See the [Pagination Guide](/guides/pagination.html) to learn how
12864
+ to use pagination in the API and Client Libraries.
12865
+ parameters:
12866
+ - "$ref": "#/components/parameters/site_id"
12867
+ - "$ref": "#/components/parameters/ids"
12868
+ - "$ref": "#/components/parameters/limit"
12869
+ - "$ref": "#/components/parameters/order"
12870
+ - "$ref": "#/components/parameters/sort_dates"
12871
+ - "$ref": "#/components/parameters/filter_begin_time"
12872
+ - "$ref": "#/components/parameters/filter_end_time"
12873
+ - "$ref": "#/components/parameters/filter_transaction_type"
12874
+ - "$ref": "#/components/parameters/filter_transaction_success"
12875
+ responses:
12876
+ '200':
12877
+ description: A list of the site's transactions.
12878
+ content:
12879
+ application/json:
12880
+ schema:
12881
+ "$ref": "#/components/schemas/TransactionList"
12882
+ '400':
12883
+ description: Invalid or unpermitted parameter.
12884
+ content:
12885
+ application/json:
12886
+ schema:
12887
+ "$ref": "#/components/schemas/Error"
12888
+ '404':
12889
+ description: Incorrect site or subscription ID.
12890
+ content:
12891
+ application/json:
12892
+ schema:
12893
+ "$ref": "#/components/schemas/Error"
12894
+ default:
12895
+ description: Unexpected error.
12896
+ content:
12897
+ application/json:
12898
+ schema:
12899
+ "$ref": "#/components/schemas/Error"
12900
+ x-code-samples:
12901
+ - lang: Node.js
12902
+ source: |
12903
+ const transactions = client.listTransactions({ limit: 200 })
12904
+
12905
+ for await (const transaction of transactions.each()) {
12906
+ console.log(transaction.uuid)
12907
+ }
12908
+ - lang: Python
12909
+ source: |
12910
+ transactions = client.list_transactions(limit=200).items()
12911
+ for transaction in transactions:
12912
+ print(transaction.uuid)
12913
+ - lang: ".NET"
12914
+ source: |
12915
+ var transactions = client.ListTransactions(limit: 200);
12916
+ foreach(Transaction transaction in transactions)
12917
+ {
12918
+ Console.WriteLine(transaction.Uuid);
12919
+ }
12920
+ - lang: Ruby
12921
+ source: |
12922
+ transactions = @client.list_transactions(limit: 200)
12923
+ transactions.each do |transaction|
12924
+ puts "Transaction: #{transaction.uuid}"
12925
+ end
12926
+ - lang: Java
12927
+ source: |
12928
+ QueryParams params = new QueryParams();
12929
+ params.setLimit(200); // Pull 200 records at a time
12930
+ final Pager<Transaction> transactions = client.listTransactions(params);
12931
+
12932
+ for (Transaction transaction : transactions) {
12933
+ System.out.println(transaction.getUuid());
12934
+ }
12935
+ - lang: PHP
12936
+ source: |
12937
+ $params = ['limit' => 200];
12938
+ $transactions = $client->listTransactions($params);
12939
+
12464
12940
  foreach($transactions as $transaction) {
12465
12941
  echo 'Transaction: ' . $transaction->getUuid() . PHP_EOL;
12466
12942
  }
@@ -12880,22 +13356,22 @@ paths:
12880
13356
  - lang: PHP
12881
13357
  source: |
12882
13358
  try {
12883
- $purchase_create = array(
13359
+ $purchase_create = [
12884
13360
  "currency" => "USD",
12885
- "account" => array(
13361
+ "account" => [
12886
13362
  "code" => $account_code,
12887
13363
  "first_name" => "Douglas",
12888
13364
  "last_name" => "Du Monde",
12889
- "billing_info" => array(
13365
+ "billing_info" => [
12890
13366
  "token_id" => $rjs_token_id
12891
- ),
12892
- ),
13367
+ ],
13368
+ ],
12893
13369
  "subscriptions" => [
12894
- array(
13370
+ [
12895
13371
  "plan_code" => $plan_code
12896
- )
13372
+ ]
12897
13373
  ]
12898
- );
13374
+ ];
12899
13375
  $invoice_collection = $client->createPurchase($purchase_create);
12900
13376
  echo 'Created Invoices:' . PHP_EOL;
12901
13377
  var_dump($invoice_collection);
@@ -13116,22 +13592,22 @@ paths:
13116
13592
  - lang: PHP
13117
13593
  source: |
13118
13594
  try {
13119
- $purchase_preview = array(
13595
+ $purchase_preview = [
13120
13596
  "currency" => "USD",
13121
- "account" => array(
13597
+ "account" => [
13122
13598
  "code" => $account_code,
13123
13599
  "first_name" => "Douglas",
13124
13600
  "last_name" => "Du Monde",
13125
- "billing_info" => array(
13601
+ "billing_info" => [
13126
13602
  "token_id" => $rjs_token_id
13127
- ),
13128
- ),
13603
+ ],
13604
+ ],
13129
13605
  "subscriptions" => [
13130
- array(
13606
+ [
13131
13607
  "plan_code" => $plan_code
13132
- )
13608
+ ]
13133
13609
  ]
13134
- );
13610
+ ];
13135
13611
  $invoice_collection = $client->previewPurchase($purchase_preview);
13136
13612
  echo 'Preview Invoices:' . PHP_EOL;
13137
13613
  var_dump($invoice_collection);
@@ -13178,6 +13654,13 @@ components:
13178
13654
  required: true
13179
13655
  schema:
13180
13656
  type: string
13657
+ usage_id:
13658
+ name: usage_id
13659
+ in: path
13660
+ description: Usage Record ID.
13661
+ required: true
13662
+ schema:
13663
+ type: string
13181
13664
  coupon_id:
13182
13665
  name: coupon_id
13183
13666
  in: path
@@ -13217,6 +13700,14 @@ components:
13217
13700
  required: true
13218
13701
  schema:
13219
13702
  type: string
13703
+ measured_unit_id:
13704
+ name: measured_unit_id
13705
+ in: path
13706
+ description: Measured unit ID or name. For ID no prefix is used e.g. `e28zov4fw0v2`.
13707
+ For name use prefix `name-`, e.g. `name-Storage`.
13708
+ required: true
13709
+ schema:
13710
+ type: string
13220
13711
  line_item_id:
13221
13712
  name: line_item_id
13222
13713
  in: path
@@ -13324,6 +13815,30 @@ components:
13324
13815
  - created_at
13325
13816
  - updated_at
13326
13817
  default: created_at
13818
+ usage_sort_dates:
13819
+ name: sort
13820
+ in: query
13821
+ description: |
13822
+ Sort field. You *really* only want to sort by `usage_timestamp` in ascending
13823
+ order. In descending order updated records will move behind the cursor and could
13824
+ prevent some records from being returned.
13825
+ schema:
13826
+ type: string
13827
+ default: usage_timestamp
13828
+ enum:
13829
+ - recorded_timestamp
13830
+ - usage_timestamp
13831
+ billing_status:
13832
+ name: billing_status
13833
+ in: query
13834
+ description: Filter by usage record's billing status
13835
+ schema:
13836
+ type: string
13837
+ default: unbilled
13838
+ enum:
13839
+ - unbilled
13840
+ - billed
13841
+ - all
13327
13842
  filter_state:
13328
13843
  name: state
13329
13844
  in: query
@@ -13355,7 +13870,7 @@ components:
13355
13870
  name: begin_time
13356
13871
  in: query
13357
13872
  description: |
13358
- Filter by begin_time when `sort=created_at` or `sort=updated_at`.
13873
+ Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`.
13359
13874
  **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
13360
13875
  schema:
13361
13876
  type: string
@@ -13364,7 +13879,25 @@ components:
13364
13879
  name: end_time
13365
13880
  in: query
13366
13881
  description: |
13367
- Filter by end_time when `sort=created_at` or `sort=updated_at`.
13882
+ Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`.
13883
+ **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
13884
+ schema:
13885
+ type: string
13886
+ format: date-time
13887
+ filter_usage_begin_time:
13888
+ name: begin_time
13889
+ in: query
13890
+ description: |
13891
+ Inclusively filter by begin_time when `sort=usage_timestamp` or `sort=recorded_timestamp`.
13892
+ **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
13893
+ schema:
13894
+ type: string
13895
+ format: date-time
13896
+ filter_usage_end_time:
13897
+ name: end_time
13898
+ in: query
13899
+ description: |
13900
+ Inclusively filter by end_time when `sort=usage_timestamp` or `sort=recorded_timestamp`.
13368
13901
  **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
13369
13902
  schema:
13370
13903
  type: string
@@ -13642,6 +14175,23 @@ components:
13642
14175
  type: array
13643
14176
  items:
13644
14177
  "$ref": "#/components/schemas/Invoice"
14178
+ MeasuredUnitList:
14179
+ type: object
14180
+ properties:
14181
+ object:
14182
+ type: string
14183
+ title: Object type
14184
+ description: Will always be List.
14185
+ has_more:
14186
+ type: boolean
14187
+ description: Indicates there are more results on subsequent pages.
14188
+ next:
14189
+ type: string
14190
+ description: Path to subsequent page of results.
14191
+ data:
14192
+ type: array
14193
+ items:
14194
+ "$ref": "#/components/schemas/MeasuredUnit"
13645
14195
  LineItemList:
13646
14196
  type: object
13647
14197
  properties:
@@ -14286,6 +14836,32 @@ components:
14286
14836
  title: Name
14287
14837
  description: Describes your add-on and will appear in subscribers' invoices.
14288
14838
  maxLength: 255
14839
+ add_on_type:
14840
+ type: string
14841
+ enum:
14842
+ - fixed
14843
+ - usage
14844
+ title: Add-on Type
14845
+ description: Whether the add-on type is fixed, or usage-based.
14846
+ usage_type:
14847
+ type: string
14848
+ enum:
14849
+ - price
14850
+ - percentage
14851
+ title: Usage Type
14852
+ description: Type of usage, returns usage type if `add_on_type` is `usage`.
14853
+ usage_percentage:
14854
+ type: number
14855
+ format: float
14856
+ title: Usage Percentage
14857
+ description: The percentage taken of the monetary amount of usage tracked.
14858
+ This can be up to 4 decimal places. A value between 0.0 and 100.0.
14859
+ measured_unit_id:
14860
+ type: string
14861
+ title: Measured Unit ID
14862
+ description: System-generated unique identifier for an measured unit associated
14863
+ with the add-on.
14864
+ maxLength: 13
14289
14865
  item_id:
14290
14866
  type: string
14291
14867
  title: Item ID
@@ -14342,6 +14918,32 @@ components:
14342
14918
  title: Name
14343
14919
  description: Describes your add-on and will appear in subscribers' invoices.
14344
14920
  maxLength: 255
14921
+ add_on_type:
14922
+ type: string
14923
+ enum:
14924
+ - fixed
14925
+ - usage
14926
+ title: Add-on Type
14927
+ description: Whether the add-on type is fixed, or usage-based.
14928
+ usage_type:
14929
+ type: string
14930
+ enum:
14931
+ - price
14932
+ - percentage
14933
+ title: Usage Type
14934
+ description: Type of usage, returns usage type if `add_on_type` is `usage`.
14935
+ usage_percentage:
14936
+ type: number
14937
+ format: float
14938
+ title: Usage Percentage
14939
+ description: The percentage taken of the monetary amount of usage tracked.
14940
+ This can be up to 4 decimal places. A value between 0.0 and 100.0.
14941
+ measured_unit_id:
14942
+ type: string
14943
+ title: Measured Unit ID
14944
+ description: System-generated unique identifier for an measured unit associated
14945
+ with the add-on.
14946
+ maxLength: 13
14345
14947
  accounting_code:
14346
14948
  type: string
14347
14949
  title: Accounting code
@@ -14470,6 +15072,44 @@ components:
14470
15072
  If `item_code`/`item_id` is part of the request then `name` must be absent.
14471
15073
  If `item_code`/`item_id` is not present `name` is required.
14472
15074
  maxLength: 255
15075
+ add_on_type:
15076
+ type: string
15077
+ enum:
15078
+ - fixed
15079
+ - usage
15080
+ title: Add-on Type
15081
+ description: Whether the add-on type is fixed, or usage-based.
15082
+ default: fixed
15083
+ usage_type:
15084
+ type: string
15085
+ enum:
15086
+ - price
15087
+ - percentage
15088
+ title: Usage Type
15089
+ description: Type of usage, required if `add_on_type` is `usage`.
15090
+ usage_percentage:
15091
+ type: number
15092
+ format: float
15093
+ title: Usage Percentage
15094
+ description: The percentage taken of the monetary amount of usage tracked.
15095
+ This can be up to 4 decimal places. A value between 0.0 and 100.0. Required
15096
+ if `add_on_type` is usage and `usage_type` is percentage. Must be omitted
15097
+ otherwise. `usage_percentage` does not support tiers.
15098
+ measured_unit_id:
15099
+ type: string
15100
+ title: Measured Unit ID
15101
+ description: System-generated unique identifier for a measured unit to be
15102
+ associated with the add-on. Either `measured_unit_id` or `measured_unit_name`
15103
+ are required when `add_on_type` is `usage`. If `measured_unit_id` and
15104
+ `measured_unit_name` are both present, `measured_unit_id` will be used.
15105
+ maxLength: 13
15106
+ measured_unit_name:
15107
+ type: string
15108
+ title: Measured Unit Name
15109
+ description: Name of a measured unit to be associated with the add-on. Either
15110
+ `measured_unit_id` or `measured_unit_name` are required when `add_on_type`
15111
+ is `usage`. If `measured_unit_id` and `measured_unit_name` are both present,
15112
+ `measured_unit_id` will be used.
14473
15113
  plan_id:
14474
15114
  type: string
14475
15115
  title: Plan ID
@@ -14584,6 +15224,29 @@ components:
14584
15224
  description: Describes your add-on and will appear in subscribers' invoices.
14585
15225
  If an `Item` is associated to the `AddOn` then `name` must be absent.
14586
15226
  maxLength: 255
15227
+ usage_percentage:
15228
+ type: number
15229
+ format: float
15230
+ title: Usage Percentage
15231
+ description: The percentage taken of the monetary amount of usage tracked.
15232
+ This can be up to 4 decimal places. A value between 0.0 and 100.0. Required
15233
+ if `add_on_type` is usage and `usage_type` is percentage. Must be omitted
15234
+ otherwise. `usage_percentage` does not support tiers.
15235
+ measured_unit_id:
15236
+ type: string
15237
+ title: Measured Unit ID
15238
+ description: System-generated unique identifier for a measured unit to be
15239
+ associated with the add-on. Either `measured_unit_id` or `measured_unit_name`
15240
+ are required when `add_on_type` is `usage`. If `measured_unit_id` and
15241
+ `measured_unit_name` are both present, `measured_unit_id` will be used.
15242
+ maxLength: 13
15243
+ measured_unit_name:
15244
+ type: string
15245
+ title: Measured Unit Name
15246
+ description: Name of a measured unit to be associated with the add-on. Either
15247
+ `measured_unit_id` or `measured_unit_name` are required when `add_on_type`
15248
+ is `usage`. If `measured_unit_id` and `measured_unit_name` are both present,
15249
+ `measured_unit_id` will be used.
14587
15250
  accounting_code:
14588
15251
  type: string
14589
15252
  title: Accounting code
@@ -16270,6 +16933,95 @@ components:
16270
16933
  - payment_method
16271
16934
  required:
16272
16935
  - type
16936
+ MeasuredUnit:
16937
+ type: object
16938
+ title: Measured unit
16939
+ properties:
16940
+ id:
16941
+ type: string
16942
+ title: Item ID
16943
+ maxLength: 13
16944
+ readOnly: true
16945
+ object:
16946
+ type: string
16947
+ title: Object type
16948
+ readOnly: true
16949
+ name:
16950
+ type: string
16951
+ title: Name
16952
+ description: Unique internal name of the measured unit on your site.
16953
+ display_name:
16954
+ type: string
16955
+ title: Display name
16956
+ description: Display name for the measured unit. Can only contain spaces,
16957
+ underscores and must be alphanumeric.
16958
+ maxLength: 50
16959
+ state:
16960
+ title: State
16961
+ description: The current state of the measured unit.
16962
+ readOnly: true
16963
+ type: string
16964
+ enum:
16965
+ - active
16966
+ - inactive
16967
+ description:
16968
+ type: string
16969
+ title: Description
16970
+ description: Optional internal description.
16971
+ created_at:
16972
+ type: string
16973
+ format: date-time
16974
+ title: Created at
16975
+ readOnly: true
16976
+ updated_at:
16977
+ type: string
16978
+ format: date-time
16979
+ title: Last updated at
16980
+ readOnly: true
16981
+ deleted_at:
16982
+ type: string
16983
+ format: date-time
16984
+ title: Deleted at
16985
+ readOnly: true
16986
+ MeasuredUnitCreate:
16987
+ type: object
16988
+ properties:
16989
+ name:
16990
+ type: string
16991
+ title: Name
16992
+ description: Unique internal name of the measured unit on your site.
16993
+ maxLength: 255
16994
+ display_name:
16995
+ type: string
16996
+ title: Display name
16997
+ description: Display name for the measured unit.
16998
+ pattern: "/^[\\w ]+$/"
16999
+ maxLength: 50
17000
+ description:
17001
+ type: string
17002
+ title: Description
17003
+ description: Optional internal description.
17004
+ required:
17005
+ - name
17006
+ - display_name
17007
+ MeasuredUnitUpdate:
17008
+ type: object
17009
+ properties:
17010
+ name:
17011
+ type: string
17012
+ title: Name
17013
+ description: Unique internal name of the measured unit on your site.
17014
+ maxLength: 255
17015
+ display_name:
17016
+ type: string
17017
+ title: Display name
17018
+ description: Display name for the measured unit.
17019
+ pattern: "/^[\\w ]+$/"
17020
+ maxLength: 50
17021
+ description:
17022
+ type: string
17023
+ title: Description
17024
+ description: Optional internal description.
16273
17025
  LineItem:
16274
17026
  type: object
16275
17027
  title: Line item
@@ -17984,7 +18736,16 @@ components:
17984
18736
  items:
17985
18737
  "$ref": "#/components/schemas/SubscriptionAddOnTier"
17986
18738
  minItems: 1
17987
- description: Empty unless `tier_type` is `tiered`, `volume`, or `stairstep`.
18739
+ description: |
18740
+ If tiers are provided in the request, all existing tiers on the Subscription Add-on will be
18741
+ removed and replaced by the tiers in the request.
18742
+ usage_percentage:
18743
+ type: number
18744
+ format: float
18745
+ title: Usage Percentage
18746
+ description: The percentage taken of the monetary amount of usage tracked.
18747
+ This can be up to 4 decimal places. A value between 0.0 and 100.0. Required
18748
+ if add_on_type is usage and usage_type is percentage.
17988
18749
  created_at:
17989
18750
  type: string
17990
18751
  format: date-time
@@ -18043,6 +18804,14 @@ components:
18043
18804
  must include one to many tiers with `ending_quantity` and `unit_amount`.
18044
18805
  There must be one tier with an `ending_quantity` of 999999999 which is the
18045
18806
  default if not provided.
18807
+ usage_percentage:
18808
+ type: number
18809
+ format: float
18810
+ title: Usage Percentage
18811
+ description: The percentage taken of the monetary amount of usage tracked.
18812
+ This can be up to 4 decimal places. A value between 0.0 and 100.0. Required
18813
+ if `add_on_type` is usage and `usage_type` is percentage. Must be omitted
18814
+ otherwise. `usage_percentage` does not support tiers.
18046
18815
  revenue_schedule_type:
18047
18816
  type: string
18048
18817
  title: Revenue schedule type
@@ -18106,6 +18875,13 @@ components:
18106
18875
  must include one to many tiers with `ending_quantity` and `unit_amount`.
18107
18876
  There must be one tier with an `ending_quantity` of 999999999 which is the
18108
18877
  default if not provided.
18878
+ usage_percentage:
18879
+ type: number
18880
+ format: float
18881
+ title: Usage Percentage
18882
+ description: The percentage taken of the monetary amount of usage tracked.
18883
+ This can be up to 4 decimal places. A value between 0.0 and 100.0. Required
18884
+ if add_on_type is usage and usage_type is percentage.
18109
18885
  revenue_schedule_type:
18110
18886
  type: string
18111
18887
  title: Revenue schedule type
@@ -18201,6 +18977,9 @@ components:
18201
18977
  - evenly
18202
18978
  - at_range_end
18203
18979
  - at_range_start
18980
+ invoice_collection:
18981
+ title: Invoice Collection
18982
+ "$ref": "#/components/schemas/InvoiceCollection"
18204
18983
  created_at:
18205
18984
  type: string
18206
18985
  format: date-time
@@ -18332,12 +19111,9 @@ components:
18332
19111
  enum:
18333
19112
  - moto
18334
19113
  SubscriptionChangePreview:
19114
+ type: object
18335
19115
  allOf:
18336
19116
  - "$ref": "#/components/schemas/SubscriptionChange"
18337
- type: object
18338
- properties:
18339
- invoice_collection:
18340
- "$ref": "#/components/schemas/InvoiceCollection"
18341
19117
  SubscriptionChangeShippingCreate:
18342
19118
  type: object
18343
19119
  title: Shipping details that will be changed on a subscription
@@ -18564,6 +19340,13 @@ components:
18564
19340
  title: Trial ends at
18565
19341
  description: If set, overrides the default trial behavior for the subscription.
18566
19342
  The date must be in the future.
19343
+ starts_at:
19344
+ type: string
19345
+ format: date-time
19346
+ title: Start date
19347
+ description: If set, the subscription will begin in the future on this date.
19348
+ The subscription will apply the setup fee and trial period, unless the
19349
+ plan has no trial.
18567
19350
  next_bill_date:
18568
19351
  type: string
18569
19352
  format: date-time
@@ -19128,6 +19911,118 @@ components:
19128
19911
  type: array
19129
19912
  items:
19130
19913
  "$ref": "#/components/schemas/UniqueCouponCode"
19914
+ Usage:
19915
+ type: object
19916
+ properties:
19917
+ id:
19918
+ type: string
19919
+ object:
19920
+ type: string
19921
+ title: Object type
19922
+ merchant_tag:
19923
+ type: string
19924
+ description: Custom field for recording the id in your own system associated
19925
+ with the usage, so you can provide auditable usage displays to your customers
19926
+ using a GET on this endpoint.
19927
+ amount:
19928
+ type: number
19929
+ format: float
19930
+ description: The amount of usage. Can be positive, negative, or 0. No decimals
19931
+ allowed, we will strip them. If the usage-based add-on is billed with
19932
+ a percentage, your usage will be a monetary amount you will want to format
19933
+ in cents. (e.g., $5.00 is "500").
19934
+ usage_type:
19935
+ type: string
19936
+ enum:
19937
+ - price
19938
+ - percentage
19939
+ title: Usage Type
19940
+ description: Type of usage, returns usage type if `add_on_type` is `usage`.
19941
+ tier_type:
19942
+ type: string
19943
+ title: Tier type
19944
+ description: |
19945
+ The pricing model for the add-on. For more information,
19946
+ [click here](https://docs.recurly.com/docs/billing-models#section-quantity-based).
19947
+ default: flat
19948
+ enum:
19949
+ - flat
19950
+ - tiered
19951
+ - stairstep
19952
+ - volume
19953
+ tiers:
19954
+ type: array
19955
+ title: Tiers
19956
+ items:
19957
+ "$ref": "#/components/schemas/SubscriptionAddOnTier"
19958
+ description: The tiers and prices of the subscription based on the usage_timestamp.
19959
+ If tier_type = flat, tiers = null
19960
+ measured_unit_id:
19961
+ type: string
19962
+ description: The ID of the measured unit associated with the add-on the
19963
+ usage record is for.
19964
+ recording_timestamp:
19965
+ type: string
19966
+ format: date-time
19967
+ description: When the usage was recorded in your system.
19968
+ usage_timestamp:
19969
+ type: string
19970
+ format: date-time
19971
+ description: When the usage actually happened. This will define the line
19972
+ item dates this usage is billed under and is important for revenue recognition.
19973
+ billed_at:
19974
+ type: string
19975
+ format: date-time
19976
+ description: When the usage record was billed on an invoice.
19977
+ created_at:
19978
+ type: string
19979
+ format: date-time
19980
+ description: When the usage record was created in Recurly.
19981
+ updated_at:
19982
+ type: string
19983
+ format: date-time
19984
+ description: When the usage record was billed on an invoice.
19985
+ UsageCreate:
19986
+ type: object
19987
+ properties:
19988
+ merchant_tag:
19989
+ type: string
19990
+ description: Custom field for recording the id in your own system associated
19991
+ with the usage, so you can provide auditable usage displays to your customers
19992
+ using a GET on this endpoint.
19993
+ amount:
19994
+ type: number
19995
+ format: float
19996
+ description: The amount of usage. Can be positive, negative, or 0. No decimals
19997
+ allowed, we will strip them. If the usage-based add-on is billed with
19998
+ a percentage, your usage will be a monetary amount you will want to format
19999
+ in cents. (e.g., $5.00 is "500").
20000
+ recording_timestamp:
20001
+ type: string
20002
+ format: date-time
20003
+ description: When the usage was recorded in your system.
20004
+ usage_timestamp:
20005
+ type: string
20006
+ format: date-time
20007
+ description: When the usage actually happened. This will define the line
20008
+ item dates this usage is billed under and is important for revenue recognition.
20009
+ UsageList:
20010
+ type: object
20011
+ properties:
20012
+ object:
20013
+ type: string
20014
+ title: Object type
20015
+ description: Will always be List.
20016
+ has_more:
20017
+ type: boolean
20018
+ description: Indicates there are more results on subsequent pages.
20019
+ next:
20020
+ type: string
20021
+ description: Path to subsequent page of results.
20022
+ data:
20023
+ type: array
20024
+ items:
20025
+ "$ref": "#/components/schemas/Usage"
19131
20026
  User:
19132
20027
  type: object
19133
20028
  properties: