RSA-encrypted card payments are an optional capability. Merchants may choose whether to use this capability based on their PCI DSS compliance requirements and card-data transmission architecture. Applicable scenario: server-side card payments initiated through PaymentIntents. The endpoint base path remains /api/v1/payment_intents.
payment_method_data.card.encrypted_payment_data{
"payment_data_type": "encrypted"
}payment_data_type is omitted, UseePay continues to process the existing card fields through the legacy flow.payment_data_type=encrypted, encrypted_payment_data is required.number, cvc, expiry_year, and expiry_month must not also be provided as cleartext sibling fields in the outer card object.| Use case | Endpoint |
|---|---|
| Create and confirm immediately | POST /api/v1/payment_intents/create with confirm=true |
| Create first and confirm later | POST /api/v1/payment_intents/{id}/confirm |
| Scenario | Use encrypted payment data? |
|---|---|
| Credit/debit card PAN payment | Supported and recommended for server-side integrations |
x-merchant-no.| Parameter | Requirement |
|---|---|
| Public-key format | X.509 SubjectPublicKeyInfo |
| Public-key encoding | Base64, optionally enclosed in standard PEM headers and footers |
| Encryption algorithm | RSA |
| Padding scheme | PKCS#1 v1.5 (RSA/ECB/PKCS1Padding) |
| Plaintext character encoding | UTF-8 |
| Ciphertext encoding | Standard Base64 without line breaks |
The RSA private key is managed by UseePay's security service using the merchant's key index. Merchants must never include a private key or key index in an API request.
{
"number": "4242424242424242",
"cvc": "565",
"expiry_year": "2029",
"expiry_month": "10"
}| Field | Type | Required | Description |
|---|---|---|---|
number | String | Yes | PAN containing 12–19 digits only |
cvc | String | Yes | CVC/CVV containing 3–4 digits only |
expiry_year | String | Yes | Four-digit expiration year, for example 2029; two-digit years are not supported |
expiry_month | String | Yes | Two-digit expiration month in the range 01–12 |
cardNumber, cvv, and expiryDate are not accepted.expiry_year and expiry_month must be supplied as separate fields.encryptedPaymentData = Base64(
RSA_PKCS1_V1_5_ENCRYPT(
UTF8(JSON.stringify(cardData)),
merchantRsaPublicKey
)
)encrypted_payment_data as a standard JSON string.payment_method_data{
"payment_method_data": {
"type": "card",
"card": {
"payment_data_type": "encrypted",
"encrypted_payment_data": "<Base64-encoded ciphertext produced with the RSA public key>"
}
}
}| Field | Type | Required | Value | Description |
|---|---|---|---|---|
payment_method_data.type | String | Yes | card | Payment-method type |
payment_method_data.card.payment_data_type | String | No | encrypted | Include this field when using RSA-encrypted card data |
payment_method_data.card.encrypted_payment_data | String | Conditionally required | Standard Base64 | Required when payment_data_type=encrypted |
{
"merchant_order_id": "ORDER_202609090001",
"amount": 12.34,
"currency": "USD",
"confirm": true,
"auto_capture": true,
"return_url": "https://merchant.example.com/payment/return",
"device_data": {
"ip_address": "203.0.113.10",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"language": "en-US",
"timezone": "+08:00",
"screen_color_depth": 24,
"screen_height": 1080,
"screen_width": 1920,
"browser": {
"javascript_enabled": true,
"java_enabled": false,
"user_agent": "Mozilla/5.0 ..."
}
},
"payment_method_data": {
"type": "card",
"card": {
"payment_data_type": "encrypted",
"encrypted_payment_data": "dGVzdC1yc2EtY2lwaGVydGV4dA=="
}
}
}The ciphertext above is a placeholder that demonstrates field placement. It is not valid RSA ciphertext.
confirm must be true to initiate payment confirmation immediately after creation.device_data.ip_address is required during confirmation.return_url when the transaction may require 3DS authentication.number, cvc, expiry_year, or expiry_month as cleartext sibling fields in the outer card object.confirm=false, do not include typed payment_method_data:{
"merchant_order_id": "ORDER_202609090002",
"amount": 12.34,
"currency": "USD",
"confirm": false,
"auto_capture": true
}id returned in the response.{
"return_url": "https://merchant.example.com/payment/return",
"device_data": {
"ip_address": "203.0.113.10",
"language": "en-US",
"timezone": "+08:00",
"browser": {
"javascript_enabled": true,
"java_enabled": false,
"user_agent": "Mozilla/5.0 ..."
}
},
"payment_method_data": {
"type": "card",
"card": {
"payment_data_type": "encrypted",
"encrypted_payment_data": "<Base64-encoded ciphertext produced with the RSA public key>"
}
}
}CryptoJSdoes not implement RSA encryption. Do not substituteCryptoJS.AESor a hashing algorithm for the RSA PKCS#1 v1.5 encryption required by this API.
status | Recommended merchant action |
|---|---|
succeeded | Treat the payment as successful and reconcile against the webhook notification |
requires_customer_action | Read next_action.redirect and direct the cardholder to complete the 3DS Challenge |
pending | Do not resubmit the payment; wait for the webhook or retrieve the PaymentIntent |
requires_capture | Authorization succeeded; submit a subsequent Capture request |
requires_payment_method | The current payment method cannot be used; collect another card and confirm again |
failed | The payment failed; inspect last_payment_error |
canceled | The PaymentIntent has been canceled |
{
"code": "encrypted_payment_data_unavailable",
"source": "payment_method_data.card.encrypted_payment_data",
"message": "encrypted payment data is unavailable"
}| Error message | Trigger condition |
|---|---|
card.payment_data_type invalid | payment_data_type is not encrypted |
card.encrypted_payment_data required | Ciphertext is missing in encrypted mode |
plain card fields are not allowed | Cleartext card fields are also present in the outer card object |
invalid card.encrypted_payment_data | The decrypted payload is not valid JSON |
invalid card.encrypted_payment_data.number | PAN is missing, non-numeric, or not 12–19 digits long |
invalid card.encrypted_payment_data.cvc | CVC is missing, non-numeric, or not 3–4 digits long |
invalid card.encrypted_payment_data.expiry_year | Expiration year is missing, non-numeric, or not four digits |
invalid card.encrypted_payment_data.expiry_month | Expiration month is missing, malformed, or outside 01–12 |
card.encrypted_payment_data expired | The card has expired |
invalid merchant rsa key | No valid RSA key is configured for the merchant |
x-merchant-no and the target environment.RSA/ECB/PKCS1Padding, not OAEP.+, /, and = were not removed or modified in transit.encrypted_payment_data value.encrypted_payment_data is intended only for the current payment request and must not be treated as a reusable card token.encrypted_payment_data required?payment_method_data.card.payment_data_type=encrypted. If encrypted mode is not enabled, the existing card-payment flow remains unchanged.card object also contains number, cvc, expiry_year, or expiry_month.expiry_year be supplied as 29?expiry_year accepts only a four-digit year, such as 2029. Two-digit years are not supported.expiry_month be supplied as 9?09.cardNumber, expiryDate, and cvv still supported?number, cvc, expiry_year, and expiry_month.cardData and encrypted_payment_data the same field?payerInfo.cardData, whereas OpenAPI uses payment_method_data.card.encrypted_payment_data.encrypted_payment_data included in an API signature?x-merchant-no, x-app-id, and x-api-key. It does not use the MD5/RSA request-parameter signing scheme applied by the MAPI /api endpoint.RSA/ECB/PKCS1Padding.number, cvc, expiry_year, and expiry_month in the plaintext JSON.expiry_year as four digits; do not use a two-digit year.expiry_month as two digits in the range 01–12.payment_method_data.card.encrypted_payment_data.payment_data_type to encrypted.card object.device_data.ip_address in confirmation requests.return_url and the webhook endpoint.