Class: Mercadopago::CardToken
- Defined in:
- lib/mercadopago/resources/card_token.rb
Overview
Tokenises raw card data on the MercadoPago server.
The returned token is a single-use reference that replaces sensitive card details when creating a payment or saving a card to a Customer. This keeps PCI-sensitive data off your servers.
Instance Method Summary collapse
-
#create(card_token_data, request_options: nil) ⇒ Hash{Symbol => Object}
Creates a new card token from raw card data.
-
#get(card_token_id, request_options: nil) ⇒ Hash{Symbol => Object}
Retrieves an existing card token’s metadata.
Methods inherited from MPBase
#_check_headers, #_check_request_options, #_delete, #_get, #_post, #_put, #initialize
Constructor Details
This class inherits a constructor from Mercadopago::MPBase
Instance Method Details
#create(card_token_data, request_options: nil) ⇒ Hash{Symbol => Object}
Creates a new card token from raw card data.
28 29 30 31 32 |
# File 'lib/mercadopago/resources/card_token.rb', line 28 def create(card_token_data, request_options: nil) raise TypeError, 'Param card_token_data must be a Hash' unless card_token_data.is_a?(Hash) _post(uri: '/v1/card_tokens', data: card_token_data, request_options: ) end |
#get(card_token_id, request_options: nil) ⇒ Hash{Symbol => Object}
Retrieves an existing card token’s metadata.
18 19 20 |
# File 'lib/mercadopago/resources/card_token.rb', line 18 def get(card_token_id, request_options: nil) _get(uri: "/v1/card_tokens/#{card_token_id}", request_options: ) end |