Paymob.accept library for Python
A Python library for Paymob Accept’s API.
Setup
You can install this package by using the pip tool and installing:
$ pip install accept-paymob
Setting up a Accept Account
Sign up for Accept at https://accept.paymob.com/.
Using the Accept API
from accept.payment import *
API_KEY = "<API-KEY>"
accept = AcceptAPI(API_KEY)
# Authentication Request
auth_token = accept.retrieve_auth_token()
print(auth_token)
# Order Registration
OrderData = {
"auth_token": auth_token,
"delivery_needed": "false",
"amount_cents": "1100",
"currency": "EGP",
"merchant_order_id": 125, # UNIQUE
"items": [
{
"name": "ASC1515",
"amount_cents": "500000",
"description": "Smart Watch",
"quantity": "1"
},
{
"name": "ERT6565",
"amount_cents": "200000",
"description": "Power Bank",
"quantity": "1"
}
],
"shipping_data": {
"apartment": "803",
"email": "claudette09@exa.com",
"floor": "42",
"first_name": "Clifford",
"street": "Ethan Land",
"building": "8028",
"phone_number": "+86(8)9135210487",
"postal_code": "01898",
"extra_description": "8 Ram , 128 Giga",
"city": "Jaskolskiburgh",
"country": "CR",
"last_name": "Nicolas",
"state": "Utah"
},
"shipping_details": {
"notes": " test",
"number_of_packages": 1,
"weight": 10,
"weight_unit": "Kilogram",
"length": 100,
"width": 100,
"height": 100,
"contents": "product of some sorts"
}
}
order = accept.order_registration(OrderData)
print(order)
# Payment Key Request
Request = {
"auth_token": auth_token,
"amount_cents": "1500",
"expiration": 3600,
"order_id": order.get("id"),
"billing_data": {
"apartment": "803",
"email": "claudette09@exa.com",
"floor": "42",
"first_name": "Clifford",
"street": "Ethan Land",
"building": "8028",
"phone_number": "+86(8)9135210487",
"shipping_method": "PKG",
"postal_code": "01898",
"city": "Jaskolskiburgh",
"country": "CR",
"last_name": "Nicolas",
"state": "Utah"
},
"currency": "EGP",
"integration_id": 246701, # https://accept.paymob.com/portal2/en/PaymentIntegrations
"lock_order_when_paid": "false"
}
payment_token = accept.payment_key_request(Request)
print(payment_token)
# Payments API [Kiosk, Mobile Wallets , Cash, Pay With Saved Token]
identifier = "cash"
payment_method = "CASH"
transaction = accept.pay(identifier, payment_method, payment_token)
print(transaction)
# Auth-Capture Payments
transaction00 = accept.capture_transaction(transaction_id="7608793", amount_cents=1000)
print(transaction00)
# Refund Transaction
transaction01 = accept.refund_transaction(transaction_id="7608793", amount_cents=10)
print(transaction01)
# Void Transaction
transaction02 = accept.void_transaction(transaction_id="7608793")
print(transaction02)
# Retrieve Transaction
transaction03 = accept.retrieve_transaction(transaction_id="7608793")
print(transaction03)
# Inquire Transaction
transaction_inquire = accept.inquire_transaction(merchant_order_id="123", order_id="10883471")
print(transaction_inquire)
# Tracking
order_10883471_track = accept.tracking(order_id="10883471")
print(order_10883471_track)
# Preparing Package
# This will return a pdf file url to be printed.
package = accept.preparing_package(order_id="10883471")
print(package)
# IFrame URL
iframeURL = accept.retrieve_iframe(iframe_id="230796", payment_token=payment_token)
print(iframeURL)
# Loyalty Checkout
response = accept.loyalty_checkout(transaction_reference='', otp='123', payment_token=payment_token)
print(response)
Metadata
Release files for accept-paymob 1.0.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 |
|---|---|---|---|---|
| accept-paymob-1.0.0.tar.gz | 6.8 kB | Without provenance | Details for accept-paymob-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| accept_paymob-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for accept_paymob-1.0.0-py3-none-any.whl |
Total release size: 12.6 kB
Release files / accept-paymob-1.0.0.tar.gz
| Download URL | accept-paymob-1.0.0.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
65c951b2fc448458e1170588ecf28e2d8716de87ac60bfe0d59d8628b49d479a
|
|
BLAKE2b-256 checksum How to use checksums |
2f29f588adccf991ebb36911e46364616cfea1816df133bc3e36cb37f1b997ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
|
Release files / accept_paymob-1.0.0-py3-none-any.whl
| Download URL | accept_paymob-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d5b48a29f23697aa6baf48bf5d5b428666b174b1b626231e79831551e783efdd
|
|
BLAKE2b-256 checksum How to use checksums |
3ddec94879d066e7becaa9b97bf1e5a7f0853eb2ed42d2601571b482ba4b0d05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
|
Security for accept-paymob 1.0.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.