whop_sdk 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -0
  3. data/README.md +1 -1
  4. data/lib/whop_sdk/client.rb +8 -0
  5. data/lib/whop_sdk/internal/type/union.rb +12 -0
  6. data/lib/whop_sdk/models/app_build_create_params.rb +9 -1
  7. data/lib/whop_sdk/models/invoice_create_params.rb +10 -1
  8. data/lib/whop_sdk/models/payment.rb +88 -1
  9. data/lib/whop_sdk/models/payment_create_params.rb +307 -0
  10. data/lib/whop_sdk/models/payment_list_response.rb +88 -1
  11. data/lib/whop_sdk/models/payment_method_list_params.rb +78 -0
  12. data/lib/whop_sdk/models/payment_method_list_response.rb +85 -0
  13. data/lib/whop_sdk/models/payment_method_retrieve_params.rb +22 -0
  14. data/lib/whop_sdk/models/payment_method_retrieve_response.rb +85 -0
  15. data/lib/whop_sdk/models/setup_intent.rb +251 -0
  16. data/lib/whop_sdk/models/setup_intent_canceled_webhook_event.rb +52 -0
  17. data/lib/whop_sdk/models/setup_intent_list_params.rb +78 -0
  18. data/lib/whop_sdk/models/setup_intent_list_response.rb +253 -0
  19. data/lib/whop_sdk/models/setup_intent_requires_action_webhook_event.rb +52 -0
  20. data/lib/whop_sdk/models/setup_intent_retrieve_params.rb +14 -0
  21. data/lib/whop_sdk/models/setup_intent_status.rb +18 -0
  22. data/lib/whop_sdk/models/setup_intent_succeeded_webhook_event.rb +52 -0
  23. data/lib/whop_sdk/models/unwrap_webhook_event.rb +28 -19
  24. data/lib/whop_sdk/models.rb +20 -0
  25. data/lib/whop_sdk/resources/app_builds.rb +3 -1
  26. data/lib/whop_sdk/resources/invoices.rb +3 -1
  27. data/lib/whop_sdk/resources/payment_methods.rb +91 -0
  28. data/lib/whop_sdk/resources/payments.rb +50 -0
  29. data/lib/whop_sdk/resources/setup_intents.rb +91 -0
  30. data/lib/whop_sdk/resources/webhooks.rb +1 -1
  31. data/lib/whop_sdk/version.rb +1 -1
  32. data/lib/whop_sdk.rb +15 -0
  33. data/rbi/whop_sdk/client.rbi +6 -0
  34. data/rbi/whop_sdk/models/app_build_create_params.rbi +8 -0
  35. data/rbi/whop_sdk/models/invoice_create_params.rbi +10 -0
  36. data/rbi/whop_sdk/models/payment.rbi +139 -0
  37. data/rbi/whop_sdk/models/payment_create_params.rbi +384 -0
  38. data/rbi/whop_sdk/models/payment_list_response.rbi +164 -0
  39. data/rbi/whop_sdk/models/payment_method_list_params.rbi +99 -0
  40. data/rbi/whop_sdk/models/payment_method_list_response.rbi +137 -0
  41. data/rbi/whop_sdk/models/payment_method_retrieve_params.rbi +43 -0
  42. data/rbi/whop_sdk/models/payment_method_retrieve_response.rbi +142 -0
  43. data/rbi/whop_sdk/models/setup_intent.rbi +410 -0
  44. data/rbi/whop_sdk/models/setup_intent_canceled_webhook_event.rbi +77 -0
  45. data/rbi/whop_sdk/models/setup_intent_list_params.rbi +99 -0
  46. data/rbi/whop_sdk/models/setup_intent_list_response.rbi +491 -0
  47. data/rbi/whop_sdk/models/setup_intent_requires_action_webhook_event.rbi +77 -0
  48. data/rbi/whop_sdk/models/setup_intent_retrieve_params.rbi +27 -0
  49. data/rbi/whop_sdk/models/setup_intent_status.rbi +25 -0
  50. data/rbi/whop_sdk/models/setup_intent_succeeded_webhook_event.rbi +77 -0
  51. data/rbi/whop_sdk/models/unwrap_webhook_event.rbi +3 -0
  52. data/rbi/whop_sdk/models.rbi +23 -0
  53. data/rbi/whop_sdk/resources/app_builds.rbi +3 -0
  54. data/rbi/whop_sdk/resources/invoices.rbi +4 -0
  55. data/rbi/whop_sdk/resources/payment_methods.rbi +84 -0
  56. data/rbi/whop_sdk/resources/payments.rbi +44 -0
  57. data/rbi/whop_sdk/resources/setup_intents.rbi +85 -0
  58. data/rbi/whop_sdk/resources/webhooks.rbi +3 -0
  59. data/sig/whop_sdk/client.rbs +4 -0
  60. data/sig/whop_sdk/models/app_build_create_params.rbs +5 -0
  61. data/sig/whop_sdk/models/invoice_create_params.rbs +5 -0
  62. data/sig/whop_sdk/models/payment.rbs +69 -0
  63. data/sig/whop_sdk/models/payment_create_params.rbs +210 -0
  64. data/sig/whop_sdk/models/payment_list_response.rbs +69 -0
  65. data/sig/whop_sdk/models/payment_method_list_params.rbs +61 -0
  66. data/sig/whop_sdk/models/payment_method_list_response.rbs +67 -0
  67. data/sig/whop_sdk/models/payment_method_retrieve_params.rbs +23 -0
  68. data/sig/whop_sdk/models/payment_method_retrieve_response.rbs +67 -0
  69. data/sig/whop_sdk/models/setup_intent.rbs +189 -0
  70. data/sig/whop_sdk/models/setup_intent_canceled_webhook_event.rbs +40 -0
  71. data/sig/whop_sdk/models/setup_intent_list_params.rbs +61 -0
  72. data/sig/whop_sdk/models/setup_intent_list_response.rbs +193 -0
  73. data/sig/whop_sdk/models/setup_intent_requires_action_webhook_event.rbs +40 -0
  74. data/sig/whop_sdk/models/setup_intent_retrieve_params.rbs +15 -0
  75. data/sig/whop_sdk/models/setup_intent_status.rbs +17 -0
  76. data/sig/whop_sdk/models/setup_intent_succeeded_webhook_event.rbs +40 -0
  77. data/sig/whop_sdk/models/unwrap_webhook_event.rbs +3 -0
  78. data/sig/whop_sdk/models.rbs +20 -0
  79. data/sig/whop_sdk/resources/app_builds.rbs +1 -0
  80. data/sig/whop_sdk/resources/invoices.rbs +1 -0
  81. data/sig/whop_sdk/resources/payment_methods.rbs +25 -0
  82. data/sig/whop_sdk/resources/payments.rbs +9 -0
  83. data/sig/whop_sdk/resources/setup_intents.rbs +24 -0
  84. data/sig/whop_sdk/resources/webhooks.rbs +3 -0
  85. metadata +47 -2
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WhopSDK
4
+ module Resources
5
+ class PaymentMethods
6
+ # A payment method is a stored representation of how a customer intends to pay,
7
+ # such as a card, bank account, or digital wallet. It holds the necessary billing
8
+ # details and can be attached to a member for future one-time or recurring
9
+ # charges. This lets you reuse the same payment credentials across multiple
10
+ # payments.
11
+ #
12
+ # Required permissions:
13
+ #
14
+ # - `member:payment_methods:read`
15
+ #
16
+ # @overload retrieve(id, member_id:, request_options: {})
17
+ #
18
+ # @param id [String] The ID of the PaymentMethod
19
+ #
20
+ # @param member_id [String] The ID of the Member associated with the PaymentMethod
21
+ #
22
+ # @param request_options [WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil]
23
+ #
24
+ # @return [WhopSDK::Models::PaymentMethodRetrieveResponse]
25
+ #
26
+ # @see WhopSDK::Models::PaymentMethodRetrieveParams
27
+ def retrieve(id, params)
28
+ parsed, options = WhopSDK::PaymentMethodRetrieveParams.dump_request(params)
29
+ @client.request(
30
+ method: :get,
31
+ path: ["payment_methods/%1$s", id],
32
+ query: parsed,
33
+ model: WhopSDK::Models::PaymentMethodRetrieveResponse,
34
+ options: options
35
+ )
36
+ end
37
+
38
+ # A payment method is a stored representation of how a customer intends to pay,
39
+ # such as a card, bank account, or digital wallet. It holds the necessary billing
40
+ # details and can be attached to a member for future one-time or recurring
41
+ # charges. This lets you reuse the same payment credentials across multiple
42
+ # payments.
43
+ #
44
+ # Required permissions:
45
+ #
46
+ # - `member:payment_methods:read`
47
+ #
48
+ # @overload list(member_id:, after: nil, before: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, request_options: {})
49
+ #
50
+ # @param member_id [String] The ID of the Member to list payment methods for
51
+ #
52
+ # @param after [String, nil] Returns the elements in the list that come after the specified cursor.
53
+ #
54
+ # @param before [String, nil] Returns the elements in the list that come before the specified cursor.
55
+ #
56
+ # @param created_after [Time, nil] The minimum creation date to filter by
57
+ #
58
+ # @param created_before [Time, nil] The maximum creation date to filter by
59
+ #
60
+ # @param direction [Symbol, WhopSDK::Models::Direction, nil] The direction of the sort.
61
+ #
62
+ # @param first [Integer, nil] Returns the first _n_ elements from the list.
63
+ #
64
+ # @param last [Integer, nil] Returns the last _n_ elements from the list.
65
+ #
66
+ # @param request_options [WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil]
67
+ #
68
+ # @return [WhopSDK::Internal::CursorPage<WhopSDK::Models::PaymentMethodListResponse>]
69
+ #
70
+ # @see WhopSDK::Models::PaymentMethodListParams
71
+ def list(params)
72
+ parsed, options = WhopSDK::PaymentMethodListParams.dump_request(params)
73
+ @client.request(
74
+ method: :get,
75
+ path: "payment_methods",
76
+ query: parsed,
77
+ page: WhopSDK::Internal::CursorPage,
78
+ model: WhopSDK::Models::PaymentMethodListResponse,
79
+ options: options
80
+ )
81
+ end
82
+
83
+ # @api private
84
+ #
85
+ # @param client [WhopSDK::Client]
86
+ def initialize(client:)
87
+ @client = client
88
+ end
89
+ end
90
+ end
91
+ end
@@ -3,6 +3,56 @@
3
3
  module WhopSDK
