PHP {#rn-announce}
==================

PHP Prerequisites
-----------------

You must create a P12 certificate. See the *[REST Getting Started Developer Guide](https://developer.cybersource.com/docs/cybs/en-us/platform/developer/all/rest/rest-getting-started/restgs-jwt-message-intro/restgs-security-p12-intro.md "")*.  
With this change to use a P12 certificate in your PHP SOAP toolkit configuration, the new requirements for your application will be:
* PHP 5.6x and higher
* PHP SOAP extension
* PHP OpenSSL extension
  {#rn-announce_ul_gpv_mcz_mdc}

PHP Migration Steps
-------------------

Follow these steps to upgrade your existing PHP code:

1. Update the following service URL (`WSDL_URL`) in your code:

   ```
   https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_N.NNN.wsdl
   ```

   *N.NNN* is the latest server API version.

2. Copy these files to your project directory:

   * ExtendedClientWithToken.php
   * PropertiesUtility.php
   * SecurityUtility.php
     {#rn-announce_ul_rcp_rcz_mdc}
3. FInd these lines in your existing code:

   ```
   $soapClient = new ExtendedClient(WSDL_URL, array());
   ```

   Replace them with these lines:

   ```
   $soapClient = new ExtendedClientWithToken(
       WSDL_URL,
       array(
           'SSL' =&gt; array(
                   'KEY_ALIAS' =&gt; 'YOUR KEY ALIAS',
                   'KEY_FILE' =&gt; 'YOUR CERTIFICATE FILE',
                   'KEY_PASS' =&gt; 'YOUR KEY PASS',
                   'KEY_DIRECTORY' =&gt; 'PATH TO CERTIFICATES'
               )
           )
   );
   ```
4. Update the necessary values for these fields in your code:

   * MERCHANT_ID
   * KEY_ALIAS
   * KEY_FILE
   * KEY_PASS
   * KEY_DIRECTORY
     {#rn-announce_ul_scp_rcz_mdc}
5. Add your P12 certificate to the KEY_DIRECTORY.  
   This KEY_DIRECTORY location must be accessible to your code. Ensure that your code has permission to read this location.

6. Run the code:

   ```
   php &lt;sample_PHP_file&gt;
   ```
7. (Optional) You can confirm that your configuration is updated successfully by confirming that your request was authenticated using a Bearer token. To confirm, add this command after line 109 in the *ExtendedClientWithToken.php* file:

   ```
   print_r($request);
   ```

{#rn-announce_ol_qcp_rcz_mdc}
