PHP Class PayPal\Rest\ApiContext

Call level parameters such as request id, credentials etc
Show file Open project: paypal/rest-api-sdk-php Class Usage Examples

Public Methods

Method Description
__construct ( OAuthTokenCredential $credential = null, string | null $requestId = null ) Construct
addRequestHeader ( $name, $value )
get ( $searchKey ) : mixed Gets a specific configuration from key
getConfig ( ) : array Gets Configurations
getCredential ( ) : OAuthTokenCredential Get Credential
getRequestHeaders ( )
getRequestId ( ) : string Get Request ID
resetRequestId ( ) : string Resets the requestId that can be used to set the PayPal-request-id header used for idempotency. In cases where you need to make multiple create calls using the same ApiContext object, you need to reset request Id.
setConfig ( array $config ) Sets Config

Private Methods

Method Description
generateRequestId ( ) : string Generates a unique per request id that can be used to set the PayPal-Request-Id header that is used for idempotency

Method Details

__construct() public method

Construct
public __construct ( OAuthTokenCredential $credential = null, string | null $requestId = null )
$credential PayPal\Auth\OAuthTokenCredential
$requestId string | null

addRequestHeader() public method

public addRequestHeader ( $name, $value )

get() public method

Gets a specific configuration from key
public get ( $searchKey ) : mixed
$searchKey
return mixed

getConfig() public method

Gets Configurations
public getConfig ( ) : array
return array

getCredential() public method

Get Credential
public getCredential ( ) : OAuthTokenCredential
return PayPal\Auth\OAuthTokenCredential

getRequestHeaders() public method

public getRequestHeaders ( )

getRequestId() public method

Get Request ID
public getRequestId ( ) : string
return string

resetRequestId() public method

Resets the requestId that can be used to set the PayPal-request-id header used for idempotency. In cases where you need to make multiple create calls using the same ApiContext object, you need to reset request Id.
public resetRequestId ( ) : string
return string

setConfig() public method

Sets Config
public setConfig ( array $config )
$config array SDK configuration parameters