public function TransactionDataSubscriber::addTransactionData in Commerce Stripe 8
Adds additional metadata to a transaction.
Parameters
\Drupal\commerce_stripe\Event\TransactionDataEvent $event: The transaction data event.
File
- tests/
modules/ commerce_stripe_test/ src/ EventSubscriber/ TransactionDataSubscriber.php, line 26
Class
Namespace
Drupal\commerce_stripe_test\EventSubscriberCode
public function addTransactionData(TransactionDataEvent $event) {
$payment = $event
->getPayment();
$metadata = $event
->getMetadata();
// Add the payment's UUID to the Stripe transaction metadata. For example,
// another service may query Stripe payment transactions and also load the
// payment from Drupal Commerce over JSON API.
$metadata['payment_uuid'] = $payment
->uuid();
$event
->setMetadata($metadata);
}