Skip to main content

Card Public Key

API data

API Gateway
This API is used for payment gateway operations:

Get RSA public key

Returns the RSA public key for the authenticated client, used to encrypt sensitive card data on the frontend.

GET /v1/cards/public-key

Via REST request without a body:

Request
GET /v1/cards/public-key
Authorization: Bearer {your_token}

Required headers

PROPERTYDESCRIPTIONTYPELOCATIONREQUIRED
AuthorizationAPI authentication tokenstringheaderyes

Flow

The process to obtain the RSA public key follows these steps:

  1. Client request: The authenticated client calls /v1/cards/public-key.
  2. Key generation/retrieval: The system generates (or retrieves) an RSA private key linked to the client.
  3. Public key returned: The corresponding public key is returned for use in encrypting card data.

Response

Success (200)

Success response
{
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."
}

Data dictionary - Response

PROPERTYDESCRIPTIONTYPE
keyRSA public key in PEM format for encrypting card datastring

Error codes

CODEDESCRIPTION
401Not authenticated
400Error generating or retrieving key
500Internal error

Usage

The public key should be used to encrypt card data before sending it to the following payment routes:

Payment routes

  1. Get the public key: Call this endpoint before starting the payment flow.
  2. Encrypt the data: Use the public key to encrypt sensitive card data on the frontend.
  3. Send the payment: Use the encrypted data in the payment routes listed above.
Security

RSA encryption ensures sensitive card data is protected during transmission, following best practices for online payments.


For questions or issues, visit the support section in Sopague.