Class: WhopSDK::Resources::Cards
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Cards
- Defined in:
- lib/whop_sdk/resources/cards.rb,
sig/whop_sdk/resources/cards.rbs
Overview
Cards represent Whop-issued virtual payment cards that spend from an account or user balance. Cards can be assigned to cardholders and configured with spending limits for controlled spending.
Use the Cards API to issue cards, list cards for an account or user, and retrieve active card details such as the card number and CVC.
Instance Method Summary collapse
-
#create(account_id: nil, assigned_user_id: nil, name: nil, spend_limit: nil, spend_limit_frequency: nil, transaction_limit: nil, user_id: nil, request_options: {}) ⇒ WhopSDK::Models::CardCreateResponse
Some parameter documentations has been truncated, see Models::CardCreateParams for more details.
-
#initialize(client:) ⇒ Cards
constructor
private
A new instance of Cards.
-
#list(account_id: nil, user_id: nil, request_options: {}) ⇒ WhopSDK::Models::CardListResponse
Lists issued Whop virtual cards for an account or user, including pending invitation cards that have not been issued by the card provider yet.
-
#retrieve(card_id, account_id: nil, user_id: nil, request_options: {}) ⇒ WhopSDK::Models::CardRetrieveResponse
Retrieves a single card by its icrd_ identifier, including its secrets (full card number, CVC, and cardholder name) for active cards.
-
#update(card_id, account_id: nil, billing: nil, canceled: nil, frozen: nil, name: nil, pin: nil, remove_limit: nil, spend_limit: nil, spend_limit_frequency: nil, transaction_limit: nil, user_id: nil, request_options: {}) ⇒ WhopSDK::Models::CardUpdateResponse
Some parameter documentations has been truncated, see Models::CardUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Cards
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 Cards.
173 174 175 |
# File 'lib/whop_sdk/resources/cards.rb', line 173 def initialize(client:) @client = client end |
Instance Method Details
#create(account_id: nil, assigned_user_id: nil, name: nil, spend_limit: nil, spend_limit_frequency: nil, transaction_limit: nil, user_id: nil, request_options: {}) ⇒ WhopSDK::Models::CardCreateResponse
Some parameter documentations has been truncated, see Models::CardCreateParams for more details.
Issues a virtual card. For an individual (consumer) card issuing account, the card is issued to the account's own cardholder. For a company (business) card issuing account, pass assigneduser_id to issue the card to a company member; if that member is not yet an approved card-issuing user, the card is provisioned asynchronously or an onboarding invitation is sent (HTTP 202). Pass exactly one of account_id (a biz identifier) or userid (a user identifier). Returns the newly created card resource.
comp
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/whop_sdk/resources/cards.rb', line 45 def create(params = {}) parsed, = WhopSDK::CardCreateParams.dump_request(params) @client.request( method: :post, path: "cards", body: parsed, model: WhopSDK::Models::CardCreateResponse, options: ) end |
#list(account_id: nil, user_id: nil, request_options: {}) ⇒ WhopSDK::Models::CardListResponse
Lists issued Whop virtual cards for an account or user, including pending invitation cards that have not been issued by the card provider yet. Pass exactly one of accountid (a biz identifier) or userid (a user identifier). Non-owner team members only see cards assigned to them. Users without the payout:account:read scope can still list cards assigned to them (for example moderators or external cardholders). Use GET /cards/:card_id to retrieve a single card with its secrets.
158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/whop_sdk/resources/cards.rb', line 158 def list(params = {}) parsed, = WhopSDK::CardListParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "cards", query: query, model: WhopSDK::Models::CardListResponse, options: ) end |
#retrieve(card_id, account_id: nil, user_id: nil, request_options: {}) ⇒ WhopSDK::Models::CardRetrieveResponse
Retrieves a single card by its icrd_ identifier, including its secrets (full card number, CVC, and cardholder name) for active cards.
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/whop_sdk/resources/cards.rb', line 72 def retrieve(card_id, params = {}) parsed, = WhopSDK::CardRetrieveParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["cards/%1$s", card_id], query: query, model: WhopSDK::Models::CardRetrieveResponse, options: ) end |
#update(card_id, account_id: nil, billing: nil, canceled: nil, frozen: nil, name: nil, pin: nil, remove_limit: nil, spend_limit: nil, spend_limit_frequency: nil, transaction_limit: nil, user_id: nil, request_options: {}) ⇒ WhopSDK::Models::CardUpdateResponse
Some parameter documentations has been truncated, see Models::CardUpdateParams for more details.
Updates an issued card. All fields are optional; only the fields you pass are changed. Updates the card name, billing address, and spending limits in one call, sets a new PIN, freezes or unfreezes the card, or cancels it. Pass canceled: true alone to cancel the card — cancellation is permanent and a canceled card cannot be uncanceled. Pass exactly one of accountid (a biz identifier) or userid (a user identifier). Assigned cardholders without the payout:account:update scope can update the PIN and freeze state of their own card. The PIN can only be changed on a card assigned to the acting user. Returns the updated card resource.
128 129 130 131 132 133 134 135 136 137 |
# File 'lib/whop_sdk/resources/cards.rb', line 128 def update(card_id, params = {}) parsed, = WhopSDK::CardUpdateParams.dump_request(params) @client.request( method: :patch, path: ["cards/%1$s", card_id], body: parsed, model: WhopSDK::Models::CardUpdateResponse, options: ) end |