4
4
  module Resources
5
5
  class Payments
6
+ # Some parameter documentations has been truncated, see
7
+ # {WhopSDK::Models::PaymentCreateParams} for more details.
8
+ #
9
+ # Charge an existing member off-session using one of their stored payment methods.
10
+ # You can provide an existing plan, or create a new one in-line. This endpoint
11
+ # will respond with a payment object immediately, but the payment is processed
12
+ # asynchronously in the background. Use webhooks to be notified when the payment
13
+ # succeeds or fails.
14
+ #
15
+ # Required permissions:
16
+ #
17
+ # - `payment:charge`
18
+ # - `plan:create`
19
+ # - `access_pass:create`
20
+ # - `access_pass:update`
21
+ # - `plan:basic:read`
22
+ # - `access_pass:basic:read`
23
+ # - `member:email:read`
24
+ # - `member:basic:read`
25
+ # - `member:phone:read`
26
+ # - `promo_code:basic:read`
27
+ #
28
+ # @overload create(company_id:, member_id:, payment_method_id:, plan:, plan_id:, request_options: {})
29
+ #
30
+ # @param company_id [String] The ID of the company to create the payment for.
31
+ #
32
+ # @param member_id [String] The ID of the member to create the payment for.
33
+ #
34
+ # @param payment_method_id [String] The ID of the payment method to use for the payment. It must be connected to the
35
+ #
36
+ # @param plan [WhopSDK::Models::PaymentCreateParams::Plan] Pass this object to create a new plan for this payment
37
+ #
38
+ # @param plan_id [String] An ID of an existing plan to use for the payment.
39
+ #
40
+ # @param request_options [WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil]
41
+ #
42
+ # @return [WhopSDK::Models::Payment]
43
+ #
44
+ # @see WhopSDK::Models::PaymentCreateParams
45
+ def create(params)
46
+ parsed, options = WhopSDK::PaymentCreateParams.dump_request(params)
47
+ @client.request(
48
+ method: :post,
49
+ path: "payments",
50
+ body: parsed,
51
+ model: WhopSDK::Payment,
52
+ options: options
53
+ )
54
+ end
55
+
6
56
  # Retrieves a payment by ID
