-
Notifications
You must be signed in to change notification settings - Fork 2
/
subscriptions.go
1401 lines (1215 loc) · 82.2 KB
/
subscriptions.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by the Paddle SDK Generator; DO NOT EDIT.
package paddle
import (
"context"
"encoding/json"
paddleerr "github.com/PaddleHQ/paddle-go-sdk/v3/pkg/paddleerr"
)
// ErrSubscriptionLockedRenewal represents a `subscription_locked_renewal` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_locked_renewal for more information.
var ErrSubscriptionLockedRenewal = &paddleerr.Error{
Code: "subscription_locked_renewal",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionLockedProcessing represents a `subscription_locked_processing` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_locked_processing for more information.
var ErrSubscriptionLockedProcessing = &paddleerr.Error{
Code: "subscription_locked_processing",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionLockedPendingChanges represents a `subscription_locked_pending_changes` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_locked_pending_changes for more information.
var ErrSubscriptionLockedPendingChanges = &paddleerr.Error{
Code: "subscription_locked_pending_changes",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionUpdateWhenCanceled represents a `subscription_update_when_canceled` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_update_when_canceled for more information.
var ErrSubscriptionUpdateWhenCanceled = &paddleerr.Error{
Code: "subscription_update_when_canceled",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionUpdateWhenTrialing represents a `subscription_update_when_trialing` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_update_when_trialing for more information.
var ErrSubscriptionUpdateWhenTrialing = &paddleerr.Error{
Code: "subscription_update_when_trialing",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionCannotBePaused represents a `subscription_cannot_be_paused` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_cannot_be_paused for more information.
var ErrSubscriptionCannotBePaused = &paddleerr.Error{
Code: "subscription_cannot_be_paused",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionIsCanceledActionInvalid represents a `subscription_is_canceled_action_invalid` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_is_canceled_action_invalid for more information.
var ErrSubscriptionIsCanceledActionInvalid = &paddleerr.Error{
Code: "subscription_is_canceled_action_invalid",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionIsInactiveActionInvalid represents a `subscription_is_inactive_action_invalid` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_is_inactive_action_invalid for more information.
var ErrSubscriptionIsInactiveActionInvalid = &paddleerr.Error{
Code: "subscription_is_inactive_action_invalid",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionUpdateWhenPastDue represents a `subscription_update_when_past_due` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_update_when_past_due for more information.
var ErrSubscriptionUpdateWhenPastDue = &paddleerr.Error{
Code: "subscription_update_when_past_due",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionNotAutomaticCollection represents a `subscription_not_automatic_collection` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_not_automatic_collection for more information.
var ErrSubscriptionNotAutomaticCollection = &paddleerr.Error{
Code: "subscription_not_automatic_collection",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionNotActive represents a `subscription_not_active` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_not_active for more information.
var ErrSubscriptionNotActive = &paddleerr.Error{
Code: "subscription_not_active",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionNextBilledAtTooSoon represents a `subscription_next_billed_at_too_soon` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_next_billed_at_too_soon for more information.
var ErrSubscriptionNextBilledAtTooSoon = &paddleerr.Error{
Code: "subscription_next_billed_at_too_soon",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionOutstandingTransaction represents a `subscription_outstanding_transaction` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_outstanding_transaction for more information.
var ErrSubscriptionOutstandingTransaction = &paddleerr.Error{
Code: "subscription_outstanding_transaction",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionMustBePaused represents a `subscription_must_be_paused` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_must_be_paused for more information.
var ErrSubscriptionMustBePaused = &paddleerr.Error{
Code: "subscription_must_be_paused",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionAllItemsRemoved represents a `subscription_all_items_removed` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_all_items_removed for more information.
var ErrSubscriptionAllItemsRemoved = &paddleerr.Error{
Code: "subscription_all_items_removed",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionItemsUpdateMissingProrationBillingMode represents a `subscription_items_update_missing_proration_billing_mode` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_items_update_missing_proration_billing_mode for more information.
var ErrSubscriptionItemsUpdateMissingProrationBillingMode = &paddleerr.Error{
Code: "subscription_items_update_missing_proration_billing_mode",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionDiscountNotValidForItems represents a `subscription_discount_not_valid_for_items` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_discount_not_valid_for_items for more information.
var ErrSubscriptionDiscountNotValidForItems = &paddleerr.Error{
Code: "subscription_discount_not_valid_for_items",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionOneOffDiscountNotValid represents a `subscription_one_off_discount_not_valid` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_one_off_discount_not_valid for more information.
var ErrSubscriptionOneOffDiscountNotValid = &paddleerr.Error{
Code: "subscription_one_off_discount_not_valid",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionDuplicatePriceIDs represents a `subscription_duplicate_price_ids` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_duplicate_price_ids for more information.
var ErrSubscriptionDuplicatePriceIDs = &paddleerr.Error{
Code: "subscription_duplicate_price_ids",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionScheduledChangeInvalidUpdate represents a `subscription_scheduled_change_invalid_update` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_scheduled_change_invalid_update for more information.
var ErrSubscriptionScheduledChangeInvalidUpdate = &paddleerr.Error{
Code: "subscription_scheduled_change_invalid_update",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionOnlyUpdateItemsOnPausedSubscription represents a `subscription_only_update_items_on_paused_subscription` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_only_update_items_on_paused_subscription for more information.
var ErrSubscriptionOnlyUpdateItemsOnPausedSubscription = &paddleerr.Error{
Code: "subscription_only_update_items_on_paused_subscription",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionIncorrectProrationOnPausedSubscription represents a `subscription_incorrect_proration_on_paused_subscription` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_incorrect_proration_on_paused_subscription for more information.
var ErrSubscriptionIncorrectProrationOnPausedSubscription = &paddleerr.Error{
Code: "subscription_incorrect_proration_on_paused_subscription",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionPaymentDeclined represents a `subscription_payment_declined` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_payment_declined for more information.
var ErrSubscriptionPaymentDeclined = &paddleerr.Error{
Code: "subscription_payment_declined",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionBillingDetailsRequired represents a `subscription_billing_details_required` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_billing_details_required for more information.
var ErrSubscriptionBillingDetailsRequired = &paddleerr.Error{
Code: "subscription_billing_details_required",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionNewItemsNotValid represents a `subscription_new_items_not_valid` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_new_items_not_valid for more information.
var ErrSubscriptionNewItemsNotValid = &paddleerr.Error{
Code: "subscription_new_items_not_valid",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionQuantityMissingForNewItems represents a `subscription_quantity_missing_for_new_items` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_quantity_missing_for_new_items for more information.
var ErrSubscriptionQuantityMissingForNewItems = &paddleerr.Error{
Code: "subscription_quantity_missing_for_new_items",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionChargeDuplicatePriceIDs represents a `subscription_charge_duplicate_price_ids` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_charge_duplicate_price_ids for more information.
var ErrSubscriptionChargeDuplicatePriceIDs = &paddleerr.Error{
Code: "subscription_charge_duplicate_price_ids",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionNoRecurringItemsRemain represents a `subscription_no_recurring_items_remain` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_no_recurring_items_remain for more information.
var ErrSubscriptionNoRecurringItemsRemain = &paddleerr.Error{
Code: "subscription_no_recurring_items_remain",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionQuantityNotValid represents a `subscription_quantity_not_valid` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_quantity_not_valid for more information.
var ErrSubscriptionQuantityNotValid = &paddleerr.Error{
Code: "subscription_quantity_not_valid",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionCurrencyCodeNotValidForManual represents a `subscription_currency_code_not_valid_for_manual` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_currency_code_not_valid_for_manual for more information.
var ErrSubscriptionCurrencyCodeNotValidForManual = &paddleerr.Error{
Code: "subscription_currency_code_not_valid_for_manual",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionCurrencyCodeIncompatibleWithPaymentMethodProvider represents a `subscription_currency_code_incompatible_with_payment_method_provider` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_currency_code_incompatible_with_payment_method_provider for more information.
var ErrSubscriptionCurrencyCodeIncompatibleWithPaymentMethodProvider = &paddleerr.Error{
Code: "subscription_currency_code_incompatible_with_payment_method_provider",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionCustomerNotSuitableForCollectionMode represents a `subscription_customer_not_suitable_for_collection_mode` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_customer_not_suitable_for_collection_mode for more information.
var ErrSubscriptionCustomerNotSuitableForCollectionMode = &paddleerr.Error{
Code: "subscription_customer_not_suitable_for_collection_mode",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionAddressNotSuitableForCollectionMode represents a `subscription_address_not_suitable_for_collection_mode` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_address_not_suitable_for_collection_mode for more information.
var ErrSubscriptionAddressNotSuitableForCollectionMode = &paddleerr.Error{
Code: "subscription_address_not_suitable_for_collection_mode",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionInvalidDiscountCurrency represents a `subscription_invalid_discount_currency` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_invalid_discount_currency for more information.
var ErrSubscriptionInvalidDiscountCurrency = &paddleerr.Error{
Code: "subscription_invalid_discount_currency",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionTrialingItemsUpdateInvalidOptions represents a `subscription_trialing_items_update_invalid_options` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_trialing_items_update_invalid_options for more information.
var ErrSubscriptionTrialingItemsUpdateInvalidOptions = &paddleerr.Error{
Code: "subscription_trialing_items_update_invalid_options",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionCannotActivate represents a `subscription_cannot_activate` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_cannot_activate for more information.
var ErrSubscriptionCannotActivate = &paddleerr.Error{
Code: "subscription_cannot_activate",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionOutstandingPendingRefund represents a `subscription_outstanding_pending_refund` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_outstanding_pending_refund for more information.
var ErrSubscriptionOutstandingPendingRefund = &paddleerr.Error{
Code: "subscription_outstanding_pending_refund",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionTrialingDiscountUpdateInvalidOptions represents a `subscription_trialing_discount_update_invalid_options` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_trialing_discount_update_invalid_options for more information.
var ErrSubscriptionTrialingDiscountUpdateInvalidOptions = &paddleerr.Error{
Code: "subscription_trialing_discount_update_invalid_options",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionUpdateTransactionBalanceLessThanChargeLimit represents a `subscription_update_transaction_balance_less_than_charge_limit` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_update_transaction_balance_less_than_charge_limit for more information.
var ErrSubscriptionUpdateTransactionBalanceLessThanChargeLimit = &paddleerr.Error{
Code: "subscription_update_transaction_balance_less_than_charge_limit",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionCustomerEmailDomainNotAllowed represents a `subscription_customer_email_domain_not_allowed` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_customer_email_domain_not_allowed for more information.
var ErrSubscriptionCustomerEmailDomainNotAllowed = &paddleerr.Error{
Code: "subscription_customer_email_domain_not_allowed",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionPaymentRetryAttemptsExceeded represents a `subscription_payment_retry_attempts_exceeded` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_payment_retry_attempts_exceeded for more information.
var ErrSubscriptionPaymentRetryAttemptsExceeded = &paddleerr.Error{
Code: "subscription_payment_retry_attempts_exceeded",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionManualRetryPaymentNotAllowed represents a `subscription_manual_retry_payment_not_allowed` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_manual_retry_payment_not_allowed for more information.
var ErrSubscriptionManualRetryPaymentNotAllowed = &paddleerr.Error{
Code: "subscription_manual_retry_payment_not_allowed",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionCurrencyUpdateNotAllowed represents a `subscription_currency_update_not_allowed` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_currency_update_not_allowed for more information.
var ErrSubscriptionCurrencyUpdateNotAllowed = &paddleerr.Error{
Code: "subscription_currency_update_not_allowed",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionUpdateDifferentCurrencyCredits represents a `subscription_update_different_currency_credits` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_update_different_currency_credits for more information.
var ErrSubscriptionUpdateDifferentCurrencyCredits = &paddleerr.Error{
Code: "subscription_update_different_currency_credits",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionCurrencyUpdateAndActionsCreatingCreditsNotAllowed represents a `subscription_currency_update_and_actions_creating_credits_not_allowed` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_currency_update_and_actions_creating_credits_not_allowed for more information.
var ErrSubscriptionCurrencyUpdateAndActionsCreatingCreditsNotAllowed = &paddleerr.Error{
Code: "subscription_currency_update_and_actions_creating_credits_not_allowed",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionCreditCreationAgainstUncompletedTransactionNotAllowed represents a `subscription_credit_creation_against_uncompleted_transaction_not_allowed` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_credit_creation_against_uncompleted_transaction_not_allowed for more information.
var ErrSubscriptionCreditCreationAgainstUncompletedTransactionNotAllowed = &paddleerr.Error{
Code: "subscription_credit_creation_against_uncompleted_transaction_not_allowed",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionUpdateCausingCustomerMismatchNotAllowed represents a `subscription_update_causing_customer_mismatch_not_allowed` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_update_causing_customer_mismatch_not_allowed for more information.
var ErrSubscriptionUpdateCausingCustomerMismatchNotAllowed = &paddleerr.Error{
Code: "subscription_update_causing_customer_mismatch_not_allowed",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionCreditCreationAgainstProcessingTransaction represents a `subscription_credit_creation_against_processing_transaction` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_credit_creation_against_processing_transaction for more information.
var ErrSubscriptionCreditCreationAgainstProcessingTransaction = &paddleerr.Error{
Code: "subscription_credit_creation_against_processing_transaction",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionProductTaxCategoryNotApproved represents a `subscription_product_tax_category_not_approved` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_product_tax_category_not_approved for more information.
var ErrSubscriptionProductTaxCategoryNotApproved = &paddleerr.Error{
Code: "subscription_product_tax_category_not_approved",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionManualCollectionModeActivationNotAllowed represents a `subscription_manual_collection_mode_activation_not_allowed` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_manual_collection_mode_activation_not_allowed for more information.
var ErrSubscriptionManualCollectionModeActivationNotAllowed = &paddleerr.Error{
Code: "subscription_manual_collection_mode_activation_not_allowed",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionArchivedDiscountApplicationAttempt represents a `subscription_archived_discount_application_attempt` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_archived_discount_application_attempt for more information.
var ErrSubscriptionArchivedDiscountApplicationAttempt = &paddleerr.Error{
Code: "subscription_archived_discount_application_attempt",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionMaximumNumberOfLineItemsReached represents a `subscription_maximum_number_of_line_items_reached` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_maximum_number_of_line_items_reached for more information.
var ErrSubscriptionMaximumNumberOfLineItemsReached = &paddleerr.Error{
Code: "subscription_maximum_number_of_line_items_reached",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionImmediateChargeHourLimitExceeded represents a `subscription_immediate_charge_hour_limit_exceeded` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_immediate_charge_hour_limit_exceeded for more information.
var ErrSubscriptionImmediateChargeHourLimitExceeded = &paddleerr.Error{
Code: "subscription_immediate_charge_hour_limit_exceeded",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionImmediateCharge24HourLimitExceeded represents a `subscription_immediate_charge_24_hour_limit_exceeded` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_immediate_charge_24_hour_limit_exceeded for more information.
var ErrSubscriptionImmediateCharge24HourLimitExceeded = &paddleerr.Error{
Code: "subscription_immediate_charge_24_hour_limit_exceeded",
Type: paddleerr.ErrorTypeRequestError,
}
// ErrSubscriptionContinuingExistingBillingPeriodNotAllowed represents a `subscription_continuing_existing_billing_period_not_allowed` error.
// See https://developer.paddle.com/errors/subscriptions/subscription_continuing_existing_billing_period_not_allowed for more information.
var ErrSubscriptionContinuingExistingBillingPeriodNotAllowed = &paddleerr.Error{
Code: "subscription_continuing_existing_billing_period_not_allowed",
Type: paddleerr.ErrorTypeRequestError,
}
// SubscriptionStatus: Status of this subscription. Set automatically by Paddle. Use the pause subscription or cancel subscription operations to change..
type SubscriptionStatus string
const (
SubscriptionStatusActive SubscriptionStatus = "active"
SubscriptionStatusCanceled SubscriptionStatus = "canceled"
SubscriptionStatusPastDue SubscriptionStatus = "past_due"
SubscriptionStatusPaused SubscriptionStatus = "paused"
SubscriptionStatusTrialing SubscriptionStatus = "trialing"
)
// SubscriptionDiscountTimePeriod: Details of the discount applied to this subscription.
type SubscriptionDiscountTimePeriod struct {
// ID: Unique Paddle ID for this discount, prefixed with `dsc_`.
ID string `json:"id,omitempty"`
// StartsAt: RFC 3339 datetime string of when this discount was first applied. `null` for canceled subscriptions where a discount was redeemed but never applied to a transaction.
StartsAt *string `json:"starts_at,omitempty"`
// EndsAt: RFC 3339 datetime string of when this discount no longer applies. Where a discount has `maximum_recurring_intervals`, this is the date of the last billing period where this discount applies. `null` where a discount recurs forever.
EndsAt *string `json:"ends_at,omitempty"`
}
// ScheduledChangeAction: Kind of change that's scheduled to be applied to this subscription..
type ScheduledChangeAction string
const (
ScheduledChangeActionCancel ScheduledChangeAction = "cancel"
ScheduledChangeActionPause ScheduledChangeAction = "pause"
ScheduledChangeActionResume ScheduledChangeAction = "resume"
)
// SubscriptionScheduledChange: Change that's scheduled to be applied to a subscription. Use the pause subscription, cancel subscription, and resume subscription operations to create scheduled changes. `null` if no scheduled changes.
type SubscriptionScheduledChange struct {
// Action: Kind of change that's scheduled to be applied to this subscription.
Action ScheduledChangeAction `json:"action,omitempty"`
// EffectiveAt: RFC 3339 datetime string of when this scheduled change takes effect.
EffectiveAt string `json:"effective_at,omitempty"`
// ResumeAt: RFC 3339 datetime string of when a paused subscription should resume. Only used for `pause` scheduled changes.
ResumeAt *string `json:"resume_at,omitempty"`
}
// SubscriptionManagementURLs: Authenticated customer portal deep links for this subscription. For security, the `token` appended to each link is temporary. You shouldn't store these links.
type SubscriptionManagementURLs struct {
// UpdatePaymentMethod: Link to the page for this subscription in the customer portal with the payment method update form pre-opened. Use as part of workflows to let customers update their payment details. `null` for manually-collected subscriptions.
UpdatePaymentMethod *string `json:"update_payment_method,omitempty"`
// Cancel: Link to the page for this subscription in the customer portal with the subscription cancellation form pre-opened. Use as part of cancel subscription workflows.
Cancel string `json:"cancel,omitempty"`
}
// SubscriptionItemStatus: Status of this subscription item. Set automatically by Paddle..
type SubscriptionItemStatus string
const (
SubscriptionItemStatusActive SubscriptionItemStatus = "active"
SubscriptionItemStatusInactive SubscriptionItemStatus = "inactive"
SubscriptionItemStatusTrialing SubscriptionItemStatus = "trialing"
)
// SubscriptionItem: Represents a subscription item.
type SubscriptionItem struct {
// Status: Status of this subscription item. Set automatically by Paddle.
Status SubscriptionItemStatus `json:"status,omitempty"`
// Quantity: Quantity of this item on the subscription.
Quantity int `json:"quantity,omitempty"`
// Recurring: Whether this is a recurring item. `false` if one-time.
Recurring bool `json:"recurring,omitempty"`
// CreatedAt: RFC 3339 datetime string of when this item was added to this subscription.
CreatedAt string `json:"created_at,omitempty"`
// UpdatedAt: RFC 3339 datetime string of when this item was last updated on this subscription.
UpdatedAt string `json:"updated_at,omitempty"`
// PreviouslyBilledAt: RFC 3339 datetime string of when this item was last billed.
PreviouslyBilledAt *string `json:"previously_billed_at,omitempty"`
// NextBilledAt: RFC 3339 datetime string of when this item is next scheduled to be billed.
NextBilledAt *string `json:"next_billed_at,omitempty"`
// TrialDates: Trial dates for this item.
TrialDates *TimePeriod `json:"trial_dates,omitempty"`
// Price: Related price entity for this item. This reflects the price entity at the time it was added to the subscription.
Price Price `json:"price,omitempty"`
// Product: Related product entity for this item. This reflects the product entity at the time it was added to the subscription.
Product Product `json:"product,omitempty"`
}
// SubscriptionTransactionLineItemPreview: Information about line items for this transaction preview. Different from transaction preview `items` as they include totals calculated by Paddle. Considered the source of truth for line item totals.
type SubscriptionTransactionLineItemPreview struct {
/*
PriceID: Paddle ID for the price related to this transaction line item, prefixed with `pri_`.
The value is null for custom prices being previewed.
*/
PriceID *string `json:"price_id,omitempty"`
// Quantity: Quantity of this transaction line item.
Quantity int `json:"quantity,omitempty"`
// TaxRate: Rate used to calculate tax for this transaction line item.
TaxRate string `json:"tax_rate,omitempty"`
// UnitTotals: Breakdown of the charge for one unit in the lowest denomination of a currency (e.g. cents for USD).
UnitTotals Totals `json:"unit_totals,omitempty"`
// Totals: Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
Totals Totals `json:"totals,omitempty"`
// Product: Related product entity for this transaction line item price.
Product ProductPreview `json:"product,omitempty"`
// Proration: How proration was calculated for this item.
Proration Proration `json:"proration,omitempty"`
}
// SubscriptionTransactionDetailsPreview: Calculated totals for a transaction preview, including discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction preview.
type SubscriptionTransactionDetailsPreview struct {
// TaxRatesUsed: List of tax rates applied to this transaction preview.
TaxRatesUsed []TaxRatesUsed `json:"tax_rates_used,omitempty"`
// Totals: Breakdown of the total for a transaction preview. `fee` and `earnings` always return `null` for transaction previews.
Totals TransactionTotals `json:"totals,omitempty"`
// LineItems: Information about line items for this transaction preview. Different from transaction preview `items` as they include totals calculated by Paddle. Considered the source of truth for line item totals.
LineItems []SubscriptionTransactionLineItemPreview `json:"line_items,omitempty"`
}
// SubscriptionAdjustmentItem: List of transaction items that this adjustment is for.
type SubscriptionAdjustmentItem struct {
// ItemID: Paddle ID for the transaction item that this adjustment item relates to, prefixed with `txnitm_`.
ItemID string `json:"item_id,omitempty"`
/*
Type: Type of adjustment for this transaction item. `tax` adjustments are automatically created by Paddle.
Include `amount` when creating a `partial` adjustment.
*/
Type AdjustmentItemType `json:"type,omitempty"`
// Amount: Amount adjusted for this transaction item. Required when item type is `partial`.
Amount *string `json:"amount,omitempty"`
// Proration: How proration was calculated for this adjustment item.
Proration *Proration `json:"proration,omitempty"`
// Totals: Breakdown of the total for an adjustment item.
Totals AdjustmentItemTotals `json:"totals,omitempty"`
}
// AdjustmentPreview: Represents an adjustment entity when previewing adjustments.
type AdjustmentPreview struct {
// TransactionID: Paddle ID for this transaction entity that this adjustment relates to, prefixed with `txn_`.
TransactionID string `json:"transaction_id,omitempty"`
// Items: List of transaction items that this adjustment is for.
Items []SubscriptionAdjustmentItem `json:"items,omitempty"`
// Totals: Calculated totals for this adjustment.
Totals AdjustmentTotals `json:"totals,omitempty"`
}
// NextTransaction: Preview of the next transaction for this subscription. May include prorated charges that are not yet billed and one-time charges. Returned when the `include` parameter is used with the `next_transaction` value. `null` if the subscription is scheduled to cancel or pause.
type NextTransaction struct {
// BillingPeriod: Billing period for the next transaction.
BillingPeriod TimePeriod `json:"billing_period,omitempty"`
// Details: Calculated totals for a transaction preview, including discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction preview.
Details SubscriptionTransactionDetailsPreview `json:"details,omitempty"`
// Adjustments: Represents an adjustment entity when previewing adjustments.
Adjustments []AdjustmentPreview `json:"adjustments,omitempty"`
}
// Subscription: Represents a subscription entity with included entities.
type Subscription struct {
// ID: Unique Paddle ID for this subscription entity, prefixed with `sub_`.
ID string `json:"id,omitempty"`
// Status: Status of this subscription. Set automatically by Paddle. Use the pause subscription or cancel subscription operations to change.
Status SubscriptionStatus `json:"status,omitempty"`
// CustomerID: Paddle ID of the customer that this subscription is for, prefixed with `ctm_`.
CustomerID string `json:"customer_id,omitempty"`
// AddressID: Paddle ID of the address that this subscription is for, prefixed with `add_`.
AddressID string `json:"address_id,omitempty"`
// BusinessID: Paddle ID of the business that this subscription is for, prefixed with `biz_`.
BusinessID *string `json:"business_id,omitempty"`
// CurrencyCode: Supported three-letter ISO 4217 currency code. Transactions for this subscription are created in this currency. Must be `USD`, `EUR`, or `GBP` if `collection_mode` is `manual`.
CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
// CreatedAt: RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
CreatedAt string `json:"created_at,omitempty"`
// UpdatedAt: RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
UpdatedAt string `json:"updated_at,omitempty"`
// StartedAt: RFC 3339 datetime string of when this subscription started. This may be different from `first_billed_at` if the subscription started in trial.
StartedAt *string `json:"started_at,omitempty"`
// FirstBilledAt: RFC 3339 datetime string of when this subscription was first billed. This may be different from `started_at` if the subscription started in trial.
FirstBilledAt *string `json:"first_billed_at,omitempty"`
// NextBilledAt: RFC 3339 datetime string of when this subscription is next scheduled to be billed.
NextBilledAt *string `json:"next_billed_at,omitempty"`
// PausedAt: RFC 3339 datetime string of when this subscription was paused. Set automatically by Paddle when the pause subscription operation is used. `null` if not paused.
PausedAt *string `json:"paused_at,omitempty"`
// CanceledAt: RFC 3339 datetime string of when this subscription was canceled. Set automatically by Paddle when the cancel subscription operation is used. `null` if not canceled.
CanceledAt *string `json:"canceled_at,omitempty"`
// Discount: Details of the discount applied to this subscription.
Discount *SubscriptionDiscountTimePeriod `json:"discount,omitempty"`
// CollectionMode: How payment is collected for transactions created for this subscription. `automatic` for checkout, `manual` for invoices.
CollectionMode CollectionMode `json:"collection_mode,omitempty"`
// BillingDetails: Details for invoicing. Required if `collection_mode` is `manual`.
BillingDetails *BillingDetails `json:"billing_details,omitempty"`
// CurrentBillingPeriod: Current billing period for this subscription. Set automatically by Paddle based on the billing cycle. `null` for `paused` and `canceled` subscriptions.
CurrentBillingPeriod *TimePeriod `json:"current_billing_period,omitempty"`
// BillingCycle: How often this subscription renews. Set automatically by Paddle based on the prices on this subscription.
BillingCycle Duration `json:"billing_cycle,omitempty"`
// ScheduledChange: Change that's scheduled to be applied to a subscription. Use the pause subscription, cancel subscription, and resume subscription operations to create scheduled changes. `null` if no scheduled changes.
ScheduledChange *SubscriptionScheduledChange `json:"scheduled_change,omitempty"`
// ManagementURLs: Authenticated customer portal deep links for this subscription. For security, the `token` appended to each link is temporary. You shouldn't store these links.
ManagementURLs SubscriptionManagementURLs `json:"management_urls,omitempty"`
// Items: Represents a subscription item.
Items []SubscriptionItem `json:"items,omitempty"`
// CustomData: Your own structured key-value data.
CustomData CustomData `json:"custom_data,omitempty"`
// ImportMeta: Import information for this entity. `null` if this entity is not imported.
ImportMeta *ImportMeta `json:"import_meta,omitempty"`
// NextTransaction: Preview of the next transaction for this subscription. May include prorated charges that are not yet billed and one-time charges. Returned when the `include` parameter is used with the `next_transaction` value. `null` if the subscription is scheduled to cancel or pause.
NextTransaction *NextTransaction `json:"next_transaction,omitempty"`
// RecurringTransactionDetails: Preview of the recurring transaction for this subscription. This is what the customer can expect to be billed when there are no prorated or one-time charges. Returned when the `include` parameter is used with the `recurring_transaction_details` value.
RecurringTransactionDetails SubscriptionTransactionDetailsPreview `json:"recurring_transaction_details,omitempty"`
}
// EffectiveFrom: When this discount should take effect from..
type EffectiveFrom string
const (
EffectiveFromNextBillingPeriod EffectiveFrom = "next_billing_period"
EffectiveFromImmediately EffectiveFrom = "immediately"
)
// SubscriptionDiscountEffectiveFrom: Details of the discount applied to this subscription. Include to add a discount to a subscription. `null` to remove a discount.
type SubscriptionDiscountEffectiveFrom struct {
// ID: Unique Paddle ID for this discount, prefixed with `dsc_`.
ID string `json:"id,omitempty"`
// EffectiveFrom: When this discount should take effect from.
EffectiveFrom EffectiveFrom `json:"effective_from,omitempty"`
}
// SubscriptionUpdateItemFromCatalog: Add or update a catalog item to a subscription. In this case, the product and price that you're billing for exist in your product catalog in Paddle.
type SubscriptionUpdateItemFromCatalog struct {
// PriceID: Paddle ID for the price to add to this subscription, prefixed with `pri_`.
PriceID string `json:"price_id,omitempty"`
// Quantity: Quantity of this item to add to the subscription. If updating an existing item and not changing the quantity, you may omit `quantity`.
Quantity int `json:"quantity,omitempty"`
}
// SubscriptionUpdateItemCreateWithPrice: Add a non-catalog price for an existing product in your catalog to a subscription. In this case, the product you're billing for is a catalog product, but you charge a specific price for it.
type SubscriptionUpdateItemCreateWithPrice struct {
// Quantity: Quantity to bill for.
Quantity int `json:"quantity,omitempty"`
// Price: Price object for a non-catalog item to bill for. Include a `product_id` to relate this non-catalog price to an existing catalog price.
Price TransactionPriceCreateWithProductID `json:"price,omitempty"`
}
// SubscriptionUpdateItemCreateWithProduct: Add a non-catalog price for a non-catalog product in your catalog to a subscription. In this case, the product and price that you're billing for are specific to this subscription.
type SubscriptionUpdateItemCreateWithProduct struct {
// Quantity: Quantity to bill for.
Quantity int `json:"quantity,omitempty"`
// Price: Price object for a non-catalog item to charge for. Include a `product` object to create a non-catalog product for this non-catalog price.
Price TransactionPriceCreateWithProduct `json:"price,omitempty"`
}
/*
ProrationBillingMode: How Paddle should handle proration calculation for changes made to a subscription or its items. Required when making
changes that impact billing.
For automatically-collected subscriptions, responses may take longer than usual if a proration billing mode that
collects for payment immediately is used..
*/
type ProrationBillingMode string
const (
ProrationBillingModeProratedImmediately ProrationBillingMode = "prorated_immediately"
ProrationBillingModeProratedNextBillingPeriod ProrationBillingMode = "prorated_next_billing_period"
ProrationBillingModeFullImmediately ProrationBillingMode = "full_immediately"
ProrationBillingModeFullNextBillingPeriod ProrationBillingMode = "full_next_billing_period"
ProrationBillingModeDoNotBill ProrationBillingMode = "do_not_bill"
)
// SubscriptionOnPaymentFailure: How Paddle should handle changes made to a subscription or its items if the payment fails during update. If omitted, defaults to `prevent_change`..
type SubscriptionOnPaymentFailure string
const (
SubscriptionOnPaymentFailurePreventChange SubscriptionOnPaymentFailure = "prevent_change"
SubscriptionOnPaymentFailureApplyChange SubscriptionOnPaymentFailure = "apply_change"
)
// SubscriptionOnResume: How Paddle should set the billing period for the subscription when resuming. If omitted, defaults to `start_new_billing_period`..
type SubscriptionOnResume string
const (
SubscriptionOnResumeContinueExistingBillingPeriod SubscriptionOnResume = "continue_existing_billing_period"
SubscriptionOnResumeStartNewBillingPeriod SubscriptionOnResume = "start_new_billing_period"
)
type ResumeOnASpecificDate struct {
/*
EffectiveFrom: When this scheduled change should take effect from. RFC 3339 datetime string of when the subscription should resume.
Valid where subscriptions are `active` with a scheduled change to pause, or where they have the status of `paused`.
*/
EffectiveFrom string `json:"effective_from,omitempty"`
// OnResume: How Paddle should set the billing period for the subscription when resuming. If omitted, defaults to `start_new_billing_period`.
OnResume SubscriptionOnResume `json:"on_resume,omitempty"`
}
type ResumeImmediately struct {
/*
EffectiveFrom: When this subscription change should take effect from. You can pass `immediately` to resume immediately.
Valid where subscriptions have the status of `paused`.
Defaults to `immediately` if omitted.
*/
EffectiveFrom *EffectiveFrom `json:"effective_from,omitempty"`
// OnResume: How Paddle should set the billing period for the subscription when resuming. If omitted, defaults to `start_new_billing_period`.
OnResume SubscriptionOnResume `json:"on_resume,omitempty"`
}
// UpdateSummaryResultAction: Whether the subscription change results in a prorated credit or a charge..
type UpdateSummaryResultAction string
const (
UpdateSummaryResultActionCredit UpdateSummaryResultAction = "credit"
UpdateSummaryResultActionCharge UpdateSummaryResultAction = "charge"
)
// UpdateSummaryResult: Details of the result of credits and charges. Where the total of any credit adjustments is greater than the total charge, the result is a prorated credit; otherwise, the result is a prorated charge.
type UpdateSummaryResult struct {
// Action: Whether the subscription change results in a prorated credit or a charge.
Action UpdateSummaryResultAction `json:"action,omitempty"`
// Amount: Amount representing the result of this update, either a charge or a credit.
Amount string `json:"amount,omitempty"`
// CurrencyCode: Three-letter ISO 4217 currency code for the transaction or adjustment.
CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
}
// SubscriptionPreviewUpdateSummary: Impact of this subscription change. Includes whether the change results in a charge or credit, and totals for prorated amounts.
type SubscriptionPreviewUpdateSummary struct {
// Credit: Details of any credit adjustments created for this update. Paddle creates adjustments against existing transactions when prorating.
Credit Money `json:"credit,omitempty"`
// Charge: Details of the transaction to be created for this update. Paddle creates a transaction to bill for new charges.
Charge Money `json:"charge,omitempty"`
// Result: Details of the result of credits and charges. Where the total of any credit adjustments is greater than the total charge, the result is a prorated credit; otherwise, the result is a prorated charge.
Result UpdateSummaryResult `json:"result,omitempty"`
}
// SubscriptionPreview: Represents a subscription preview when previewing a subscription.
type SubscriptionPreview struct {
// Status: Status of this subscription. Set automatically by Paddle. Use the pause subscription or cancel subscription operations to change.
Status SubscriptionStatus `json:"status,omitempty"`
// CustomerID: Paddle ID of the customer that this subscription is for, prefixed with `ctm_`.
CustomerID string `json:"customer_id,omitempty"`
// AddressID: Paddle ID of the address that this subscription is for, prefixed with `add_`.
AddressID string `json:"address_id,omitempty"`
// BusinessID: Paddle ID of the business that this subscription is for, prefixed with `biz_`.
BusinessID *string `json:"business_id,omitempty"`
// CurrencyCode: Supported three-letter ISO 4217 currency code. Transactions for this subscription are created in this currency. Must be `USD`, `EUR`, or `GBP` if `collection_mode` is `manual`.
CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
// CreatedAt: RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
CreatedAt string `json:"created_at,omitempty"`
// UpdatedAt: RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
UpdatedAt string `json:"updated_at,omitempty"`
// StartedAt: RFC 3339 datetime string of when this subscription started. This may be different from `first_billed_at` if the subscription started in trial.
StartedAt *string `json:"started_at,omitempty"`
// FirstBilledAt: RFC 3339 datetime string of when this subscription was first billed. This may be different from `started_at` if the subscription started in trial.
FirstBilledAt *string `json:"first_billed_at,omitempty"`
// NextBilledAt: RFC 3339 datetime string of when this subscription is next scheduled to be billed.
NextBilledAt *string `json:"next_billed_at,omitempty"`
// PausedAt: RFC 3339 datetime string of when this subscription was paused. Set automatically by Paddle when the pause subscription operation is used. `null` if not paused.
PausedAt *string `json:"paused_at,omitempty"`
// CanceledAt: RFC 3339 datetime string of when this subscription was canceled. Set automatically by Paddle when the cancel subscription operation is used. `null` if not canceled.
CanceledAt *string `json:"canceled_at,omitempty"`
// Discount: Details of the discount applied to this subscription.
Discount *SubscriptionDiscountTimePeriod `json:"discount,omitempty"`
// CollectionMode: How payment is collected for transactions created for this subscription. `automatic` for checkout, `manual` for invoices.
CollectionMode CollectionMode `json:"collection_mode,omitempty"`
// BillingDetails: Details for invoicing. Required if `collection_mode` is `manual`.
BillingDetails *BillingDetails `json:"billing_details,omitempty"`
// CurrentBillingPeriod: Current billing period for this subscription. Set automatically by Paddle based on the billing cycle. `null` for `paused` and `canceled` subscriptions.
CurrentBillingPeriod *TimePeriod `json:"current_billing_period,omitempty"`
// BillingCycle: How often this subscription renews. Set automatically by Paddle based on the prices on this subscription.
BillingCycle Duration `json:"billing_cycle,omitempty"`
// ScheduledChange: Change that's scheduled to be applied to a subscription. Use the pause subscription, cancel subscription, and resume subscription operations to create scheduled changes. `null` if no scheduled changes.
ScheduledChange *SubscriptionScheduledChange `json:"scheduled_change,omitempty"`
// ManagementURLs: Authenticated customer portal deep links for this subscription. For security, the `token` appended to each link is temporary. You shouldn't store these links.
ManagementURLs SubscriptionManagementURLs `json:"management_urls,omitempty"`
// Items: Represents a subscription item.
Items []SubscriptionItem `json:"items,omitempty"`
// CustomData: Your own structured key-value data.
CustomData CustomData `json:"custom_data,omitempty"`
// ImmediateTransaction: Preview of the immediate transaction created as a result of changes to the subscription. Returns a complete object where `proration_billing_mode` is `prorated_immediately` or `full_immediately`; `null` otherwise.
ImmediateTransaction *NextTransaction `json:"immediate_transaction,omitempty"`
// NextTransaction: Preview of the next transaction for this subscription. Includes charges created where `proration_billing_mode` is `prorated_next_billing_period` or `full_next_billing_period`, as well as one-time charges. `null` if the subscription is scheduled to cancel or pause.
NextTransaction *NextTransaction `json:"next_transaction,omitempty"`
// RecurringTransactionDetails: Preview of the recurring transaction for this subscription. This is what the customer can expect to be billed when there are no prorated or one-time charges.
RecurringTransactionDetails SubscriptionTransactionDetailsPreview `json:"recurring_transaction_details,omitempty"`
// UpdateSummary: Impact of this subscription change. Includes whether the change results in a charge or credit, and totals for prorated amounts.
UpdateSummary *SubscriptionPreviewUpdateSummary `json:"update_summary,omitempty"`
// ImportMeta: Import information for this entity. `null` if this entity is not imported.
ImportMeta *ImportMeta `json:"import_meta,omitempty"`
}
// SubscriptionChargeItemFromCatalog: Add a catalog item to a subscription. In this case, the product and price that you're billing for exist in your product catalog in Paddle.
type SubscriptionChargeItemFromCatalog struct {
// Quantity: Quantity to bill for.
Quantity int `json:"quantity,omitempty"`
// PriceID: Paddle ID of an an existing catalog price to bill for.
PriceID string `json:"price_id,omitempty"`
}
// SubscriptionChargeCreateWithPrice: Price object for a non-catalog item to bill for. Include a `product_id` to relate this non-catalog price to an existing catalog price.
type SubscriptionChargeCreateWithPrice struct {
// ProductID: Paddle ID for the product that this price is for, prefixed with `pro_`.
ProductID string `json:"product_id,omitempty"`
// Description: Internal description for this price, not shown to customers. Typically notes for your team.
Description string `json:"description,omitempty"`
// Name: Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
Name *string `json:"name,omitempty"`
// TaxMode: How tax is calculated for this price.
TaxMode TaxMode `json:"tax_mode,omitempty"`
// UnitPrice: Base price. This price applies to all customers, except for customers located in countries where you have `unit_price_overrides`.
UnitPrice Money `json:"unit_price,omitempty"`
// UnitPriceOverrides: List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
UnitPriceOverrides []UnitPriceOverride `json:"unit_price_overrides,omitempty"`
// Quantity: Limits on how many times the related product can be purchased at this price. Useful for discount campaigns. If omitted, defaults to 1-100.
Quantity PriceQuantity `json:"quantity,omitempty"`
// CustomData: Your own structured key-value data.
CustomData CustomData `json:"custom_data,omitempty"`
}
// SubscriptionChargeItemCreateWithPrice: Add a non-catalog price for an existing product in your catalog to a subscription. In this case, the product you're billing for is a catalog product, but you charge a specific price for it.
type SubscriptionChargeItemCreateWithPrice struct {
// Quantity: Quantity to bill for.
Quantity int `json:"quantity,omitempty"`
// Price: Price object for a non-catalog item to bill for. Include a `product_id` to relate this non-catalog price to an existing catalog price.
Price SubscriptionChargeCreateWithPrice `json:"price,omitempty"`
}
// SubscriptionChargeCreateWithProduct: Price object for a non-catalog item to charge for. Include a `product` object to create a non-catalog product for this non-catalog price.
type SubscriptionChargeCreateWithProduct struct {
// Description: Internal description for this price, not shown to customers. Typically notes for your team.
Description string `json:"description,omitempty"`
// Name: Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
Name *string `json:"name,omitempty"`
// TaxMode: How tax is calculated for this price.
TaxMode TaxMode `json:"tax_mode,omitempty"`
// UnitPrice: Base price. This price applies to all customers, except for customers located in countries where you have `unit_price_overrides`.
UnitPrice Money `json:"unit_price,omitempty"`
// UnitPriceOverrides: List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
UnitPriceOverrides []UnitPriceOverride `json:"unit_price_overrides,omitempty"`
// Quantity: Limits on how many times the related product can be purchased at this price. Useful for discount campaigns. If omitted, defaults to 1-100.
Quantity PriceQuantity `json:"quantity,omitempty"`
// CustomData: Your own structured key-value data.
CustomData CustomData `json:"custom_data,omitempty"`
// Product: Product object for a non-catalog item to charge for.
Product TransactionSubscriptionProductCreate `json:"product,omitempty"`
}
// SubscriptionChargeItemCreateWithProduct: Add a non-catalog price for a non-catalog product in your catalog to a subscription. In this case, the product and price that you're billing for are specific to this transaction.
type SubscriptionChargeItemCreateWithProduct struct {
// Quantity: Quantity to bill for.
Quantity int `json:"quantity,omitempty"`
// Price: Price object for a non-catalog item to charge for. Include a `product` object to create a non-catalog product for this non-catalog price.
Price SubscriptionChargeCreateWithProduct `json:"price,omitempty"`
}
// SubscriptionsClient is a client for the Subscriptions resource.
type SubscriptionsClient struct {
doer Doer
}
// GetSubscriptionRequest is given as an input to GetSubscription.
type GetSubscriptionRequest struct {
// URL path parameters.
SubscriptionID string `in:"path=subscription_id" json:"-"`
// IncludeNextTransaction allows requesting the next_transaction sub-resource as part of this request.
// If set to true, will be included on the response.
IncludeNextTransaction bool `in:"paddle_include=next_transaction" json:"-"`
// IncludeRecurringTransactionDetails allows requesting the recurring_transaction_details sub-resource as part of this request.
// If set to true, will be included on the response.
IncludeRecurringTransactionDetails bool `in:"paddle_include=recurring_transaction_details" json:"-"`
}
// GetSubscription performs the GET operation on a Subscriptions resource.
func (c *SubscriptionsClient) GetSubscription(ctx context.Context, req *GetSubscriptionRequest) (res *Subscription, err error) {
if err := c.doer.Do(ctx, "GET", "/subscriptions/{subscription_id}", req, &res); err != nil {
return nil, err
}
return res, nil
}
// NewUpdateSubscriptionItemsSubscriptionUpdateItemFromCatalog takes a SubscriptionUpdateItemFromCatalog type
// and creates a UpdateSubscriptionItems for use in a request.
func NewUpdateSubscriptionItemsSubscriptionUpdateItemFromCatalog(r *SubscriptionUpdateItemFromCatalog) *UpdateSubscriptionItems {
return &UpdateSubscriptionItems{SubscriptionUpdateItemFromCatalog: r}
}
// NewUpdateSubscriptionItemsSubscriptionUpdateItemCreateWithPrice takes a SubscriptionUpdateItemCreateWithPrice type
// and creates a UpdateSubscriptionItems for use in a request.
func NewUpdateSubscriptionItemsSubscriptionUpdateItemCreateWithPrice(r *SubscriptionUpdateItemCreateWithPrice) *UpdateSubscriptionItems {
return &UpdateSubscriptionItems{SubscriptionUpdateItemCreateWithPrice: r}
}
// NewUpdateSubscriptionItemsSubscriptionUpdateItemCreateWithProduct takes a SubscriptionUpdateItemCreateWithProduct type
// and creates a UpdateSubscriptionItems for use in a request.
func NewUpdateSubscriptionItemsSubscriptionUpdateItemCreateWithProduct(r *SubscriptionUpdateItemCreateWithProduct) *UpdateSubscriptionItems {
return &UpdateSubscriptionItems{SubscriptionUpdateItemCreateWithProduct: r}
}
// UpdateSubscriptionItems represents a union request type of the following types:
// - `SubscriptionUpdateItemFromCatalog`
// - `SubscriptionUpdateItemCreateWithPrice`
// - `SubscriptionUpdateItemCreateWithProduct`
//
// The following constructor functions can be used to create a new instance of this type.
// - `NewUpdateSubscriptionItemsSubscriptionUpdateItemFromCatalog()`
// - `NewUpdateSubscriptionItemsSubscriptionUpdateItemCreateWithPrice()`
// - `NewUpdateSubscriptionItemsSubscriptionUpdateItemCreateWithProduct()`
//
// Only one of the values can be set at a time, the first non-nil value will be used in the request.
// Items: Add a non-catalog price for a non-catalog product in your catalog to a subscription. In this case, the product and price that you're billing for are specific to this subscription.
type UpdateSubscriptionItems struct {
*SubscriptionUpdateItemFromCatalog
*SubscriptionUpdateItemCreateWithPrice
*SubscriptionUpdateItemCreateWithProduct
}
// MarshalJSON implements the json.Marshaler interface.
func (u UpdateSubscriptionItems) MarshalJSON() ([]byte, error) {
if u.SubscriptionUpdateItemFromCatalog != nil {
return json.Marshal(u.SubscriptionUpdateItemFromCatalog)
}
if u.SubscriptionUpdateItemCreateWithPrice != nil {
return json.Marshal(u.SubscriptionUpdateItemCreateWithPrice)
}
if u.SubscriptionUpdateItemCreateWithProduct != nil {
return json.Marshal(u.SubscriptionUpdateItemCreateWithProduct)
}
return nil, nil
}
// UpdateSubscriptionRequest is given as an input to UpdateSubscription.
type UpdateSubscriptionRequest struct {
// URL path parameters.
SubscriptionID string `in:"path=subscription_id" json:"-"`
// CustomerID: Paddle ID of the customer that this subscription is for, prefixed with `ctm_`. Include to change the customer for a subscription.
CustomerID *PatchField[string] `json:"customer_id,omitempty"`
// AddressID: Paddle ID of the address that this subscription is for, prefixed with `add_`. Include to change the address for a subscription.
AddressID *PatchField[string] `json:"address_id,omitempty"`
// BusinessID: Paddle ID of the business that this subscription is for, prefixed with `biz_`. Include to change the business for a subscription.
BusinessID *PatchField[*string] `json:"business_id,omitempty"`
// CurrencyCode: Supported three-letter ISO 4217 currency code. Include to change the currency that a subscription bills in. When changing `collection_mode` to `manual`, you may need to change currency code to `USD`, `EUR`, or `GBP`.
CurrencyCode *PatchField[CurrencyCode] `json:"currency_code,omitempty"`
// NextBilledAt: RFC 3339 datetime string of when this subscription is next scheduled to be billed. Include to change the next billing date.
NextBilledAt *PatchField[string] `json:"next_billed_at,omitempty"`
// Discount: Details of the discount applied to this subscription. Include to add a discount to a subscription. `null` to remove a discount.
Discount *PatchField[*SubscriptionDiscountEffectiveFrom] `json:"discount,omitempty"`
// CollectionMode: How payment is collected for transactions created for this subscription. `automatic` for checkout, `manual` for invoices.
CollectionMode *PatchField[CollectionMode] `json:"collection_mode,omitempty"`
// BillingDetails: Details for invoicing. Required if `collection_mode` is `manual`. `null` if changing `collection_mode` to `automatic`.
BillingDetails *PatchField[*BillingDetailsUpdate] `json:"billing_details,omitempty"`
// ScheduledChange: Change that's scheduled to be applied to a subscription. When updating, you may only set to `null` to remove a scheduled change. Use the pause subscription, cancel subscription, and resume subscription operations to create scheduled changes.
ScheduledChange *PatchField[*SubscriptionScheduledChange] `json:"scheduled_change,omitempty"`
// Items: Add a non-catalog price for a non-catalog product in your catalog to a subscription. In this case, the product and price that you're billing for are specific to this subscription.
Items *PatchField[[]UpdateSubscriptionItems] `json:"items,omitempty"`
// CustomData: Your own structured key-value data.
CustomData *PatchField[CustomData] `json:"custom_data,omitempty"`
/*
ProrationBillingMode: How Paddle should handle proration calculation for changes made to a subscription or its items. Required when making
changes that impact billing.
For automatically-collected subscriptions, responses may take longer than usual if a proration billing mode that
collects for payment immediately is used.
*/
ProrationBillingMode *PatchField[ProrationBillingMode] `json:"proration_billing_mode,omitempty"`
// OnPaymentFailure: How Paddle should handle changes made to a subscription or its items if the payment fails during update. If omitted, defaults to `prevent_change`.
OnPaymentFailure *PatchField[SubscriptionOnPaymentFailure] `json:"on_payment_failure,omitempty"`
}
// UpdateSubscription performs the PATCH operation on a Subscriptions resource.
func (c *SubscriptionsClient) UpdateSubscription(ctx context.Context, req *UpdateSubscriptionRequest) (res *Subscription, err error) {
if err := c.doer.Do(ctx, "PATCH", "/subscriptions/{subscription_id}", req, &res); err != nil {
return nil, err
}
return res, nil
}
// ListSubscriptionsRequest is given as an input to ListSubscriptions.
type ListSubscriptionsRequest struct {
// AddressID is a query parameter.
// Return entities related to the specified address. Use a comma-separated list to specify multiple address IDs.
AddressID []string `in:"query=address_id;omitempty" json:"-"`
// After is a query parameter.
// Return entities after the specified Paddle ID when working with paginated endpoints. Used in the `meta.pagination.next` URL in responses for list operations.
After *string `in:"query=after;omitempty" json:"-"`
// CollectionMode is a query parameter.
// Return entities that match the specified collection mode.
CollectionMode *string `in:"query=collection_mode;omitempty" json:"-"`
// CustomerID is a query parameter.
// Return entities related to the specified customer. Use a comma-separated list to specify multiple customer IDs.
CustomerID []string `in:"query=customer_id;omitempty" json:"-"`
// ID is a query parameter.
// Return only the IDs specified. Use a comma-separated list to get multiple entities.
ID []string `in:"query=id;omitempty" json:"-"`
// OrderBy is a query parameter.
/*
Order returned entities by the specified field and direction (`[ASC]` or `[DESC]`). For example, `?order_by=id[ASC]`.
Valid fields for ordering: `id`.
*/
OrderBy *string `in:"query=order_by;omitempty" json:"-"`
// PerPage is a query parameter.
/*
Set how many entities are returned per page. Paddle returns the maximum number of results if a number greater than the maximum is requested. Check `meta.pagination.per_page` in the response to see how many were returned.