Is there a way to update any meta field on a payment record for an order that has already created a purchase order object?
See code sample below, I hope it helps.
// Get Order reference
var orderReference = _orderRepository.SaveAsPurchaseOrder(cart);
// Load purchase order
IPurchaseOrder purchaseOrder = _orderRepository.Load<IPurchaseOrder>(orderReference.OrderGroupId);
// loop through all payments in the PurchaseOrder, find payment with id equal guidPaymentMethodId, set TransactionId
foreach (var payment in purchaseOrder.Forms.SelectMany(form => form.Payments).Where(payment => payment.PaymentMethodId.Equals(paymentMethodId)))
payment.TransactionID = token;
payment.ProviderTransactionID = token;