LangChain tools for Mercado Pago payments (CobroYa)
Project description
langchain-mercadopago
LangChain tools for Mercado Pago payments. Wraps 5 core Mercado Pago API operations as LangChain StructuredTool instances, ready to use with any LangChain or LangGraph agent.
Installation
pip install langchain-mercadopago
Usage
from langchain_mercadopago import create_mercadopago_tools
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_openai import ChatOpenAI
# Create the 5 Mercado Pago tools
tools = create_mercadopago_tools("YOUR_MERCADO_PAGO_ACCESS_TOKEN")
# Use with any LangChain agent
llm = ChatOpenAI(model="gpt-4o")
agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)
result = executor.invoke({"input": "Create a payment link for 2 shirts at $50 ARS each"})
Available Tools
| Tool | Description |
|---|---|
create_payment_preference |
Creates a Mercado Pago checkout payment preference (payment link). Returns init_point URL for redirecting buyers. |
get_payment |
Retrieve a payment by its ID. Returns full payment details including status, amount, payer info. |
create_refund |
Refund a payment fully or partially. Omit amount for full refund. |
search_payments |
Search recent payments for the authenticated merchant. Supports filtering by status. |
get_merchant_info |
Retrieve the authenticated merchant's user profile including ID, nickname, and site. |
Security
payment_idparameters are validated to be strictly numeric before URL interpolation to prevent path traversal attacks.- All API calls use Bearer token authentication via the
Authorizationheader.
Development
pip install -e ".[dev]"
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_mercadopago-0.1.0.tar.gz.
File metadata
- Download URL: langchain_mercadopago-0.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e0e26a5d2f7b3d6397548e3d6693e943070513fe606c8a80e05dbcb44147ed9
|
|
| MD5 |
03dee3ca2398f875902ad4ab40ed55f6
|
|
| BLAKE2b-256 |
a3763194a768f3fdc7b01eb808e265b46961a1cb6b86c690bebfbed87b77b79d
|
File details
Details for the file langchain_mercadopago-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_mercadopago-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
322afadd0e7fa4d28b72ea9f019350abdee340614a17948b5908f9ebeda496a9
|
|
| MD5 |
6e758d2389b83dcd4cb088c30332b6a1
|
|
| BLAKE2b-256 |
cf518de5f0eebf5a4c0d255cfd0904f5e55d91e6ca6093e996cd6de327e55155
|