7
57
  #
8
58
  # Required permissions:
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WhopSDK
4
+ module Resources
5
+ class SetupIntents
6
+ # A setup intent is an object used to securely collect and store a member’s
7
+ # payment method for future use without charging them immediately. It handles
8
+ # authentication steps up front so future off-session payments can be completed
9
+ # smoothly. This ensures the payment method is verified and ready for later
10
+ # billing.
11
+ #
12
+ # Required permissions:
13
+ #
14
+ # - `payment:setup_intent:read`
15
+ # - `member:basic:read`
16
+ # - `member:email:read`
17
+ #
18
+ # @overload retrieve(id, request_options: {})
19
+ #
20
+ # @param id [String] The ID of the Setup Intent
21
+ #
22
+ # @param request_options [WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil]
23
+ #
24
+ # @return [WhopSDK::Models::SetupIntent]
25
+ #
26
+ # @see WhopSDK::Models::SetupIntentRetrieveParams
27
+ def retrieve(id, params = {})
28
+ @client.request(
29
+ method: :get,
30
+ path: ["setup_intents/%1$s", id],
31
+ model: WhopSDK::SetupIntent,
32
+ options: params[:request_options]
33
+ )
34
+ end
35
+
36
+ # A setup intent is an object used to securely collect and store a member’s
37
+ # payment method for future use without charging them immediately. It handles
38
+ # authentication steps up front so future off-session payments can be completed
39
+ # smoothly. This ensures the payment method is verified and ready for later
40
+ # billing.
41
+ #
42
+ # Required permissions:
43
+ #
44
+ # - `payment:setup_intent:read`
45
+ # - `member:basic:read`
46
+ # - `member:email:read`
47
+ #
48
+ # @overload list(company_id:, after: nil, before: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, request_options: {})
49
+ #
50
+ # @param company_id [String] The ID of the company to list setup intents for
51
+ #
52
+ # @param after [String, nil] Returns the elements in the list that come after the specified cursor.
53
+ #
54
+ # @param before [String, nil] Returns the elements in the list that come before the specified cursor.
55
+ #
56
+ # @param created_after [Time, nil] The minimum creation date to filter by
57
+ #
58
+ # @param created_before [Time, nil] The maximum creation date to filter by
59
+ #
60
+ # @param direction [Symbol, WhopSDK::Models::Direction, nil] The direction of the sort.
61
+ #
62
+ # @param first [Integer, nil] Returns the first _n_ elements from the list.
63
+ #
64
+ # @param last [Integer, nil] Returns the last _n_ elements from the list.
65
+ #
66
+ # @param request_options [WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil]
67
+ #
68
+ # @return [WhopSDK::Internal::CursorPage<WhopSDK::Models::SetupIntentListResponse>]
69
+ #
70
+ # @see WhopSDK::Models::SetupIntentListParams
71
+ def list(params)
72
+ parsed, options = WhopSDK::SetupIntentListParams.dump_request(params)
73
+ @client.request(
74
+ method: :get,
75
+ path: "setup_intents",
76
+ query: parsed,
77
+ page: WhopSDK::Internal::CursorPage,
78
+ model: WhopSDK::Models::SetupIntentListResponse,
79
+ options: options
80
+ )
81
+ end
82
+
83
+ # @api private
84
+ #
85
+ # @param client [WhopSDK::Client]
86
+ def initialize(client:)
87
+ @client = client
88
+ end
89
+ end
90
+ end
91
+ end
@@ -5,7 +5,7 @@ module WhopSDK
5
5
  class Webhooks
