Class: Mercadopago::Chargeback

Inherits:
MPBase
  • Object
show all
Defined in:
lib/mercadopago/resources/chargeback.rb

Overview

Provides read access to chargeback disputes.

Chargebacks are initiated by cardholders through their issuing bank when they dispute a payment. Use #get and #search to monitor and respond to disputes.

Instance Method Summary collapse

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

#get(chargeback_id, request_options: nil) ⇒ Hash{Symbol => Object}

Retrieves a chargeback by its ID.

Parameters:

  • chargeback_id (Integer, String)

    unique chargeback identifier

  • request_options (RequestOptions, nil) (defaults to: nil)

    per-call configuration override

Returns:

  • (Hash{Symbol => Object})

    :status and :response with the full chargeback object

See Also:



19
20
21
# File 'lib/mercadopago/resources/chargeback.rb', line 19

def get(chargeback_id, request_options: nil)
  _get(uri: "/v1/chargebacks/#{chargeback_id}", request_options: request_options)
end

#search(filters: nil, request_options: nil) ⇒ Hash{Symbol => Object}

Searches chargebacks matching the given filters.

Parameters:

  • filters (Hash, nil) (defaults to: nil)

    query parameters (e.g. :payment_id, :status)

  • request_options (RequestOptions, nil) (defaults to: nil)

    per-call configuration override

Returns:

  • (Hash{Symbol => Object})

    :status and :response with a paginated list of chargebacks

Raises:

  • (TypeError)

    if filters is not a Hash

See Also:



30
31
32
33
34
# File 'lib/mercadopago/resources/chargeback.rb', line 30

def search(filters: nil, request_options: nil)
  raise TypeError, 'Param filters must be a Hash' unless filters.nil? || filters.is_a?(Hash)

  _get(uri: '/v1/chargebacks/search', filters: filters, request_options: request_options)
end