class MercadoPago::CustomCheckout::Customer

Public Class Methods

Public Instance Methods

create_customer(payload = {}) click to toggle source

Create a customer.

  • payload: Contains the data required to create the customer.

# File lib/mercadopago/custom_checkout/customer.rb, line 17
def create_customer(payload = {})
  payload = MultiJson.dump(payload)

  MercadoPago::Core::Request.post_request(
    "/v1/customers?access_token=#{@access_token}",
    payload
  )
end
create_customer_card(customer_id, payload = {}) click to toggle source

Create a customer card.

  • customer_id: The ID of the customer to retrieve the cards.

# File lib/mercadopago/custom_checkout/customer.rb, line 74
def create_customer_card(customer_id, payload = {})
  payload = MultiJson.dump(payload)

  MercadoPago::Core::Request.post_request(
    "/v1/customers/#{customer_id}/cards?access_token=#{@access_token}",
    payload
  )
end
delete_customer(customer_id) click to toggle source

Delete a customer.

  • customer_id: The ID of the customer to be deleted.

# File lib/mercadopago/custom_checkout/customer.rb, line 52
def delete_customer(customer_id)
  MercadoPago::Core::Request.delete_request(
    "/v1/customers/#{customer_id}",
    { access_token: @access_token }
  )
end
retrieve_customer(customer_id) click to toggle source

Retrieve a customer.

  • customer_id: The ID of the customer to be retrieved.

# File lib/mercadopago/custom_checkout/customer.rb, line 29
def retrieve_customer(customer_id)
  MercadoPago::Core::Request.get_request(
    "/v1/customers/#{customer_id}",
    { access_token: @access_token }
  )
end
retrieve_customer_cards(customer_id) click to toggle source

Retrieves all customer cards.

  • customer_id: The ID of the customer to retrieve the cards.

# File lib/mercadopago/custom_checkout/customer.rb, line 64
def retrieve_customer_cards(customer_id)
  MercadoPago::Core::Request.get_request(
    "/v1/customers/#{customer_id}/cards",
    { access_token: @access_token }
  )
end
update_customer(customer_id, payload = {}) click to toggle source

Update a customer.

  • customer_id: The ID of the customer to be updated.

  • payload: Contains the data required to update the customer.

# File lib/mercadopago/custom_checkout/customer.rb, line 40
def update_customer(customer_id, payload = {})
  payload = MultiJson.dump(payload)

  MercadoPago::Core::Request.put_request(
    "/v1/customers/#{customer_id}?access_token=#{@access_token}",
    payload
  )
end