Skip to content

Commit ed00f09

Browse files
committed
Automated release commit on 15-MAY-2026
1 parent c8f349d commit ed00f09

605 files changed

Lines changed: 103410 additions & 53845 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

MLE.md

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ MLE supports both **Request Encryption** (encrypting outgoing request payloads)
1111
- **Request MLE**: Only supported with `JWT (JSON Web Token)` authentication type
1212
- **Response MLE**: Only supported with `JWT (JSON Web Token)` authentication type
1313

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)).
24+
1425
<br/>
1526

1627
## Configuration
@@ -300,6 +311,58 @@ $merchantConfig->setRequestMleKeyAlias('New_Alias');
300311
$merchantConfig->setMleKeyAlias('Old_Alias'); // This delegates to setRequestMleKeyAlias, both will have value 'Old_Alias'
301312
```
302313

314+
### (ix) Request MLE with Shared Secret (JWT Symmetric Key) Authentication
315+
316+
```php
317+
// MLE with JWT SHARED_SECRET authentication — requires mleForRequestPublicCertPath
318+
$merchantConfig = new MerchantConfiguration();
319+
320+
// JWT authentication with SHARED_SECRET key type
321+
$merchantConfig->setAuthenticationType('JWT');
322+
$merchantConfig->setMerchantID('your_merchant_id');
323+
$merchantConfig->setRunEnvironment('apitest.cybersource.com');
324+
$merchantConfig->setJwtKeyType('SHARED_SECRET');
325+
$merchantConfig->setApiKeyID('your_key_id');
326+
$merchantConfig->setSecretKey('your_base64_encoded_shared_secret');
327+
328+
// Request MLE settings
329+
$merchantConfig->setEnableRequestMLEForOptionalApisGlobally(true);
330+
// mleForRequestPublicCertPath is REQUIRED for SHARED_SECRET since there is no P12 file
331+
$merchantConfig->setMleForRequestPublicCertPath('/path/to/mle/public/cert.pem');
332+
$merchantConfig->setRequestMleKeyAlias('CyberSource_SJC_US'); // Optional, defaults to CyberSource_SJC_US
333+
```
334+
335+
> **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)).
336+
337+
### (x) Response MLE with MetaKey
338+
339+
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.
340+
341+
```php
342+
// MetaKey + Response MLE — portfolio's response MLE key is required
343+
$merchantConfig = new MerchantConfiguration();
344+
345+
// JWT authentication with MetaKey
346+
$merchantConfig->setAuthenticationType('JWT');
347+
$merchantConfig->setJwtKeyType('SHARED_SECRET');
348+
$merchantConfig->setMerchantID('your_transacting_merchant_id');
349+
$merchantConfig->setApiKeyID('your_metakey_portfolio_KeyId');
350+
$merchantConfig->setSecretKey('your_metakey_portfolio_shared_secret_key');
351+
$merchantConfig->setPortfolioID('your_portfolio_id');
352+
$merchantConfig->setUseMetaKey(true);
353+
$merchantConfig->setRunEnvironment('apitest.cybersource.com');
354+
355+
// Response MLE — use the portfolio's response MLE key, not the transacting merchant's
356+
$merchantConfig->setEnableResponseMleGlobally(true);
357+
$merchantConfig->setResponseMlePrivateKeyFilePath('/path/to/portfolio/response/mle/private/key.p12');
358+
$merchantConfig->setResponseMlePrivateKeyFilePassword('portfolio_private_key_password');
359+
// responseMleKID is optional when using a CyberSource-generated P12 file (auto-fetched from P12)
360+
// Required when using PEM files or responseMlePrivateKey object
361+
// $merchantConfig->setResponseMleKID('your_portfolio_response_mle_kid');
362+
```
363+
364+
> **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.
365+
303366
<br/>
304367

305368
## 5. JSON Configuration Examples
@@ -414,7 +477,8 @@ For Response MLE private key files, the following formats are supported:
414477
- If `enableRequestMLEForOptionalApisGlobally` is set to `true`, it enables request MLE for all APIs that have optional MLE support
415478
- APIs with mandatory MLE requirements are enabled by default unless `disableRequestMLEForMandatoryApisGlobally` is set to `true`
416479
- If `mapToControlMLEonAPI` doesn't contain a specific API, the global setting applies
417-
- For HTTP Signature authentication, request MLE will fall back to non-encrypted requests with a warning
480+
- 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.
481+
- 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.
418482

419483
### (ii) Response MLE
420484
- Response MLE requires either `responseMlePrivateKey` object OR `responseMlePrivateKeyFilePath` (not both)
@@ -423,6 +487,7 @@ For Response MLE private key files, the following formats are supported:
423487
- **Required** when using PEM format files (`.pem`, `.key`, `.p8`)
424488
- **Required** when using `responseMlePrivateKey` object directly
425489
- When both auto-fetched and user-provided values exist, the user-provided value takes precedence
490+
- **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.
426491
- If an API expects a mandatory MLE response but the map specifies non-MLE response, the API might return an error
427492
- Both the private key object and file path approaches are mutually exclusive
428493
- Password-protected private keys enhance security
@@ -464,6 +529,10 @@ The SDK provides specific error messages for common MLE issues:
464529
For comprehensive examples and sample implementations, please refer to:
465530
[CyberSource PHP Sample Code Repository (on GitHub)](https://github.com/CyberSource/cybersource-rest-samples-php/tree/master/Samples/MLEFeature)
466531

532+
For MLE with JWT Shared Secret (HS256) authentication specifically, see:
533+
- [JWT Shared Secret Auth Samples](https://github.com/CyberSource/cybersource-rest-samples-php/tree/master/Samples/JwtSharedSecretAuth) — includes a payment sample with MLE enabled
534+
- [JwtSharedSecretConfiguration.php](https://github.com/CyberSource/cybersource-rest-samples-php/tree/master/Resources/JwtSharedSecretConfiguration.php) — configuration with MLE enabled
535+
467536
<br/>
468537

469538
## 10. Additional Information

README.md

Lines changed: 214 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ override the new secure-http default setting)*.
2929
{
3030
"require": {
3131
"php": ">=8.0.0",
32-
"cybersource/rest-client-php": "0.0.72"
32+
"cybersource/rest-client-php": "0.0.73"
3333
}
3434
}
3535
```
@@ -63,6 +63,10 @@ The API Reference Guide provides examples of what information is needed for a pa
6363

