You are here

function commerce_paypal_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.

10 calls to commerce_paypal_price_amount()
commerce_payflow_link_create_secure_token in modules/payflow/commerce_payflow.module
Requests a Secure Token from Payflow for use in follow-up API requests.
commerce_payflow_link_itemize_order in modules/payflow/commerce_payflow.module
Returns an itemized order data array for use in a name-value pair array.
commerce_paypal_ec_capture_form_submit in modules/ec/includes/commerce_paypal_ec.admin.inc
Submit handler: process a prior authorization capture via PayPal EC.
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_itemize_order in modules/ec/commerce_paypal_ec.module
Returns a name-value pair array of information to the API request.

... See full list

File

./commerce_paypal.module, line 684
Implements PayPal payment services for use with Drupal Commerce.

Code

function commerce_paypal_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, '.', '');
}