Skip to main content

Unofficial Robokassa API

Project description

Robokassa API

You can use this simple library for create a link or use that for checks a signatures.

Example:

  • Firstly, create Robokassa instance. If you use this in sandbox mode for test robokassa, you need to paste a pair of test keys. Also, don't forget check what is_test argument equals True.
from robokassa import Robokassa, HashAlgorithm

robokassa = Robokassa(
    merchant_login="my_login",
    password1="super_secret_test_password1",
    password2="super_secret_test_password2",
    algorithm=HashAlgorithm.sha512,
    is_test=True
)
  • After that, you can generate a link to payment page Write a necessary params for a link. You can use additional params. Choose default prefix of params. It can be shp, Shp or SHP. Don't specify = symbol. Method automatically generate additional params. Next, you can use any params like in example: user_data, product_id.
my_payment_link = robokassa.generate_link_to_payment_page(
    out_sum=1000,
    inv_id=0,
    description="It's my description",
    success_url="https://example.com",
    success_url_method="POST",
    default_prefix="shp",
    user_data="important_user_data",
    product_id="790ec274-20af-4972-b5d6-c8698d64fb52"
)
  • Check signature when you received robokassa notification in result, success or fail urls.
signature_is_success = robokassa.result_url_signature_is_valid(
    result_signature=("f31b7e1a669ee8686f14be357e5ed2144"
                      "1aca28893fa5b80032ad7f57af07fca80"
                      "2c5f23abb2628ec2d7826af43c8919d7d"
                      "06b4c6881e774b7dc8a056339a8cf"),
    inv_id=0,
    out_sum=1000,
    shp_user_data="important_user_data",
    shp_product_id="790ec274-20af-4972-b5d6-c8698d64fb52"
)

if signature_is_success:
    print("Nice!")

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

robokassa-0.1.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

robokassa-0.1.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file robokassa-0.1.1.tar.gz.

File metadata

  • Download URL: robokassa-0.1.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.3 Linux/6.8.0-1013-oem

File hashes

Hashes for robokassa-0.1.1.tar.gz
Algorithm Hash digest
SHA256 580856330144e4c57bba9a6add31a569304f90268279a2c65e876cc305d90d58
MD5 f0267bf02e3746211573847256c0ded5
BLAKE2b-256 9371ea34fdaec7118b270c04ebbb030cb06179fe962637990bca5a85c84a1fec

See more details on using hashes here.

Provenance

File details

Details for the file robokassa-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: robokassa-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.3 Linux/6.8.0-1013-oem

File hashes

Hashes for robokassa-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8c480972a7c4d40643ec1027c7fb482067256faef243c33b77b11d14bfc227cb
MD5 5ffa61052e55611bd64e83f06283622a
BLAKE2b-256 7da72eec1e8832a023c79fec8617c25dafa2b7438c246b8830f2e8432deca79d

See more details on using hashes here.

Provenance

Supported by

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