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.payment.link.generate_by_script(
    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.payment.check.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.3.2.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

robokassa-0.3.2-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: robokassa-0.3.2.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.3 Windows/11

File hashes

Hashes for robokassa-0.3.2.tar.gz
Algorithm Hash digest
SHA256 0a4fa6eeb1f959fa6743a2a3638381feaf1c137f06c6aaeb91faf3b24cfe892b
MD5 b3d2e3987a5077f8af7fe294b752235f
BLAKE2b-256 c7ce1c9fe483c2907217242576571aa4383a139c60545992bc483e99556b8cae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: robokassa-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.3 Windows/11

File hashes

Hashes for robokassa-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1080502795b12b1173deab8cf5bd377ae584dc8864755c30136b68d3ab0cec4e
MD5 bc8433a97e5295e5a35bbd4d1fd38f40
BLAKE2b-256 e1c43caeae80cd8b5dac9aea5ce9767499fad9327e9d14f2d6ea00f92f89348f

See more details on using hashes here.

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