You are here

function commerce_stripe_pi_add_metadata in Commerce Stripe Payment Intent 7

Adds a metadata key to an existing information array.

By default nothing is added here. Third party modules can implement hook_commerce_stripe_pi_metadata(), documented in commerce_stripe_pi.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

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

object $order: The commerce order object.

1 call to commerce_stripe_pi_add_metadata()
_commerce_stripe_pi_get_payment_intent in ./commerce_stripe_pi.module
Get payment intent and create if not exists.

File

./commerce_stripe_pi.module, line 1964
Payment intent stripe payment integration.

Code

function commerce_stripe_pi_add_metadata(array &$data, $order) {
  $metadata = module_invoke_all('commerce_stripe_pi_metadata', $order);
  if (count($metadata)) {
    $data['metadata'] = $metadata;
  }
}