get_credential returns credential.key and credential.payload. Contact Clink offline to configure your platform’s public key first, as described in platform integration, then decrypt with the matching private key.
If the response already contains credential.card, continue directly with Browser Pay. No decryption is needed.
Decrypt the credential
Copy the function from the expandable example below. Pass your private key and the unchangedkey and payload values from the same response. The returned body contains payment information and identifiers for result reporting.
Complete Python decryption example
Complete Python decryption example
Use Python 3.10+ and install the dependency:
private_key_pem accepts unencrypted RSA PEM private-key bytes. Adapt key loading to your existing platform implementation. The function raises an error without returning payment data if decryption fails.Read the payment information
Use the fields actually present inbody:
Also keep the outer
operation_id from the get_credential response for confirm_result.operationId.
The decrypted
amount uses major units, such as USD 12.50. get_credential.amount and confirm_result.paidAmount use minor units, which would be 1250. Convert the actual paid amount using the currency’s precision; do not copy the decrypted amount directly.Fill the card fields
When the decryptedbody contains signedPayload, use the helper below to read its card fields. Copy the function from the expandable example, then call it:
Card field-reading example
Card field-reading example
Uses the imports from the decryption example above. This function only reads fields from
signedPayload; it does not verify the JWT signature.
Check that the card number, security code, and expiry fields are present before submitting, and use the credential before it expires. Continue with Browser Pay to submit the payment and report the result.
Handle decryption failures
If decryption fails, check that the private key matches the public key configured for this platform and environment, and thatkey and payload come from the same complete response. If it still fails or payment fields are missing, stop before submitting and contact Clink to investigate.
If a credential was issued but the payment was never submitted, call confirm_result with the available order and operation identifiers and report NOT_SUBMITTED. Use OTHER if supplying a failureReason. If identifiers are unavailable or you need another credential, follow Browser Pay recovery.