6
6
  # @param payload [String] The raw webhook payload as a string
7
7
  #
8
- # @return [WhopSDK::Models::InvoiceCreatedWebhookEvent, WhopSDK::Models::InvoicePaidWebhookEvent, WhopSDK::Models::InvoicePastDueWebhookEvent, WhopSDK::Models::InvoiceVoidedWebhookEvent, WhopSDK::Models::MembershipActivatedWebhookEvent, WhopSDK::Models::MembershipDeactivatedWebhookEvent, WhopSDK::Models::EntryCreatedWebhookEvent, WhopSDK::Models::EntryApprovedWebhookEvent, WhopSDK::Models::EntryDeniedWebhookEvent, WhopSDK::Models::EntryDeletedWebhookEvent, WhopSDK::Models::CourseLessonInteractionCompletedWebhookEvent, WhopSDK::Models::PaymentSucceededWebhookEvent, WhopSDK::Models::PaymentFailedWebhookEvent, WhopSDK::Models::PaymentPendingWebhookEvent, WhopSDK::Models::DisputeCreatedWebhookEvent, WhopSDK::Models::DisputeUpdatedWebhookEvent, WhopSDK::Models::RefundCreatedWebhookEvent, WhopSDK::Models::RefundUpdatedWebhookEvent]
8
+ # @return [WhopSDK::Models::InvoiceCreatedWebhookEvent, WhopSDK::Models::InvoicePaidWebhookEvent, WhopSDK::Models::InvoicePastDueWebhookEvent, WhopSDK::Models::InvoiceVoidedWebhookEvent, WhopSDK::Models::MembershipActivatedWebhookEvent, WhopSDK::Models::MembershipDeactivatedWebhookEvent, WhopSDK::Models::EntryCreatedWebhookEvent, WhopSDK::Models::EntryApprovedWebhookEvent, WhopSDK::Models::EntryDeniedWebhookEvent, WhopSDK::Models::EntryDeletedWebhookEvent, WhopSDK::Models::SetupIntentRequiresActionWebhookEvent, WhopSDK::Models::SetupIntentSucceededWebhookEvent, WhopSDK::Models::SetupIntentCanceledWebhookEvent, WhopSDK::Models::CourseLessonInteractionCompletedWebhookEvent, WhopSDK::Models::PaymentSucceededWebhookEvent, WhopSDK::Models::PaymentFailedWebhookEvent, WhopSDK::Models::PaymentPendingWebhookEvent, WhopSDK::Models::DisputeCreatedWebhookEvent, WhopSDK::Models::DisputeUpdatedWebhookEvent, WhopSDK::Models::RefundCreatedWebhookEvent, WhopSDK::Models::RefundUpdatedWebhookEvent]
9
9
  def unwrap(payload)
