FILTER BY TAG

PHP Upgrade to P12 Authentication

This section describes how to upgrade your application using the PHP programming language.

Application Requirements

Your PHP SOAP toolkit must have access to these system requirements:
  • PHP 5.6x or higher
  • PHP SOAP extension
  • PHP OpenSSL extension

Version Compatibility for PHP

This P12 authentication upgrade is compatible with WSDL and XSD version
1.219
or later.

Migrate with PHP

This section explains how to edit the files in your application to use P12 authentication. If you do not have the files that are mentioned in this section, you can find them in the most recent version of the PHP SOAP toolkit in GitHub:
Follow these steps to upgrade your existing PHP code:
  1. Update this service URL (
    WSDL_URL
    ) in your code, and set the
    N.NNN
    to the most recent server API version.
    https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_N.NNN.wsdl
  2. Copy these files from the
    PHPSoapToolkit
    folder and put them in your project directory:
  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' => array( 'KEY_ALIAS' => 'YOUR KEY ALIAS', 'KEY_FILE' => 'YOUR CERTIFICATE FILE', 'KEY_PASS' => 'YOUR KEY PASS', 'KEY_DIRECTORY' => 'PATH TO CERTIFICATES' ) ) );
  4. Update these field values in your code with your information:
    • MERCHANT_ID
    • KEY_ALIAS
    • KEY_FILE
    • KEY_PASS
    • KEY_DIRECTORY
  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 this command in your terminal:
    php <sample_PHP_file>
  7. To confirm that your configuration is updated successfully, you can use a Bearer token that verifies that your request is authenticated. To do so, add this command after line 109 in the
    ExtendedClientWithToken.php
    file from the
    PHPSoapToolkit
    folder:
    print_r($request);

What to Do Next

After completing the above migration steps, you must send a test authorization request using your P12 certificate to validate your migration. For more information, see Send a Test Request with P12 Authentication.