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
  • .env file with a valid MercadoPago token under the key TOKEN

Configuration

Create a .env file in your project root and add:

TOKEN=your_mercadopago_token_here

Usage

Creating a PIX Payment

from mercadopagovp import CreatePixPayment

# Initialize the payment instance
pix = CreatePixPayment("https://your-domain.com/notification")

# Set payment details
pix.set_value(2.00)
pix.create_client('John', 'Doe', email="johndoe@example.com")

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

# Verify the payment status
verify = VerifyPixPayment(payment.id)
status = verify.verify_payment()
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


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.3.7-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mercadopagovp-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 6.8 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.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 672bc5f007fa10c4e6a6c43ba3307ffac150cff023f2ce5aef2e485057a7cb49
MD5 726d059d1dfb983cb921c6bc7cd3edc4
BLAKE2b-256 5df462f22daa9a016d3d8b715db096a6f626f9fa124b7507572eb8e11c1b07d8

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