Class: Mercadopago::Refund
- Defined in:
- lib/mercadopago/resources/refund.rb
Overview
Issues full or partial refunds on approved payments.
Refunds can be created within 180 days of payment approval. The seller's account must hold enough funds to cover the refund; otherwise the API returns a 400 Bad Request.
Instance Method Summary collapse
-
#create(payment_id, refund_data: nil, request_options: nil) ⇒ Hash{Symbol => Object}
Creates a full or partial refund on a payment.
-
#get(payment_id, refund_id, request_options: nil) ⇒ Hash{Symbol => Object}
Retrieves a single refund by ID.
-
#list(payment_id, request_options: nil) ⇒ Hash{Symbol => Object}
Lists all refunds for a given payment.
Methods inherited from MPBase
#_check_headers, #_check_request_options, #_delete, #_get, #_path_param, #_post, #_put, #initialize
Constructor Details
This class inherits a constructor from Mercadopago::MPBase
Instance Method Details
#create(payment_id, refund_data: nil, request_options: nil) ⇒ Hash{Symbol => Object}
Creates a full or partial refund on a payment.
Omit refund_data for a full refund, or pass { amount: 10.0 }
for a partial refund.
48 49 50 51 52 |
# File 'lib/mercadopago/resources/refund.rb', line 48 def create(payment_id, refund_data: nil, request_options: nil) raise TypeError, 'Param refund_data must be a Hash' unless refund_data.nil? || refund_data.is_a?(Hash) _post(uri: "/v1/payments/#{_path_param(payment_id)}/refunds", data: refund_data, request_options: ) end |
#get(payment_id, refund_id, request_options: nil) ⇒ Hash{Symbol => Object}
Retrieves a single refund by ID.
30 31 32 33 34 35 |
# File 'lib/mercadopago/resources/refund.rb', line 30 def get(payment_id, refund_id, request_options: nil) _get( uri: "/v1/payments/#{_path_param(payment_id)}/refunds/#{_path_param(refund_id)}", request_options: ) end |
#list(payment_id, request_options: nil) ⇒ Hash{Symbol => Object}
Lists all refunds for a given payment.
19 20 21 |
# File 'lib/mercadopago/resources/refund.rb', line 19 def list(payment_id, request_options: nil) _get(uri: "/v1/payments/#{_path_param(payment_id)}/refunds", request_options: ) end |