You are here

function commerce_paypal_checkout_api_client in Commerce PayPal 7.2

Returns an instantiated PayPal Checkout API client for the given settings.

Parameters

array $config: An associative array containing at least the following keys:

  • client_id: The client ID.
  • secret: The client secret.
  • server: The API server ("sandbox or "live").

Return value

PayPalCheckoutClient|NULL. An instantiated PayPalCheckout client, NULL if no client_id/secret were specified.

7 calls to commerce_paypal_checkout_api_client()
commerce_paypal_checkout_capture_form_submit in modules/checkout/includes/commerce_paypal_checkout.admin.inc
Submit handler: process a prior authorization capture via PayPal Checkout.
commerce_paypal_checkout_create_order in modules/checkout/commerce_paypal_checkout.module
Page callback: Provide the createOrder() callback expected by the SDK.
commerce_paypal_checkout_do_payment in modules/checkout/commerce_paypal_checkout.module
Capture/authorize a PayPal order and create a payment transaction.
commerce_paypal_checkout_redirect_form_validate in modules/checkout/commerce_paypal_checkout.module
Payment method callback: redirect form return validation.
commerce_paypal_checkout_refund_form_submit in modules/checkout/includes/commerce_paypal_checkout.admin.inc
Submit handler: process a refund request.

... See full list

File

modules/checkout/commerce_paypal_checkout.module, line 895
Implements PayPal Checkout in Drupal Commerce checkout.

Code

function commerce_paypal_checkout_api_client($config) {
  if (!isset($config['client_id']) || !isset($config['secret'])) {
    return NULL;
  }
  $instances =& drupal_static(__FUNCTION__, array());
  if (isset($instances[$config['client_id']])) {
    return $instances[$config['client_id']];
  }
  $instances[$config['client_id']] = new PayPalCheckoutClient($config);
  return $instances[$config['client_id']];
}