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/aggregate_balances.rb,
lib/lithic/resources/cards/financial_transactions.rb
Defined Under Namespace
Classes: AggregateBalances, Balances, FinancialTransactions
Instance Attribute Summary collapse
- #aggregate_balances ⇒ Lithic::Resources::Cards::AggregateBalances readonly
- #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, request_options: {}) ⇒ Lithic::Models::Card
Some parameter documentations has been truncated, see Models::CardCreateParams for more details.
-
#embed(embed_request:, hmac:, request_options: {}) ⇒ String
Handling full card PANs and CVV codes requires that you comply with the Payment Card Industry Data Security Standards (PCI DSS).
-
#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_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.
487 488 489 490 491 492 |
# File 'lib/lithic/resources/cards.rb', line 487 def initialize(client:) @client = client @aggregate_balances = Lithic::Resources::Cards::AggregateBalances.new(client: client) @balances = Lithic::Resources::Cards::Balances.new(client: client) @financial_transactions = Lithic::Resources::Cards::FinancialTransactions.new(client: client) end |
Instance Attribute Details
#aggregate_balances ⇒ Lithic::Resources::Cards::AggregateBalances (readonly)
7 8 9 |
# File 'lib/lithic/resources/cards.rb', line 7 def aggregate_balances @aggregate_balances end |
#balances ⇒ Lithic::Resources::Cards::Balances (readonly)
10 11 12 |
# File 'lib/lithic/resources/cards.rb', line 10 def balances @balances end |
#financial_transactions ⇒ Lithic::Resources::Cards::FinancialTransactions (readonly)
13 14 15 |
# File 'lib/lithic/resources/cards.rb', line 13 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`).
212 213 214 215 216 217 218 219 220 221 |
# File 'lib/lithic/resources/cards.rb', line 212 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, 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.
68 69 70 71 |
# File 'lib/lithic/resources/cards.rb', line 68 def create(params) parsed, = Lithic::CardCreateParams.dump_request(params) @client.request(method: :post, path: "v1/cards", body: parsed, model: Lithic::Card, options: ) end |
#embed(embed_request:, hmac:, request_options: {}) ⇒ String
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.
“‘html <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**.
262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/lithic/resources/cards.rb', line 262 def (params) parsed, = Lithic::CardEmbedParams.dump_request(params) @client.request( method: :get, path: "v1/embed/card", query: parsed, 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.
169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/lithic/resources/cards.rb', line 169 def list(params = {}) parsed, = Lithic::CardListParams.dump_request(params) @client.request( method: :get, path: "v1/cards", query: parsed.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](lithic.com/contact) or your Customer Success representative for more information.
305 306 307 308 309 310 311 312 313 314 |
# File 'lib/lithic/resources/cards.rb', line 305 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.
342 343 344 345 346 347 348 349 350 351 |
# File 'lib/lithic/resources/cards.rb', line 342 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.
387 388 389 390 391 392 393 394 395 396 |
# File 'lib/lithic/resources/cards.rb', line 387 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.
83 84 85 86 87 88 89 90 |
# File 'lib/lithic/resources/cards.rb', line 83 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_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.
411 412 413 414 415 416 417 418 |
# File 'lib/lithic/resources/cards.rb', line 411 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 [[email protected]]([email protected]) 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._
435 436 437 438 439 440 441 442 443 444 |
# File 'lib/lithic/resources/cards.rb', line 435 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._
130 131 132 133 134 135 136 137 138 139 |
# File 'lib/lithic/resources/cards.rb', line 130 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. Currently only suported for Apple Pay.
This requires some additional setup and configuration. Please [Contact Us](lithic.com/contact) or your Customer Success representative for more information.
473 474 475 476 477 478 479 480 481 482 |
# File 'lib/lithic/resources/cards.rb', line 473 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 |