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.
-
#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, #_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.
34 35 36 37 38 |
# File 'lib/mercadopago/resources/refund.rb', line 34 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/#{payment_id}/refunds", data: refund_data, 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/#{payment_id}/refunds", request_options: ) end |