Class: Mercadopago::Point

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

Overview

Manages payment intents on MercadoPago Point (POS) devices.

Enables in-person payment processing by creating payment intents that are sent to a physical Point device for the buyer to complete the transaction by inserting or tapping their card.

Note: The change_operating_mode operation (PATCH /point/integration-api/devices/{device_id}) is not included because the Ruby SDK HTTP client does not currently expose a PATCH method.

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

#cancel(device_id, payment_intent_id, request_options: nil) ⇒ Hash{Symbol => Object}

Cancels a pending payment intent on a specific device.

Use this to abort a transaction before the buyer completes the payment on the device.

Parameters:

  • device_id (String)

    unique identifier of the Point device holding the intent

  • payment_intent_id (String)

    unique identifier of the payment intent to cancel

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

    per-call configuration override

Returns:

  • (Hash{Symbol => Object})

    :status and :response with cancellation confirmation

See Also:



79
80
81
82
83
84
# File 'lib/mercadopago/resources/point.rb', line 79

def cancel(device_id, payment_intent_id, request_options: nil)
  _delete(
    uri: "/point/integration-api/devices/#{device_id}/payment-intents/#{payment_intent_id}",
    request_options: request_options
  )
end

#create(device_id, payment_intent_data, request_options: nil) ⇒ Hash{Symbol => Object}

Creates a payment intent on a specific Point device.

The payment intent is sent to the physical device, where the buyer completes the transaction.

Parameters:

  • device_id (String)

    unique identifier of the target Point device

  • payment_intent_data (Hash)

    payment intent attributes (amount, description, payment method details, etc.)

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

    per-call configuration override

Returns:

  • (Hash{Symbol => Object})

    :status and :response with the created intent

Raises:

  • (TypeError)

    if payment_intent_data is not a Hash

See Also:



42
43
44
45
46
47
48
49
50
# File 'lib/mercadopago/resources/point.rb', line 42

def create(device_id, payment_intent_data, request_options: nil)
  raise TypeError, 'Param payment_intent_data must be a Hash' unless payment_intent_data.is_a?(Hash)

  _post(
    uri: "/point/integration-api/devices/#{device_id}/payment-intents",
    data: payment_intent_data,
    request_options: request_options
  )
end

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

Retrieves the current state of a payment intent by its ID.

Use this to check whether the buyer has completed, cancelled, or is still processing the payment on the device.

Parameters:

  • payment_intent_id (String)

    unique identifier of the payment intent

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

    per-call configuration override

Returns:

  • (Hash{Symbol => Object})

    :status and :response with intent details including :state and, when completed, :payment_id

See Also:



62
63
64
65
66
67
# File 'lib/mercadopago/resources/point.rb', line 62

def get(payment_intent_id, request_options: nil)
  _get(
    uri: "/point/integration-api/payment-intents/#{payment_intent_id}",
    request_options: request_options
  )
end

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

Lists Point devices linked to the authenticated account.

Parameters:

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

    optional query parameters (e.g. store_id, pos_id)

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

    per-call configuration override

Returns:

  • (Hash{Symbol => Object})

    :status and :response with a list of devices

Raises:

  • (TypeError)

    if filters is not a Hash

See Also:



24
25
26
27
28
# File 'lib/mercadopago/resources/point.rb', line 24

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

  _get(uri: '/point/integration-api/devices', filters: filters, request_options: request_options)
end