Giter Club home page Giter Club logo

django-payments-mercadopago's Introduction

django-payments-mercadopago

A mercadopago payment gateway backend for django-payments

Compatibility

  • Python 3.6 ≥ 3.8
  • Django 2.2 ≥ 3.2

Installation

You can install it via pip, pipenv or your favorite virtual environment manager

pip install django-payments-mercadopago

Add payments_mercadopago to your settings.py file

INSTALLED_APPS = [
    # ...
    'payments_mercadopago',
    ]

Settings.py configuration

Add the payments_mercadopago.MercadoPagoProvider to your PAYMENT_VARIANTS variable. Also to make it available add MercadoPago to your CHECKOUT_PAYMENT_CHOICES variable

Configuration for development

PAYMENT_VARIANTS = {
    # ...
    'MercadoPago':('payments_mercadopago.MercadoPagoProvider',{
        'access_token': 'MERCADO_PAGO_SANDBOX_ACCESS_TOKEN',
        'sandbox_mode': True})
}

CHECKOUT_PAYMENT_CHOICES = [('MercadoPago', 'Mercado Pago')]

If you have any problem using localhost urls as the return value of get_failure_url() or get_success_url() methods try using ngrok.

Configuration for production

PAYMENT_VARIANTS = {
    # ...
    'MercadoPago':('payments_mercadopago.MercadoPagoProvider',{
        'access_token': 'MERCADO_PAGO_ACCESS_TOKEN',
        'sandbox_mode': False})
}

CHECKOUT_PAYMENT_CHOICES = [('MercadoPago', 'Mercado Pago')]

Obtaining the Tokens

You can get your own Mercado Pago production and sandbox access tokens in your Mercado pago developer panel

Documentation

This project uses django-payments to work. For detailed instructions on how to make and configure payments using django-payments please visit the official django-payments documentation

django-payments-mercadopago's People

Contributors

eduardozepeda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

loboguardian

django-payments-mercadopago's Issues

There's no `transaction_id` for unpaid preferences

I'm looking into migrating from my own implementation (jazzband/django-payments#232) to yours, especially since yours uses a newer SDK and some newer API endpoints.

I've noticed a big variation that makes things very tricky; when I create a preference, I save its id into payment.transaction_id. This makes sure I have an externally unique id for each preference, so I'm fully certain that data can be crossed between both systems in case of discrepancy.

However, I've noticed that your library does not save anything in payment.trasaction_id; you're only saving a the payment's id after you receive a payment confirmation. This can be tricky, because if the confirmation is not received/processed for some reason, there's no way to map the Payment object to a preference.

self.create_payment is also called unconditaionally via get_form, so if the preference had already been created, a second one is created. This can result in two Preferences being created (and paid!), but only one reflected in the database model.

I've though about making some changes to use payment.transaction_id = preference_id, but I think that would very likely break for you, since your database contains something difference. Do you think there's another fix around this that could work?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.