10
10
  parsed = JSON.parse(payload, symbolize_names: true)
11
11
  WhopSDK::Internal::Type::Converter.coerce(WhopSDK::Models::UnwrapWebhookEvent, parsed)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WhopSDK
4
- VERSION = "0.0.9"
4
+ VERSION = "0.0.11"
5
5
  end
data/lib/whop_sdk.rb CHANGED
@@ -239,9 +239,14 @@ require_relative "whop_sdk/models/notification_create_params"
239
239
  require_relative "whop_sdk/models/notification_create_response"
240
240
  require_relative "whop_sdk/models/page_info"
241
241
  require_relative "whop_sdk/models/payment"
242
+ require_relative "whop_sdk/models/payment_create_params"
242
243
  require_relative "whop_sdk/models/payment_failed_webhook_event"
243
244
  require_relative "whop_sdk/models/payment_list_params"
244
245
  require_relative "whop_sdk/models/payment_list_response"
246
+ require_relative "whop_sdk/models/payment_method_list_params"
247
+ require_relative "whop_sdk/models/payment_method_list_response"
248
+ require_relative "whop_sdk/models/payment_method_retrieve_params"
249
+ require_relative "whop_sdk/models/payment_method_retrieve_response"
245
250
  require_relative "whop_sdk/models/payment_method_types"
246
251
  require_relative "whop_sdk/models/payment_pending_webhook_event"
247
252
  require_relative "whop_sdk/models/payment_provider"
@@ -298,6 +303,14 @@ require_relative "whop_sdk/models/review_list_response"
298
303
  require_relative "whop_sdk/models/review_retrieve_params"
299
304
  require_relative "whop_sdk/models/review_retrieve_response"
300
305
  require_relative "whop_sdk/models/review_status"
306
+ require_relative "whop_sdk/models/setup_intent"
307
+ require_relative "whop_sdk/models/setup_intent_canceled_webhook_event"
308
+ require_relative "whop_sdk/models/setup_intent_list_params"
309
+ require_relative "whop_sdk/models/setup_intent_list_response"
310
+ require_relative "whop_sdk/models/setup_intent_requires_action_webhook_event"
311
+ require_relative "whop_sdk/models/setup_intent_retrieve_params"
312
+ require_relative "whop_sdk/models/setup_intent_status"
313
+ require_relative "whop_sdk/models/setup_intent_succeeded_webhook_event"
301
314
  require_relative "whop_sdk/models/shipment"
