Simple Pagar.me module made by Surfmappers.com
Project description
Pagarme Surfmappers
An implementation of the Pagar.me API for Python. This repository appears as an alternative to the Pagar.me library suggested by the documentation, that has some problems and which, for example, was not used by us because of this.
Install
pip install pagarme-surfmappers
How to use
You can use this lib as Pagar.me documentation suggests to. Above we'll show some examples
We gonna assume that you already have an valid Pagar.me api key:
YOUR_API_KEY = "your_pagarme_api_key"
Table of Contents
Bank Account
You can create and get an bank account. Check Pagar.me documentation for more details:
Create Bank Account
import pagarme_surfmappers
YOUR_API_KEY = "your_pagarme_api_key"
pagarme_surfmappers.set_api_key(YOUR_API_KEY)
bank_account = pagarme_surfmappers.BankAccount()
params = {
...
}
try:
new_bank_account = bank_account.create(params)
except Exception as e:
print(e)
raise
print(new_bank_account)
Get Bank Account
import pagarme_surfmappers
YOUR_API_KEY = "your_pagarme_api_key"
pagarme_surfmappers.set_api_key(YOUR_API_KEY)
bank_account = pagarme_surfmappers.BankAccount()
try:
user_bank_account = bank_account.get()
except Exception as e:
print(e)
raise
print(user_bank_account)
Bulk Anticipation
You can create, confirm, calcel and get limits of a bulk anticipation. Check Pagar.me documentation for more details:
import pagarme_surfmappers
YOUR_API_KEY = "your_pagarme_api_key"
pagarme_surfmappers.set_api_key(YOUR_API_KEY)
bulk = pagarme_surfmappers.BulkAnticipation()
recipient_id = "some_user_recipient"
params = {
...
}
try:
new_bulk = bulk.create(recipient_id, params)
except Exception as e:
print(e)
raise
print(new_bulk)
Recipient
You can create, get and edit an recipient. You can also get an recipient balance. Check Pagar.me documentation for more details:
Create Recipient
import pagarme_surfmappers
YOUR_API_KEY = "your_pagarme_api_key"
params = {
...
}
pagarme_surfmappers.set_api_key(YOUR_API_KEY)
recipient = pagarme_surfmappers.Recipient()
try:
new_recipient = recipient.create(params)
except Exception as e:
print(e)
raise
print(new_recipient)
Get Recipient
import pagarme_surfmappers
YOUR_API_KEY = "your_pagarme_api_key"
recipient_id = "some_user_recipient_id"
pagarme_surfmappers.set_api_key(YOUR_API_KEY)
recipient = pagarme_surfmappers.Recipient()
try:
user_recipient = recipient.get(recipient_id)
except Exception as e:
print(e)
raise
print(user_recipient)
Get Recipient's Balance
import pagarme_surfmappers
YOUR_API_KEY = "your_pagarme_api_key"
recipient_id = 'some_user_recipient_id'
pagarme_surfmappers.set_api_key(YOUR_API_KEY)
recipient = pagarme_surfmappers.Recipient()
try:
user_balance = recipient.get_balance(recipient_id)
except Exception as e:
print(e)
raise
print(user_balance)
Transaction
You can create and capture an transaction. Check Pagar.me documentation for more details:
Create Transaction
import pagarme_surfmappers
YOUR_API_KEY = "your_pagarme_api_key"
params = {
...
}
pagarme_surfmappers.set_api_key(YOUR_API_KEY)
transaction = pagarme_surfmappers.Transaction()
try:
new_transaction = transaction.create(params)
except Exception as e:
print(e)
raise
print(new_transaction)
Capture Transaction
import pagarme_surfmappers
YOUR_API_KEY = "your_pagarme_api_key"
params = {
...
}
pagarme_surfmappers.set_api_key(YOUR_API_KEY)
transaction = pagarme_surfmappers.Transaction()
token_id = "some_transaction_token_id"
try:
captured_transaction = transaction.capture(token_id, params)
except Exception as e:
print(e)
raise
print(captured_transaction)
Calculate Installments
import pagarme_surfmappers
YOUR_API_KEY = "your_pagarme_api_key"
params = {
...
}
pagarme_surfmappers.set_api_key(YOUR_API_KEY)
transaction = pagarme_surfmappers.Transaction()
token_id = "some_transaction_token_id"
try:
installments = transaction.calculate_installments_amount(token_id, params)
except Exception as e:
print(e)
raise
print(installments)
Transfer
You can create, get and cancel an transfer. Check Pagar.me documentation for more details:
Create Transfer:
import pagarme_surfmappers
YOUR_API_KEY = "your_pagarme_api_key"
params = {
...
}
pagarme_surfmappers.set_api_key(YOUR_API_KEY)
transfer = pagarme_surfmappers.Transfer()
try:
new_transfer = transfer.create(params)
except Exception as e:
print(e)
raise
print(new_transfer)
Contributing and Support
Feel free to contribut to this code, improving it. Any problems can be reported in form of github issue, as any doubts.
Changelog
License
This lib is MIT licensed.
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
Built Distributions
File details
Details for the file pagarme_surfmappers-1.4.1-py3-none-any.whl
.
File metadata
- Download URL: pagarme_surfmappers-1.4.1-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97bcd8b2d4854fed0cd42aee8728efb6b6aa37d214976f47caf909fb60bfb651 |
|
MD5 | 39e6bdec48243a72749153840e94f9b7 |
|
BLAKE2b-256 | bdb7ba84fddd4e6b51caeec9815155bbfe657538b0b2da209e32dffd09574ff3 |
File details
Details for the file pagarme_surfmappers-1.4.1-py2-none-any.whl
.
File metadata
- Download URL: pagarme_surfmappers-1.4.1-py2-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d583385c6b95c4c700deb617b3baf0ac7becc7c3c5d551b634aa538d729ade2c |
|
MD5 | b613ff972ce737e3d1f28e767fbed42e |
|
BLAKE2b-256 | 99edf778a23017ebebcfa6731eb3fc4be9bb376049ff37ad946e5c12b29105c5 |