point

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdditionalInfoRequest

type AdditionalInfoRequest struct {
	ExternalReference string `json:"external_reference,omitempty"`
	TicketNumber      string `json:"ticket_number,omitempty"`
	PrintOnTerminal   bool   `json:"print_on_terminal,omitempty"`
}

AdditionalInfoRequest contains the additional payment intent information.

type AdditionalInfoResponse

type AdditionalInfoResponse struct {
	ExternalReference string `json:"external_reference"`
	TicketNumber      string `json:"ticket_number"`
	PrintOnTerminal   bool   `json:"print_on_terminal"`
}

type CancelResponse

type CancelResponse struct {
	ID string `json:"id"`
}

type Client

type Client interface {
	// Create a point payment intent.
	// It is a post request to the endpoint: https://api.mercadopago.com/point/integration-api/devices/{device_id}/payment-intents
	// Reference: https://www.mercadopago.com/developers/en/reference/integrations_api_paymentintent_mlb/_point_integration-api_devices_deviceid_payment-intents/post
	Create(ctx context.Context, deviceID string, request Request) (*Response, error)

	// Get a point payment intent.
	// It is a get request to the endpoint: https://api.mercadopago.com/point/integration-api/payment-intents/{payment_intent_id}
	// Reference: https://www.mercadopago.com/developers/en/reference/integrations_api/_point_integration-api_payment-intents_paymentintentid/get
	Get(ctx context.Context, paymentIntentID string) (*Response, error)

	// Cancel a point payment intent.
	// It is a cancel request to the endpoint: https://api.mercadopago.com/point/integration-api/devices/{device_id}/payment-intents/{payment_intent_id}
	// Reference: https://www.mercadopago.com/developers/en/reference/integrations_api/_point_integration-api_devices_deviceid_payment-intents_paymentintentid/delete
	Cancel(ctx context.Context, deviceID, paymentIntentID string) (*CancelResponse, error)

	// ListDevices retrieve devices.
	// It is a get request to the endpoint: https://api.mercadopago.com/point/integration-api/devices
	// Reference: https://www.mercadopago.com/developers/en/reference/integrations_api/_point_integration-api_devices/get
	ListDevices(ctx context.Context) (*DevicesResponse, error)

	// UpdateOperatingMode update operating mode from device.
	// It is a patch request to the endpoint: https://api.mercadopago.com/point/integration-api/devices/{device-id}
	// Reference: https://www.mercadopago.com/developers/en/reference/integrations_api/_point_integration-api_devices_device-id/patch
	UpdateOperatingMode(ctx context.Context, deviceID, operatingMode string) (*OperatingModeResponse, error)
}

Client contains the methods to interact with the Point API.

func NewClient

func NewClient(c *config.Config) Client

NewClient returns a new Point Client.

type DeviceResponse

type DeviceResponse struct {
	ID            string `json:"id"`
	ExternalPosID string `json:"external_pos_id"`
	OperatingMode string `json:"operating_mode"`
	PosID         int    `json:"pos_id"`
	StoreID       string `json:"store_id"`
}

type DevicesResponse

type DevicesResponse struct {
	Paging  PagingResponse   `json:"paging"`
	Devices []DeviceResponse `json:"devices"`
}

type OperatingModeRequest

type OperatingModeRequest struct {
	OperatingMode string `json:"operating_mode,omitempty"`
}

OperatingModeRequest represents the operation mode to be changed of the device. The options are: PDV, which is when the device is used in integrated mode with our API, and STANDALONE, which is used when you want to process payments without our API.

type OperatingModeResponse

type OperatingModeResponse struct {
	OperatingMode string `json:"operating_mode"`
}

type PagingResponse

type PagingResponse struct {
	Total  int `json:"total"`
	Offset int `json:"offset"`
	Limit  int `json:"limit"`
}

type PaymentRequest

type PaymentRequest struct {
	Type             string `json:"type,omitempty"`
	InstallmentsCost string `json:"installments_cost,omitempty"`
	ID               int    `json:"id,omitempty"`
	Installments     int    `json:"installments,omitempty"`
}

PaymentRequest contains properties of Payment Intent.

type PaymentResponse

type PaymentResponse struct {
	Type             string `json:"type"`
	InstallmentsCost string `json:"installments_cost"`
	VoucherType      string `json:"voucher_type"`
	ID               int    `json:"id"`
	Installments     int    `json:"installments"`
}

type Request

type Request struct {
	AdditionalInfo *AdditionalInfoRequest `json:"additional_info,omitempty"`
	Payment        *PaymentRequest        `json:"payment,omitempty"`

	Description string `json:"description,omitempty"`
	Amount      int    `json:"amount,omitempty"`
}

Request is used to create a payment intention, sending the details of a transaction.

type Response

type Response struct {
	Payment        PaymentResponse        `json:"payment"`
	AdditionalInfo AdditionalInfoResponse `json:"additional_info"`

	ID          string `json:"id"`
	Description string `json:"description"`
	State       string `json:"state"`
	DeviceID    string `json:"device_id"`
	Amount      int    `json:"amount"`
}

Response contains the response of a payment intention.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL