Skip to main content

Paykassa API & SCI

Project description

Paykassa SCI & API

Installation

python -m pip install paykassa-api-sdk

Payment API

Initialize Client

from paykassa.payment import PaymentApi

client = PaymentApi(api_id, api_key)

Check Balance

from paykassa.dto import CheckBalanceRequest
from paykassa.struct import System, Currency

request = CheckBalanceRequest() \
    .set_shop_id("123")

response = client.check_balance(request)

if not response.has_error():
    print(response.get_balance(System.BITCOIN, Currency.BTC))
    print(response.get_balance(System.ETHEREUM, Currency.ETH))

Make Payment

from paykassa.dto import MakePaymentRequest
from paykassa.struct import System, Currency, CommissionPayer, TransactionPriority 

request = MakePaymentRequest() \
    .set_shop_id("123") \
    .set_amount("1.02") \
    .set_priority(TransactionPriority.MEDIUM) \
    .set_system(System.BITCOIN) \
    .set_currency(Currency.BTC) \
    .set_paid_commission(CommissionPayer.SHOP) \
    .set_number("3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy")
 
response = client.make_payment(request)

if not response.has_error():
    print(response.get_transaction())
    print(response.get_paid_commission())

Get txids by invoice IDs

from paykassa.dto import GetTxidsOfInvoicesRequest

invoices = ["37411867", "37411866", "37411817", ]

request = GetTxidsOfInvoicesRequest() \
    .set_shop_id("1234") \
    .set_invoices(invoices)

response = client.get_txids_by_invoices(request)


if not response.has_error():
    for invoice in invoices:
        try:
            print(("Invoice %s: %s" % (invoice, response.get_txids_of_invoice(invoice))))
        except KeyError as e:
            print(e.args[0])  # invoice id not found
            continue
else:
    print("Errors: %s" % (response.get_message()))

Merchant API

Initialize Client

from paykassa.merchant import MerchantApi

client = MerchantApi(sci_id, sci_key)

Check Payment (IPN)

from paykassa.dto import CheckPaymentRequest

request = CheckPaymentRequest() \
    .set_private_hash("hash")

response = client.check_payment(request)

if not response.has_error():
    print(response.get_transaction())

Check Transaction (IPN)

from paykassa.dto import CheckTransactionRequest

request = CheckTransactionRequest() \
    .set_private_hash("hash")

response = client.check_transaction(request)

if not response.has_error():
    print(response.get_address_from())
    print(response.get_confirmations())

Generate Address

from paykassa.dto import GenerateAddressRequest
from paykassa.struct import System, Currency, CommissionPayer

request = GenerateAddressRequest() \
    .set_amount("1.123456") \
    .set_currency(Currency.DOGE) \
    .set_system(System.DOGECOIN) \
    .set_comment("test") \
    .set_paid_commission(CommissionPayer.CLIENT)

response = client.generate_address(request)

if not response.has_error():
    print(response.get_amount())
    print(response.get_wallet())

Get Payment Url

from paykassa.dto import GetPaymentUrlRequest
from paykassa.struct import System, Currency, CommissionPayer

request = GetPaymentUrlRequest() \
    .set_amount("110") \
    .set_currency(Currency.USDT) \
    .set_system(System.TRON_TRC20) \
    .set_comment("test") \
    .set_paid_commission(CommissionPayer.CLIENT)

response = client.get_payment_url(request)

if not response.has_error():
    print(response.get_method())
    print(response.get_url())

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paykassa_api_sdk-1.2.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paykassa_api_sdk-1.2.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file paykassa_api_sdk-1.2.0.tar.gz.

File metadata

  • Download URL: paykassa_api_sdk-1.2.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for paykassa_api_sdk-1.2.0.tar.gz
Algorithm Hash digest
SHA256 94c320aa371d0445f91c4cdfe29f617113351e81fb24b6a9dbbaf11852d5a7e1
MD5 e8d4d9b7d224070a457d35efc673c4fe
BLAKE2b-256 a4c7e84f22765198f411d1f8ce555b1071d144b9ff39775ac63a3fd156f74c7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for paykassa_api_sdk-1.2.0.tar.gz:

Publisher: python-publish.yml on paykassa-dev/python-api-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file paykassa_api_sdk-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for paykassa_api_sdk-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16095082d3e663e2caafa94e1e2be425c58913c4894a54b56ad603c000ccb51d
MD5 b4d06e5d1609c4f4d6afd9ceaec3543a
BLAKE2b-256 d0d061fded0134ea5fd24ec75e0244e90c171878584faff15bb03c410f481be7

See more details on using hashes here.

Provenance

The following attestation bundles were made for paykassa_api_sdk-1.2.0-py3-none-any.whl:

Publisher: python-publish.yml on paykassa-dev/python-api-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page