Paga-connect Python Library is a Python module that helps you make API calls when processing Paga Transactions.
Steps to using the Paga-Connect Library. Install pip on your local environment. Then run the command below.
pip install pagaconnect
To use Paga-connect, you would need to import it
See the sample code below
from paga_connect_client.paga_connect_client_core import PagaConnectCore import json principal = "publicId" credential = "password" test = True pagaConnect = PagaConnectCore(principal, credential, True)
To obtain your authorisation code, click here
To get Access tokens, Use the authorization code from the HTML call :
data = pagaconnect.get_access_token(authorization_code, redirect_uri, scope, user_data) token_data = json.loads(data) access_token = token_data['access_token']
This is the operation executed to make a payment to you on behalf of the customer. To make use of this function, call the getAccessToken in pagaconnect which will return a response with the access token which will be used to complete payment.
To get Access tokens, Use the authorization code gotten from the call to the backend :
payment_data = pagaconnect.make_payment(access_token, reference_number, amount, user_id, product_code, currency)
This operation allows Merchant to credit a user's Paga account. To make use of this function, call the moneyTransfer in pagaconnect which will return a MoneyTransferResponse.
money_transfer = pagaconnect. money_transfer(access_token,reference_number, amount,skip_messaging,recipient_credential)
This Operation allows the client to get the user's personal details. The data requested is included in the authentication and authorization request in the data parameter. Additionally, the scope parameter must contain the USER_DETAILS_REQUEST option. To make use of this function, call the getUserDetails in paagconnect which will return a UserDetailResponse with user details.
user_detail = pagaconnect.get_user_details(access_token)
Updated over 1 year ago