mongolian-payment-paylink
PayLink card payment SDK for Python — create invoices, query transactions, run reports.
Wraps the PayLink External API (single POST /external/process endpoint, process-code driven).
Installation
pip install mongolian-payment-paylink
Requires Python >= 3.8. Depends on httpx.
Quick Start
from mongolian_payment_paylink import PayLinkClient, PayLinkConfig, CreateInvoiceInput
client = PayLinkClient(PayLinkConfig(
base_url="https://paylink.mn/api/v1", # test: https://pay-link.fiba.mn/api/v1
username="MERCHANT_USERNAME",
signature_key="YOUR_SIGNATURE_KEY",
))
invoice = client.create_invoice(CreateInvoiceInput(
amount_total=10000,
count_total=1,
amount=10000,
description="Order #123",
merchant_ref="ORDER-123",
))
print(invoice.payment_link) # redirect the buyer here
print(invoice.invid)
Async
import asyncio
from mongolian_payment_paylink import AsyncPayLinkClient, PayLinkConfig
async def main():
async with AsyncPayLinkClient(PayLinkConfig(
base_url="https://paylink.mn/api/v1",
username="MERCHANT_USERNAME",
signature_key="YOUR_SIGNATURE_KEY",
)) as client:
detail = await client.get_invoice("INV-123")
print(detail["status"])
asyncio.run(main())
Authentication & signing
Every request sends three headers: pc (process code), X-USERNAME, and X-SIGNATURE.
Note on the signature. PayLink's exact signing scheme is not published. By default this SDK signs the HMAC-SHA256 (hex) of the JSON request body, keyed by
signature_key. If PayLink specifies a different scheme, pass your ownsignfunction — it receives the exact body string and returns the signature:PayLinkConfig(base_url=..., username=..., sign=lambda body: my_signature(body))
Environment variables
PAYLINK_BASE_URL=https://paylink.mn/api/v1
PAYLINK_USERNAME=MERCHANT_USERNAME
PAYLINK_SIGNATURE_KEY=your-signature-key
from mongolian_payment_paylink import PayLinkClient, load_config_from_env
client = PayLinkClient(load_config_from_env())
Methods
| Method | Process code | Description |
|---|---|---|
create_invoice(input) |
cu0900 | Create an invoice → CreatedInvoice |
list_invoices(input) |
cu0901 | List invoices |
get_invoice(invid) |
cu0904 | Invoice detail incl. transactions |
cancel_invoice(invid) |
cu0905 | Cancel an invoice |
batch_mark_paid(invid) |
cu0906 | Batch mark an invoice paid |
invoice_report(input) |
cu0907 | Paginated invoice report |
invoice_summary(input) |
cu0908 | Invoice summary counters |
transaction_report(input) |
cu0909 | Paginated transaction report |
transaction_summary(input) |
cu0910 | Transaction summary counters |
List/report/summary results are returned as plain dicts/lists exactly as the API
sends them (snake_case keys). create_invoice maps to the CreatedInvoice dataclass.
Dates use the YYYY-MM-DD HH24:MI:SS format.
Endpoints
| Environment | Base URL |
|---|---|
| Production | https://paylink.mn/api/v1 |
| Test | https://pay-link.fiba.mn/api/v1 |
Error handling
Every call returns HTTP 200; the result is driven by response_code (RC000000 =
success). Non-success codes and transport errors raise PayLinkError:
from mongolian_payment_paylink import PayLinkError
try:
client.get_invoice("INV-404")
except PayLinkError as err:
print(err) # "PayLink cu0904 failed: RC000015 - Record not found"
print(err.response_code) # "RC000015"
print(err.status_code) # set for HTTP-level failures
print(err.response) # raw response body
License
MIT
Metadata
Release files for mongolian-payment-paylink 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 |
|---|---|---|---|---|
| mongolian_payment_paylink-1.0.0.tar.gz | 7.9 kB | Without provenance | Details for mongolian_payment_paylink-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mongolian_payment_paylink-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for mongolian_payment_paylink-1.0.0-py3-none-any.whl |
Total release size: 17.2 kB
Release files / mongolian_payment_paylink-1.0.0.tar.gz
| Download URL | mongolian_payment_paylink-1.0.0.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
46ea408e322964fa3de7f95354e62f3814ad15c212c94c25e0d6dca8711965e3
|
|
BLAKE2b-256 checksum How to use checksums |
2096813316dc2122d0bdcdc5dad588a960c7d8eef368988297733e9d18e8e44b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / mongolian_payment_paylink-1.0.0-py3-none-any.whl
| Download URL | mongolian_payment_paylink-1.0.0-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5489ff2ee42ba5eaa09befd0c09fd9460d5ffd42b033f1efd2437d727ed819a1
|
|
BLAKE2b-256 checksum How to use checksums |
0b0d99dd736ac48bb62bd0a318b4b22f2b363e143201e42493774bd1013bd8ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for mongolian-payment-paylink 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.