Skip to main content

PiePAL - PayPal observability tool

Project description

PiePAL - Terminal Tool for PayPal Observability

A Python program to fetch and display PayPal transactions and subscription details. The script uses the PayPal REST API to retrieve transactions related to a specific Subscription ID and can display them in a terminal using the rich library for a formatted and clean output.

Features

  • Fetch Subscription details
  • Fetch all transactions for a given subscription ID.
  • Display transaction details such as Transaction ID, Amount, Payer Email, and Payer Name.
  • Fetch Subscription Plan details
  • Use the PayPal Sandbox API for testing by using --sandbox
  • Use --verbose output to understand API calls

Setup for usage

  • Install with pip - pip install piepal
  • Set env variables
    • export PAYPAL_CLIENT_ID="..."
    • export PAYPAL_CLIENT_SECRET="..."
  • Run piepal

Setup for development

  • Git clone repository
  • cd ./src
  • Setup credentials with env variables
    • export PAYPAL_CLIENT_ID="..."
    • export PAYPAL_CLIENT_SECRET="..."

Options

usage: piepal [-h] [--transactions | --no-transactions] [--sub SUB] [--txn TXN] [--plan PLAN] [--sandbox | --no-sandbox] [--debug | --no-debug]
              [--verbose | --no-verbose]

[PyPal] - PayPal API Viewer written with Python

options:
  -h, --help            show this help message and exit
  --transactions, --no-transactions
                        List latest transactions
  --sub SUB             Subscription ID to fetch details
  --txn TXN             Transaction ID to fetch details
  --plan PLAN           Plan ID to fetch
  --sandbox, --no-sandbox
                        Use SANDBOX environment
  --debug, --no-debug   Debug output
  --verbose, --no-verbose
                        Verbose output

Examples

Get latest subscriptions

piepal --transactions

Get Subscription details

piepal --sub I-1234567890GG

Get Transaction details

piepal --txn T-12345678990F3FG1231

Get Subscription Plan details

piepal --plan P-12345678990F3FG1231

                           Subscription I-1234567890GG
┏━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Name               ┃ Value                                                     ┃
┡━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Subscription ID    │ I-1234567890GG                                            │
├────────────────────┼───────────────────────────────────────────────────────────┤
│ Plan ID            │ P-1234567890GG123456789YYA                                │
├────────────────────┼───────────────────────────────────────────────────────────┤
│ Status             │ CANCELLED                                                 │
├────────────────────┼───────────────────────────────────────────────────────────┤
│ Amount             │ 12.5                                                      │
├────────────────────┼───────────────────────────────────────────────────────────┤
│ Currency           │ USD                                                       │
├────────────────────┼───────────────────────────────────────────────────────────┤
│ Last Payment Time  │ 2025-04-24T00:00:00Z                                      │
├────────────────────┼───────────────────────────────────────────────────────────┤
│ Status Update Time │ 2025-04-25T00:00:00Z                                      │
├────────────────────┼───────────────────────────────────────────────────────────┤
│ Next Billing Time  │ N/A                                                       │
├────────────────────┼───────────────────────────────────────────────────────────┤
│ Start Time         │ 2025-05-01T00:00:00Z                                      │
├────────────────────┼───────────────────────────────────────────────────────────┤
│ Update Time        │ 2025-04-25T00:00:00Z                                      │
├────────────────────┼───────────────────────────────────────────────────────────┤
│ Failed CX          │ 0                                                         │
├────────────────────┼───────────────────────────────────────────────────────────┤
│ Subscriber Email   │ user_email@example.com                                    │
├────────────────────┼───────────────────────────────────────────────────────────┤
│ Subscriber Name    │ {'given_name': 'John', 'surname': Snow'}                  │
├────────────────────┼───────────────────────────────────────────────────────────┤
│ Payer ID           │ DB1234567890                                              │
└────────────────────┴───────────────────────────────────────────────────────────┘

Transactions for this Subscription

+-----------------------+-------------------------+--------+----------+-------------------+----------------------+
| Transaction ID        |  Date                   | Amount | Currency | Payer Email       | Payer Name           | 
+-----------------------+-------------------------+--------+----------+-------------------+----------------------+
| 5A6789ABC1234567X     | 2025-03-31T12:00:00Z    | $50.00 | USD      | user@example.com  | John Doe             |
+-----------------------+-------------------------+--------+----------+-------------------+----------------------+
| 5A6789ABC1234567Y     | 2025-04-01T10:30:00Z    | $50.00 | USD      | user@example.com  | John Doe             |
+-----------------------+-------------------------+--------+----------+-------------------+----------------------+

Screenshots

License

  • MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

piepal-0.1.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

piepal-0.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file piepal-0.1.0.tar.gz.

File metadata

  • Download URL: piepal-0.1.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for piepal-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4f78fb4b0410bd9f7dd7f78792b436a17c257ac256f462e9d459b5a632df7f44
MD5 9c2e9b63a2c11966a7f88358da57384c
BLAKE2b-256 54d59b16eddf8c23757262d9bd16be4e63acfddccd3e0df130b1cfb67cbf4528

See more details on using hashes here.

File details

Details for the file piepal-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: piepal-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for piepal-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e4c863a7fc86f26bea2d04bbdd8ba35ad159bd6abda1d20cbf8b96937f06ab1
MD5 b7107bdb17f32fbde2437ad1e4abec1f
BLAKE2b-256 9795243303fd3bc7878ee7c096e7b2d701e4f1bbe9814a1cdb1b24395db21e41

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page