You are here

function commerce_stripe_add_metadata in Commerce Stripe 7

Same name and namespace in other branches
  1. 7.3 commerce_stripe.module \commerce_stripe_add_metadata()

Adds a metadata key to an existing information array.

By default nothing is added here. Third party modules can implement hook_commerce_stripe_metadata(), documented in commerce_stripe.api.php, to add metadata. Metadata is useful to pass arbitrary information to Stripe, such as the order number, information about the items in the cart, etc.

Parameters

&$c: An associative array, to which [metadata] => array(...) will be added, in case modules define information via the hook_commerce_stripe_metadata() hook.

$order: The commerce order object.

3 calls to commerce_stripe_add_metadata()
commerce_stripeTestCase::testModule in ./commerce_stripe.test
commerce_stripe_cardonfile_charge in ./commerce_stripe.module
Card on file callback: background charge payment TODO: implement proper return codes per commerce payment
commerce_stripe_submit_form_submit in ./commerce_stripe.module
Payment method callback: checkout form submission.

File

./commerce_stripe.module, line 1195
This module provides Stripe (http://stripe.com/) payment gateway integration to Commerce. Commerce Stripe offers a PCI-compliant way to process payments straight from you Commerce shop.

Code

function commerce_stripe_add_metadata(&$c, $order) {
  $metadata = module_invoke_all('commerce_stripe_metadata', $order);
  if (count($metadata)) {
    $c['metadata'] = $metadata;
  }
}