Payment_PayPal_SOAP
[ class tree: Payment_PayPal_SOAP ] [ index: Payment_PayPal_SOAP ] [ all elements ]

Class: Payment_PayPal_SOAP

Source Location: /Payment_PayPal_SOAP-0.2.1/Payment/PayPal/SOAP.php

Class Overview


An easy to use SOAP client for the PayPal SOAP API


Author(s):

Copyright:

  • 2008-2009 silverorange

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 71]
An easy to use SOAP client for the PayPal SOAP API

By itself, this class isn't very useful. It should be used in combination with the documentation provided by PayPal at https://www.paypal.com/en_US/pdf/PP_APIReference.pdf. This class makes it easier to get up and running, and allows you to begin integration by making requests rather than by figuring out how to set SOAP authentication headers.



[ Top ]


Class Variables

$lastSoapClient =  null

[line 110]

The SOAP client used to make the last SOAP request

Type:   SoapClient


[ Top ]

$soapClient =  null

[line 100]

SOAP client used to make PayPal SOAP requests

Type:   SoapClient


[ Top ]

$soapHeader =  null

[line 121]

SOAP header values specific to PayPal SOAP API

This contains PayPal authentication values.


Type:   SoapHeader


[ Top ]

$soapOptions = array(
        'trace'        => true,
        'soap_version' => SOAP_1_1
    )

[line 139]

Options passed to the SOAP client when it is created

PayPal's SOAP implementation uses SOAP 1.1 so the SOAP version option is specified by default. If using local certificates for authentication, the local certificate file is also included in these options.

The API endpoint location is also specified in these options as the endpoint in the WSDL file is not always correct depending on the authentication mechanism used.


Type:   array


[ Top ]



Method Detail

__construct (Constructor)   [line 265]

Payment_PayPal_SOAP __construct( array $options)

Creates a new PayPal SOAP client

Either signature-based or certificate-based authentication options are required. The username, password and optional signature fields may be retrieved from your PayPal account in the 'API Credentials' section.

Sandbox and live modes require different PayPal accounts so all option values will require changing if you select a different mode.

The available options are:

  • mode</code> - optional. The mode to use for PayPal API calls. Valid modes are <kbd>sandbox for development and testing, and live for live payments. If not specified, <em>sandbox</em> is used.
  • username - the username used for authentication.
  • password - the password used for authentication.
  • signature - optional. The signature used for signature- based authentication. Not required if certificate-based authentication is used.
  • certificate - optional. The local certificate filename used for certificate-based authentication. Not required if signature-based authentication is used.

  • Throws: InvalidArgumentException if neither a signature nor a certificate file is specified in the options array, or if the username or password options are not specified in the options array.
  • Access: public

Parameters:

array   $options   —  array of options.

[ Top ]

call   [line 370]

mixed call( string $requestName, [mixed $arguments = array()])

Makes a PayPal SOAP request

If a structured array is used as the arguments, WSDL types with attributes may be specified as:

  1.  $arguments = array(
  2.      'OrderTotal' => array(    // 'OrderTotal' is a type with attributes
  3.          '_' => '1000.00',     // this is the element value
  4.          'currencyID' => 'USD' // this is an attribute value
  5.      )
  6.  );

  • Return: the PayPal SOAP response. If only one value is returned for the request, a simple value (e.g. an integer, a string, etc) is returned. For requests that return multiple values or complex types, a data structure composed of stdClass objects is returned.
  • Throws: Payment_PayPal_SOAP_InvalidRequestNameException if the specified request name is not a valid PayPal SOAP API request name.
  • Throws: Payment_PayPal_SOAP_FaultException if a SOAP initialization error occurs or an unknown SOAP error occurs.
  • Throws: Payment_PayPal_SOAP_MissingPropertyException if a required property for a request type is not specified in the request arguments. Refer to the PayPal SOAP API documentation at https://www.paypal.com/en_US/pdf/PP_APIReference.pdf for information about required fields.
  • Throws: Payment_PayPal_SOAP_ErrorException if a SOAP response contains one or more Error elements. A detailed error message will be present in the exception message and the PayPal error code will be in the exception code.
  • Access: public

Parameters:

string   $requestName   —  the name of the request. This should be a request documented in the PayPal SOAP API reference manual. Sending a request of an invalid type will cause a SoapFault to be thrown.
mixed   $arguments   —  optional. Either a structured array or an object representing the SOAP request arguments. If the request requires no arguments, this parameter may be ommitted.

[ Top ]

getLastRequest   [line 469]

boolean|string getLastRequest( )

Gets the XML sent in the last SOAP request
  • Return: the XML sent in the last SOAP request. If no request has been performed, false is returned.
  • Access: public

[ Top ]

getLastResponse   [line 489]

boolean|string getLastResponse( )

Gets the XML returned in the last SOAP response
  • Return: the XML used in the last SOAP response. If no response has been retrieved, false is returned.
  • Access: public

[ Top ]

getSoapClient   [line 570]

SoapClient getSoapClient( )

Gets the SOAP client used to make PayPal SOAP calls

If the client doesn't exist, it is created and stored in the protected property PaymentPayPal_SOAP::$soapClient.


[ Top ]

getSoapHeaders   [line 535]

SoapHeader getSoapHeaders( )

Gets the SOAP headers required for PayPal authentication

If the header doesn't exist, it is created and stored in the protected property PaymentPayPal_SOAP::$soapHeader.

This header is passed to all PayPal SOAP calls.


[ Top ]

setCertificateFile   [line 655]

void setCertificateFile( string $certificateFile)

Sets the local certificate file used for certificate-based authentication

This file is downloaded from your API credentials page when logged into your PayPal account.


Parameters:

string   $certificateFile   —  the local certificate file used for certificate-based authentication.

[ Top ]

setMode   [line 681]

void setMode( string $mode)

Sets the mode to use for API calls

Parameters:

string   $mode   —  the mode to use for PayPal API calls. Valid modes are:
  • sandbox - for development and testing
  • live - for live payments.

[ Top ]

setPassword   [line 613]

void setPassword( string $password)

Sets the API password used for authentication

Parameters:

string   $password   —  the API password used for authentication.

[ Top ]

setSignature   [line 632]

void setSignature( string $signature)

Sets the API signature used for signature-based authentication

Parameters:

string   $signature   —  the API signature used for signature-based authentication.

[ Top ]

setSoapClient   [line 512]

void setSoapClient( SoapClient $client)

Sets a SOAP client to use for SOAP requests

This is useful for testing.

  • Access: public

Parameters:

SoapClient   $client   —  the SOAP client to use.

[ Top ]

setUsername   [line 595]

void setUsername( string $username)

Sets the API username used for authentication

Parameters:

string   $username   —  the API username used for authentication.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:29:13 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.