dps-pxpy
This package provides a Python low-level client for the DPS Payment Express API’s. Clients for both PxPost and PxFusion are available.
Installation
pip install dps-pxpy
Usage
PxPost
PxPost allows merchants to handle the entire lifecycle of payment transactions using HTTPS POST requests.
For a complete documentation of the PxPost API: https://www.paymentexpress.com/Technical_Resources/Ecommerce_NonHosted/PxPost.aspx
Client
Instantiate a client with your PxPost username and password:
from dps.pxpost import PxPostClient
client = PxPostClient("username", "password")
PxPostClient relies on the popular requests.
Complete
To complete an authorization and transfer funds:
response = client.complete(dps_txn_ref="reference")
Purchase
purchase is similar to authorize, but funds are transferred immediately:
response = client.purchase(amount="10.01",
input_currency="NZD",
card_number="4111111111111111",
card_holder_name="Holder Name",
date_expiry="1114",
cvc2="123")
You can also use a DPS or custom billing token.
Refund
To perform a complete or partial refund, use the dps transaction id returned by purchase or complete:
response = client.refund(dps_txn_ref="reference",
amount="5.01",
merchant_reference="reason for refund")
Status
To query the status of a transaction, use your merchant transaction id (authorize and purchase can take an optional txn_id used as a unique merchant reference):
response = client.status(txn_id="inv1234")
PxFusion
PxFusion allows merchants to accept credit card details within a form on their own web page. The form posts sensitive data directly to DPS, which processes the transaction and redirects the user’s browser to the merchant’s website in a way that is totally transparent to the cardholder.
For a complete documentation of the PxFusion API: https://www.paymentexpress.com/Technical_Resources/Ecommerce_NonHosted/PxFusion.aspx
Client
Instantiate a client with your PxFusion username and password:
from dps.pxfusion import PxFusionClient
client = PxFusionClient("username", "password")
PxFusionClient relies on suds-jurko for SOAP requests and ships with suds_requests to take advantage of requests.
Transaction
To retrieve a session ID where funds are transferred immediately:
response = client.purchase(amount="10.01",
currency="NZD",
return_url="https://yourdomain.com/pxfusion-callback",
txn_ref="ref")
You can also issue authorizations:
response = client.authorize(amount="10.01",
currency="NZD",
return_url="https://yourdomain.com/pxfusion-callback",
txn_ref="ref")
Note that completing an authorization transaction must be done via PxPost’s complete.
After posting the payment details and session ID to the PxFusion endpoint (https://sec.paymentexpress.com/pxmi3/pxfusionauth), DPS redirects your customer to return_url with the session ID in the query string.
Status
To check the outcome of a transaction:
response = client.status(transaction_id="sessionid")
Cancellation
To prevent a transaction from taking place:
response = client.cancel(transaction_id="sessionid")
Running Tests
Get a copy of the repository:
git clone git@github.com:OohlaLabs/dps-pxpy.git .
Install tox:
pip install tox
Run the tests:
tox
Contributions
All contributions and comments are welcome.
Change Log
v0.2.1
Switch to Semantic Versioning
Fix issue with parse_requirements for newer versions of pip (>=6.0.0)
v0.2
Fix setup.py for distribution
v0.1
Initial
Metadata
Release files for dps-pxpy 0.2.1
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 |
|---|---|---|---|---|
| dps-pxpy-0.2.1.tar.gz | 22.5 kB | Without provenance | Details for dps-pxpy-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dps_pxpy-0.2.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for dps_pxpy-0.2.1-py2.py3-none-any.whl |
Total release size: 54.0 kB
Release files / dps-pxpy-0.2.1.tar.gz
| Download URL | dps-pxpy-0.2.1.tar.gz |
|---|---|
| Size | 22.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4dc65dbaa04d4baf482f7be0edd690bdf80a19d0a1118e92d5e0f765aa63c56b
|
|
BLAKE2b-256 checksum How to use checksums |
e531bf69e8fdb128c2c97a2326c6d58cd8622ba3ab138061f1777fce392273ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / dps_pxpy-0.2.1-py2.py3-none-any.whl
| Download URL | dps_pxpy-0.2.1-py2.py3-none-any.whl |
|---|---|
| Size | 31.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e9de35632855af42824412acce84bfd000ac7de666d1abfea205184db7e939c9
|
|
BLAKE2b-256 checksum How to use checksums |
6273cf6445ae5725b4028a6cbef0402eb6af14978ba825f9d7ded4c805331bde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for dps-pxpy 0.2.1
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.