recurly 3.14.0 → 3.18.1
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.
- checksums.yaml +4 -4
- data/.bumpversion.cfg +1 -1
- data/.travis.yml +1 -0
- data/CHANGELOG.md +72 -3
- data/GETTING_STARTED.md +1 -1
- data/lib/recurly/client.rb +2 -2
- data/lib/recurly/client/operations.rb +111 -1
- data/lib/recurly/errors/api_errors.rb +2 -0
- data/lib/recurly/pager.rb +1 -1
- data/lib/recurly/requests/billing_info_create.rb +12 -0
- data/lib/recurly/requests/coupon_create.rb +8 -0
- data/lib/recurly/requests/coupon_redemption_create.rb +4 -0
- data/lib/recurly/requests/invoice_collect.rb +4 -0
- data/lib/recurly/requests/plan_update.rb +0 -4
- data/lib/recurly/requests/purchase_create.rb +4 -0
- data/lib/recurly/requests/subscription_create.rb +4 -0
- data/lib/recurly/requests/subscription_update.rb +4 -0
- data/lib/recurly/resources/billing_info.rb +4 -0
- data/lib/recurly/resources/coupon.rb +8 -0
- data/lib/recurly/resources/coupon_redemption.rb +4 -0
- data/lib/recurly/resources/invoice.rb +4 -0
- data/lib/recurly/resources/subscription.rb +5 -1
- data/lib/recurly/version.rb +1 -1
- data/openapi/api.yaml +487 -35
- metadata +3 -3
@@ -6,6 +6,10 @@ module Recurly
|
|
6
6
|
module Resources
|
7
7
|
class Coupon < Resource
|
8
8
|
|
9
|
+
# @!attribute applies_to_all_items
|
10
|
+
# @return [Boolean] The coupon is valid for all items if true. If false then `items` will list the applicable items.
|
11
|
+
define_attribute :applies_to_all_items, :Boolean
|
12
|
+
|
9
13
|
# @!attribute applies_to_all_plans
|
10
14
|
# @return [Boolean] The coupon is valid for all plans if true. If false then `plans` and `plans_names` will list the applicable plans.
|
11
15
|
define_attribute :applies_to_all_plans, :Boolean
|
@@ -66,6 +70,10 @@ module Recurly
|
|
66
70
|
# @return [String] Description of the coupon on the invoice.
|
67
71
|
define_attribute :invoice_description, String
|
68
72
|
|
73
|
+
# @!attribute items
|
74
|
+
# @return [Array[ItemMini]] A list of items for which this coupon applies. This will be `null` if `applies_to_all_items=true`.
|
75
|
+
define_attribute :items, Array, { :item_type => :ItemMini }
|
76
|
+
|
69
77
|
# @!attribute max_redemptions
|
70
78
|
# @return [Integer] A maximum number of redemptions for the coupon. The coupon will expire when it hits its maximum redemptions.
|
71
79
|
define_attribute :max_redemptions, Integer
|
@@ -42,6 +42,10 @@ module Recurly
|
|
42
42
|
# @return [String] Coupon Redemption state
|
43
43
|
define_attribute :state, String
|
44
44
|
|
45
|
+
# @!attribute subscription_id
|
46
|
+
# @return [String] Subscription ID
|
47
|
+
define_attribute :subscription_id, String
|
48
|
+
|
45
49
|
# @!attribute updated_at
|
46
50
|
# @return [DateTime] Last updated at
|
47
51
|
define_attribute :updated_at, DateTime
|
@@ -18,6 +18,10 @@ module Recurly
|
|
18
18
|
# @return [Float] The outstanding balance remaining on this invoice.
|
19
19
|
define_attribute :balance, Float
|
20
20
|
|
21
|
+
# @!attribute billing_info_id
|
22
|
+
# @return [String] The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info.
|
23
|
+
define_attribute :billing_info_id, String
|
24
|
+
|
21
25
|
# @!attribute closed_at
|
22
26
|
# @return [DateTime] Date invoice was marked paid or failed.
|
23
27
|
define_attribute :closed_at, DateTime
|
@@ -30,6 +30,10 @@ module Recurly
|
|
30
30
|
# @return [DateTime] Recurring subscriptions paid with ACH will have this attribute set. This timestamp is used for alerting customers to reauthorize in 3 years in accordance with NACHA rules. If a subscription becomes inactive or the billing info is no longer a bank account, this timestamp is cleared.
|
31
31
|
define_attribute :bank_account_authorized_at, DateTime
|
32
32
|
|
33
|
+
# @!attribute billing_info_id
|
34
|
+
# @return [String] Billing Info ID.
|
35
|
+
define_attribute :billing_info_id, String
|
36
|
+
|
33
37
|
# @!attribute canceled_at
|
34
38
|
# @return [DateTime] Canceled at
|
35
39
|
define_attribute :canceled_at, DateTime
|
@@ -39,7 +43,7 @@ module Recurly
|
|
39
43
|
define_attribute :collection_method, String
|
40
44
|
|
41
45
|
# @!attribute coupon_redemptions
|
42
|
-
# @return [Array[CouponRedemptionMini]]
|
46
|
+
# @return [Array[CouponRedemptionMini]] Returns subscription level coupon redemptions that are tied to this subscription.
|
43
47
|
define_attribute :coupon_redemptions, Array, { :item_type => :CouponRedemptionMini }
|
44
48
|
|
45
49
|
# @!attribute created_at
|
data/lib/recurly/version.rb
CHANGED
data/openapi/api.yaml
CHANGED
@@ -275,8 +275,8 @@ tags:
|
|
275
275
|
allow for individual delivery and tracking.
|
276
276
|
- name: coupon_redemption
|
277
277
|
x-displayName: Coupon Redemption
|
278
|
-
description: Coupon redemptions are created when a coupon is applied to an account
|
279
|
-
This allows you to track your promotions.
|
278
|
+
description: Coupon redemptions are created when a coupon is applied to an account
|
279
|
+
or subscription. This allows you to track your promotions.
|
280
280
|
- name: unique_coupon_code
|
281
281
|
x-displayName: Unique Coupon Code
|
282
282
|
description: Unique coupon codes are generated from bulk coupons.
|
@@ -1142,14 +1142,11 @@ paths:
|
|
1142
1142
|
const account = await client.deactivateAccount(accountId)
|
1143
1143
|
console.log('Deleted account: ', account.code)
|
1144
1144
|
} catch (err) {
|
1145
|
-
if (err
|
1145
|
+
if (err instanceof recurly.errors.NotFoundError) {
|
1146
1146
|
// If the request was not found, you may want to alert the user or
|
1147
1147
|
// just return null
|
1148
1148
|
console.log('Resource Not Found')
|
1149
1149
|
}
|
1150
|
-
// If we don't know what to do with the err, we should
|
1151
|
-
// probably re-raise and let our web framework and logger handle it
|
1152
|
-
throw err
|
1153
1150
|
}
|
1154
1151
|
- lang: Python
|
1155
1152
|
source: |
|
@@ -1649,14 +1646,11 @@ paths:
|
|
1649
1646
|
const account = await client.reactivateAccount(accountId)
|
1650
1647
|
console.log('Reactivated account: ', account.code)
|
1651
1648
|
} catch (err) {
|
1652
|
-
if (err
|
1649
|
+
if (err instanceof recurly.errors.NotFoundError) {
|
1653
1650
|
// If the request was not found, you may want to alert the user or
|
1654
1651
|
// just return null
|
1655
1652
|
console.log('Resource Not Found')
|
1656
1653
|
}
|
1657
|
-
// If we don't know what to do with the err, we should
|
1658
|
-
// probably re-raise and let our web framework and logger handle it
|
1659
|
-
throw err
|
1660
1654
|
}
|
1661
1655
|
- lang: Python
|
1662
1656
|
source: |
|
@@ -1974,8 +1968,8 @@ paths:
|
|
1974
1968
|
summary: Set an account's billing information
|
1975
1969
|
description: |
|
1976
1970
|
If you're using Recurly.js to securely submit data from webforms without sending it through your server,
|
1977
|
-
you can associate the billing information with an account by passing in the `token_id`.
|
1978
|
-
|
1971
|
+
you can associate the billing information with an account by passing in the `token_id`. The only other
|
1972
|
+
field permitted with `token_id` is `primary_payment_method`.
|
1979
1973
|
|
1980
1974
|
For credit card payments you'll need the following required fields:
|
1981
1975
|
|
@@ -2250,6 +2244,221 @@ paths:
|
|
2250
2244
|
{\n\t\tfmt.Printf(\"Resource not found: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected
|
2251
2245
|
Recurly error: %v\", e)\n\treturn nil, err\n}\n\nfmt.Printf(\"Removed Billing
|
2252
2246
|
Info: %v\", billingInfo)"
|
2247
|
+
"/sites/{site_id}/accounts/{account_id}/billing_infos":
|
2248
|
+
get:
|
2249
|
+
tags:
|
2250
|
+
- account
|
2251
|
+
- billing_info
|
2252
|
+
operationId: list_billing_infos
|
2253
|
+
summary: Get the list of billing information associated with an account
|
2254
|
+
description: See the [Pagination Guide](/guides/pagination.html) to learn how
|
2255
|
+
to use pagination in the API and Client Libraries.
|
2256
|
+
parameters:
|
2257
|
+
- "$ref": "#/components/parameters/site_id"
|
2258
|
+
- "$ref": "#/components/parameters/account_id"
|
2259
|
+
- "$ref": "#/components/parameters/ids"
|
2260
|
+
- "$ref": "#/components/parameters/sort_dates"
|
2261
|
+
- "$ref": "#/components/parameters/filter_begin_time"
|
2262
|
+
- "$ref": "#/components/parameters/filter_end_time"
|
2263
|
+
responses:
|
2264
|
+
'200':
|
2265
|
+
description: A list of the the billing information for an account's
|
2266
|
+
content:
|
2267
|
+
application/json:
|
2268
|
+
schema:
|
2269
|
+
"$ref": "#/components/schemas/BillingInfoList"
|
2270
|
+
'400':
|
2271
|
+
description: Invalid or unpermitted parameter
|
2272
|
+
content:
|
2273
|
+
application/json:
|
2274
|
+
schema:
|
2275
|
+
"$ref": "#/components/schemas/Error"
|
2276
|
+
'404':
|
2277
|
+
description: Incorrect site or account
|
2278
|
+
content:
|
2279
|
+
application/json:
|
2280
|
+
schema:
|
2281
|
+
"$ref": "#/components/schemas/Error"
|
2282
|
+
x-code-samples: []
|
2283
|
+
post:
|
2284
|
+
tags:
|
2285
|
+
- account
|
2286
|
+
- billing_info
|
2287
|
+
operationId: create_billing_info
|
2288
|
+
summary: Set an account's billing information when the wallet feature is enabled
|
2289
|
+
description: |
|
2290
|
+
If you're using Recurly.js to securely submit data from webforms without sending it through your server,
|
2291
|
+
you can associate the billing information with an account by passing in the `token_id`. The only other
|
2292
|
+
field permitted with `token_id` is `primary_payment_method`.
|
2293
|
+
|
2294
|
+
For credit card payments you'll need the following required fields:
|
2295
|
+
|
2296
|
+
- first_name
|
2297
|
+
- last_name
|
2298
|
+
- number
|
2299
|
+
- month
|
2300
|
+
- year
|
2301
|
+
|
2302
|
+
For external (not Recurly.js) tokenized payments you'll need the following required fields:
|
2303
|
+
|
2304
|
+
- first_name
|
2305
|
+
- last_name
|
2306
|
+
- gateway_token
|
2307
|
+
- gateway_code
|
2308
|
+
parameters:
|
2309
|
+
- "$ref": "#/components/parameters/site_id"
|
2310
|
+
- "$ref": "#/components/parameters/account_id"
|
2311
|
+
requestBody:
|
2312
|
+
content:
|
2313
|
+
application/json:
|
2314
|
+
schema:
|
2315
|
+
"$ref": "#/components/schemas/BillingInfoCreate"
|
2316
|
+
required: true
|
2317
|
+
responses:
|
2318
|
+
'200':
|
2319
|
+
description: Updated billing information.
|
2320
|
+
content:
|
2321
|
+
application/json:
|
2322
|
+
schema:
|
2323
|
+
"$ref": "#/components/schemas/BillingInfo"
|
2324
|
+
'400':
|
2325
|
+
description: Bad request, perhaps invalid JSON?
|
2326
|
+
content:
|
2327
|
+
application/json:
|
2328
|
+
schema:
|
2329
|
+
"$ref": "#/components/schemas/Error"
|
2330
|
+
'404':
|
2331
|
+
description: Incorrect site or account ID.
|
2332
|
+
content:
|
2333
|
+
application/json:
|
2334
|
+
schema:
|
2335
|
+
"$ref": "#/components/schemas/Error"
|
2336
|
+
'422':
|
2337
|
+
description: Invalid billing information, or error running the verification
|
2338
|
+
transaction.
|
2339
|
+
content:
|
2340
|
+
application/json:
|
2341
|
+
schema:
|
2342
|
+
"$ref": "#/components/schemas/ErrorMayHaveTransaction"
|
2343
|
+
x-code-samples: []
|
2344
|
+
"/sites/{site_id}/accounts/{account_id}/billing_infos/{billing_info_id}":
|
2345
|
+
get:
|
2346
|
+
tags:
|
2347
|
+
- account
|
2348
|
+
- billing_info
|
2349
|
+
operationId: get_a_billing_info
|
2350
|
+
summary: Fetch a billing info
|
2351
|
+
parameters:
|
2352
|
+
- "$ref": "#/components/parameters/site_id"
|
2353
|
+
- "$ref": "#/components/parameters/account_id"
|
2354
|
+
- "$ref": "#/components/parameters/billing_info_id"
|
2355
|
+
responses:
|
2356
|
+
'200':
|
2357
|
+
description: A billing info.
|
2358
|
+
content:
|
2359
|
+
application/json:
|
2360
|
+
schema:
|
2361
|
+
"$ref": "#/components/schemas/BillingInfo"
|
2362
|
+
'404':
|
2363
|
+
description: Incorrect site, account, or billing info ID.
|
2364
|
+
content:
|
2365
|
+
application/json:
|
2366
|
+
schema:
|
2367
|
+
"$ref": "#/components/schemas/Error"
|
2368
|
+
x-code-samples: []
|
2369
|
+
put:
|
2370
|
+
tags:
|
2371
|
+
- account
|
2372
|
+
- billing_info
|
2373
|
+
operationId: update_a_billing_info
|
2374
|
+
summary: Update an account's billing information
|
2375
|
+
description: |
|
2376
|
+
If you're using Recurly.js to securely submit data from webforms without sending it through your server,
|
2377
|
+
you can associate the billing information with an account by passing in the `token_id`. The only other
|
2378
|
+
field permitted with `token_id` is `primary_payment_method`.
|
2379
|
+
|
2380
|
+
For credit card payments you'll need the following required fields:
|
2381
|
+
|
2382
|
+
- first_name
|
2383
|
+
- last_name
|
2384
|
+
- number
|
2385
|
+
- month
|
2386
|
+
- year
|
2387
|
+
|
2388
|
+
For external (not Recurly.js) tokenized payments you'll need the following required fields:
|
2389
|
+
|
2390
|
+
- first_name
|
2391
|
+
- last_name
|
2392
|
+
- gateway_token
|
2393
|
+
- gateway_code
|
2394
|
+
parameters:
|
2395
|
+
- "$ref": "#/components/parameters/site_id"
|
2396
|
+
- "$ref": "#/components/parameters/account_id"
|
2397
|
+
- "$ref": "#/components/parameters/billing_info_id"
|
2398
|
+
requestBody:
|
2399
|
+
content:
|
2400
|
+
application/json:
|
2401
|
+
schema:
|
2402
|
+
"$ref": "#/components/schemas/BillingInfoCreate"
|
2403
|
+
required: true
|
2404
|
+
responses:
|
2405
|
+
'200':
|
2406
|
+
description: Updated billing information.
|
2407
|
+
content:
|
2408
|
+
application/json:
|
2409
|
+
schema:
|
2410
|
+
"$ref": "#/components/schemas/BillingInfo"
|
2411
|
+
'400':
|
2412
|
+
description: Bad request, perhaps invalid JSON?
|
2413
|
+
content:
|
2414
|
+
application/json:
|
2415
|
+
schema:
|
2416
|
+
"$ref": "#/components/schemas/Error"
|
2417
|
+
'404':
|
2418
|
+
description: Incorrect site or account ID.
|
2419
|
+
content:
|
2420
|
+
application/json:
|
2421
|
+
schema:
|
2422
|
+
"$ref": "#/components/schemas/Error"
|
2423
|
+
'422':
|
2424
|
+
description: Invalid billing information, or error running the verification
|
2425
|
+
transaction.
|
2426
|
+
content:
|
2427
|
+
application/json:
|
2428
|
+
schema:
|
2429
|
+
"$ref": "#/components/schemas/ErrorMayHaveTransaction"
|
2430
|
+
x-code-samples: []
|
2431
|
+
delete:
|
2432
|
+
tags:
|
2433
|
+
- account
|
2434
|
+
- billing_info
|
2435
|
+
operationId: remove_a_billing_info
|
2436
|
+
summary: Remove an account's billing information
|
2437
|
+
parameters:
|
2438
|
+
- "$ref": "#/components/parameters/site_id"
|
2439
|
+
- "$ref": "#/components/parameters/account_id"
|
2440
|
+
- "$ref": "#/components/parameters/billing_info_id"
|
2441
|
+
description: You may remove any stored billing information for an account. If
|
2442
|
+
the account has a subscription, the renewal will go into dunning unless the
|
2443
|
+
billing information is updated before the renewal occurs.
|
2444
|
+
responses:
|
2445
|
+
'204':
|
2446
|
+
description: Billing information deleted
|
2447
|
+
'404':
|
2448
|
+
description: Account has no billing information, or incorrect site or account
|
2449
|
+
ID.
|
2450
|
+
content:
|
2451
|
+
application/json:
|
2452
|
+
schema:
|
2453
|
+
"$ref": "#/components/schemas/Error"
|
2454
|
+
'422':
|
2455
|
+
description: Billing info cannot be deleted. Please set a new primary billing
|
2456
|
+
info before deleting this billing info
|
2457
|
+
content:
|
2458
|
+
application/json:
|
2459
|
+
schema:
|
2460
|
+
"$ref": "#/components/schemas/Error"
|
2461
|
+
x-code-samples: []
|
2253
2462
|
"/sites/{site_id}/accounts/{account_id}/coupon_redemptions":
|
2254
2463
|
get:
|
2255
2464
|
tags:
|
@@ -2266,6 +2475,7 @@ paths:
|
|
2266
2475
|
- "$ref": "#/components/parameters/sort_dates"
|
2267
2476
|
- "$ref": "#/components/parameters/filter_begin_time"
|
2268
2477
|
- "$ref": "#/components/parameters/filter_end_time"
|
2478
|
+
- "$ref": "#/components/parameters/filter_state"
|
2269
2479
|
responses:
|
2270
2480
|
'200':
|
2271
2481
|
description: A list of the the coupon redemptions on an account.
|
@@ -2462,7 +2672,7 @@ paths:
|
|
2462
2672
|
- account
|
2463
2673
|
- coupon_redemption
|
2464
2674
|
operationId: create_coupon_redemption
|
2465
|
-
summary: Generate an active coupon redemption on an account
|
2675
|
+
summary: Generate an active coupon redemption on an account or subscription
|
2466
2676
|
parameters:
|
2467
2677
|
- "$ref": "#/components/parameters/site_id"
|
2468
2678
|
- "$ref": "#/components/parameters/account_id"
|
@@ -5527,7 +5737,108 @@ paths:
|
|
5527
5737
|
application/json:
|
5528
5738
|
schema:
|
5529
5739
|
"$ref": "#/components/schemas/Error"
|
5530
|
-
x-code-samples:
|
5740
|
+
x-code-samples:
|
5741
|
+
- lang: Node.js
|
5742
|
+
source: |
|
5743
|
+
try {
|
5744
|
+
const coupon = await client.restoreCoupon(couponId, {
|
5745
|
+
name: "New Coupon Name"
|
5746
|
+
})
|
5747
|
+
console.log('Restored coupon: ', coupon.code)
|
5748
|
+
} catch (err) {
|
5749
|
+
if (err instanceof recurly.errors.NotFoundError) {
|
5750
|
+
// If the request was not found, you may want to alert the user or
|
5751
|
+
// just return null
|
5752
|
+
console.log('Resource Not Found')
|
5753
|
+
}
|
5754
|
+
|
5755
|
+
}
|
5756
|
+
- lang: Python
|
5757
|
+
source: |
|
5758
|
+
try:
|
5759
|
+
coupon = client.restore_coupon(coupon_id, {
|
5760
|
+
"name": "New Coupon Name"
|
5761
|
+
})
|
5762
|
+
print("Restored Coupon %s" % coupon)
|
5763
|
+
except recurly.errors.NotFoundError:
|
5764
|
+
# If the resource was not found, you may want to alert the user or
|
5765
|
+
# just return nil
|
5766
|
+
print("Resource Not Found")
|
5767
|
+
- lang: ".NET"
|
5768
|
+
source: |
|
5769
|
+
try
|
5770
|
+
{
|
5771
|
+
var couponReq = new CouponUpdate() {
|
5772
|
+
Name = "New Coupon Name"
|
5773
|
+
};
|
5774
|
+
Coupon coupon = client.RestoreCoupon(couponId, couponReq);
|
5775
|
+
Console.WriteLine($"Restored coupon {coupon.Code}");
|
5776
|
+
}
|
5777
|
+
catch (Recurly.Errors.Validation ex)
|
5778
|
+
{
|
5779
|
+
// If the request was not valid, you may want to tell your user
|
5780
|
+
// why. You can find the invalid params and reasons in ex.Error.Params
|
5781
|
+
Console.WriteLine($"Failed validation: {ex.Error.Message}");
|
5782
|
+
}
|
5783
|
+
catch (Recurly.Errors.ApiError ex)
|
5784
|
+
{
|
5785
|
+
// Use ApiError to catch a generic error from the API
|
5786
|
+
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
|
5787
|
+
}
|
5788
|
+
- lang: Ruby
|
5789
|
+
source: |
|
5790
|
+
begin
|
5791
|
+
coupon = @client.restore_coupon(coupon_id: coupon_id, body: {
|
5792
|
+
name: "New Coupon Name"
|
5793
|
+
})
|
5794
|
+
puts "Restored coupon #{coupon}"
|
5795
|
+
rescue Recurly::Errors::NotFoundError
|
5796
|
+
# If the resource was not found, you may want to alert the user or
|
5797
|
+
# just return nil
|
5798
|
+
puts "Resource Not Found"
|
5799
|
+
end
|
5800
|
+
- lang: Java
|
5801
|
+
source: |
|
5802
|
+
try {
|
5803
|
+
final CouponUpdate couponUpdate = new CouponUpdate();
|
5804
|
+
couponUpdate.setName("New Coupon Name");
|
5805
|
+
|
5806
|
+
final Coupon coupon = client.restoreCoupon(couponId, couponUpdate);
|
5807
|
+
System.out.println("Restored coupon: " + coupon.getCode());
|
5808
|
+
} catch (ValidationException e) {
|
5809
|
+
// If the request was not valid, you may want to tell your user
|
5810
|
+
// why. You can find the invalid params and reasons in e.getError().getParams()
|
5811
|
+
System.out.println("Failed validation: " + e.getError().getMessage());
|
5812
|
+
} catch (ApiException e) {
|
5813
|
+
// Use ApiException to catch a generic error from the API
|
5814
|
+
System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
|
5815
|
+
}
|
5816
|
+
- lang: PHP
|
5817
|
+
source: |
|
5818
|
+
try {
|
5819
|
+
$coupon_update = [
|
5820
|
+
"name" => "New Coupon Name"
|
5821
|
+
];
|
5822
|
+
$coupon = $client->restoreCoupon($coupon_id, $coupon_update);
|
5823
|
+
|
5824
|
+
echo 'Restored Coupon:' . PHP_EOL;
|
5825
|
+
var_dump($coupon);
|
5826
|
+
} catch (\Recurly\Errors\NotFound $e) {
|
5827
|
+
// Could not find the resource, you may want to inform the user
|
5828
|
+
// or just return a NULL
|
5829
|
+
echo 'Could not find resource.' . PHP_EOL;
|
5830
|
+
var_dump($e);
|
5831
|
+
} catch (\Recurly\RecurlyError $e) {
|
5832
|
+
// Something bad happened... tell the user so that they can fix it?
|
5833
|
+
echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
|
5834
|
+
}
|
5835
|
+
- lang: Go
|
5836
|
+
source: "updateReq := &recurly.CouponUpdate{\n\tName: recurly.String(\"New
|
5837
|
+
Coupon Name\"),\n}\ncoupon, err := client.RestoreCoupon(couponId, updateReq)\nif
|
5838
|
+
e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeValidation
|
5839
|
+
{\n\t\tfmt.Printf(\"Failed validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected
|
5840
|
+
Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Restored Coupon:
|
5841
|
+
%s\", coupon.Id)"
|
5531
5842
|
"/sites/{site_id}/coupons/{coupon_id}/unique_coupon_codes":
|
5532
5843
|
get:
|
5533
5844
|
tags:
|
@@ -6526,14 +6837,11 @@ paths:
|
|
6526
6837
|
const item = await client.deactivateItem(itemId)
|
6527
6838
|
console.log('Deleted item: ', item.code)
|
6528
6839
|
} catch (err) {
|
6529
|
-
if (err
|
6840
|
+
if (err instanceof recurly.errors.NotFoundError) {
|
6530
6841
|
// If the request was not found, you may want to alert the user or
|
6531
6842
|
// just return null
|
6532
6843
|
console.log('Resource Not Found')
|
6533
6844
|
}
|
6534
|
-
// If we don't know what to do with the err, we should
|
6535
|
-
// probably re-raise and let our web framework and logger handle it
|
6536
|
-
throw err
|
6537
6845
|
}
|
6538
6846
|
- lang: Python
|
6539
6847
|
source: |
|
@@ -6650,14 +6958,11 @@ paths:
|
|
6650
6958
|
const item = await client.reactivateItem(itemId)
|
6651
6959
|
console.log('Reactivated item: ', item.code)
|
6652
6960
|
} catch (err) {
|
6653
|
-
if (err
|
6961
|
+
if (err instanceof recurly.errors.NotFoundError) {
|
6654
6962
|
// If the request was not found, you may want to alert the user or
|
6655
6963
|
// just return null
|
6656
6964
|
console.log('Resource Not Found')
|
6657
6965
|
}
|
6658
|
-
// If we don't know what to do with the err, we should
|
6659
|
-
// probably re-raise and let our web framework and logger handle it
|
6660
|
-
throw err
|
6661
6966
|
}
|
6662
6967
|
- lang: Python
|
6663
6968
|
source: |
|
@@ -11236,6 +11541,16 @@ paths:
|
|
11236
11541
|
- partial
|
11237
11542
|
- none
|
11238
11543
|
default: none
|
11544
|
+
- name: charge
|
11545
|
+
in: query
|
11546
|
+
description: Applicable only if the subscription has usage based add-ons and
|
11547
|
+
unbilled usage logged for the current billing cycle. If true, current billing
|
11548
|
+
cycle unbilled usage is billed on the final invoice. If false, Recurly will
|
11549
|
+
create a negative usage record for current billing cycle usage that will
|
11550
|
+
zero out the final invoice line items.
|
11551
|
+
schema:
|
11552
|
+
default: true
|
11553
|
+
type: boolean
|
11239
11554
|
responses:
|
11240
11555
|
'200':
|
11241
11556
|
description: An expired subscription.
|
@@ -13933,6 +14248,13 @@ components:
|
|
13933
14248
|
required: true
|
13934
14249
|
schema:
|
13935
14250
|
type: string
|
14251
|
+
billing_info_id:
|
14252
|
+
name: billing_info_id
|
14253
|
+
in: path
|
14254
|
+
description: Billing Info ID.
|
14255
|
+
required: true
|
14256
|
+
schema:
|
14257
|
+
type: string
|
13936
14258
|
usage_id:
|
13937
14259
|
name: usage_id
|
13938
14260
|
in: path
|
@@ -14360,6 +14682,23 @@ components:
|
|
14360
14682
|
type: array
|
14361
14683
|
items:
|
14362
14684
|
"$ref": "#/components/schemas/AddOn"
|
14685
|
+
BillingInfoList:
|
14686
|
+
type: object
|
14687
|
+
properties:
|
14688
|
+
object:
|
14689
|
+
type: string
|
14690
|
+
title: Object type
|
14691
|
+
description: Will always be List.
|
14692
|
+
has_more:
|
14693
|
+
type: boolean
|
14694
|
+
description: Indicates there are more results on subsequent pages.
|
14695
|
+
next:
|
14696
|
+
type: string
|
14697
|
+
description: Path to subsequent page of results.
|
14698
|
+
data:
|
14699
|
+
type: array
|
14700
|
+
items:
|
14701
|
+
"$ref": "#/components/schemas/BillingInfo"
|
14363
14702
|
CreditPaymentList:
|
14364
14703
|
type: object
|
14365
14704
|
properties:
|
@@ -14815,7 +15154,7 @@ components:
|
|
14815
15154
|
maxLength: 255
|
14816
15155
|
company:
|
14817
15156
|
type: string
|
14818
|
-
maxLength:
|
15157
|
+
maxLength: 100
|
14819
15158
|
vat_number:
|
14820
15159
|
type: string
|
14821
15160
|
description: The VAT number of the account (to avoid having the VAT applied).
|
@@ -15717,6 +16056,16 @@ components:
|
|
15717
16056
|
risk_rules_triggered:
|
15718
16057
|
type: object
|
15719
16058
|
title: Kount rules
|
16059
|
+
primary_payment_method:
|
16060
|
+
type: boolean
|
16061
|
+
description: The `primary_payment_method` indicator is used to designate
|
16062
|
+
the primary billing info on the account. The first billing info created
|
16063
|
+
on an account will always become primary. Adding additional billing infos
|
16064
|
+
provides the flexibility to mark another billing info as primary, or adding
|
16065
|
+
additional non-primary billing infos. This can be accomplished by passing
|
16066
|
+
the `primary_payment_method` indicator. When adding billing infos via
|
16067
|
+
the billing_info and /accounts endpoints, this value is not permitted,
|
16068
|
+
and will return an error if provided.
|
15720
16069
|
created_at:
|
15721
16070
|
type: string
|
15722
16071
|
format: date-time
|
@@ -15857,6 +16206,28 @@ components:
|
|
15857
16206
|
- checking
|
15858
16207
|
- savings
|
15859
16208
|
description: The bank account type. (ACH only)
|
16209
|
+
tax_identifier:
|
16210
|
+
type: string
|
16211
|
+
description: Tax identifier is required if adding a billing info that is
|
16212
|
+
a consumer card in Brazil. This would be the customer's CPF, CPF is a
|
16213
|
+
Brazilian tax identifier for all tax paying residents.
|
16214
|
+
tax_identifier_type:
|
16215
|
+
type: string
|
16216
|
+
enum:
|
16217
|
+
- cpf
|
16218
|
+
description: this field and a value of 'cpf' are required if adding a billing
|
16219
|
+
info that is an elo or hipercard type in Brazil.
|
16220
|
+
primary_payment_method:
|
16221
|
+
type: boolean
|
16222
|
+
title: Primary Payment Method
|
16223
|
+
description: The `primary_payment_method` indicator is used to designate
|
16224
|
+
the primary billing info on the account. The first billing info created
|
16225
|
+
on an account will always become primary. Adding additional billing infos
|
16226
|
+
provides the flexibility to mark another billing info as primary, or adding
|
16227
|
+
additional non-primary billing infos. This can be accomplished by passing
|
16228
|
+
the `primary_payment_method` indicator. When adding billing infos via
|
16229
|
+
the billing_info and /accounts endpoints, this value is not permitted,
|
16230
|
+
and will return an error if provided.
|
15860
16231
|
Coupon:
|
15861
16232
|
type: object
|
15862
16233
|
properties:
|
@@ -15955,6 +16326,13 @@ components:
|
|
15955
16326
|
description: The coupon is valid for all plans if true. If false then `plans`
|
15956
16327
|
and `plans_names` will list the applicable plans.
|
15957
16328
|
default: true
|
16329
|
+
applies_to_all_items:
|
16330
|
+
type: boolean
|
16331
|
+
title: Applies to all items?
|
16332
|
+
description: |
|
16333
|
+
The coupon is valid for all items if true. If false then `items`
|
16334
|
+
will list the applicable items.
|
16335
|
+
default: false
|
15958
16336
|
applies_to_non_plan_charges:
|
15959
16337
|
type: boolean
|
15960
16338
|
title: Applied to all non-plan charges?
|
@@ -15973,6 +16351,14 @@ components:
|
|
15973
16351
|
`null` if `applies_to_all_plans=true`.
|
15974
16352
|
items:
|
15975
16353
|
"$ref": "#/components/schemas/PlanMini"
|
16354
|
+
items:
|
16355
|
+
type: array
|
16356
|
+
title: Items
|
16357
|
+
description: |
|
16358
|
+
A list of items for which this coupon applies. This will be
|
16359
|
+
`null` if `applies_to_all_items=true`.
|
16360
|
+
items:
|
16361
|
+
"$ref": "#/components/schemas/ItemMini"
|
15976
16362
|
redemption_resource:
|
15977
16363
|
type: string
|
15978
16364
|
title: Redemption resource
|
@@ -16101,6 +16487,16 @@ components:
|
|
16101
16487
|
The coupon is valid for all plans if true. If false then
|
16102
16488
|
`plans` and `plans_names` will list the applicable plans.
|
16103
16489
|
default: true
|
16490
|
+
applies_to_all_items:
|
16491
|
+
type: boolean
|
16492
|
+
title: Applies to all items?
|
16493
|
+
description: |
|
16494
|
+
To apply coupon to Items in your Catalog, include a list
|
16495
|
+
of `item_codes` in the request that the coupon will apply to. Or set value
|
16496
|
+
to true to apply to all Items in your Catalog. The following values
|
16497
|
+
are not permitted when `applies_to_all_items` is included: `free_trial_amount`
|
16498
|
+
and `free_trial_unit`.
|
16499
|
+
default: false
|
16104
16500
|
plan_codes:
|
16105
16501
|
type: array
|
16106
16502
|
title: Plan codes
|
@@ -16110,6 +16506,16 @@ components:
|
|
16110
16506
|
when `applies_to_all_plans` is true.
|
16111
16507
|
items:
|
16112
16508
|
type: string
|
16509
|
+
item_codes:
|
16510
|
+
type: array
|
16511
|
+
title: Item codes
|
16512
|
+
description: |
|
16513
|
+
List of item codes to which this coupon applies. Sending
|
16514
|
+
`item_codes` is only permitted when `applies_to_all_items` is set to false.
|
16515
|
+
The following values are not permitted when `item_codes` is included:
|
16516
|
+
`free_trial_amount` and `free_trial_unit`.
|
16517
|
+
items:
|
16518
|
+
type: string
|
16113
16519
|
duration:
|
16114
16520
|
type: string
|
16115
16521
|
title: Duration
|
@@ -16305,6 +16711,9 @@ components:
|
|
16305
16711
|
description: The Account on which the coupon was applied.
|
16306
16712
|
readOnly: true
|
16307
16713
|
"$ref": "#/components/schemas/AccountMini"
|
16714
|
+
subscription_id:
|
16715
|
+
type: string
|
16716
|
+
title: Subscription ID
|
16308
16717
|
coupon:
|
16309
16718
|
"$ref": "#/components/schemas/Coupon"
|
16310
16719
|
state:
|
@@ -16352,6 +16761,9 @@ components:
|
|
16352
16761
|
title: Currency
|
16353
16762
|
description: 3-letter ISO 4217 currency code.
|
16354
16763
|
maxLength: 3
|
16764
|
+
subscription_id:
|
16765
|
+
type: string
|
16766
|
+
title: Subscription ID
|
16355
16767
|
required:
|
16356
16768
|
- coupon_id
|
16357
16769
|
CouponRedemptionMini:
|
@@ -16926,6 +17338,13 @@ components:
|
|
16926
17338
|
- voided
|
16927
17339
|
account:
|
16928
17340
|
"$ref": "#/components/schemas/AccountMini"
|
17341
|
+
billing_info_id:
|
17342
|
+
type: string
|
17343
|
+
title: Billing info ID
|
17344
|
+
description: The `billing_info_id` is the value that represents a specific
|
17345
|
+
billing info for an end customer. When `billing_info_id` is used to assign
|
17346
|
+
billing info to the subscription, all future billing events for the subscription
|
17347
|
+
will bill to the specified billing info.
|
16929
17348
|
subscription_ids:
|
16930
17349
|
type: array
|
16931
17350
|
title: Subscription IDs
|
@@ -17167,6 +17586,13 @@ components:
|
|
17167
17586
|
mail order and telephone transactions.
|
17168
17587
|
enum:
|
17169
17588
|
- moto
|
17589
|
+
billing_info_id:
|
17590
|
+
type: string
|
17591
|
+
title: Billing Info ID
|
17592
|
+
description: The `billing_info_id` is the value that represents a specific
|
17593
|
+
billing info for an end customer. When `billing_info_id` is used to assign
|
17594
|
+
billing info to the subscription, all future billing events for the subscription
|
17595
|
+
will bill to the specified billing info.
|
17170
17596
|
InvoiceCollection:
|
17171
17597
|
type: object
|
17172
17598
|
title: Invoice collection
|
@@ -18311,13 +18737,13 @@ components:
|
|
18311
18737
|
the setup fee will be charged at the time of signup. Setup fees do not
|
18312
18738
|
increase with the quantity of a subscription plan.
|
18313
18739
|
minimum: 0
|
18314
|
-
maximum:
|
18740
|
+
maximum: 1000000
|
18315
18741
|
unit_amount:
|
18316
18742
|
type: number
|
18317
18743
|
format: float
|
18318
18744
|
title: Unit price
|
18319
18745
|
minimum: 0
|
18320
|
-
maximum:
|
18746
|
+
maximum: 1000000
|
18321
18747
|
PlanUpdate:
|
18322
18748
|
type: object
|
18323
18749
|
properties:
|
@@ -18450,11 +18876,6 @@ components:
|
|
18450
18876
|
type: object
|
18451
18877
|
title: Hosted pages settings
|
18452
18878
|
"$ref": "#/components/schemas/PlanHostedPages"
|
18453
|
-
add_ons:
|
18454
|
-
type: array
|
18455
|
-
title: Add Ons
|
18456
|
-
items:
|
18457
|
-
"$ref": "#/components/schemas/AddOnCreate"
|
18458
18879
|
allow_any_item_on_subscriptions:
|
18459
18880
|
type: boolean
|
18460
18881
|
title: Allow any item on subscriptions
|
@@ -18475,7 +18896,7 @@ components:
|
|
18475
18896
|
format: float
|
18476
18897
|
title: Unit price
|
18477
18898
|
minimum: 0
|
18478
|
-
maximum:
|
18899
|
+
maximum: 1000000
|
18479
18900
|
required:
|
18480
18901
|
- currency
|
18481
18902
|
- unit_amount
|
@@ -18492,7 +18913,7 @@ components:
|
|
18492
18913
|
format: float
|
18493
18914
|
title: Unit price
|
18494
18915
|
minimum: 0
|
18495
|
-
maximum:
|
18916
|
+
maximum: 1000000
|
18496
18917
|
required:
|
18497
18918
|
- currency
|
18498
18919
|
- unit_amount
|
@@ -19001,6 +19422,8 @@ components:
|
|
19001
19422
|
coupon_redemptions:
|
19002
19423
|
type: array
|
19003
19424
|
title: Coupon redemptions
|
19425
|
+
description: Returns subscription level coupon redemptions that are tied
|
19426
|
+
to this subscription.
|
19004
19427
|
items:
|
19005
19428
|
"$ref": "#/components/schemas/CouponRedemptionMini"
|
19006
19429
|
pending_change:
|
@@ -19165,6 +19588,10 @@ components:
|
|
19165
19588
|
set. This timestamp is used for alerting customers to reauthorize in 3
|
19166
19589
|
years in accordance with NACHA rules. If a subscription becomes inactive
|
19167
19590
|
or the billing info is no longer a bank account, this timestamp is cleared.
|
19591
|
+
billing_info_id:
|
19592
|
+
type: string
|
19593
|
+
title: Billing Info ID
|
19594
|
+
description: Billing Info ID.
|
19168
19595
|
SubscriptionAddOn:
|
19169
19596
|
type: object
|
19170
19597
|
title: Subscription Add-on
|
@@ -19285,6 +19712,7 @@ components:
|
|
19285
19712
|
* Optionally, override the add-on's default unit amount.
|
19286
19713
|
* If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount` must be absent.
|
19287
19714
|
minimum: 0
|
19715
|
+
maximum: 1000000
|
19288
19716
|
tiers:
|
19289
19717
|
type: array
|
19290
19718
|
title: Tiers
|
@@ -19358,6 +19786,7 @@ components:
|
|
19358
19786
|
title: Unit amount
|
19359
19787
|
description: Optionally, override the add-on's default unit amount.
|
19360
19788
|
minimum: 0
|
19789
|
+
maximum: 1000000
|
19361
19790
|
tiers:
|
19362
19791
|
type: array
|
19363
19792
|
title: Tiers
|
@@ -19398,6 +19827,7 @@ components:
|
|
19398
19827
|
format: float
|
19399
19828
|
title: Unit amount
|
19400
19829
|
minimum: 0
|
19830
|
+
maximum: 1000000
|
19401
19831
|
SubscriptionCancel:
|
19402
19832
|
type: object
|
19403
19833
|
properties:
|
@@ -19530,7 +19960,7 @@ components:
|
|
19530
19960
|
the plan's default unit amount. The subscription's current currency will
|
19531
19961
|
be used.
|
19532
19962
|
minimum: 0
|
19533
|
-
maximum:
|
19963
|
+
maximum: 1000000
|
19534
19964
|
quantity:
|
19535
19965
|
type: integer
|
19536
19966
|
title: Quantity
|
@@ -19655,6 +20085,13 @@ components:
|
|
19655
20085
|
are provided the `plan_id` will be used.
|
19656
20086
|
account:
|
19657
20087
|
"$ref": "#/components/schemas/AccountCreate"
|
20088
|
+
billing_info_id:
|
20089
|
+
type: string
|
20090
|
+
title: Billing Info ID
|
20091
|
+
description: The `billing_info_id` is the value that represents a specific
|
20092
|
+
billing info for an end customer. When `billing_info_id` is used to assign
|
20093
|
+
billing info to the subscription, all future billing events for the subscription
|
20094
|
+
will bill to the specified billing info.
|
19658
20095
|
shipping:
|
19659
20096
|
title: Shipping address
|
19660
20097
|
description: Create a shipping address on the account and assign it to the
|
@@ -19680,7 +20117,7 @@ components:
|
|
19680
20117
|
this value. If not provided, the subscription will inherit the price from
|
19681
20118
|
the subscription plan for the provided currency.
|
19682
20119
|
minimum: 0
|
19683
|
-
maximum:
|
20120
|
+
maximum: 1000000
|
19684
20121
|
quantity:
|
19685
20122
|
type: integer
|
19686
20123
|
title: Quantity
|
@@ -19814,7 +20251,7 @@ components:
|
|
19814
20251
|
this value in cents. If not provided, the subscription will inherit the
|
19815
20252
|
price from the subscription plan for the provided currency.
|
19816
20253
|
minimum: 0
|
19817
|
-
maximum:
|
20254
|
+
maximum: 1000000
|
19818
20255
|
quantity:
|
19819
20256
|
type: integer
|
19820
20257
|
title: Quantity
|
@@ -19957,6 +20394,13 @@ components:
|
|
19957
20394
|
default: 0
|
19958
20395
|
shipping:
|
19959
20396
|
"$ref": "#/components/schemas/SubscriptionShippingUpdate"
|
20397
|
+
billing_info_id:
|
20398
|
+
type: string
|
20399
|
+
title: Billing Info ID
|
20400
|
+
description: The `billing_info_id` is the value that represents a specific
|
20401
|
+
billing info for an end customer. When `billing_info_id` is used to assign
|
20402
|
+
billing info to the subscription, all future billing events for the subscription
|
20403
|
+
will bill to the specified billing info.
|
19960
20404
|
SubscriptionPause:
|
19961
20405
|
type: object
|
19962
20406
|
properties:
|
@@ -20581,6 +21025,13 @@ components:
|
|
20581
21025
|
maxLength: 3
|
20582
21026
|
account:
|
20583
21027
|
"$ref": "#/components/schemas/AccountPurchase"
|
21028
|
+
billing_info_id:
|
21029
|
+
type: string
|
21030
|
+
title: Billing info ID
|
21031
|
+
description: The `billing_info_id` is the value that represents a specific
|
21032
|
+
billing info for an end customer. When `billing_info_id` is used to assign
|
21033
|
+
billing info to the subscription, all future billing events for the subscription
|
21034
|
+
will bill to the specified billing info.
|
20584
21035
|
collection_method:
|
20585
21036
|
type: string
|
20586
21037
|
title: Collection method
|
@@ -20789,6 +21240,7 @@ components:
|
|
20789
21240
|
- invalid_permissions
|
20790
21241
|
- invalid_token
|
20791
21242
|
- not_found
|
21243
|
+
- service_not_available
|
20792
21244
|
- simultaneous_request
|
20793
21245
|
- transaction
|
20794
21246
|
- unauthorized
|