openpay python sdk
Project description
Python Openpay SDK
This module is created to achieve payment via. Openpay from any web based platform created by Python. Every merchant can use admit his SDK for his clients to handle order creation to complete payment.
Installation
pip install openpay-py
Creation of Merchant and Client
Create object of the Merchant class passing at least "JamAuthToken" . If you are using Django then settings.py
is the best place to instantiate the Client
from openpay import Client, Merchant
merchant= Merchant(jam_auth_token='your jam auth token')
to set Merchant's success, cancel and failure url call set_call_back_url and to set user's info call the next function
merchant.set_callback_url(callback_url, cancel_url, failure_url)
create client aka user in your desired module, send merchant to attach this with client
client = Client(order_id=100, first_name='Abhisek', family_name='Roy', email='testdevloper007@gmail.com', address_1='15/520 Collins Street',
suburb='Melbourne', state='Victoria', postcode=3000, dob='06 Jan 1985', merchant=merchant)
Here %b
Month as locale’s abbreviated name. Jan, Feb, …, Dec.
So the date format should be like '06 Jan 1985'.
Sending merchant as argument when creating Client object is strictly required in the above code, to proceed further.
Call new_online_order method to create new order
client.new_online_order(purchase_price, plan_creation_type)
To create online plan call
client.create_online_plan()
To check order capture & order status you should call below function respectively
client.check_payment_capture(plan_id)
client.check_order_status(plan_id)
Note: You will get plan id from the very first call of new_online_order
To create refund you've to supply plan_id, new_purchase_price(which is previous price - refund price)
client.refund_status(plan_id, new_purchase_price)
In case of full refund, pass full_refund=True
in place of new_purchase_price so the code will be like
client.refund_status(plan_id, full_return=True)
If you want to give full refund, you just set the full refund to True, There is no need to pass the price, otherwise just passing the price is fine for partial refund
To check order dispatch plan
client.order_dispatch_plan(plan_id)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for python_openpay-0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a8e0c06b96ffec10df74af0760c8c9101b9372f290bb0d88462fd18986aeeed |
|
MD5 | 88c12bbc8687fe80f86eddfc83aa383e |
|
BLAKE2b-256 | 942e7da7d8547c6863153ca2fa3a1e6eb22603b6f4ae6377b873dc7cee8adcb9 |