Class: Lithic::Resources::Cards
- Inherits:
-
Object
- Object
- Lithic::Resources::Cards
- Defined in:
- lib/lithic/resources/cards.rb,
lib/lithic/resources/cards/balances.rb,
lib/lithic/resources/cards/financial_transactions.rb,
sig/lithic/resources/cards.rbs,
sig/lithic/resources/cards/balances.rbs,
sig/lithic/resources/cards/financial_transactions.rbs
Defined Under Namespace
Classes: Balances, FinancialTransactions
Instance Attribute Summary collapse
- #balances ⇒ Lithic::Resources::Cards::Balances readonly
- #financial_transactions ⇒ Lithic::Resources::Cards::FinancialTransactions readonly
Instance Method Summary collapse
-
#convert_physical(card_token, shipping_address:, carrier: nil, product_id: nil, shipping_method: nil, request_options: {}) ⇒ Lithic::Models::Card
Some parameter documentations has been truncated, see Models::CardConvertPhysicalParams for more details.
-
#create(type:, account_token: nil, bulk_order_token: nil, card_program_token: nil, carrier: nil, digital_card_art_token: nil, exp_month: nil, exp_year: nil, memo: nil, pin: nil, product_id: nil, replacement_account_token: nil, replacement_comment: nil, replacement_for: nil, replacement_substatus: nil, shipping_address: nil, shipping_method: nil, spend_limit: nil, spend_limit_duration: nil, state: nil, idempotency_key: nil, request_options: {}) ⇒ Lithic::Models::Card
Some parameter documentations has been truncated, see Models::CardCreateParams for more details.
- #embed(embed_request:, hmac:, request_options: {}) ⇒ String deprecated Deprecated.
-
#initialize(client:) ⇒ Cards
constructor
private
A new instance of Cards.
-
#list(account_token: nil, begin_: nil, end_: nil, ending_before: nil, memo: nil, page_size: nil, starting_after: nil, state: nil, request_options: {}) ⇒ Lithic::Internal::CursorPage<Lithic::Models::NonPCICard>
Some parameter documentations has been truncated, see Models::CardListParams for more details.
-
#provision(card_token, certificate: nil, client_device_id: nil, client_wallet_account_id: nil, digital_wallet: nil, nonce: nil, nonce_signature: nil, request_options: {}) ⇒ Lithic::Models::CardProvisionResponse
Some parameter documentations has been truncated, see Models::CardProvisionParams for more details.
-
#reissue(card_token, carrier: nil, product_id: nil, shipping_address: nil, shipping_method: nil, request_options: {}) ⇒ Lithic::Models::Card
Some parameter documentations has been truncated, see Models::CardReissueParams for more details.
-
#renew(card_token, shipping_address:, carrier: nil, exp_month: nil, exp_year: nil, product_id: nil, shipping_method: nil, request_options: {}) ⇒ Lithic::Models::Card
Some parameter documentations has been truncated, see Models::CardRenewParams for more details.
-
#retrieve(card_token, request_options: {}) ⇒ Lithic::Models::Card
Get card configuration such as spend limit and state.
-
#retrieve_signals(card_token, request_options: {}) ⇒ Lithic::Models::SignalsResponse
Returns behavioral feature state derived from a card's transaction history.
-
#retrieve_spend_limits(card_token, request_options: {}) ⇒ Lithic::Models::CardSpendLimits
Get a Card's available spend limit, which is based on the spend limit configured on the Card and the amount already spent over the spend limit's duration.
-
#search_by_pan(pan:, request_options: {}) ⇒ Lithic::Models::Card
Get card configuration such as spend limit and state.
-
#update(card_token, comment: nil, digital_card_art_token: nil, memo: nil, network_program_token: nil, pin: nil, pin_status: nil, spend_limit: nil, spend_limit_duration: nil, state: nil, substatus: nil, request_options: {}) ⇒ Lithic::Models::Card
Some parameter documentations has been truncated, see Models::CardUpdateParams for more details.
-
#web_provision(card_token, client_device_id: nil, client_wallet_account_id: nil, digital_wallet: nil, server_session_id: nil, request_options: {}) ⇒ Lithic::Models::CardWebProvisionResponse::AppleWebPushProvisioningResponse, Lithic::Models::CardWebProvisionResponse::GoogleWebPushProvisioningResponse
Some parameter documentations has been truncated, see Models::CardWebProvisionParams 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.
526 527 528 529 530 |
# File 'lib/lithic/resources/cards.rb', line 526 def initialize(client:) @client = client @balances = Lithic::Resources::Cards::Balances.new(client: client) @financial_transactions = Lithic::Resources::Cards::FinancialTransactions.new(client: client) end |
Instance Attribute Details
#balances ⇒ Lithic::Resources::Cards::Balances (readonly)
7 8 9 |
# File 'lib/lithic/resources/cards.rb', line 7 def balances @balances end |
#financial_transactions ⇒ Lithic::Resources::Cards::FinancialTransactions (readonly)
10 11 12 |
# File 'lib/lithic/resources/cards.rb', line 10 def financial_transactions @financial_transactions end |
Instance Method Details
#convert_physical(card_token, shipping_address:, carrier: nil, product_id: nil, shipping_method: nil, request_options: {}) ⇒ Lithic::Models::Card
Some parameter documentations has been truncated, see Models::CardConvertPhysicalParams for more details.
Convert a virtual card into a physical card and manufacture it. Customer must
supply relevant fields for physical card creation including product_id,
carrier, shipping_method, and shipping_address. The card token will be
unchanged. The card's type will be altered to PHYSICAL. The card will be set
to state PENDING_FULFILLMENT and fulfilled at next fulfillment cycle. Virtual
cards created on card programs which do not support physical cards cannot be
converted. The card program cannot be changed as part of the conversion. Cards
must be in an OPEN state to be converted. Only applies to cards of type
VIRTUAL (or existing cards with deprecated types of DIGITAL_WALLET and
UNLOCKED).
220 221 222 223 224 225 226 227 228 229 |
# File 'lib/lithic/resources/cards.rb', line 220 def convert_physical(card_token, params) parsed, = Lithic::CardConvertPhysicalParams.dump_request(params) @client.request( method: :post, path: ["v1/cards/%1$s/convert_physical", card_token], body: parsed, model: Lithic::Card, options: ) end |
#create(type:, account_token: nil, bulk_order_token: nil, card_program_token: nil, carrier: nil, digital_card_art_token: nil, exp_month: nil, exp_year: nil, memo: nil, pin: nil, product_id: nil, replacement_account_token: nil, replacement_comment: nil, replacement_for: nil, replacement_substatus: nil, shipping_address: nil, shipping_method: nil, spend_limit: nil, spend_limit_duration: nil, state: nil, idempotency_key: nil, request_options: {}) ⇒ Lithic::Models::Card
Some parameter documentations has been truncated, see Models::CardCreateParams for more details.
Create a new virtual or physical card. Parameters shipping_address and
product_id only apply to physical cards.
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/lithic/resources/cards.rb', line 67 def create(params) parsed, = Lithic::CardCreateParams.dump_request(params) header_params = {idempotency_key: "idempotency-key"} @client.request( method: :post, path: "v1/cards", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Lithic::Card, options: ) end |
#embed(embed_request:, hmac:, request_options: {}) ⇒ String
Deprecated. Use the modern embedded card flow instead: create a session with
POST /v1/cards/{card_token}/embed and render it via GET /v1/embed.
Handling full card PANs and CVV codes requires that you comply with the Payment Card Industry Data Security Standards (PCI DSS). Some clients choose to reduce their compliance obligations by leveraging our embedded card UI solution documented below.
In this setup, PANs and CVV codes are presented to the end-user via a card UI
that we provide, optionally styled in the customer's branding using a specified
css stylesheet. A user's browser makes the request directly to api.lithic.com,
so card PANs and CVVs never touch the API customer's servers while full card
data is displayed to their end-users. The response contains an HTML document
(see Embedded Card UI or Changelog for upcoming changes in January). This means
that the url for the request can be inserted straight into the src attribute
of an iframe.
<iframe
id="card-iframe"
src="https://sandbox.lithic.com/v1/embed/card?embed_request=eyJjc3MiO...;hmac=r8tx1..."
allow="clipboard-write"
class="content"
></iframe>
You should compute the request payload on the server side. You can render it (or the whole iframe) on the server or make an ajax call from your front end code, but do not ever embed your API key into front end code, as doing so introduces a serious security vulnerability.
275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/lithic/resources/cards.rb', line 275 def (params) parsed, = Lithic::CardEmbedParams.dump_request(params) query = Lithic::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/embed/card", query: query, headers: {"accept" => "text/html"}, model: String, options: ) end |
#list(account_token: nil, begin_: nil, end_: nil, ending_before: nil, memo: nil, page_size: nil, starting_after: nil, state: nil, request_options: {}) ⇒ Lithic::Internal::CursorPage<Lithic::Models::NonPCICard>
Some parameter documentations has been truncated, see Models::CardListParams for more details.
List cards.
176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/lithic/resources/cards.rb', line 176 def list(params = {}) parsed, = Lithic::CardListParams.dump_request(params) query = Lithic::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/cards", query: query.transform_keys(begin_: "begin", end_: "end"), page: Lithic::Internal::CursorPage, model: Lithic::NonPCICard, options: ) end |
#provision(card_token, certificate: nil, client_device_id: nil, client_wallet_account_id: nil, digital_wallet: nil, nonce: nil, nonce_signature: nil, request_options: {}) ⇒ Lithic::Models::CardProvisionResponse
Some parameter documentations has been truncated, see Models::CardProvisionParams for more details.
Allow your cardholders to directly add payment cards to the device's digital wallet (e.g. Apple Pay) with one touch from your app.
This requires some additional setup and configuration. Please Contact Us or your Customer Success representative for more information.
319 320 321 322 323 324 325 326 327 328 |
# File 'lib/lithic/resources/cards.rb', line 319 def provision(card_token, params = {}) parsed, = Lithic::CardProvisionParams.dump_request(params) @client.request( method: :post, path: ["v1/cards/%1$s/provision", card_token], body: parsed, model: Lithic::Models::CardProvisionResponse, options: ) end |
#reissue(card_token, carrier: nil, product_id: nil, shipping_address: nil, shipping_method: nil, request_options: {}) ⇒ Lithic::Models::Card
Some parameter documentations has been truncated, see Models::CardReissueParams for more details.
Initiate print and shipment of a duplicate physical card (e.g. card is
physically damaged). The PAN, expiry, and CVC2 will remain the same and the
original card can continue to be used until the new card is activated. Only
applies to cards of type PHYSICAL. A card can be reissued or renewed a total
of 8 times.
356 357 358 359 360 361 362 363 364 365 |
# File 'lib/lithic/resources/cards.rb', line 356 def reissue(card_token, params = {}) parsed, = Lithic::CardReissueParams.dump_request(params) @client.request( method: :post, path: ["v1/cards/%1$s/reissue", card_token], body: parsed, model: Lithic::Card, options: ) end |
#renew(card_token, shipping_address:, carrier: nil, exp_month: nil, exp_year: nil, product_id: nil, shipping_method: nil, request_options: {}) ⇒ Lithic::Models::Card
Some parameter documentations has been truncated, see Models::CardRenewParams for more details.
Applies to card types PHYSICAL and VIRTUAL. For PHYSICAL, creates a new
card with the same card token and PAN, but updated expiry and CVC2 code. The
original card will keep working for card-present transactions until the new card
is activated. For card-not-present transactions, the original card details
(expiry, CVC2) will also keep working until the new card is activated. A
PHYSICAL card can be reissued or renewed a total of 8 times. For VIRTUAL,
the card will retain the same card token and PAN and receive an updated expiry
and CVC2 code. product_id, shipping_method, shipping_address, carrier
are only relevant for renewing PHYSICAL cards.
401 402 403 404 405 406 407 408 409 410 |
# File 'lib/lithic/resources/cards.rb', line 401 def renew(card_token, params) parsed, = Lithic::CardRenewParams.dump_request(params) @client.request( method: :post, path: ["v1/cards/%1$s/renew", card_token], body: parsed, model: Lithic::Card, options: ) end |
#retrieve(card_token, request_options: {}) ⇒ Lithic::Models::Card
Get card configuration such as spend limit and state.
90 91 92 93 94 95 96 97 |
# File 'lib/lithic/resources/cards.rb', line 90 def retrieve(card_token, params = {}) @client.request( method: :get, path: ["v1/cards/%1$s", card_token], model: Lithic::Card, options: params[:request_options] ) end |
#retrieve_signals(card_token, request_options: {}) ⇒ Lithic::Models::SignalsResponse
Returns behavioral feature state derived from a card's transaction history.
These signals expose the same data used by behavioral rule attributes (e.g.
AMOUNT_Z_SCORE with scope: CARD, IS_NEW_COUNTRY with scope: CARD) and
custom code TRANSACTION_HISTORY_SIGNALS features, allowing clients to inspect
feature values before writing rules and debug rule behavior.
428 429 430 431 432 433 434 435 |
# File 'lib/lithic/resources/cards.rb', line 428 def retrieve_signals(card_token, params = {}) @client.request( method: :get, path: ["v1/cards/%1$s/signals", card_token], model: Lithic::SignalsResponse, options: params[:request_options] ) end |
#retrieve_spend_limits(card_token, request_options: {}) ⇒ Lithic::Models::CardSpendLimits
Get a Card's available spend limit, which is based on the spend limit configured on the Card and the amount already spent over the spend limit's duration. For example, if the Card has a monthly spend limit of $1000 configured, and has spent $600 in the last month, the available spend limit returned would be $400.
450 451 452 453 454 455 456 457 |
# File 'lib/lithic/resources/cards.rb', line 450 def retrieve_spend_limits(card_token, params = {}) @client.request( method: :get, path: ["v1/cards/%1$s/spend_limits", card_token], model: Lithic::CardSpendLimits, options: params[:request_options] ) end |
#search_by_pan(pan:, request_options: {}) ⇒ Lithic::Models::Card
Get card configuration such as spend limit and state. Customers must be PCI
compliant to use this endpoint. Please contact
support.lithic.com for questions. Note: this is
a POST endpoint because it is more secure to send sensitive data in a request
body than in a URL.
474 475 476 477 478 479 480 481 482 483 |
# File 'lib/lithic/resources/cards.rb', line 474 def search_by_pan(params) parsed, = Lithic::CardSearchByPanParams.dump_request(params) @client.request( method: :post, path: "v1/cards/search_by_pan", body: parsed, model: Lithic::Card, options: ) end |
#update(card_token, comment: nil, digital_card_art_token: nil, memo: nil, network_program_token: nil, pin: nil, pin_status: nil, spend_limit: nil, spend_limit_duration: nil, state: nil, substatus: nil, request_options: {}) ⇒ Lithic::Models::Card
Some parameter documentations has been truncated, see Models::CardUpdateParams for more details.
Update the specified properties of the card. Unsupplied properties will remain unchanged.
Note: setting a card to a CLOSED state is a final action that cannot be
undone.
137 138 139 140 141 142 143 144 145 146 |
# File 'lib/lithic/resources/cards.rb', line 137 def update(card_token, params = {}) parsed, = Lithic::CardUpdateParams.dump_request(params) @client.request( method: :patch, path: ["v1/cards/%1$s", card_token], body: parsed, model: Lithic::Card, options: ) end |
#web_provision(card_token, client_device_id: nil, client_wallet_account_id: nil, digital_wallet: nil, server_session_id: nil, request_options: {}) ⇒ Lithic::Models::CardWebProvisionResponse::AppleWebPushProvisioningResponse, Lithic::Models::CardWebProvisionResponse::GoogleWebPushProvisioningResponse
Some parameter documentations has been truncated, see Models::CardWebProvisionParams for more details.
Allow your cardholders to directly add payment cards to the device's digital wallet from a browser on the web.
This requires some additional setup and configuration. Please Contact Us or your Customer Success representative for more information.
512 513 514 515 516 517 518 519 520 521 |
# File 'lib/lithic/resources/cards.rb', line 512 def web_provision(card_token, params = {}) parsed, = Lithic::CardWebProvisionParams.dump_request(params) @client.request( method: :post, path: ["v1/cards/%1$s/web_provision", card_token], body: parsed, model: Lithic::Models::CardWebProvisionResponse, options: ) end |