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
Release files for AX3-Mercadopago 0.3.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| AX3 Mercadopago-0.3.7.tar.gz | 8.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| AX3_Mercadopago-0.3.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.2 kB
Release files / AX3 Mercadopago-0.3.7.tar.gz
| Download URL | AX3 Mercadopago-0.3.7.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6abd7cbad4663e60a58d674d4ca481d77c8c2f211b27ad352daa6297c381034a
|
|
BLAKE2b-256 checksum How to use checksums |
0efe3a50359bf884e7b4d0f168f367612c52935e6c2d20ce5e222bd78b4ad28d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / AX3_Mercadopago-0.3.7-py3-none-any.whl
| Download URL | AX3_Mercadopago-0.3.7-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
28b5f94157532292b52aa22846974ce87dea2356648fa9ac740332694666e472
|
|
BLAKE2b-256 checksum How to use checksums |
9b686e3d63fba93b9976d3e662a224ccfe4f7c775233bd2d92a3ac7531609a86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|