Skip to main content

A simple lightweight api client for awesome stripe

Project description

simple-stripe-client

A simple lightweight api client for awesome stripe.

Example

import simple_stripe_client
import os
STRIPE_SECRET_KEY = os.environ.get('STRIPE_SECRET_KEY')
# create client
stripe_api = simple_stripe_client.Api(STRIPE_SECRET_KEY, debug_http=True)


CHARGE_DATA = {
    'amount': 15921,
    'currency': 'gbp',
    'capture' : False,
    'source': 'tok_amex',
    'metadata': {
        'first_name' : 'Sachin',
        'last_name'  : 'Tendulkar',
    } 
}

# Creating Charge
charge = stripe_api.charges.post(**CHARGE_DATA)

CHARGE_ID = 'ch_xxx'
# Fetching Charge
charge = stripe_api.charges.id(CHARGE_ID).get()

# Update Charge
charge = stripe_api.charges.id(CHARGE_ID).post(description='Test Update')

# Capture Charge
charge = stripe_api.charges.id(CHARGE_ID).capture.post(amount=12000)

Building Stripe's Curl URLs

URLs would match one-to-one to stripe's curl api urls. For more links please refer to stripe doc


stripe_api.charges                                  # == /v1/charges
stripe_api.charges.id(CHARGE_ID)                    # == /v1/charges/{CHARGE_ID}    

stripe_api.customers                                # == /v1/customers
stripe_api.customers.id(CUSTOMER_ID)                # == /v1/customers/{CUSTOMER_ID}

stripe_api.invoices                                 # == /v1/invoices
stripe_api.invoices.id(INVOICE_ID)                  # == /v1/invoices/{INVOICE_ID}

TODO

  • Add support for Stripe Connect, Files
  • Add more extensive tests

Changelog -

0.0.2 (01-02-2019)

  • fixed issue for python 2

0.0.1 (01-02-2019)

  • initial release

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

simple_stripe_client-0.0.2.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

simple_stripe_client-0.0.2-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file simple_stripe_client-0.0.2.tar.gz.

File metadata

  • Download URL: simple_stripe_client-0.0.2.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.5

File hashes

Hashes for simple_stripe_client-0.0.2.tar.gz
Algorithm Hash digest
SHA256 94ca8ca62f62c57c4b23fdca926e9ebf1a230a19dd643cb8f3f86c358d999638
MD5 4d1f9d77fb6a395cc6c0fee3e3c1bd28
BLAKE2b-256 fef09bbfe6409b964d27c21298e65ff6eaec31db225bd10e54fb9673e3b3c426

See more details on using hashes here.

File details

Details for the file simple_stripe_client-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: simple_stripe_client-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.5

File hashes

Hashes for simple_stripe_client-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4b9f30577e48913c2abcb72534648c78ad9c71c22b6b6bb216aa5f78e659ac1b
MD5 c00149fba4880b8b2badb21c3e192dfd
BLAKE2b-256 edba91b3abebeb523d935a362b80e646d3b48bddd4e59ebe902edf48b2ab0a70

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