python包简化与soofapay的集成

soofa的Python项目详细描述


该软件包旨在简化整合Soofapay的过程 python系统的支付解决方案。你可以查一下我们的website 更多信息

安装

$ pip install soofa

用法

一。检查事务

fromsoofaimportSoofa,Transactionsoofa=Soofa("you_soofa_till_number","your_client_secret_here")exists=soofa.find("tranaction_id_here")ifexists:transaction:Transaction=soofa.get_transaction()print(transaction.tid)print(transaction.sender)print(transaction.gross_amount)else:print("No such transaction")

事务检查的预期响应是Transactionobject 使用各种键和方法

还有一个获取整个json对象的附加方法。

transaction.json()
{"status":"SUCCESSFUL","sender_currency":"KES","receiver_currency":"KES","tid":"QTMB3","reference":"T5002","receipt_no":"NFQ6U45W28","timestamp":1561499777.715254,"gross_amount":5,"net_amount":4.8605,"transacted_via":"mpesa","is_money_in":true,"sender":"+254721732519","receiver":"Dev Market"}

下表描述了事务对象的所有属性。

KeyDescription
statusThe state of the transaction, either ^{tt2}$ or ^{tt3}$
sender_currencyThe currency of the person who performed the transaction
receiver_currencyThe currency of the business, if the transaction was Money in for the business
referenceThe transaction reference passed when making a transaction
timestampUnix timestamp for the transaction
gross_amountThe amount of the transaction
net_amountThe amount received after deducting soofa
transacted_viaThe service provider which facilitated the transaction eg. mpesa, visa, airtelmoney, mastercard, tkash …
is_money_inA boolean indicating if the money was to the business or out of the business
senderThe performer of transaction
receiverThe receiver of the transaction which is the business if the transaction was inbound

2.检查您的soofa业务账户余额

fromsoofaimportSoofasoofa=Soofa("you_soofa_till_number","your_client_secret_here")balance=soofa.get_balance()print(balance)

检查余额的预期响应是带有三个字段的json:

{“balance”:“1587.49”,“currency”:“KES”,“timestamp”:1561820831.623298}

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java为什么我的代码永远运行?它只是一堆带int的for循环,应该是递减的?   java如何更改IntelliJ IDEA中的XML缩进?   java如何使未填充的int数组不打印0?   eclipse My Weka Java代码结果*Weka*虚拟*STRING*用于*STRING*属性*   java泄漏了Windows com。安卓内部的政策恳求   java这个无限循环的原因是什么?   swing My标签在Java中很模糊   java如何在组件表示存储扩展中获取组件对象   java如何避免selenium网格中的会话超时   Java乘法测验,如果答案错误,如何循环   在Java HttpServlet Google app engine中保存对象   java ArrayList过滤器   java跳跃减慢了xvelocity:使用Libgdx/Box2D进行跳跃和跑步   java删除、复制和修改pom。xml文件   当提供的时区与服务器的时区相同时,RestCall中的java@DateTimeFormat(iso=iso.DATE_TIME)不工作   java Spring批处理多线程默认限制为10隐式?   安卓错误java。lang.UnsupportedOperationException:无法转换为维度:type=0x1