Skip to main content

Juno Python Library

PyPI

The Juno Python library provides integration access to the Juno Gateway.

Installing

This lib can be found on pip. To install it, use:

$ pip install juno-python-nfr

Documentation

Quick Start Example

import juno

juno.init(
    client_id="CLIENT_ID_JUNO",
    client_secret="CLIENT_SECRET_JUNO",
    resource_token="RESOURCE_TOKEN_JUNO",
    idempotency_key="IDEMPOTENCY_KEY",  # only for create pix routes
    sandbox=False,
)

result_charge = juno.charge.create(
    {
        "charge": {
            "description": "Description",
            "amount": "100.00",
            "references": [""],
            "payment_types": ["CREDIT_CARD"],
        },
        "billing": {
            "name": "Name Test",
            "document": "00000000000",  # Add a valid CPF
        },
    }
)

if result_charge.is_success:
    result_payment = juno.payment.create(
        {
            "charge_id": result_charge.charge.id,
            "billing": {
                "email": "name@test.com",  # Add a valid email
                "address": {  # Add a valid address
                    "street": "",
                    "number": "",
                    "complement": "",
                    "neighborhood": "",
                    "city": "",
                    "state": "",
                    "post_code": "",
                },
                "delayed": False,  # for capture delayed, use: "delayed": True
            },
            # if card is attached: "credit_card_details": {"credit_card_id": "id"}
            "credit_card_details": {"credit_card_hash": "hash"},
        }
    )

    if result_payment.is_success:
        print(f"Success payment: {result_payment.payment.id}")
    else:
        print(result_payment.errors)
else:
    print(result_charge.errors)

Tokenize Card

result_card = juno.card.tokenization({"credit_card_hash": "39612e90-ae60-4fdd-a437-fcff56c41bea"})

if result_card.is_success:
    print(f"Attached card id: {result_card.credit_card_id}")
    print(f".... {result_card.last4_card_number} ({result_card.expiration_month}/{result_card.expiration_year})")
else:
    print(result_card.errors)

List Charges

response = juno.charge.find_all(
    query_params={
        "created_on_start": "2022-02-13", "created_on_end": "2022-02-14", "order_asc": False
    }
)

# You can pass the argument with keyword or not
# ... charge.find_all({"created_on_start": "2022-02-13", ...})

for charge in response.charges:
    print(charge)

Detail Charge

response = juno.charge.find_by_id("chr_1EECDF55648943D78BDFC6D852E19266")
print(response.charge)

Cancel Charge

response = juno.charge.cancelation("chr_1EECDF55648943D78BDFC6D852E19266")
print(response)

Capture Delayed

# ...
juno.payment.capture(result_payment.payment.id, {"charge_id": result_charge.charge.id})

Partial Capture Delayed

# ...
juno.payment.capture(result_payment.payment.id, {"charge_id": result_charge.charge.id, "amount": "100.00"})

Refund Payment

response = juno.payment.refund("pay_879D6006555C3309E4504C63B743BF59")
print(response)

Partial Refund Payment

response = juno.payment.refund("pay_879D6006555C3309E4504C63B743BF59", {"amount": "10.00"})
print(response)

Support

If you have any problem or suggestion please open an issue here.

License

Check here.

Release files for juno-python-nfr 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for juno-python-nfr 0.4.2
File Size Uploaded
juno-python-nfr-0.4.2.tar.gz 11.0 kB Details

Release files / juno-python-nfr-0.4.2.tar.gz

Download URL juno-python-nfr-0.4.2.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4d57346f2994140a527df4bba095689586523b7dfb04b27c97038f6add84c0df
BLAKE2b-256 checksum
How to use checksums
1c3af9c82b17c8e03cd3b1de30174f331ce2aa2b7830614a00527d2a643c29a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.4.2 This release

1 release file

0.4.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page