302
315
  require_relative "whop_sdk/models/shipment_carrier"
303
316
  require_relative "whop_sdk/models/shipment_create_params"
@@ -362,6 +375,7 @@ require_relative "whop_sdk/resources/members"
362
375
  require_relative "whop_sdk/resources/memberships"
363
376
  require_relative "whop_sdk/resources/messages"
364
377
  require_relative "whop_sdk/resources/notifications"
378
+ require_relative "whop_sdk/resources/payment_methods"
365
379
  require_relative "whop_sdk/resources/payments"
366
380
  require_relative "whop_sdk/resources/plans"
367
381
  require_relative "whop_sdk/resources/products"
@@ -369,6 +383,7 @@ require_relative "whop_sdk/resources/promo_codes"
369
383
  require_relative "whop_sdk/resources/reactions"
370
384
  require_relative "whop_sdk/resources/refunds"
371
385
  require_relative "whop_sdk/resources/reviews"
386
+ require_relative "whop_sdk/resources/setup_intents"
372
387
  require_relative "whop_sdk/resources/shipments"
373
388
  require_relative "whop_sdk/resources/support_channels"
374
389
  require_relative "whop_sdk/resources/transfers"
@@ -130,6 +130,12 @@ module WhopSDK
130
130
  sig { returns(WhopSDK::Resources::AccountLinks) }
131
131
  attr_reader :account_links
132
132
 
133
+ sig { returns(WhopSDK::Resources::SetupIntents) }
134
+ attr_reader :setup_intents
135
+
136
+ sig { returns(WhopSDK::Resources::PaymentMethods) }
137
+ attr_reader :payment_methods
138
+
133
139
  # @api private
134
140
  sig { override.returns(T::Hash[String, String]) }
135
141
  private def auth_headers
@@ -34,6 +34,10 @@ module WhopSDK
34
34
  sig { returns(WhopSDK::AppBuildPlatforms::OrSymbol) }
35
35
  attr_accessor :platform
36
36
 
37
+ # The id of the ai prompt that created this build
38
+ sig { returns(T.nilable(String)) }
39
+ attr_accessor :ai_prompt_id
40
+
37
41
  # The ID of the app to create a build for. By default the current app from the api
38
42
  # key is used.
39
43
  sig { returns(T.nilable(String)) }
@@ -53,6 +57,7 @@ module WhopSDK
53
57
  ),
54
58
  checksum: String,
55
59
  platform: WhopSDK::AppBuildPlatforms::OrSymbol,
60
+ ai_prompt_id: T.nilable(String),
56
61
  app_id: T.nilable(String),
57
62
  supported_app_view_types:
58
63
  T.nilable(T::Array[WhopSDK::AppViewType::OrSymbol]),
@@ -70,6 +75,8 @@ module WhopSDK
70
75
  checksum:,
71
76
  # The platform of the app build (ios, android, web)
72
77
  platform:,
78
+ # The id of the ai prompt that created this build
79
+ ai_prompt_id: nil,
73
80
  # The ID of the app to create a build for. By default the current app from the api
74
81
  # key is used.
75
82
  app_id: nil,
@@ -90,6 +97,7 @@ module WhopSDK
90
97
  ),
91
98
  checksum: String,
92
99
  platform: WhopSDK::AppBuildPlatforms::OrSymbol,
100
+ ai_prompt_id: T.nilable(String),
93
101
  app_id: T.nilable(String),
94
102
  supported_app_view_types:
95
103
  T.nilable(T::Array[WhopSDK::AppViewType::OrSymbol]),
@@ -57,6 +57,11 @@ module WhopSDK
57
57
  sig { returns(T.nilable(String)) }
58
58
  attr_accessor :customer_name
59
59
 
60
+ # The payment method ID to use for this invoice. If using charge_automatically,
61
+ # you must provide a payment_method_id.
62
+ sig { returns(T.nilable(String)) }
63
+ attr_accessor :payment_method_id
64
+
60
65
  # The payment token ID to use for this invoice. If using charge_automatically, you