6464
To learn more about how to use CyberSource's REST API SDKs, please use [Developer Center REST API SDKs](https://developer.cybersource.com/hello-world/rest-api-sdks.html).
6565

66+
## Security Guidance
67+
68+
* It is strongly recommended to use HTTPS for any proxy servers in your environment to protect secrets during transit.
69+
6670
### Example using Sample Code Application
6771

6872
* Add the [CyberSource REST client](https://github.com/CyberSource/cybersource-rest-samples-php/blob/ea6dc700c833fc41f493147cdc8f1c4b5616683b/composer.json#L23) as a dependency in your php project.
@@ -107,6 +111,123 @@ This feature provides an implementation of Message Level Encryption (MLE) for AP
107111

108112
More information about this new MLE feature can be found in this file : [MLE.md](MLE.md)
109113

114+
### JWT Authentication with Symmetric Key (Shared Secret / HS256 HMAC-SHA256) Support
115+
116+
[![Generic badge](https://img.shields.io/badge/JWT_SHARED_SECRET-NEW-GREEN.svg)](https://shields.io/)
117+
118+
> **⚠️ HTTP Signature Deprecation Notice:** HTTP Signature authentication (`HTTP_SIGNATURE`) is being deprecated. JWT with Shared Secret (HS256 / HMAC-SHA256) 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.
119+
120+
JWT authentication now supports two key types, configurable via the `jwtKeyType` property:
121+
122+
| `jwtKeyType` | Algorithm | Credentials Required |
123+
|---|---|---|
124+
| `P12` (default) | RS256 (asymmetric, RSA-SHA256) | `keysDirectory`, `keyFileName`, `keyAlias`, `keyPass` |
125+
| `SHARED_SECRET` | HS256 (symmetric, HMAC-SHA256) | `merchantKeyId`, `merchantsecretKey` |
126+
127+
The default value is `P12`, which preserves full backward compatibility with existing configurations.
128+
129+
#### Configuration for JWT with P12 (default — no changes needed)
130+
131+
```php
132+
$config = new CyberSource\Authentication\Core\MerchantConfiguration();
133+
$config->setAuthenticationType('JWT');
134+
$config->setMerchantID('your_merchant_id');
135+
$config->setRunEnvironment('apitest.cybersource.com');
136+
// jwtKeyType defaults to P12 if omitted
137+
$config->setKeyAlias('your_merchant_id');
138+
$config->setKeyPassword('your_merchant_id');
139+
$config->setKeyFileName('your_merchant_id');
140+
$config->setKeysDirectory('/path/to/p12/directory');
141+
```
142+
143+
#### Configuration for JWT with Shared Secret
144+
145+
```php
146+
$config = new CyberSource\Authentication\Core\MerchantConfiguration();
147+
$config->setAuthenticationType('JWT');
148+
$config->setMerchantID('your_merchant_id');
149+
$config->setRunEnvironment('apitest.cybersource.com');
150+
$config->setJwtKeyType('SHARED_SECRET');
151+
$config->setApiKeyID('your_key_id');
152+
$config->setSecretKey('your_base64_encoded_shared_secret');
153+
```
154+
155+
> **Note:** When `jwtKeyType` is set to `SHARED_SECRET`, the P12-related properties (`keysDirectory`, `keyFileName`, `keyAlias`, `keyPass`) are not required and will be ignored. Conversely, when using `P12`, the `merchantKeyId` and `merchantsecretKey` properties are not required for JWT authentication.
156+
157+
#### JSON Configuration for JWT with P12
158+
159+
```json
160+
{
161+
"authenticationType": "jwt",
162+
"merchantID": "your_merchant_id",
163+
"runEnvironment": "apitest.cybersource.com",
164+
"keyAlias": "your_merchant_id",
165+
"keyPass": "your_merchant_id",
166+
"keyFileName": "your_merchant_id",
167+
"keysDirectory": "path/to/p12/directory"
168+
}
169+
```
170+
171+
#### JSON Configuration for JWT with Shared Secret
172+
173+
```json
174+
{
175+
"authenticationType": "jwt",
176+
"merchantID": "your_merchant_id",
177+
"runEnvironment": "apitest.cybersource.com",
178+
"jwtKeyType": "SHARED_SECRET",
179+
"merchantKeyId": "your_key_id",
180+
"merchantsecretKey": "your_base64_encoded_shared_secret"
181+
}
182+
```
183+
184+
#### Migrating from HTTP Signature to JWT with Shared Secret (HS256 / HMAC-SHA256)
185+
186+
If you are currently using HTTP Signature authentication, migrating to JWT with Shared Secret (symmetric key, HS256 / HMAC-SHA256) requires only **two property changes** — your credentials remain the same:
187+
188+
```php
189+
// BEFORE (HTTP Signature — deprecated)
190+
$config->setAuthenticationType('HTTP_SIGNATURE');
191+
$config->setApiKeyID('your_key_id');
192+
$config->setSecretKey('your_shared_secret');
193+
194+
// AFTER (JWT with Shared Secret / HS256 HMAC-SHA256 — recommended)
195+
$config->setAuthenticationType('JWT'); // changed
196+
$config->setJwtKeyType('SHARED_SECRET'); // added — uses HS256 (HMAC-SHA256)
197+
$config->setApiKeyID('your_key_id'); // same
198+
$config->setSecretKey('your_shared_secret'); // same
199+
```
200+
201+
#### Using MLE with Shared Secret Credentials
202+
203+
MLE (Message Level Encryption) is fully supported with the `SHARED_SECRET` key type. This allows merchants who use shared secret credentials (instead of a P12 certificate) to still leverage MLE for secure communication.
204+
205+
When using `jwtKeyType=SHARED_SECRET` with MLE, you must provide the MLE public certificate separately via the `mleForRequestPublicCertPath` property, since there is no P12 file to auto-extract the MLE certificate from. The request MLE public certificate can be downloaded from the CyberSource Business Center:
206+
207+
- **Test**: <https://businesscentertest.cybersource.com/ebc2>
208+
- **Production**: <https://businesscenter.cybersource.com/ebc2>
209+
210+
```php
211+
$config = new CyberSource\Authentication\Core\MerchantConfiguration();
212+
$config->setAuthenticationType('JWT');
213+
$config->setMerchantID('your_merchant_id');
214+
$config->setRunEnvironment('apitest.cybersource.com');
215+
$config->setJwtKeyType('SHARED_SECRET');
216+
$config->setApiKeyID('your_key_id');
217+
$config->setSecretKey('your_base64_encoded_shared_secret');
218+
219+
// Request MLE configuration
220+
$config->setEnableRequestMLEForOptionalApisGlobally(true);
221+
$config->setMleForRequestPublicCertPath('/path/to/mle/public/cert.pem');
222+
223+
// Response MLE is also supported — see MLE.md for full configuration
224+
// $config->setEnableResponseMleGlobally(true);
225+
// $config->setResponseMlePrivateKeyFilePath('/path/to/private/key.p12');
226+
// $config->setResponseMlePrivateKeyFilePassword('password');
227+
```
228+
229+
For more details on MLE configuration options (including Response MLE), see [MLE.md](MLE.md).
230+
110231
### MetaKey Support
111232

112233
A Meta Key is a single key that can be used by one, some, or all merchants (or accounts, if created by a Portfolio user) in the portfolio.
@@ -115,8 +236,100 @@ The Portfolio or Parent Account owns the key and is considered the transaction s
115236

116237
MIDs continue to be able to create keys for themselves, even if a Meta Key is generated.
117238

239+
MetaKey works with all three authentication types: HTTP Signature, JWT (P12), and JWT with Shared Secret.
240+
241+
#### MetaKey with HTTP Signature (⚠️ Deprecated)
242+
243+
```php
244+
$config->setAuthenticationType('HTTP_SIGNATURE');
245+
$config->setMerchantID('your_transacting_merchant_id');
246+
$config->setApiKeyID('your_metakey_portfolio_KeyId');
247+
$config->setSecretKey('your_metakey_portfolio_shared_secret_key');
248+
$config->setPortfolioID('your_portfolio_id');
249+
$config->setUseMetaKey(true);
250+
```
251+
252+
#### MetaKey with JWT (P12)
253+
254+
```php
255+
$config->setAuthenticationType('JWT');
256+
$config->setMerchantID('your_transacting_merchant_id');
257+
$config->setKeyAlias('your_portfolio_id');
258+
$config->setKeyPassword('your_metakey_portfolio_p12File_password');
259+
$config->setKeyFileName('your_metakey_portfolio_p12FileName');
260+
$config->setKeysDirectory('/path/to/p12/directory');
261+
$config->setPortfolioID('your_portfolio_id');
262+
$config->setUseMetaKey(true);
263+
```
264+
265+
#### MetaKey with JWT Shared Secret (Recommended)
266+
267+
```php
268+
$config->setAuthenticationType('JWT');
269+
$config->setJwtKeyType('SHARED_SECRET');
270+
$config->setMerchantID('your_transacting_merchant_id');
271+
$config->setApiKeyID('your_metakey_portfolio_KeyId');
272+
$config->setSecretKey('your_metakey_portfolio_shared_secret_key');
273+
$config->setPortfolioID('your_portfolio_id');
274+
$config->setUseMetaKey(true);
275+
```
276+
277+
> **Note:** MetaKey with JWT Shared Secret uses the same MetaKey credentials as HTTP Signature but authenticates via JWT, enabling MLE support.
278+
279+
#### Response MLE with MetaKey
280+
281+
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:
282+
283+
- `responseMlePrivateKeyFilePath` (or the `responseMlePrivateKey` object) must point to the **portfolio's** response MLE private key.
284+
- `responseMleKID` — the KID value associated with the **portfolio's** response MLE certificate.
285+
- **Optional** when `responseMlePrivateKeyFilePath` points to a CyberSource-generated P12 file — the SDK will automatically fetch the KID from the P12 file.
286+
- **Required** when using PEM format files (`.pem`, `.key`, `.p8`) or when providing `responseMlePrivateKey` object directly.
287+
288+
```php
289+
$config = new CyberSource\Authentication\Core\MerchantConfiguration();
290+
$config->setAuthenticationType('JWT');
291+
$config->setJwtKeyType('SHARED_SECRET');
292+
$config->setMerchantID('your_transacting_merchant_id');
293+
$config->setApiKeyID('your_metakey_portfolio_KeyId');
294+
$config->setSecretKey('your_metakey_portfolio_shared_secret_key');
295+
$config->setPortfolioID('your_portfolio_id');
296+
$config->setUseMetaKey(true);
297+
$config->setRunEnvironment('apitest.cybersource.com');
298+
299+
// Response MLE — use the portfolio's response MLE key, not the transacting merchant's
300+
$config->setEnableResponseMleGlobally(true);
301+
$config->setResponseMlePrivateKeyFilePath('/path/to/portfolio/response/mle/private/key.p12');
302+
$config->setResponseMlePrivateKeyFilePassword('portfolio_private_key_password');
303+
// responseMleKID is optional when using a CyberSource-generated P12 file (auto-fetched from P12)
304+
// Required when using PEM files or responseMlePrivateKey object
305+
// $config->setResponseMleKID('your_portfolio_response_mle_kid');
306+
```
307+
308+
> **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. See [MLE.md](MLE.md) for full details on when `responseMleKID` is required vs optional.
309+
118310
Further information on MetaKey can be found in [New Business Center User Guide](https://developer.cybersource.com/library/documentation/dev_guides/Business_Center/New_Business_Center_User_Guide.pdf).
119311

312+
### OAuth Support
313+
314+
OAuth enables service providers to securely share access to customer data without sharing password data.
315+
316+
The CyberSource OAuth2.0 Authorization Server (or API Auth Service) will issue access tokens (based on merchant user credentials) to CyberSource or third-party Applications. These applications can access CyberSource APIs on the merchant's behalf, using the access tokens.
317+
318+
During application registration, third-party application developers are issued a `client_id` and optionally a `client_secret` (if they can be considered a confidential client, for example a web application).
319+
320+
These values will be used when the merchant application wants to request an access token and/or a refresh token. This is explained in more detail in [Requesting the Access and Refresh Tokens](https://developer.cybersource.com/api/developer-guides/OAuth/cybs_extend_intro/obtaining_access_refresh_tokens.html).
321+
322+
For more detailed information on OAuth, refer to the documentation at [Cybersource OAuth 2.0](https://developer.cybersource.com/api/developer-guides/OAuth/cybs_extend_intro.html).
323+
324+
In order to use OAuth, set the run environment to OAuth enabled URLs. OAuth only works in these run environments.
325+
326+
```php
327+
// For TESTING use
328+
$config->setRunEnvironment('api-matest.cybersource.com');
329+
// For PRODUCTION use
330+
// $config->setRunEnvironment('api-ma.cybersource.com');
331+
```
332+
120333
## Additional Information
121334

122335
### PHP_APCU PHP Extension

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cybersource/rest-client-php",
3-
"version": "0.0.72",
3+
"version": "0.0.73",
44
"description": "Client SDK for CyberSource REST APIs",
55
"keywords": [
66
"cybersource", "payments", "ecommerce", "merchant", "merchants", "authorize", "visa", "payment", "payment-gateway", "payment-integration", "payment-module", "payment-processing", "payment-service", "payment-methods"

0 commit comments

Comments
 (0)