pip install paypack-py
from paypack.client import HttpClient
client_id="xxxxxxx",
client_secret="xxxxxxx"
HttpClient(client_id=client_id, client_secret=client_secret)
from paypack.transactions import Transaction
//paramaters are required
cashin = Transaction().cashin(amount=100, phone_number="078xxxxx")
print(cashin)
{
"amount": 1000,
"created_at": "2005-11-09T21:19:07.459Z",
"kind": "CASHIN",
"ref": "d0bb2807-1d52-4795-b373-3feaf63dceb1",
"status": "pending"
}
from paypack.transactions import Transaction
//paramaters are required
cashout = Transaction().cashout(amount=100, phone_number="078xxxxx")
print(cashout)
{
"amount": 1000,
"created_at": "2005-11-09T21:19:07.459Z",
"kind": "CASHOUT",
"ref": "d0bb2807-1d52-4795-b373-3feaf63dceb1",
"status": "pending"
}
from paypack.oauth2 import Oauth
//Login
auth = Oauth().auth()
print(auth)
//Refresh access token
refresh = Oauth().refresh_access_token()
print(refresh)
{
"access": "xxxxxxxxxxxxxxxxxxxx",
"refresh": "xxxxxxxxxxxxxxxxxxxx",
"expires": "xxxxxxxx"
}
from paypack.events import Event
kind='cashout'
limit=10
offset=0
//Optional parameters
events = Event().list(kind,limit,offset)
print(events)
{
"amount": 100,
"client": "078xxxxxxx",
"event-kind": "transaction:created",
"kind": "CASHIN",
"limit": 20,
"offset": 0,
"ref": "d0bb2807-1d52-4795-b373-3feaf63dceb1",
"status": "failed",
"total": 250,
"transactions": [{
"event_id": "bf76c3a8-cafe-11ec-9478-dead2ba023b5",
"event_kind": "transaction:processed",
"created_at": "2022-05-03T16:33:22.434606Z",
"data": {
"ref": "ajsfh44w3j-4h4r-28438-efnef-e9f44a5b4c2d",
"kind": "CASHIN",
"fee": 2.3,
"merchant": "XXXXX",
"client": "078xxxxxxx",
"amount": 100,
"status": "successful",
"created_at": "2022-05-03T16:27:01.292808134Z",
"processed_at": "2022-05-03T16:33:22.434351492Z"
}
}]
}
from paypack.merchant import Merchant
print(Merchant().me())
{
"balance": 10000,
"email": "email@example.com",
"id": "XXXXX",
"in_rate": 0.05,
"name": "Company Name",
"out_rate": 0.05,
}