Skip to main content

A Django app to add support for Mercadopago payments

Project description

AX3 Mercadopago

AX3 Mercadopago A Django app to add support for Mercadopago payments.

Installation

AX3 Mercadopago is easy to install from the PyPI package:

$ pip install ax3-mercadopago

After installing the package, the project settings need to be configured.

Add ax3_mercadopago to your INSTALLED_APPS

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    # ax3_mercadopago app can be in any position in the INSTALLED_APPS list.
    'ax3_mercadopago',
]

Configuration

Add mercadopago settings

# app/settings.py

MERCADOPAGO_REFERENCE_PREFIX = ''  # Prefix for Mercadopago external reference 
MERCADOPAGO_PAYMENT_MODEL = ''  # Path to payment model
MERCADOPAGO_PAID_USECASE = ''  # Path to use case for paid payments
MERCADOPAGO_REJECTED_USECASE = ''  # Path to use case for rejected payments

# For Marketplace
# https://www.mercadopago.com.co/developers/es/guides/online-payments/marketplace/checkout-pro/introduction
MERCADOPAGO_MARKETPLACE_SELLER = True
MERCADOPAGO_MARKETPLACE_APP_ID = ''
MERCADOPAGO_MARKETPLACE_REDIRECT_URI = ''  

Set ax3_mercadopago in app urls

# app/urls.py
urlpatterns = [
    path('admin/', admin.site.urls),

    # Add this line
    path('mercadopago/', include('ax3_mercadopago.urls', namespace='mercadopago')),
]

Use PaymentModelMixin in your payment model

class Payment(PaymentModelMixin):

Utils

Get seller token request uri, on shell_plus

from ax3_mercadopago.api import AX3Client

mp = AX3Client()
mp.marketplace_tokens.get_auth_uri()
# response
https://auth.mercadopago.com.co/authorization?client_id=&redirect_uri=https%3A%2F%2Fclientes-staging.takami.co&response_type=code&platform_id=mp

To create Seller Token, on shell_plus use

from app.mercadopago import create_seller_token

brand = Brand.objects.first()
create_seller_token(code='SELLER-CODE', brand=brand)

Releasing a new version

Make sure you increase the version number and create a git tag:

$ python3 -m pip install --user --upgrade setuptools wheel twine
$ ./release.sh

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

AX3 Mercadopago-0.3.5.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

AX3_Mercadopago-0.3.5-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file AX3 Mercadopago-0.3.5.tar.gz.

File metadata

  • Download URL: AX3 Mercadopago-0.3.5.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.5

File hashes

Hashes for AX3 Mercadopago-0.3.5.tar.gz
Algorithm Hash digest
SHA256 7c7663039dc7af412d986ac2aa4ddacb8c0daa3e3e56c06542115a57d61c4c08
MD5 1be4700e59aa73ecc0bde1d5fa76582a
BLAKE2b-256 6d30a11e81174a4ff10b4d5f08224c044f5882f9619fe3a7373ddacf74b808b8

See more details on using hashes here.

File details

Details for the file AX3_Mercadopago-0.3.5-py3-none-any.whl.

File metadata

  • Download URL: AX3_Mercadopago-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.5

File hashes

Hashes for AX3_Mercadopago-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 55bd358bac9e9997f7610f4fff5004954d78a3096241880c5cbec3b366571ddd
MD5 55cd9cafee79a98a6d0822939de449e7
BLAKE2b-256 0c5919a163d9a5390c3beac70424b675de4d211ed291fbb183dafd01619e98af

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