Class: Mercadopago::Preference
- Defined in:
- lib/mercadopago/resources/preference.rb
Overview
Manages Checkout Pro payment preferences.
A preference defines the items, payer info, redirect URLs, and payment configuration for a Checkout Pro session. The API returns an init_point URL that redirects the buyer to the hosted checkout.
Instance Method Summary collapse
-
#create(preference_data, request_options: nil) ⇒ Hash{Symbol => Object}
Creates a new Checkout Pro preference.
-
#get(preference_id, request_options: nil) ⇒ Hash{Symbol => Object}
Retrieves an existing preference.
-
#update(preference_id, preference_data, request_options: nil) ⇒ Hash{Symbol => Object}
Updates an existing preference.
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(preference_data, request_options: nil) ⇒ Hash{Symbol => Object}
Creates a new Checkout Pro preference.
30 31 32 33 34 |
# File 'lib/mercadopago/resources/preference.rb', line 30 def create(preference_data, request_options: nil) raise TypeError, 'Param preference_data must be a Hash' unless preference_data.is_a?(Hash) _post(uri: '/checkout/preferences', data: preference_data, request_options: ) end |
#get(preference_id, request_options: nil) ⇒ Hash{Symbol => Object}
Retrieves an existing preference.
19 20 21 |
# File 'lib/mercadopago/resources/preference.rb', line 19 def get(preference_id, request_options: nil) _get(uri: "/checkout/preferences/#{preference_id}", request_options: ) end |
#update(preference_id, preference_data, request_options: nil) ⇒ Hash{Symbol => Object}
Updates an existing preference.
44 45 46 47 48 |
# File 'lib/mercadopago/resources/preference.rb', line 44 def update(preference_id, preference_data, request_options: nil) raise TypeError, 'Param preference_data must be a Hash' unless preference_data.is_a?(Hash) _put(uri: "/checkout/preferences/#{preference_id}", data: preference_data, request_options: ) end |