**Note**: If you're using this wrapper with our sandbox environment `https://test.instamojo.com/` then you should pass `'https://test.instamojo.com/api/1.1/'` as third argument to the `Instamojo` class while initializing it. API key and Auth token for the same can be obtained from https://test.instamojo.com/developers/ (Details: [Test Or Sandbox Account](https://instamojo.zendesk.com/hc/en-us/articles/208485675-Test-or-Sandbox-Account)).
api = Instamojo(api_key=API_KEY, auth_token=AUTH_TOKEN, endpoint='https://test.instamojo.com/api/1.1/');
## Installation
`pip install instamojo_wrapper`
## Authentication Keys
You can find your API_KEY and AUTH_TOKEN at the API Documentation Page.
Create an account on Instamojo, log in and visit this link:
https://www.instamojo.com/developers/
## Usage
### Create a new Payment Request
from instamojo_wrapper import Instamojo
api = Instamojo(api_key=API_KEY,
auth_token=AUTH_TOKEN)
# Create a new Payment Request
response = api.payment_request_create(
amount='3499',
purpose='FIFA 16',
send_email=True,
email="foo@example.com",
redirect_url="http://www.example.com/handle_redirect.py"
)
# print the long URL of the payment request.
print response['payment_request']['longurl']
# print the unique ID(or payment request ID)
print response['payment_request']['id']
### Get the status or details of a Payment Request
from instamojo_wrapper import Instamojo
api = Instamojo(api_key=API_KEY,
auth_token=AUTH_TOKEN)
# Create a new Payment Request
response = api.payment_request_status('[PAYMENT REQUEST ID]')
print response['payment_request']['shorturl'] # Get the short URL
print response['payment_request']['status'] # Get the current status
print response['payment_request']['payments'] # List of payments
### Get the status of a Payment related to a Payment Request
from instamojo_wrapper import Instamojo
api = Instamojo(api_key=API_KEY,
auth_token=AUTH_TOKEN)
# Create a new Payment Request
response = api.payment_request_payment_status('[PAYMENT REQUEST ID]', '[PAYMENT ID]')
print response['payment_request']['purpose'] # Purpose of Payment Request
print response['payment_request']['payment']['status'] # Payment status
### Get a list of all Payment Requests
from instamojo_wrapper import Instamojo
api = Instamojo(api_key=API_KEY,
auth_token=AUTH_TOKEN)
# Create a new Payment Request
response = api.payment_requests_list()
# Loop over all of the payment requests
for payment_request in response['payment_requests']:
print payment_request['status']
`payment_requests_list()` also accepts optional arguments like `max_created_at`, `min_created_at`, `min_modified_at` and `max_modified_at` for filtering the list of Payment Requests. Note that it is not required to pass all of them.
response = api.payment_requests_list(max_created_at="2015-11-19T10:12:19Z",
min_created_at="2015-10-29T12:51:36Z")
For details related to supported datetime format supported by these arguments check the documentation: https://www.instamojo.com/developers/request-a-payment-api/#toc-filtering-payment-requests
## Available Request a Payment Functions
* `payment_request_create(purpose, amount)` => Payment Request
* `payment_request_status(id)` => Payment Request
* `payment_requests_list()` => List of Payment Requests
* `payment_request_payment_status(id, payment_id)` => Payment Request with Payment details
## Payment Request Creation Parameters
### Required
* `purpose`: Purpose of the payment request. (max-characters: 30)
* `amount`: Amount requested (min-value: 9 ; max-value: 200000)
### Optional
* `buyer_name`: Name of the payer. (max-characters: 100)
* `email`: Email of the payer. (max-characters: 75)
* `phone`: Phone number of the payer.
* `send_email`: Set this to True if you want to send email to the payer if email is specified. If email is not specified then an error is raised. (default value: `False`)
* `send_sms`: Set this to True if you want to send SMS to the payer if phone is specified. If phone is not specified then an error is raised. (default value: `False`)
* `redirect_url`: set this to a thank-you page on your site. Buyers will be redirected here after successful payment.
* `webhook`: set this to a URL that can accept POST requests made by Instamojo server after successful payment.
* `allow_repeated_payments`: To disallow multiple successful payments on a Payment Request pass `false` for this field. If this is set to `false` then the link is not accessible publicly after first successful payment, though you can still access it using API(default value: `True`).
Further documentation is available at https://www.instamojo.com/developers/request-a-payment-api/
Metadata
Release files for instamojo-wrapper 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| instamojo_wrapper-1.2.0.tar.gz | 8.9 kB | Without provenance | Details for instamojo_wrapper-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| instamojo_wrapper-1.2.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for instamojo_wrapper-1.2.0-py2.py3-none-any.whl |
Total release size: 17.0 kB
Release files / instamojo_wrapper-1.2.0.tar.gz
| Download URL | instamojo_wrapper-1.2.0.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d83eeb0ec712630aa8649b9fb32211638a50643a58f21438dec130767237c4c5
|
|
BLAKE2b-256 checksum How to use checksums |
2d9f86bb0e1a2e161f0d6da043ec98d8306e5ff9aa6c99321835635bfbc29c2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.10
|
Release files / instamojo_wrapper-1.2.0-py2.py3-none-any.whl
| Download URL | instamojo_wrapper-1.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
5771567d41fa8db940e367d952abe7ba651c40e23945b298fd4f62c9691dbde8
|
|
BLAKE2b-256 checksum How to use checksums |
56c07ea990655c7242d3150699a48277a597b4a8208eee120a8d8af92737b02a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.10
|
Security for instamojo-wrapper 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.