You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**Request MLE**: Only supported with `JWT (JSON Web Token)` authentication type
12
12
-**Response MLE**: Only supported with `JWT (JSON Web Token)` authentication type
13
13
14
+
### MLE with JWT Key Types
15
+
16
+
MLE works with both JWT key types:
17
+
18
+
| JWT Key Type | MLE Support | Request MLE Certificate Source |
19
+
|---|---|---|
20
+
|`P12` (default) | Supported | Auto-extracted from the P12 file (using `requestMleKeyAlias`), or from a separate file via `mleForRequestPublicCertPath`|
21
+
|`SHARED_SECRET`| Supported |**Must** be provided via `mleForRequestPublicCertPath` (since there is no P12 file to extract from) |
22
+
23
+
> **Important:** When using `jwtKeyType=SHARED_SECRET` with MLE, the `mleForRequestPublicCertPath` property is **required** for request MLE. The SDK cannot auto-extract the MLE certificate from a P12 file because shared secret authentication does not use one. The request MLE public certificate can be downloaded from the CyberSource Business Center ([Test](https://businesscentertest.cybersource.com/ebc2) | [Production](https://businesscenter.cybersource.com/ebc2)).
requestMleKeyAlias:'CyberSource_SJC_US'// Optional, defaults to CyberSource_SJC_US
324
+
};
325
+
```
326
+
327
+
> **Note:** When using `jwtKeyType=SHARED_SECRET`, the MLE certificate cannot be auto-extracted from a P12 file. You **must** provide the certificate via `mleForRequestPublicCertPath`. The request MLE public certificate can be downloaded from the CyberSource Business Center ([Test](https://businesscentertest.cybersource.com/ebc2) | [Production](https://businesscenter.cybersource.com/ebc2)).
328
+
329
+
### (x) Response MLE with MetaKey
330
+
331
+
When using MetaKey (`useMetaKey: true`) with Response MLE, the response MLE private key and KID must belong to the **portfolio (parent account)**, not the transacting merchant.
> **Important:** In MetaKey mode, the portfolio is the transaction submitter. The response is encrypted using the portfolio's MLE certificate, so the decryption key must also be the portfolio's.
357
+
295
358
<br/>
296
359
297
360
## 5. Common Pitfalls
@@ -612,7 +675,8 @@ For Response MLE private key files, the following formats are supported:
612
675
- If `enableRequestMLEForOptionalApisGlobally` is set to `true`, it enables request MLE for all APIs that have optional MLE support
613
676
- APIs with mandatory MLE requirements are enabled by default unless `disableRequestMLEForMandatoryApisGlobally` is set to `true`
614
677
- If `mapToControlMLEonAPI` doesn't contain a specific API, the global setting applies
615
-
- For HTTP Signature authentication, request MLE will fall back to non-encrypted requests with a warning
678
+
- When using `jwtKeyType=SHARED_SECRET`, the `mleForRequestPublicCertPath` parameter is **required** because the SDK cannot auto-extract the MLE certificate from a P12 file. See [Example (ix)](#ix-request-mle-with-shared-secret-jwt-symmetric-key-authentication) for a complete configuration.
679
+
- For HTTP Signature authentication, request MLE will fall back to non-encrypted requests with a warning. **Note:** HTTP Signature is being deprecated — migrate to JWT with Shared Secret (`jwtKeyType=SHARED_SECRET`) to enable full MLE support using the same credentials. See [Example (ix)](#ix-request-mle-with-shared-secret-jwt-symmetric-key-authentication) for details.
616
680
617
681
### (ii) Response MLE
618
682
- Response MLE requires either `responseMlePrivateKey` object OR `responseMlePrivateKeyFilePath` (not both)
@@ -622,6 +686,7 @@ For Response MLE private key files, the following formats are supported:
622
686
-**Required** when using PEM format files (`.pem`, `.key`, `.p8`)
623
687
-**Required** when using `responseMlePrivateKey` object directly
624
688
- When both auto-fetched and user-provided values exist, the user-provided value takes precedence
689
+
-**MetaKey (`useMetaKey=true`):** When Response MLE is used with MetaKey, the `responseMlePrivateKeyFilePath` (or `responseMlePrivateKey` object) and `responseMleKID` must belong to the **portfolio (parent account)** — not the transacting merchant. This is because in MetaKey mode the portfolio is the transaction submitter, and the response is encrypted using the portfolio's MLE certificate.
625
690
- If an API expects a mandatory MLE response but the map specifies non-MLE response, the API might return an error
626
691
- Both the private key object and file path approaches are mutually exclusive
Copy file name to clipboardExpand all lines: README.md
+124Lines changed: 124 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,130 @@ Follow the first step mentioned in [Getting Started with CyberSource REST SDKs](
25
25
26
26
Follow the second step mentioned in [Getting Started with CyberSource REST SDKs](https://developer.cybersource.com/hello-world/rest-api-sdks.html#gettingstarted) to configure the SDK by inputting your credentials.
27
27
28
+
> **⚠️ HTTP Signature Deprecation Notice:** HTTP Signature authentication is being deprecated. **JWT with Shared Secret** is the recommended migration path — it uses the same `merchantKeyId` and `merchantsecretKey` credentials, requires only two property changes, and enables MLE (Message Level Encryption) support that HTTP Signature does not provide.
29
+
30
+
## Authentication Configuration
31
+
32
+
To set your API credentials for an API request, configure the following information in your configuration object:
33
+
34
+
### For HTTP Signature authentication (⚠️ Deprecated — migrate to JWT with Shared Secret)
35
+
36
+
```javascript
37
+
var merchantConfig = {
38
+
authenticationType:'http_signature',
39
+
merchantID:'testrest',
40
+
runEnvironment:'apitest.cybersource.com',
41
+
merchantKeyId:'your_merchant_key_id',
42
+
merchantsecretKey:'your_merchant_secret_key',
43
+
enableLog:true,
44
+
logDirectory:'./log',
45
+
logFilename:'cybs'
46
+
};
47
+
```
48
+
49
+
### For JWT authentication (with P12 certificate)
50
+
51
+
```javascript
52
+
var merchantConfig = {
53
+
authenticationType:'jwt',
54
+
merchantID:'testrest',
55
+
runEnvironment:'apitest.cybersource.com',
56
+
keyAlias:'testrest',
57
+
keyPass:'testrest',
58
+
keyFileName:'testrest',
59
+
keysDirectory:'./resource',
60
+
enableLog:true,
61
+
logDirectory:'./log',
62
+
logFilename:'cybs'
63
+
};
64
+
```
65
+
66
+
### For JWT authentication with Shared Secret (Recommended migration from HTTP Signature)
67
+
68
+
Uses the **same**`merchantKeyId` and `merchantsecretKey` credentials as HTTP Signature. Only two properties change:
69
+
70
+
```javascript
71
+
var merchantConfig = {
72
+
authenticationType:'jwt',
73
+
jwtKeyType:'SHARED_SECRET',
74
+
merchantID:'testrest',
75
+
runEnvironment:'apitest.cybersource.com',
76
+
merchantKeyId:'your_merchant_key_id',
77
+
merchantsecretKey:'your_merchant_secret_key',
78
+
enableLog:true,
79
+
logDirectory:'./log',
80
+
logFilename:'cybs'
81
+
};
82
+
```
83
+
84
+
### For using MetaKey
85
+
86
+
MetaKey can be used for HTTP Signature, JWT (P12), and JWT with Shared Secret authentication.
87
+
88
+
#### For HTTP Signature Authentication (⚠️ Deprecated)
When Response MLE is enabled (`enableResponseMleGlobally: true`) and MetaKey is in use (`useMetaKey: true`), the Response MLE configuration must use the **portfolio's** response MLE key — not the transacting merchant's. Specifically:
132
+
133
+
-`responseMlePrivateKeyFilePath` (or the `responseMlePrivateKey` object) must point to the **portfolio's** response MLE private key.
134
+
-`responseMleKID` — the KID value associated with the **portfolio's** response MLE certificate.
135
+
-**Optional** when `responseMlePrivateKeyFilePath` points to a CyberSource-generated P12 file (SDK auto-fetches from P12).
136
+
-**Required** when using PEM format files (`.pem`, `.key`, `.p8`) or when providing `responseMlePrivateKey` object directly.
// responseMleKID is optional when using a CyberSource-generated P12 file (auto-fetched from P12)
145
+
// Required when using PEM files or responseMlePrivateKey object
146
+
// responseMleKID: '<Portfolio Response MLE KID>'
147
+
};
148
+
```
149
+
150
+
> **Important:** The response MLE private key (and KID, if applicable) must belong to the portfolio (parent account), since in MetaKey mode the portfolio is the transaction submitter and the response is encrypted using the portfolio's MLE certificate.
151
+
28
152
## How to Use
29
153
30
154
To get started using this SDK, it's highly recommended to download our sample code repository:
**verificationMethod** | **String** | Method of the verification. Possible values: - `02` - App-based authentication - `04` - One-time passcode - `21` - Visa Token Service step-up: Device binding - `22` - Visa Token Service step-up: Cardholder verification - `23` - FIDO2 |
10
-
**verificationResults** | **String** | Result of the verification. Possible values: - `01` - Verified - `02` - Not Verified - `03` - Not performed - `04` - Not required - `21` - Not allowed |
11
-
**verificationTimestamp** | **String** | Date and time the verification occurred. UTC time in Unix epoch format. |
6
+
**verificationType** | **String** | Optional. Type of the verification data. Possible values: - `CARDHOLDER` (Default) - `DEVICE` | [optional]
7
+
**verificationEntity** | **String** | Optional. Entity performing the verification. Possible value: - `10` - VISA (Default) | [optional]
**verificationMethod** | **String** | Required. Method of the verification. Possible values: - `02` - App-based authentication - `04` - One-time passcode - `21` - Visa Token Service step-up: Device binding - `22` - Visa Token Service step-up: Cardholder verification - `23` - FIDO2 |
10
+
**verificationResults** | **String** | Required. Result of the verification. Possible values: - `01` - Verified - `02` - Not Verified - `03` - Not performed - `04` - Not required - `21` - Not allowed |
11
+
**verificationTimestamp** | **String** | Required. Date and time the verification occurred. UTC time in Unix epoch format. |
0 commit comments