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:
- Update this service URL (WSDL_URL) in your code, and set theN.NNNto the most recent server API version.https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_N.NNN.wsdl
- Copy these files from thePHPSoapToolkitfolder and put them in your project directory:
- Find these lines in your existing code:
Replace them with these lines:$soapClient = new ExtendedClient(WSDL_URL, array());$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' ) ) ); - Update these field values in your code with your information:
- MERCHANT_ID
- KEY_ALIAS
- KEY_FILE
- KEY_PASS
- KEY_DIRECTORY
- 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.
- Run this command in your terminal:php <sample_PHP_file>
- 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 theExtendedClientWithToken.phpfile from thePHPSoapToolkitfolder: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.