Checkout-P2P Python Integration Library
This project is a Python library inspired by the PlaceToPay PHP Redirection Library. It is designed to simplify integration with the PlaceToPay Web Checkout payment gateway. This library provides a robust and user-friendly solution for managing diverse payment scenarios, including single payments, recurring subscriptions, and payments using subscription tokens.
Integration demo
https://github.com/user-attachments/assets/b2363b94-f59d-4ce4-8a44-72e2e503b6c2
Documentation
See the Web Checkout API docs.
Installation
You don’t need this source code unless you intend to modify the package. To simply use the package, you can install it directly by running:
pip install checkout-p2p
Contribution
If you’d like to contribute, request, or suggest adding new features to the library, please follow the installation guide in our Contribution Wiki.
Requirements
- Python 3.13+
Usage
Here’s a quick example to get you started with the library:
1.Configuration
Set up your Settings object with the necessary credentials:
from checkout import Checkout, RedirectRequest
checkout = Checkout({
"base_url": "https://checkout-co.placetopay.dev/",
"login": "your_login",
"tranKey": "your_trankey",
})
2.Create a Payment Request
from checkout import RedirectRequest
redirect_request = RedirectRequest(
return_url="https://example.com/return",
ip_address="192.168.1.1",
user_agent="Test User Agent",
payment={"reference": "TEST _q", "description": "Test Payment", "amount": {"currency": "COP", "total": 10000}}
)
response = checkout.request(redirect_request)
print("Redirect to:", response.process_url)
3.Query a Payment Request
query_response = checkout.query(123456) # Replace with your request ID
print("Request Status:", query_response.status)
4 Charge using token
from checkout import CollectRequest
collect_request = CollectRequest(
return_url="https://example.com/return",
ip_address="192.168.1.1",
user_agent="Test User Agent",
instrument={"token": {"token" : "your_token_c5583922eccd6d2061c1b0592b099f04e352a894f37ae51cf1a"}},
payer={
"email": "andres2@yopmail.com",
"name" : "Andres",
"surname": "López",
"document": "111111111",
"documentType": "CC",
"mobile": "+573111111111"
},
payment={
"reference": "TEST_COllECT",
"description": "Test Payment",
"amount": {"currency": "COP", "total": 15000}
}
)
# Collect. Returns a `InformationResponse` object.
collect_response = checkout.collect(collect_request)
print("Collect Status :", collect_response.status)
5.Reverse a Payment
# Reverse a transaction. Returns a `ReverseResponse` object.
reverse_response = checkout.reverse("internal_reference")
print("Reverse Status:", reverse_response.status)
6.Invalidate token
invalidate_token_request = {
"locale": "en_US",
"instrument": {"token" : {"token" : "your_token_c5583922eccd6d2061c1b0592b099f04e352a894f37ae51cf1a"}}
}
# invalite token. Returns a `Status` object.
invalidate_response = checkout.invalidate_token(invalidate_token_request)
print("Invalidate Status:", invalidate_response.status)
print("Message:", invalidate_response.message)
License
This project is licensed under the MIT License. See the LICENSE file for details.
Metadata
Release files for checkout-p2p 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 |
|---|---|---|---|---|
| checkout_p2p-1.0.0.tar.gz | 42.9 kB | Without provenance | Details for checkout_p2p-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| checkout_p2p-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for checkout_p2p-1.0.0-py3-none-any.whl |
Total release size: 119.2 kB
Release files / checkout_p2p-1.0.0.tar.gz
| Download URL | checkout_p2p-1.0.0.tar.gz |
|---|---|
| Size | 42.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6acb2b8cd4790ae69aad1a32483c85a398c327ae6e0af798c3647764fedcc1fd
|
|
BLAKE2b-256 checksum How to use checksums |
7389aa7fe0202951d9136eba0a6a2f1b03e624ed2ca7f162a4ebe75bed473f48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.5 CPython/3.13.1 Linux/6.8.0-1017-azure
|
Release files / checkout_p2p-1.0.0-py3-none-any.whl
| Download URL | checkout_p2p-1.0.0-py3-none-any.whl |
|---|---|
| Size | 76.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a33557adc3d6b1ace5e040353e49f1875e6851572a29601712c59f0e676ff47d
|
|
BLAKE2b-256 checksum How to use checksums |
27bd84e76c98fd70f4473e4788dbcc89e11b293a0970d00e6d10565e9550919f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.5 CPython/3.13.1 Linux/6.8.0-1017-azure
|
Security for checkout-p2p 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.