Metadata-Version: 1.1
Name: atomicpay
Version: 0.1.4
Summary: Simplified Payments
Home-page: https://github.com/mainanick/atomicpay
Author: Nick Maina
Author-email: nick.maina1@gmail.com
License: MIT
Description-Content-Type: UNKNOWN
Description: ## atomicpay: Integrate Payments Easily

        ### Provides Python APIs to create, process and manage mobile payments.

        ###### Initial development. Anything may change at any time. The public API should not be considered stable.

        

        

        #### Stage: Draft

        

        atomicpay makes it easily possible to intergrate with mpesa or equity. Many More to be supported in future

        

        

        ### Installation

        ```

        pip install atomicpay

        ```

        

        # Mpesa

        ```python

        >>> import atomicpay as atm 

        

        >>> mpesa = atm.Mpesa(<key>, <secret>, <config>)

        ```

        Or

        ```python

        >>> import atomicpay as atm

        

        >>> with atm.Mpesa(<key>, <secret>, config=configs) as at:

        >>>      print(at.balance())

        ```

        

        Takes the consumer key, consumer secret and the configuration dict

        

        *Live defaults to False*

        

        ```python

        >>> mpesa = atm.Mpesa(<key>, <secret>, <config>, live=True)

        ```

        

        ## Configurations

        In order to simplify the work of integrating it is worth it to write a one time config dict

        

        ```python

        configs = {

            "Shortcode": 111111,

            "Initiator": "AtomicPay",

            "SecurityCredential": "xxxxxxxx...",

            "Shortcode2": 222222, #Test PartyB

            "MSISDN": 254712345678, #Test

            "LipaShortcode": 333333,

            "LipaPassKey": "xxxxxxxx...",

            "URLS":{

                "BALANCE":{

                    "QueueTimeOutURL": "",

                    "ResultURL": "",

                },

                "TRANSACTIONS":{

                    "QueueTimeOutURL": "",

                    "ResultURL": "",

                },

                "B2B":{

                    "QueueTimeOutURL": "",

                    "ResultURL": ",

                },

                "B2C":{

                    "QueueTimeOutURL": "",

                    "ResultURL": "",

                },

                "LIPA":{

                    "CallBackURL": "",

                }

            }   

        }

        ```

        Pass the configs

        ```python

        >>> mpesa = atm.Mpesa(<key>, <secret>, config=configs, live=False)

        ```

        

        

        ## Responses

        Every mpesa api call return an instance of MpesaResponse

        

        Every equity api call return an instance of EquityResponse

        

        #### MpesaResponse

        - .json(): Returns the original json response [json]

        - .code: Returns mpesa status code [str]

        - .ok: Returns True for successful requests else False

        - .text: Returns the response description

        

        ```python

        >>> balance = mpesa.balance()

        

        >>> print(balance) #prints <MpesaResponse [200]>

        

        """Response Description message"""

        >>> balance.text

        

        """Mpesa status code"""

        >>> balance.code

        

        """Check if requests was successful"""

        >>> if balance.ok:

        >>>    print("Okayyy")

        ```

        

        ## Balance

        ```python

        >>> response = mpesa.balance()

        ```

        ## Transactions

        ```python

        >>> response = mpesa.transaction(<txn_id>, <originator_id>)

        ```

        

        ## Business to Business

        ```python

        >>> b2b = mpesa.b2b()

        

        >>> response = b2b.buy_goods(<shortcode>, <amount>, <reference>,<remarks>)

        

        >>> response = b2b.paybill(<shortcode>, <amount>, <reference>,<remarks>)

        ```

        

        ## Business to Customer

        ```python

        >>> b2c = mpesa.b2c()

        

        >>> response = b2c.pay_salary(<phone>, <amount>, <remarks>)

        

        >>> response = b2c.pay_business(<phone>, <amount>, <remarks>)

        

        >>> response = b2c.pay_promotion(<phone>, <amount>, <remarks>, <occassion>)

        

        ```

         ## Customer to Business

        ```python

        >>> c2b = mpesa.c2b()

        

        >>> response = c2b.buy_goods(<phone>, <amount>, <reference>)

        

        >>> response = c2b.paybill(<phone>, <amount>, <reference>)

        

        ```

        

        

        ## Lipa Na Mpesa

        ```python

        >>> lipa = mpesa.lipa()

        

        >>> pay = lipa.pay(<to>, <amount>, <description>, <reference>)

        

        >>> if pay.ok:

                checkout_id = pay.json()['CheckoutRequestID']

                response = lipa.query(checkout_id)        

                print(response.json())

        ```

        ## Advanced

        

        Every atomicpay api is also async just pass a callback and thats all

        ```python

        >>> def callback(response):

        >>>     print(response)

        

        >>> mpesa.balance(callback=callback)

        >>> print("mpesaaa")

        

        >>> # mpesaaa

        >>> # <MpesaResponse [200]>

        ```

        

        ## Not Implemented

        ### B2B

        - DisburseFundsToBusiness

        - BusinessToBusinessTransfer

        - MerchantToMerchantTransfer

        
Keywords: payments,mpesa,equity,development
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.0
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3 :: Only
