To start working with the AlliancePay platform, you need to:
Contact JSC "BANK ALLIANCE" for information about the terms of the internet acquiring service.
Open an account at JSC "BANK ALLIANCE".
Sign an agreement to connect to the internet acquiring service.
Connect to the test environment and conduct test transactions.
Connect to the production environment.
Start using the internet acquiring service.
The process of creating a new user security session involves several sequential steps, such as:
Generating client keys - "Process of generating client communication JWK keys".
Obtaining encrypted authorization data by encrypting the request body - "Process of creating JWE encrypted data" and sending the "Request to create a technical session".
Decrypting the received data.
Clarification: Encryption and decryption URL
{{url}}cipher/decrypt_by_jwk?message=
{{url}}cipher/encrypt_by_jwk?message=
Only for assistance during testing! They are prohibited from being executed with production keys.
Example of encrypt/decrypt
def encrypt_data(self, msg: str, use_server_public_key: bool = False) -> str:
"""Get compact JWE token with encrypted data"""
if not use_server_public_key:
with open(self.public_key, 'rb') as public_key_file:
public_key_raw = json.loads(public_key_file.read().decode())
public_key = jwk.JWK()
key_raw = self.server_public_key if use_server_public_key else public_key_raw
public_key.import_key(**key_raw)
protected_header = {'alg': 'ECDH-ES+A256KW', 'enc': 'A256GCM'}
jwetoken = jwe.JWE(msg.encode('utf-8'), recipient=public_key, protected=protected_header)
return jwetoken.serialize(compact=True)
def decrypt_data(self, msg: str) -> str:
"""Get decrypted data (from JWE)"""
with open(self.private_key, 'rb') as private_key_file:
private_key_raw = json.loads(private_key_file.read().decode())
private_key = jwk.JWK()
private_key.import_key(**private_key_raw)
jwetoken = jwe.JWE()
jwetoken.deserialize(msg, key=private_key)
return jwetoken.payload.decode()
Process of Generating Client Communication JWK Keys
Generating a public and private key (JSON Web Key) is done with the following parameters: