lunipay
The official LuniPay Python SDK.
pip install lunipay
Quick start
import lunipay
lunipay.api_key = "sk_test_YOUR_KEY"
session = lunipay.CheckoutSession.create(
amount=5000,
currency="usd",
success_url="https://example.com/thanks?session_id={CHECKOUT_SESSION_ID}",
)
print(session["url"])
Resources
Every LuniPay resource is a top-level class on the module:
lunipay.Customer.create(email="ada@example.com", first_name="Ada", last_name="Lovelace")
lunipay.Customer.retrieve("cus_01JRZK...")
lunipay.Customer.modify("cus_01JRZK...", phone="+18765559999")
lunipay.Customer.delete("cus_01JRZK...")
for customer in lunipay.Customer.list().auto_paging_iter():
print(customer["email"])
Supported resources: CheckoutSession, Customer, Invoice, Payment, PaymentLink, WebhookEndpoint, Event.
Webhooks
import lunipay
@app.post("/webhook")
def webhook():
payload = request.get_data()
sig = request.headers.get("LuniPay-Signature")
try:
event = lunipay.Webhook.construct_event(
payload=payload,
sig_header=sig,
secret="whsec_your_secret",
)
except lunipay.error.SignatureVerificationError:
return "bad signature", 400
if event["type"] == "checkout.session.completed":
# fulfill the order
pass
return "", 200
Errors
All LuniPay API errors raise subclasses of lunipay.error.LuniPayError:
try:
lunipay.Customer.create(email="bad", first_name="x", last_name="y")
except lunipay.error.InvalidRequestError as e:
print(e.code, e.param, str(e))
Subclasses: AuthenticationError, PermissionError, InvalidRequestError, IdempotencyError, RateLimitError, APIError, APIConnectionError.
Idempotency
Pass idempotency_key to any mutating request:
import uuid
key = str(uuid.uuid4())
session = lunipay.CheckoutSession.create(
amount=5000,
currency="usd",
success_url="https://example.com/thanks",
idempotency_key=key,
)
Full documentation
See lunipay.io/docs/sdks/python.
License
MIT
Metadata
Release files for lunipay 0.1.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 |
|---|---|---|---|---|
| lunipay-0.1.1.tar.gz | 7.3 kB | With provenance | Details for lunipay-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lunipay-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for lunipay-0.1.1-py3-none-any.whl |
Total release size: 18.9 kB
Release files / lunipay-0.1.1.tar.gz
| Download URL | lunipay-0.1.1.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68f61ccccfa32f4b3619514e49337e1763f0cab073484fa6aa77774f9694dcc6
|
|
BLAKE2b-256 checksum How to use checksums |
fa9d74a63de50453748480e66bd8e3df981254467feb5d06b5764eef85ef5699
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 11, 2026.
Transparency logRelease files / lunipay-0.1.1-py3-none-any.whl
| Download URL | lunipay-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
950094e27fd759a80750fcd8c5497f1af7d5f8ff384a9c1f8bb1b897c5f22f15
|
|
BLAKE2b-256 checksum How to use checksums |
70199ab11d87ccad3f5c87a14e56fe53c20478b97a782bf638874d7252215e34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 11, 2026.
Transparency logSecurity for lunipay 0.1.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for lunipay-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 11, 2026.
Transparency logA 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.