A library for managing PIX payments on MercadoPago
Project description
Mercadopagovp
Overview
Mercadopagovp is a Python library designed to facilitate the creation and verification of PIX payments using the MercadoPago API.
Installation
pip install mercadopagovp
Requirements
- Python 3.9+
- MercadoPago account
- MercadoPago API key
Configuration
To use the library, you need a valid MercadoPago API key.
Usage
Creating a PIX Payment
from mercadopagovp import CreatePixPayment
# Define the API key
KEY_SDK = "your_mercadopago_api_key"
# Initialize the payment instance
pix = CreatePixPayment(KEY_SDK)
# Set notification URL
pix.set_url_notification('https://your-domain.com/notification')
# Set payment value
pix.set_value(2.00)
# Create a client
pix.create_client('First Name', 'Last Name', email="email@example.com")
# Create the payment
payment = pix.create_payment('Test Payment')
print("Payment Details:")
print(payment)
Expected Response (PixPayment Dataclass)
PixPayment(
id='1234567890',
amount=2.00,
qr_code='qrcode_data_here',
description='Test Payment',
currency_id='BRL',
date_last_updated='2025-03-07T11:12:37.435-04:00',
ticket_url='https://payment.url',
date_init='2025-03-07T11:11:37.435-04:00',
date_end='2025-03-07T11:41:37.435-04:00',
status_code='pending',
status_payment='waiting for payment',
time_to_end=1800
)
Verifying a PIX Payment
from mercadopagovp import VerifyPixPayment
# Initialize the verification instance
verify = VerifyPixPayment(KEY_SDK)
# Verify the payment status
status = verify.verify_payment(payment_id=payment.id)
print("Payment Status:")
print(status)
Expected Response (PixPayment Dataclass)
PixPayment(
id='1234567890',
amount=2.00,
qr_code='qrcode_data_here',
description='Test Payment',
currency_id='BRL',
date_last_updated='2025-03-07T11:42:37.435-04:00',
ticket_url='https://payment.url',
date_init='2025-03-07T11:11:37.435-04:00',
date_end='2025-03-07T11:41:37.435-04:00',
status_code='approved',
status_payment='payment received',
time_to_end=0
)
License
This project is licensed under the MIT License.
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
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 mercadopagovp-0.3.9-py3-none-any.whl.
File metadata
- Download URL: mercadopagovp-0.3.9-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9101f96d1c09aa533fca982bbb82ee94ec7760c402963dbb28d7c5a9be6bc90
|
|
| MD5 |
bee789b7cbba955604938e706d9710e8
|
|
| BLAKE2b-256 |
dfacdc11a17bc8ec16d8275f26e75c461100e27eb7b64372f6037f8a3b9c15fa
|