Package: pythepeer
Thepeer python-sdkThepeer's official python sdk for developers to use in their python projects.To start using this sdk, create an account athttps://thepeer.co/if you haven't already.You can then retrieve your API keys from yourdashboardInstallationTo install this sdk, run the command:pipinstallpythepeerUsageInstantiateThepeerclass like so:fromthepeerimportThepeer# create an instance of Thepeer classthepeer_instance=Thepeer("YOUR_API_KEY_HERE")Available methods exposed by the sdkNote:For more info about the exposed methods, please refer to the generaldocumentationBe sure to keep your API Credentials securely inenvironment variablesIndexing a userThis method describes how to index a user on your account (this is usually the first step before using other methods)test=thepeer_instance.index_user("Osagie Iyayi","iyayiemmanuel1@gmail.com","iyayiemmanuel1@gmail.com")Parameters supportedParametersData typeRequiredDescriptionnamestringtrueThe name of user to be indexed.identifierstringtruethe identifier of the account(either email or username).emailstringtruethe email of the userValidating a HMAC signatureThis method validates incoming anhmacsignature with the payload and credentials that was passed with itPro Tip:it is used to verify that an incoming webhook event/response is coming from thepeer's serverstest=thepeer_instance.validate_signature(data,signature)Parameters supportedParametersData typeRequiredDescriptiondatadictionarytruethe payload containing the data to be authenticatedsignaturestringtrueThe HMAC signatureGet an indexed userThis method gets the information of an indexed usertest=thepeer_instance.view_user("3bbb0fbf-82fa-48a0-80eb-d2c0338fe7dd")Parameters supportedParametersData typeRequiredDescriptionreferencestringtruethe unique reference returned when the user was indexedGet all indexed usersThis method returns all indexed users for a specific accounttest=thepeer_instance.all_users(1,15)Parameters supportedParametersData typeRequiredDescriptionpageintegerfalsethe first page displaying all the indexed users. defaults to 1per_pageintegerfalseThe number of users to display per page. defaults to 15Update an indexed userThis method helps to update the details of an indexed usertest=thepeer_instance.update_user(reference,**data)Parameters supportedParametersData typeRequiredDescriptionreferencestringtruethe unique reference returned when the user was indexeddataAnytrueA keyword argument which contains on or more of the indexed user's email, name or identifierSampletest=thepeer_instance.update_user("3bbb0fbf-82fa-48a0-80eb-d2c0338fe7dd",identifier="dwave101@yahoo.com",name="Edmond Kirsch",email="dwave101@gmail.com")Remove an indexed userThis method helps to remove the details of an indexed user from a specific accounttest=thepeer_instance.delete_user("3bbb0fbf-82fa-48a0-80eb-d2c0338fe7dd")Parameters supportedParametersData typeRequiredDescriptionreferencestringtruethe unique reference returned when the user was indexedGet BusinessesThis method returns businesses based on the API they integrated.test=thepeer_instance.get_businesses("checkout")Parameters supportedParametersData typeRequiredDescriptionchannelstringtrueThe specific API to return businesses of. supported values are send, checkout, and direct_chargeGenerate a CheckoutThis method allows you to generate a link for your customer to make a one-time payment withtest=thepeer_instance.generate_checkout({"amount":1000000,"currency":"NGN","redirect_url":"https://esportfolio.netlify.app","email":"jevede6918@muzitp.com","meta":{"name":"Eddie Kirsch","identifier":"eddiekirsch",}})Parameters requiredParametersData typeRequiredDescriptionredirect_urlstringfalseThe url Thepeer should redirect to after the customer completes payment.amountintegertrueThe amount you are debiting the customer. This should be in kobo. The minimum value is 10000emailstringtrueThe customer’s email addresscurrencystringtrueThe currency the transaction should be carried out in. The supported value is NGN.metadictionaryfalseAn object containing additional attributes you will like to have in your transaction response.Get user linksThis method returns all linked accounts of a user, the user’s account details, as well as the business the account is on.test=thepeer_instance.get_user_links("3bbb0fbf-82fa-48a0-80eb-d2c0338fe7dd")Parameters requiredParametersData typeRequiredDescriptionreferencestringtruethe unique reference returned when the user was indexedGet single link (linked account)This method returns a user's linked account's details.test=thepeer_instance.get_single_link("da14a90c-61c2-4cf7-a837-e3112a2d0c3d")Parameters requiredParametersData typeRequiredDescriptionlink_idstringtrueThe link’s identifierCharge a linkThis method allows a business to charge a user via their linked accounttest=thepeer_instance.charge_link(link_id,amount,remark,currency)Parameters requiredParametersData typeRequiredDescriptionlink_idstringtrueThe link’s identifieramountintegertruethe amount of the whole transactionremarkstringtrueshort detail about the transactioncurrencystringfalseThe denomination medium of paying (either one of NGN and USD). defaults to NGNAuthorize chargeThis method allows a business to authorize a direct charge request made by a usertest=thepeer_instance.authorize_charge(charge_reference,event)Parameters requiredParametersData typeRequiredDescriptioncharge_referencestringtruethe reference associated to a pending charge requesteventstringtruethe type of webhook eventPro Tip:the various types of webhook events are availablehereGet transaction detailThis method gets the details of a transactiontest=thepeer_instance.get_transaction_detail("eda58ee3-4f2c-4aa4-9da7-10a2b8ced453")Parameters requiredParametersData typeRequiredDescriptiontransaction_idstringtruethe unique transaction identifierRefund transactionThis method allows a business to refund a transaction back to the user for obvious reasonstest=thepeer_instance.refund_transaction("28e52edf-16d9-4921-8a54-ef34d7029707","possible threat actor"):Parameters requiredParametersData typeRequiredDescriptiontransaction_idstringtruethe unique transaction identifierreasonstringfalsea short sentence explaining reasons for the refund