Skip to main content

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 time to expiration (in minutes)
pix.set_time_limit(10)

# 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)

status 
Payment Details:
ID: 108412339053
Amount: 2
QR Code: 00020126400014br.gov.bcb.pix0118devpy912@gmail.com52040000530398654042.005802BR5918BERE202405190802466009Sao Paulo62250521mpqrinter108412339053630466AA
Description: Pagamento de teste
Currency ID: BRL
Last Updated: 2025-04-18T20:05:23.000-04:00
Ticket URL: None
Start Date: 2025-04-18T20:05:20.000-04:00
Expiration Date: 2025-04-18T20:15:19.000-04:00
Status Code: pending
Payment Status: pending_waiting_transfer
Time to Expiration: 304 seconds

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)

status 
Payment Details:
ID: 108412339053
Amount: 2
QR Code: 00020126400014br.gov.bcb.pix0118devpy912@gmail.com52040000530398654042.005802BR5918BERE202405190802466009Sao Paulo62250521mpqrinter108412339053630466AA
Description: Pagamento de teste
Currency ID: BRL
Last Updated: 2025-04-18T20:05:23.000-04:00
Ticket URL: None
Start Date: 2025-04-18T20:05:20.000-04:00
Expiration Date: 2025-04-18T20:15:19.000-04:00
Status Code: pending
Payment Status: pending_waiting_transfer
Time to Expiration: 304 seconds

License

This project is licensed under the MIT License.

Project details


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

If you're not sure about the file name format, learn more about wheel file names.

mercadopagovp-0.4.2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file mercadopagovp-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: mercadopagovp-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for mercadopagovp-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 79693453d22f6a84d8a367ca87dc01c88e2a71edc336f6c30dd166b57b86fbe8
MD5 d2a06af94de0d93cfd13e6006dbcc8a3
BLAKE2b-256 7bbdce848f228aa2c4390cc74fd1ac157f94e311a8bed0f33d73ee8505dcd695

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page