You are here

function commerce_paypal_ec_checkout_url in Commerce PayPal 7.2

Returns the URL to the specified PayPal EC checkout page.

Parameters

$server: Either sandbox or live indicating which server to get the URL for.

$token: The token retrieved from the SetExpressCheckout API call.

Return value

The URL to use to submit requests to the PayPal WPP server.

3 calls to commerce_paypal_ec_checkout_url()
commerce_paypal_ec_do_payment in modules/ec/commerce_paypal_ec.module
Confirm an Express Checkout payment for an order for the specified charge amount with a DoExpressCheckoutPayment API request.
commerce_paypal_ec_order_form_submit in modules/ec/commerce_paypal_ec.module
Submit handler: redirect to PayPal Express Checkout.
commerce_paypal_ec_redirect_form in modules/ec/commerce_paypal_ec.module
Payment method callback: redirect form.

File

modules/ec/commerce_paypal_ec.module, line 1518
Implements PayPal Express Checkout in Drupal Commerce checkout.

Code

function commerce_paypal_ec_checkout_url($server, $token) {
  switch ($server) {
    case 'sandbox':
      return 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=' . $token;
    case 'live':
      return 'https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=' . $token;
  }
}