You are here

function commerce_paypal_checkout_price_amount in Commerce PayPal 7.2

Formats a price amount into a decimal value as expected by PayPal.

Parameters

$amount: An integer price amount.

$currency_code: The currency code of the price.

Return value

The decimal price amount as expected by PayPal API servers.

3 calls to commerce_paypal_checkout_price_amount()
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_prepare_order_request in modules/checkout/commerce_paypal_checkout.module
Prepare the request parameters for the create/update order request.
commerce_paypal_checkout_refund_form_submit in modules/checkout/includes/commerce_paypal_checkout.admin.inc
Submit handler: process a refund request.

File

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

Code

function commerce_paypal_checkout_price_amount($amount, $currency_code) {
  $rounded_amount = commerce_currency_round($amount, commerce_currency_load($currency_code));
  return number_format(commerce_currency_amount_to_decimal($rounded_amount, $currency_code), 2, '.', '');
}