Package: pagarme-surfmappers
Pagarme SurfmappersAn 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.Installpip install pagarme-surfmappersHow to useYou can use this lib asPagar.me documentationsuggests to. Above we'll show some examplesWe gonna assume that you already have an valid Pagar.me api key:YOUR_API_KEY="your_pagarme_api_key"Table of ContentsBank AccountBulk AnticipationRecipientTransactionTransferBank AccountYou can create and get an bank account. CheckPagar.me documentationfor more details:Create Bank Accountimportpagarme_surfmappersYOUR_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)exceptExceptionase:print(e)raiseprint(new_bank_account)Get Bank Accountimportpagarme_surfmappersYOUR_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()exceptExceptionase:print(e)raiseprint(user_bank_account)Bulk AnticipationYou can create, confirm, calcel and get limits of a bulk anticipation. CheckPagar.me documentationfor more details:importpagarme_surfmappersYOUR_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)exceptExceptionase:print(e)raiseprint(new_bulk)RecipientYou can create, get and edit an recipient. You can also get an recipient balance. CheckPagar.me documentationfor more details:Create Recipientimportpagarme_surfmappersYOUR_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)exceptExceptionase:print(e)raiseprint(new_recipient)Get Recipientimportpagarme_surfmappersYOUR_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)exceptExceptionase:print(e)raiseprint(user_recipient)Get Recipient's Balanceimportpagarme_surfmappersYOUR_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)exceptExceptionase:print(e)raiseprint(user_balance)TransactionYou can create and capture an transaction. CheckPagar.me documentationfor more details:Create Transactionimportpagarme_surfmappersYOUR_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)exceptExceptionase:print(e)raiseprint(new_transaction)Capture Transactionimportpagarme_surfmappersYOUR_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)exceptExceptionase:print(e)raiseprint(captured_transaction)Calculate Installmentsimportpagarme_surfmappersYOUR_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)exceptExceptionase:print(e)raiseprint(installments)TransferYou can create, get and cancel an transfer. CheckPagar.me documentationfor more details:Create Transfer:importpagarme_surfmappersYOUR_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)exceptExceptionase:print(e)raiseprint(new_transfer)Contributing and SupportFeel free to contribut to this code, improving it. Any problems can be reported in form of github issue, as any doubts.ChangelogLicenseThis lib isMIT licensed.