61
66
  # must provide a payment_token.
62
67
  sig { returns(T.nilable(String)) }
@@ -84,6 +89,7 @@ module WhopSDK
84
89
  product_id: String,
85
90
  charge_buyer_fee: T.nilable(T::Boolean),
86
91
  customer_name: T.nilable(String),
92
+ payment_method_id: T.nilable(String),
87
93
  payment_token_id: T.nilable(String),
88
94
  request_options: WhopSDK::RequestOptions::OrHash
89
95
  ).returns(T.attached_class)
@@ -117,6 +123,9 @@ module WhopSDK
117
123
  # want to create an invoice for a customer who does not have a member of your
118
124
  # company yet.
119
125
  customer_name: nil,
126
+ # The payment method ID to use for this invoice. If using charge_automatically,
127
+ # you must provide a payment_method_id.
128
+ payment_method_id: nil,
120
129
  # The payment token ID to use for this invoice. If using charge_automatically, you
121
130
  # must provide a payment_token.
122
131
  payment_token_id: nil,
@@ -135,6 +144,7 @@ module WhopSDK
135
144
  product: WhopSDK::InvoiceCreateParams::Product,
136
145
  charge_buyer_fee: T.nilable(T::Boolean),
137
146
  customer_name: T.nilable(String),
147
+ payment_method_id: T.nilable(String),
138
148
  payment_token_id: T.nilable(String),
139
149
  email_address: String,
140
150
  product_id: String,
@@ -93,6 +93,17 @@ module WhopSDK
93
93
  sig { returns(T.nilable(Time)) }
94
94
  attr_accessor :paid_at
95
95
 
96
+ # The payment method used for the payment, if available.
97
+ sig { returns(T.nilable(WhopSDK::Payment::PaymentMethod)) }
98
+ attr_reader :payment_method
99
+
100
+ sig do
101
+ params(
102
+ payment_method: T.nilable(WhopSDK::Payment::PaymentMethod::OrHash)
103
+ ).void
104
+ end
105
+ attr_writer :payment_method
106
+
96
107
  # The different types of payment methods that can be used.
97
108
  sig { returns(T.nilable(WhopSDK::PaymentMethodTypes::TaggedSymbol)) }
98
109
  attr_accessor :payment_method_type
@@ -191,6 +202,7 @@ module WhopSDK
191
202
  membership: T.nilable(WhopSDK::Payment::Membership::OrHash),
192
203
  metadata: T.nilable(T::Hash[Symbol, T.anything]),
193
204
  paid_at: T.nilable(Time),
205
+ payment_method: T.nilable(WhopSDK::Payment::PaymentMethod::OrHash),
194
206
  payment_method_type: T.nilable(WhopSDK::PaymentMethodTypes::OrSymbol),
195
207
  plan: T.nilable(WhopSDK::Payment::Plan::OrHash),
196
208
  product: T.nilable(WhopSDK::Payment::Product::OrHash),
@@ -244,6 +256,8 @@ module WhopSDK
244
256
  metadata:,
245
257
  # The datetime the payment was paid
246
258
  paid_at:,
259
+ # The payment method used for the payment, if available.
260
+ payment_method:,
247
261
  # The different types of payment methods that can be used.
248
262
  payment_method_type:,
249
263
  # The plan attached to this payment.
@@ -301,6 +315,7 @@ module WhopSDK
301
315
  membership: T.nilable(WhopSDK::Payment::Membership),
302
316
  metadata: T.nilable(T::Hash[Symbol, T.anything]),
303
317
  paid_at: T.nilable(Time),
318
+ payment_method: T.nilable(WhopSDK::Payment::PaymentMethod),
304
319
  payment_method_type:
305
320
  T.nilable(WhopSDK::PaymentMethodTypes::TaggedSymbol),
306
321
  plan: T.nilable(WhopSDK::Payment::Plan),
@@ -512,6 +527,130 @@ module WhopSDK
512
527
  end
513
528
  end
514
529
 
