A Getnet SDK
Project description
getnet-python
This project is a fork of Getnet-py
This project provider a SDK to handler Getnet API.
Installation
To install getnet-py you can use pip:
$ pip install getnet-python
or pipenv:
$ pipenv install getnet-python
Usage
For use this library the following information is needed:
- Seller ID
- Client ID
- Client Secret
The following environments are supported:
- Sandbox
- Homolog
- Production
At moment, we have support to the following services:
- Token
- Payments
- Credit Card
Instancing the client
from getnet import Environment, Client
client = Client("seller_id", "client_id", "client_secret", Environment.SANDBOX)
client.auth() # Optional, will be executed if needed
Using the Services
Examples
Tokenizing a credit card
token = client.generate_card_token("5155901222280001", "customer_21081826")
token.number_token # token genered in getnet
Generate a credit card
card = client.credit_card(
number_token=tokenizado.number_token,
cardholder_name="JOAO DA SILVA",
security_code="123",
brand="Mastercard",
expiration_month="12",
expiration_year="28"
)
Generate a order
order_id = "12345"
order = client.order(order_id)
Generate a customer
customer_id = "12345"
customer = client.customer(order_id)
Generate a Credit Card Payment
payment = client.create_credit_transaction(
amount="1000",
delayed=False,
pre_authorization=True,
save_card_data=False,
transaction_type="FULL",
number_installments=1,
order=order,
customer=customer,
card=card
)
payment_id = payment.payment_id # ID
status = payment.status # AUTHORIZED
Adjust a Payment Amount
payment_ajusted = client.adjust_credit_transaction(payment_id, "2000")
payment_ajusted.status # APROVED
Capture a Credit Card Payment
captured_payment = client.capture_credit_transaction(id_pagamento, "2000")
captured_payment.status # CONFIRMED
Cancel a Credit Card Payment
canceled_order = client.capture_credit_transaction(id_pagamento, "2000")
canceled_order.status # CANCELED
cancel_payment_credit.credit_cancel.message # "Credit transaction cancelled sucessfully"
Authors
Fábio Vitor fabvitor2010@gmail.com and Ramon Soares contact@ramon.dev.br
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
getnet-python-1.1.tar.gz
(19.4 kB
view hashes)
Built Distribution
Close
Hashes for getnet_python-1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3071edfff03028896b69dc1d79ad06541d1716c7002f6cf0f8ca46140eba2843 |
|
MD5 | d58678c83bcf4cb2760be6393ebfd0a1 |
|
BLAKE2b-256 | e211e2d3d09640b761f7482a89ea10c24b86a98041e88445fc75b8a8d2c192ff |