Official Python SDK for integrating with PayIsland payment APIs.
Project description
PayIsland Python SDK
Official Python SDK for integrating with PayIsland payment APIs.
Installation
pip install payisland
Initialization
from payisland import PayIsland
payisland = PayIsland(secret_key="test_xxx")
The SDK uses https://ags.payislands.com by default. Sandbox or live mode is
determined by the API key you provide; there is no separate environment flag in
the SDK.
Transaction Initialization
from payisland import PayIsland
payisland = PayIsland(secret_key="test_xxx")
response = payisland.transactions.initialize(
{
"callback_url": "https://example.com/webhooks/payislands",
"payment_item_id": "6",
"transaction_reference": "order_12345",
"channel": "card",
"amount": "1000",
"customer_info": {
"email": "ada@example.com",
"phone_number": "08011112222",
"first_name": "Ada",
"last_name": "Lovelace",
},
}
)
print(response["data"]["authorization_url"])
For card transactions, the customer may need to complete 3DS authentication after initialization. Treat the transaction as pending until you verify the transaction reference and receive a successful final status from PayIsland.
Transaction Verification
response = payisland.transactions.verify("order_12345")
print(response)
This calls:
GET /api/v1/transactions/in/check-transaction-status/{reference}
Webhook Verification
is_valid = payisland.webhooks.verify_signature(
payload=raw_payload,
signature=signature,
secret=webhook_secret,
)
Webhook signatures are verified using HMAC SHA256 and constant-time comparison. Always verify the webhook signature and verify the transaction reference before fulfilling an order.
Error Handling
API errors raise PayIslandAPIError and include the status code and response
body when available.
from payisland import PayIsland, PayIslandAPIError
payisland = PayIsland(secret_key="test_xxx")
try:
response = payisland.transactions.verify("order_12345")
except PayIslandAPIError as exc:
print(exc.message)
print(exc.status_code)
print(exc.response_data)
Development
python -m pip install -e ".[dev]"
pytest
ruff check .
python -m build
twine check dist/*
License
MIT
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file payisland-0.1.0.tar.gz.
File metadata
- Download URL: payisland-0.1.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
500a0c79172d966ace0a5e03e52b83f5c288260ed2f3e18b807cc3dd54be3775
|
|
| MD5 |
fa2c0345939901802b27142171c6459c
|
|
| BLAKE2b-256 |
411a92da3c28b172f348bfc0963ba24f6cfce6f64ebaff67ac185c8a7af88d4d
|
File details
Details for the file payisland-0.1.0-py3-none-any.whl.
File metadata
- Download URL: payisland-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06b0125be7a506a0e46516fa0f11594b459369de876943ad8728d553ac34aafa
|
|
| MD5 |
3b59d4f54bb32076946b0d16c16547e2
|
|
| BLAKE2b-256 |
ddaf5979b66c8db4c6f200ca1dd92aab6a6ae0ec1f4b096de070b6791474a444
|