Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Caching

Randy edited this page Jan 19, 2018 · 5 revisions

The PayPal PHP SDK now has the ability to cache access tokens for multiple request uses. Generally, an access token is valid for approximately 15 min to 8 hours depending on PayPal security settings. By default, however, PHP requests a new access token each time a new process/request is made.

When caching is enabled, the PayPal PHP SDK stores the access token in a file provided by the cache.FileName option. If the cache.FileName option is omitted or empty, the SDK uses the constant $CACHE_PATH value in PayPal\Cache\AuthorizationCache.

Configurations

  • cache.enabled

    • Options : true, false
    • Enables caching if true
  • cache.FileName

    • When using a relative path, the cache file is created relative to the .php file that is the entry point for this request. You can also provide an absolute path.

PLEASE NOTE
We encourage you to take advantage of this feature which can reduce the number of calls by almost 50% for most use cases. Please make sure you have proper write permissions to the caching directory on your hosting server.