Class: WhopSDK::Resources::Payments
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Payments
- Defined in:
- lib/whop_sdk/resources/payments.rb,
sig/whop_sdk/resources/payments.rbs
Instance Method Summary collapse
- #`void` ⇒ Object
-
#create(body:, request_options: {}) ⇒ WhopSDK::Models::Payment
Charge an existing member off-session using one of their stored payment methods.
-
#initialize(client:) ⇒ Payments
constructor
private
A new instance of Payments.
-
#list(after: nil, before: nil, billing_reasons: nil, checkout_configuration_ids: nil, company_id: nil, created_after: nil, created_before: nil, currencies: nil, direction: nil, first: nil, include_free: nil, last: nil, order: nil, plan_ids: nil, product_ids: nil, query: nil, statuses: nil, substatuses: nil, updated_after: nil, updated_before: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::PaymentListResponse>
Some parameter documentations has been truncated, see Models::PaymentListParams for more details.
-
#list_fees(id, after: nil, before: nil, first: nil, last: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::PaymentListFeesResponse>
Returns the list of fees associated with a specific payment, including platform fees and processing fees.
-
#refund(id, partial_amount: nil, request_options: {}) ⇒ WhopSDK::Models::Payment
Some parameter documentations has been truncated, see Models::PaymentRefundParams for more details.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Payment
Retrieves the details of an existing payment.
-
#retry_(id, request_options: {}) ⇒ WhopSDK::Models::Payment
Retry a failed or pending payment.
-
#void(id, request_options: {}) ⇒ WhopSDK::Models::Payment
Void a payment that has not yet been settled.
Constructor Details
#initialize(client:) ⇒ Payments
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Payments.
301 302 303 |
# File 'lib/whop_sdk/resources/payments.rb', line 301 def initialize(client:) @client = client end |
Instance Method Details
#`void` ⇒ Object
58 |
# File 'sig/whop_sdk/resources/payments.rbs', line 58
def `void`: (
|
#create(body:, request_options: {}) ⇒ WhopSDK::Models::Payment
Charge an existing member off-session using one of their stored payment methods. You can provide an existing plan, or create a new one in-line. This endpoint will respond with a payment object immediately, but the payment is processed asynchronously in the background. Use webhooks to be notified when the payment succeeds or fails.
Required permissions:
payment:chargeplan:createaccess_pass:createaccess_pass:updateplan:basic:readaccess_pass:basic:readmember:email:readmember:basic:readmember:phone:readpromo_code:basic:readpayment:dispute:readpayment:resolution_center_case:read
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/whop_sdk/resources/payments.rb', line 36 def create(params) parsed, = WhopSDK::PaymentCreateParams.dump_request(params) @client.request( method: :post, path: "payments", body: parsed[:body], model: WhopSDK::Payment, options: ) end |
#list(after: nil, before: nil, billing_reasons: nil, checkout_configuration_ids: nil, company_id: nil, created_after: nil, created_before: nil, currencies: nil, direction: nil, first: nil, include_free: nil, last: nil, order: nil, plan_ids: nil, product_ids: nil, query: nil, statuses: nil, substatuses: nil, updated_after: nil, updated_before: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::PaymentListResponse>
Some parameter documentations has been truncated, see Models::PaymentListParams for more details.
Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date.
Required permissions:
payment:basic:readplan:basic:readaccess_pass:basic:readmember:email:readmember:basic:readmember:phone:readpromo_code:basic:read
142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/whop_sdk/resources/payments.rb', line 142 def list(params = {}) parsed, = WhopSDK::PaymentListParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "payments", query: query, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Models::PaymentListResponse, options: ) end |
#list_fees(id, after: nil, before: nil, first: nil, last: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::PaymentListFeesResponse>
Returns the list of fees associated with a specific payment, including platform fees and processing fees.
Required permissions:
payment:basic:read
179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/whop_sdk/resources/payments.rb', line 179 def list_fees(id, params = {}) parsed, = WhopSDK::PaymentListFeesParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["payments/%1$s/fees", id], query: query, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Models::PaymentListFeesResponse, options: ) end |
#refund(id, partial_amount: nil, request_options: {}) ⇒ WhopSDK::Models::Payment
Some parameter documentations has been truncated, see Models::PaymentRefundParams for more details.
Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly.
Required permissions:
payment:manageplan:basic:readaccess_pass:basic:readmember:email:readmember:basic:readmember:phone:readpromo_code:basic:readpayment:dispute:readpayment:resolution_center_case:read
221 222 223 224 225 226 227 228 229 230 |
# File 'lib/whop_sdk/resources/payments.rb', line 221 def refund(id, params = {}) parsed, = WhopSDK::PaymentRefundParams.dump_request(params) @client.request( method: :post, path: ["payments/%1$s/refund", id], body: parsed, model: WhopSDK::Payment, options: ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Payment
Retrieves the details of an existing payment.
Required permissions:
payment:basic:readplan:basic:readaccess_pass:basic:readmember:email:readmember:basic:readmember:phone:readpromo_code:basic:readpayment:dispute:readpayment:resolution_center_case:read
70 71 72 73 74 75 76 77 |
# File 'lib/whop_sdk/resources/payments.rb', line 70 def retrieve(id, params = {}) @client.request( method: :get, path: ["payments/%1$s", id], model: WhopSDK::Payment, options: params[:request_options] ) end |
#retry_(id, request_options: {}) ⇒ WhopSDK::Models::Payment
Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details.
Required permissions:
payment:manageplan:basic:readaccess_pass:basic:readmember:email:readmember:basic:readmember:phone:readpromo_code:basic:readpayment:dispute:readpayment:resolution_center_case:read
256 257 258 259 260 261 262 263 |
# File 'lib/whop_sdk/resources/payments.rb', line 256 def retry_(id, params = {}) @client.request( method: :post, path: ["payments/%1$s/retry", id], model: WhopSDK::Payment, options: params[:request_options] ) end |
#void(id, request_options: {}) ⇒ WhopSDK::Models::Payment
Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor.
Required permissions:
payment:manageplan:basic:readaccess_pass:basic:readmember:email:readmember:basic:readmember:phone:readpromo_code:basic:readpayment:dispute:readpayment:resolution_center_case:read
289 290 291 292 293 294 295 296 |
# File 'lib/whop_sdk/resources/payments.rb', line 289 def void(id, params = {}) @client.request( method: :post, path: ["payments/%1$s/void", id], model: WhopSDK::Payment, options: params[:request_options] ) end |