530
+ class PaymentMethod < WhopSDK::Internal::Type::BaseModel
531
+ OrHash =
532
+ T.type_alias do
533
+ T.any(WhopSDK::Payment::PaymentMethod, WhopSDK::Internal::AnyHash)
534
+ end
535
+
536
+ # The ID of the payment method
537
+ sig { returns(String) }
538
+ attr_accessor :id
539
+
540
+ # The card data associated with the payment method, if its a debit or credit card.
541
+ sig { returns(T.nilable(WhopSDK::Payment::PaymentMethod::Card)) }
542
+ attr_reader :card
543
+
544
+ sig do
545
+ params(
546
+ card: T.nilable(WhopSDK::Payment::PaymentMethod::Card::OrHash)
547
+ ).void
548
+ end
549
+ attr_writer :card
550
+
551
+ # The date and time the payment method was created
552
+ sig { returns(Time) }
553
+ attr_accessor :created_at
554
+
555
+ # The payment method type of the payment method
556
+ sig { returns(WhopSDK::PaymentMethodTypes::TaggedSymbol) }
557
+ attr_accessor :payment_method_type
558
+
559
+ # The payment method used for the payment, if available.
560
+ sig do
561
+ params(
562
+ id: String,
563
+ card: T.nilable(WhopSDK::Payment::PaymentMethod::Card::OrHash),
564
+ created_at: Time,
565
+ payment_method_type: WhopSDK::PaymentMethodTypes::OrSymbol
566
+ ).returns(T.attached_class)
567
+ end
568
+ def self.new(
569
+ # The ID of the payment method
570
+ id:,
571
+ # The card data associated with the payment method, if its a debit or credit card.
572
+ card:,
573
+ # The date and time the payment method was created
574
+ created_at:,
575
+ # The payment method type of the payment method
576
+ payment_method_type:
577
+ )
578
+ end
579
+
580
+ sig do
581
+ override.returns(
582
+ {
583
+ id: String,
584
+ card: T.nilable(WhopSDK::Payment::PaymentMethod::Card),
585
+ created_at: Time,
586
+ payment_method_type: WhopSDK::PaymentMethodTypes::TaggedSymbol
587
+ }
588
+ )
589
+ end
590
+ def to_hash
591
+ end
592
+
593
+ class Card < WhopSDK::Internal::Type::BaseModel
594
+ OrHash =
595
+ T.type_alias do
596
+ T.any(
597
+ WhopSDK::Payment::PaymentMethod::Card,
598
+ WhopSDK::Internal::AnyHash
599
+ )
600
+ end
601
+
602
+ # Possible card brands that a payment token can have
603
+ sig { returns(T.nilable(WhopSDK::CardBrands::TaggedSymbol)) }
604
+ attr_accessor :brand
605
+
606
+ # Card expiration month, like 03 for March.
607
+ sig { returns(T.nilable(Integer)) }
608
+ attr_accessor :exp_month
609
+
610
+ # Card expiration year, like 27 for 2027.
611
+ sig { returns(T.nilable(Integer)) }
612
+ attr_accessor :exp_year
613
+
614
+ # Last four digits of the card.
615
+ sig { returns(T.nilable(String)) }
616
+ attr_accessor :last4
617
+
618
+ # The card data associated with the payment method, if its a debit or credit card.
619
+ sig do
620
+ params(
621
+ brand: T.nilable(WhopSDK::CardBrands::OrSymbol),
622
+ exp_month: T.nilable(Integer),
623
+ exp_year: T.nilable(Integer),
624
+ last4: T.nilable(String)
625
+ ).returns(T.attached_class)
626
+ end
627
+ def self.new(
628
+ # Possible card brands that a payment token can have
629
+ brand:,
630
+ # Card expiration month, like 03 for March.
631
+ exp_month:,
632
+ # Card expiration year, like 27 for 2027.
633
+ exp_year:,
634
+ # Last four digits of the card.
635
+ last4:
636
+ )
637
+ end
638
+
639
+ sig do
640
+ override.returns(
641
+ {
642
+ brand: T.nilable(WhopSDK::CardBrands::TaggedSymbol),
643
+ exp_month: T.nilable(Integer),
644
+ exp_year: T.nilable(Integer),
645
+ last4: T.nilable(String)
646
+ }
647
+ )
648
+ end
649
+ def to_hash
650
+ end
651
+ end
652
+ end
653
+
515
654
  class Plan < WhopSDK::Internal::Type::BaseModel
516
655
  OrHash =
517
656
  T.type_alias do